diff --git a/.gitignore b/.gitignore index 81e7d3717..e7982deb2 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,4 @@ Char /scripts/mac_installer/icon.iconset/ releaseChangelog.md skywire.msi +/scripts/win_installer/build/ diff --git a/internal/gui/gui.go b/internal/gui/gui.go index b2c67213a..2ba0ed56f 100644 --- a/internal/gui/gui.go +++ b/internal/gui/gui.go @@ -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) @@ -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() } } diff --git a/pkg/visor/api.go b/pkg/visor/api.go index 05a699167..c682362cb 100644 --- a/pkg/visor/api.go +++ b/pkg/visor/api.go @@ -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. diff --git a/scripts/win_installer/script.ps1 b/scripts/win_installer/script.ps1 index f9838bfd2..58a19f419 100644 --- a/scripts/win_installer/script.ps1 +++ b/scripts/win_installer/script.ps1 @@ -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 diff --git a/scripts/win_installer/skywire.bat b/scripts/win_installer/skywire.bat index a557d9fb3..a2eade372 100644 --- a/scripts/win_installer/skywire.bat +++ b/scripts/win_installer/skywire.bat @@ -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 diff --git a/scripts/win_installer/wix.json b/scripts/win_installer/wix.json index 9a73d69b8..c29c54583 100644 --- a/scripts/win_installer/wix.json +++ b/scripts/win_installer/wix.json @@ -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": {