Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows installer #1060

Merged
merged 20 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ Char
*.dmg
/scripts/mac_installer/icon.iconset/
releaseChangelog.md
skywire.msi
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ mac-installer: ## Create signed and notarized application, run make mac-installe
mac-installer-help: ## Show installer creation help
./scripts/mac_installer/create_installer.sh -h

win-installer:
@powershell '.\scripts\win_installer\script.ps1'

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

Expand Down
2 changes: 0 additions & 2 deletions _apps/skychat

This file was deleted.

2 changes: 0 additions & 2 deletions _apps/skysocks

This file was deleted.

2 changes: 0 additions & 2 deletions _apps/skysocks-client

This file was deleted.

2 changes: 0 additions & 2 deletions _apps/vpn-client

This file was deleted.

2 changes: 0 additions & 2 deletions _apps/vpn-server

This file was deleted.

23 changes: 0 additions & 23 deletions internal/gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package gui

import (
"context"
"embed"
"fmt"
"io"
Expand All @@ -20,7 +19,6 @@ import (
"github.com/skycoin/skycoin/src/util/logging"
"github.com/toqueteos/webbrowser"

"github.com/skycoin/skywire/pkg/servicedisc"
"github.com/skycoin/skywire/pkg/skyenv"
"github.com/skycoin/skywire/pkg/visor/visorconfig"
)
Expand Down Expand Up @@ -192,27 +190,6 @@ func handleVPNLinkButton(conf *visorconfig.V1) {
}
}

// GetAvailPublicVPNServers gets all available public VPN server from service discovery URL
func GetAvailPublicVPNServers(conf *visorconfig.V1) []string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was supposed to be used for a quick connect functionality in the Systray application. So you could use the Systray directly without having to open the browser. Can likely be kept and used when we improve the Systray application.

Copy link
Contributor

@mrpalide mrpalide Jan 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't know about it. So I'll added it back.

Update:
Done. #e264ec5

sdClient := servicedisc.NewClient(log, servicedisc.Config{
Type: servicedisc.ServiceTypeVPN,
PK: conf.PK,
SK: conf.SK,
DiscAddr: conf.Launcher.ServiceDisc,
})
//ctx, _ := context.WithTimeout(context.Background(), 7*time.Second)
vpnServers, err := sdClient.Services(context.Background(), 0)
if err != nil {
log.Error("Error getting public vpn servers: ", err)
return nil
}
serverAddrs := make([]string, len(vpnServers))
for idx, server := range vpnServers {
serverAddrs[idx] = server.Addr.PubKey().String()
}
return serverAddrs
}

func initUninstallBtn() {
if !checkIsPackage() {
mUninstall.Hide()
Expand Down
17 changes: 0 additions & 17 deletions internal/gui/gui_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,9 @@ package gui
import (
"testing"

"github.com/skycoin/dmsg/cipher"
"github.com/stretchr/testify/require"

"github.com/skycoin/skywire/pkg/visor/visorconfig"
)

func TestGetAvailPublicVPNServers(t *testing.T) {
pk, sk := cipher.GenerateKeyPair()
common := &visorconfig.Common{
Version: "v1.1.0",
SK: sk,
PK: pk,
}
config := visorconfig.MakeBaseConfig(common)
servers := GetAvailPublicVPNServers(config)
require.NotEqual(t, nil, servers)
require.NotEqual(t, []string{}, servers)
t.Logf("Servers: %v", servers)
}

func TestReadEmbeddedIcon(t *testing.T) {
b, err := ReadSysTrayIcon()
require.NoError(t, err)
Expand Down
32 changes: 32 additions & 0 deletions scripts/win_installer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Windows installer

### Requirments
- windows machine
- Install **chocolatey** by its instruction [here](https://chocolatey.org/install).
- Install **GNU Make** by choco
```
choco install make
```
- Install **go-msi** by choco
```
choco install go-msi
```
- Download and Install **Wix** from [here](https://github.com/wixtoolset/wix3/releases/tag/wix3112rtm).
- Need to add `C:\Program Files (x86)\WiX Toolset v3.11\bin` to path.
- We need to install **.Net Framework 3.5 SP1**, you can download and install from [here](https://dotnet.microsoft.com/en-us/download/dotnet-framework/thank-you/net35-sp1-web-installer).

### Build
You can build **skywire.msi** by
```
make win-installer
```

### Install
Double click the created installer to install skywire.

### Run
To run skywire open a terminal or cmd window and run
```
skywire
```
or open `skywire` shortcut on start menu.
Binary file added scripts/win_installer/ico.ico
Binary file not shown.
21 changes: 21 additions & 0 deletions scripts/win_installer/script.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
echo "Building Systray Windows Binaries..."
if (Test-Path ".\skywire.msi") { Remove-Item ".\skywire.msi" -Recurse -Force}
make build-systray-windows > $null
echo "Build Complete!"
echo "Setting go-msi configuration..."
cd .\scripts\win_installer
if (Test-Path ".\build") { Remove-Item ".\build" -Recurse -Force}
mkdir -p ".\build\amd64\apps" > $null
mv ..\..\skywire-visor.exe .\build\amd64\skywire-visor.exe
mv ..\..\skywire-cli.exe .\build\amd64\skywire-cli.exe
mv ..\..\apps\vpn-client .\build\amd64\apps\vpn-client.exe
rm ..\..\setup-node.exe
rm -r -fo ..\..\apps
cp skywire.bat .\build\amd64\skywire.bat
echo "Configuration complete!"
echo "Building msi..."
go-msi make --msi skywire.msi --version 0.5.1 --arch amd64
mv skywire.msi ../../skywire.msi
Remove-Item ".\build" -Recurse -Force
cd ../../
echo "Build Complete!"
12 changes: 12 additions & 0 deletions scripts/win_installer/skywire.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@Echo Off
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
cd /d "%~dp0"
if not exist "apps\" (
mkdir apps
move vpn-client.exe apps
)
if not exist "%HOMEPATH%\skywire-config.json" (
skywire-cli config gen -biro "%HOMEPATH%\skywire-config.json" --os windows --disable-apps skychat,skysocks,skysocks-client,vpn-server
)
start "" http://127.0.0.1:8000
skywire-visor.exe -c "%HOMEPATH%\skywire-config.json"
47 changes: 47 additions & 0 deletions scripts/win_installer/wix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"product": "Skywire",
"company": "Skycoin",
"upgrade-code": "",
"files": {
"guid": "",
"items": [
"build/amd64/skywire-cli.exe",
"build/amd64/skywire-visor.exe",
"build/amd64/apps/vpn-client.exe",
"build/amd64/skywire.bat",
"ico.ico"
]
},
"env": {
"guid": "",
"vars": [
{
"name": "PATH",
"value": "[INSTALLDIR]",
"permanent": "yes",
"system": "yes",
"action": "set",
"part": "last"
}
]
},
"shortcuts": {
"guid": "",
"items": [
{
"name": "Skywire",
"description": "run skywire",
"target": "[INSTALLDIR]\\skywire.bat",
"wdir": "INSTALLDIR",
"icon":"ico.ico"
}
]
},
"hooks": [ ],
"choco": {
"description": "skywire",
"project-url": "https://github.com/skycoin/skywire",
"tags": "skywire",
"license-url": ""
}
}