Skip to content

Commit

Permalink
Merge pull request #1179 from mrpalide/fix/improve-windows-installer
Browse files Browse the repository at this point in the history
Improve Windows Installer
  • Loading branch information
ersonp authored May 12, 2022
2 parents 58f37f7 + 7528870 commit 651e507
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ Char
/scripts/mac_installer/icon.iconset/
releaseChangelog.md
skywire.msi
/scripts/win_installer/build/
6 changes: 1 addition & 5 deletions internal/gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,8 @@ func GetOnGUIReady(icon []byte, conf *visorconfig.V1) func() {
logger := logging.NewMasterLogger()
logger.SetLevel(logrus.InfoLevel)

go func() {

}()

httpC := getHTTPClient(conf, context.Background(), logger)

if isRoot() {
return func() {
systray.SetTemplateIcon(icon, icon)
Expand Down Expand Up @@ -136,7 +133,6 @@ func initAdvancedButton(conf *visorconfig.V1) {
// if it's not installed via package, hide the uninstall button
if !checkIsPackage() {
mAdvancedButton.Hide()
mUninstall.Hide()
}
}

Expand Down
13 changes: 8 additions & 5 deletions pkg/visor/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,12 +540,15 @@ func (v *Visor) GetAppError(appName string) (string, error) {

// GetAppConnectionsSummary implements API.
func (v *Visor) GetAppConnectionsSummary(appName string) ([]appserver.ConnectionSummary, error) {
cSummary, err := v.procM.ConnectionsSummary(appName)
if err != nil {
return nil, err
}
if v.procM != nil {
cSummary, err := v.procM.ConnectionsSummary(appName)
if err != nil {
return nil, err
}

return cSummary, nil
return cSummary, nil
}
return nil, nil
}

// TransportTypes implements API.
Expand Down
2 changes: 2 additions & 0 deletions scripts/win_installer/script.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ cp ..\..\dmsghttp-config.json .\build\amd64\dmsghttp-config.json
rm ..\..\setup-node.exe
rm -r -fo ..\..\apps
cp skywire.bat .\build\amd64\skywire.bat
ni new.update
mv new.update .\build\amd64\new.update
curl "https://www.wintun.net/builds/wintun-0.14.1.zip" -o wintun.zip
tar -xf wintun.zip
cp .\wintun\bin\amd64\wintun.dll .\build\amd64\wintun.dll
Expand Down
54 changes: 48 additions & 6 deletions scripts/win_installer/skywire.bat
Original file line number Diff line number Diff line change
@@ -1,20 +1,62 @@
@Echo Off
:: Opening Powershell with Administrator privilege
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("powershell.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
cd /d "%~dp0"

:: Setting start time
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%" & set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"
set "start_time=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%"

:: Printing screen message to users
echo:
echo ########################################################################
echo # #
echo # Welcome to Skywire [Windows] #
echo # #
echo # - You have access to Hypervisor UI by http://127.0.0.1:8000 #
echo # - All logs be available in C:\Program Files\Skywire\local\logs #
echo # - You can terminate Skywire by Ctrl+C command. #
echo # #
echo ########################################################################
echo:

:: Creating logs folder if not exist [Run just in first time after installing]
if not exist "local\logs\" (
mkdir "local\logs" >nul 2>&1
)

:: Moving vpn-client.exe to its path
if exist vpn-client.exe (
if not exist "apps\" (
mkdir apps
mkdir apps >nul 2>&1
)
move /Y vpn-client.exe apps
move /Y vpn-client.exe apps >nul 2>&1
)

:: Moving wintun.dll to system32 path
if exist "wintun.dll" (
move /Y wintun.dll "C:\Windows\System32"
move /Y wintun.dll "C:\Windows\System32" >nul 2>&1
)

:: Moving existed config file in user home to installation path
if exist "%HOMEPATH%\skywire-config.json" (
move /Y "%HOMEPATH%\skywire-config.json" .
move /Y "%HOMEPATH%\skywire-config.json" . >nul 2>&1
)

:: Generating new config file if not exist
if not exist "skywire-config.json" (
skywire-cli config gen -birp --os windows --disableapps skychat,skysocks,skysocks-client,vpn-server
skywire-cli config gen -birpw --os windows --disableapps skychat,skysocks,skysocks-client,vpn-server >nul 2>&1
)

:: Regenerating config file after update and install new version of Skywire
if exist "new.update" (
skywire-cli config gen -birpwx --os windows --disableapps skychat,skysocks,skysocks-client,vpn-server >nul 2>&1
del new.update >nul 2>&1
)

:: Opening UI
start "" http://127.0.0.1:8000
skywire-visor.exe -c "skywire-config.json"

:: Running Skywire
skywire-visor.exe -c "skywire-config.json" >> local\logs\skywire_%start_time%.log
3 changes: 2 additions & 1 deletion scripts/win_installer/wix.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"build/amd64/skywire.bat",
"ico.ico",
"build/amd64/wintun.dll",
"build/amd64/dmsghttp-config.json"
"build/amd64/dmsghttp-config.json",
"build/amd64/new.update"
]
},
"env": {
Expand Down

0 comments on commit 651e507

Please sign in to comment.