[client] UI Refactor Icon Paths (#3420)
[client] UI Refactor Icon Paths (#3420)
4
.github/workflows/release.yml
vendored
@ -71,7 +71,7 @@ jobs:
|
|||||||
- name: Install goversioninfo
|
- name: Install goversioninfo
|
||||||
run: go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@233067e
|
run: go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@233067e
|
||||||
- name: Generate windows syso amd64
|
- name: Generate windows syso amd64
|
||||||
run: goversioninfo -icon client/ui/netbird.ico -manifest client/manifest.xml -product-name ${{ env.PRODUCT_NAME }} -copyright "${{ env.COPYRIGHT }}" -ver-major ${{ steps.semver_parser.outputs.major }} -ver-minor ${{ steps.semver_parser.outputs.minor }} -ver-patch ${{ steps.semver_parser.outputs.patch }} -ver-build 0 -file-version ${{ steps.semver_parser.outputs.fullversion }}.0 -product-version ${{ steps.semver_parser.outputs.fullversion }}.0 -o client/resources_windows_amd64.syso
|
run: goversioninfo -icon client/ui/assets/netbird.ico -manifest client/manifest.xml -product-name ${{ env.PRODUCT_NAME }} -copyright "${{ env.COPYRIGHT }}" -ver-major ${{ steps.semver_parser.outputs.major }} -ver-minor ${{ steps.semver_parser.outputs.minor }} -ver-patch ${{ steps.semver_parser.outputs.patch }} -ver-build 0 -file-version ${{ steps.semver_parser.outputs.fullversion }}.0 -product-version ${{ steps.semver_parser.outputs.fullversion }}.0 -o client/resources_windows_amd64.syso
|
||||||
- name: Run GoReleaser
|
- name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v4
|
uses: goreleaser/goreleaser-action@v4
|
||||||
with:
|
with:
|
||||||
@ -150,7 +150,7 @@ jobs:
|
|||||||
- name: Install goversioninfo
|
- name: Install goversioninfo
|
||||||
run: go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@233067e
|
run: go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@233067e
|
||||||
- name: Generate windows syso amd64
|
- name: Generate windows syso amd64
|
||||||
run: goversioninfo -64 -icon client/ui/netbird.ico -manifest client/ui/manifest.xml -product-name ${{ env.PRODUCT_NAME }}-"UI" -copyright "${{ env.COPYRIGHT }}" -ver-major ${{ steps.semver_parser.outputs.major }} -ver-minor ${{ steps.semver_parser.outputs.minor }} -ver-patch ${{ steps.semver_parser.outputs.patch }} -ver-build 0 -file-version ${{ steps.semver_parser.outputs.fullversion }}.0 -product-version ${{ steps.semver_parser.outputs.fullversion }}.0 -o client/ui/resources_windows_amd64.syso
|
run: goversioninfo -64 -icon client/ui/assets/netbird.ico -manifest client/ui/manifest.xml -product-name ${{ env.PRODUCT_NAME }}-"UI" -copyright "${{ env.COPYRIGHT }}" -ver-major ${{ steps.semver_parser.outputs.major }} -ver-minor ${{ steps.semver_parser.outputs.minor }} -ver-patch ${{ steps.semver_parser.outputs.patch }} -ver-build 0 -file-version ${{ steps.semver_parser.outputs.fullversion }}.0 -product-version ${{ steps.semver_parser.outputs.fullversion }}.0 -o client/ui/resources_windows_amd64.syso
|
||||||
|
|
||||||
- name: Run GoReleaser
|
- name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v4
|
uses: goreleaser/goreleaser-action@v4
|
||||||
|
@ -53,9 +53,9 @@ nfpms:
|
|||||||
scripts:
|
scripts:
|
||||||
postinstall: "release_files/ui-post-install.sh"
|
postinstall: "release_files/ui-post-install.sh"
|
||||||
contents:
|
contents:
|
||||||
- src: client/ui/netbird.desktop
|
- src: client/ui/build/netbird.desktop
|
||||||
dst: /usr/share/applications/netbird.desktop
|
dst: /usr/share/applications/netbird.desktop
|
||||||
- src: client/ui/netbird.png
|
- src: client/ui/assets/netbird.png
|
||||||
dst: /usr/share/pixmaps/netbird.png
|
dst: /usr/share/pixmaps/netbird.png
|
||||||
dependencies:
|
dependencies:
|
||||||
- netbird
|
- netbird
|
||||||
@ -72,9 +72,9 @@ nfpms:
|
|||||||
scripts:
|
scripts:
|
||||||
postinstall: "release_files/ui-post-install.sh"
|
postinstall: "release_files/ui-post-install.sh"
|
||||||
contents:
|
contents:
|
||||||
- src: client/ui/netbird.desktop
|
- src: client/ui/build/netbird.desktop
|
||||||
dst: /usr/share/applications/netbird.desktop
|
dst: /usr/share/applications/netbird.desktop
|
||||||
- src: client/ui/netbird.png
|
- src: client/ui/assets/netbird.png
|
||||||
dst: /usr/share/pixmaps/netbird.png
|
dst: /usr/share/pixmaps/netbird.png
|
||||||
dependencies:
|
dependencies:
|
||||||
- netbird
|
- netbird
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
!define DESCRIPTION "A WireGuard®-based mesh network that connects your devices into a single private network"
|
!define DESCRIPTION "A WireGuard®-based mesh network that connects your devices into a single private network"
|
||||||
!define INSTALLER_NAME "netbird-installer.exe"
|
!define INSTALLER_NAME "netbird-installer.exe"
|
||||||
!define MAIN_APP_EXE "Netbird"
|
!define MAIN_APP_EXE "Netbird"
|
||||||
!define ICON "ui\\netbird.ico"
|
!define ICON "ui\\assets\\netbird.ico"
|
||||||
!define BANNER "ui\\banner.bmp"
|
!define BANNER "ui\\build\\banner.bmp"
|
||||||
!define LICENSE_DATA "..\\LICENSE"
|
!define LICENSE_DATA "..\\LICENSE"
|
||||||
|
|
||||||
!define INSTALL_DIR "$PROGRAMFILES64\${APP_NAME}"
|
!define INSTALL_DIR "$PROGRAMFILES64\${APP_NAME}"
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
</InstallExecuteSequence>
|
</InstallExecuteSequence>
|
||||||
|
|
||||||
<!-- Icons -->
|
<!-- Icons -->
|
||||||
<Icon Id="NetbirdIcon" SourceFile=".\client\ui\netbird.ico" />
|
<Icon Id="NetbirdIcon" SourceFile=".\client\ui\assets\netbird.ico" />
|
||||||
<Property Id="ARPPRODUCTICON" Value="NetbirdIcon" />
|
<Property Id="ARPPRODUCTICON" Value="NetbirdIcon" />
|
||||||
|
|
||||||
</Package>
|
</Package>
|
||||||
|
@ -5,5 +5,5 @@
|
|||||||
#define STRINGIZE(x) #x
|
#define STRINGIZE(x) #x
|
||||||
#define EXPAND(x) STRINGIZE(x)
|
#define EXPAND(x) STRINGIZE(x)
|
||||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST manifest.xml
|
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST manifest.xml
|
||||||
7 ICON ui/netbird.ico
|
7 ICON ui/assets/netbird.ico
|
||||||
wintun.dll RCDATA wintun.dll
|
wintun.dll RCDATA wintun.dll
|
||||||
|
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 104 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
@ -35,7 +35,9 @@ import (
|
|||||||
"github.com/netbirdio/netbird/client/proto"
|
"github.com/netbirdio/netbird/client/proto"
|
||||||
"github.com/netbirdio/netbird/client/ui/desktop"
|
"github.com/netbirdio/netbird/client/ui/desktop"
|
||||||
"github.com/netbirdio/netbird/client/ui/event"
|
"github.com/netbirdio/netbird/client/ui/event"
|
||||||
|
"github.com/netbirdio/netbird/client/ui/process"
|
||||||
"github.com/netbirdio/netbird/util"
|
"github.com/netbirdio/netbird/util"
|
||||||
|
|
||||||
"github.com/netbirdio/netbird/version"
|
"github.com/netbirdio/netbird/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -44,94 +46,125 @@ const (
|
|||||||
failFastTimeout = time.Second
|
failFastTimeout = time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
censoredPreSharedKey = "**********"
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var daemonAddr string
|
daemonAddr, showSettings, showNetworks, errorMsg, saveLogsInFile := parseFlags()
|
||||||
|
|
||||||
defaultDaemonAddr := "unix:///var/run/netbird.sock"
|
|
||||||
if runtime.GOOS == "windows" {
|
|
||||||
defaultDaemonAddr = "tcp://127.0.0.1:41731"
|
|
||||||
}
|
|
||||||
|
|
||||||
flag.StringVar(
|
|
||||||
&daemonAddr, "daemon-addr",
|
|
||||||
defaultDaemonAddr,
|
|
||||||
"Daemon service address to serve CLI requests [unix|tcp]://[path|host:port]")
|
|
||||||
|
|
||||||
var showSettings bool
|
|
||||||
flag.BoolVar(&showSettings, "settings", false, "run settings windows")
|
|
||||||
var showRoutes bool
|
|
||||||
flag.BoolVar(&showRoutes, "networks", false, "run networks windows")
|
|
||||||
var errorMSG string
|
|
||||||
flag.StringVar(&errorMSG, "error-msg", "", "displays a error message window")
|
|
||||||
|
|
||||||
tmpDir := "/tmp"
|
|
||||||
if runtime.GOOS == "windows" {
|
|
||||||
tmpDir = os.TempDir()
|
|
||||||
}
|
|
||||||
|
|
||||||
var saveLogsInFile bool
|
|
||||||
flag.BoolVar(&saveLogsInFile, "use-log-file", false, fmt.Sprintf("save logs in a file: %s/netbird-ui-PID.log", tmpDir))
|
|
||||||
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
|
// Initialize file logging if needed.
|
||||||
if saveLogsInFile {
|
if saveLogsInFile {
|
||||||
logFile := path.Join(tmpDir, fmt.Sprintf("netbird-ui-%d.log", os.Getpid()))
|
if err := initLogFile(); err != nil {
|
||||||
err := util.InitLog("trace", logFile)
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("error while initializing log: %v", err)
|
log.Errorf("error while initializing log: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create the Fyne application.
|
||||||
a := app.NewWithID("NetBird")
|
a := app.NewWithID("NetBird")
|
||||||
a.SetIcon(fyne.NewStaticResource("netbird", iconDisconnected))
|
a.SetIcon(fyne.NewStaticResource("netbird", iconDisconnected))
|
||||||
|
|
||||||
if errorMSG != "" {
|
// Show error message window if needed.
|
||||||
showErrorMSG(errorMSG)
|
if errorMsg != "" {
|
||||||
|
showErrorMessage(errorMsg)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
client := newServiceClient(daemonAddr, a, showSettings, showRoutes)
|
// Create the service client (this also builds the settings or networks UI if requested).
|
||||||
|
client := newServiceClient(daemonAddr, a, showSettings, showNetworks)
|
||||||
|
|
||||||
|
// Watch for theme/settings changes to update the icon.
|
||||||
|
go watchSettingsChanges(a, client)
|
||||||
|
|
||||||
|
// Run in window mode if any UI flag was set.
|
||||||
|
if showSettings || showNetworks {
|
||||||
|
a.Run()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for another running process.
|
||||||
|
running, err := process.IsAnotherProcessRunning()
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("error while checking process: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if running {
|
||||||
|
log.Warn("another process is running")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
client.setDefaultFonts()
|
||||||
|
systray.Run(client.onTrayReady, client.onTrayExit)
|
||||||
|
}
|
||||||
|
|
||||||
|
// parseFlags reads and returns all needed command-line flags.
|
||||||
|
func parseFlags() (daemonAddr string, showSettings, showNetworks bool, errorMsg string, saveLogsInFile bool) {
|
||||||
|
defaultDaemonAddr := "unix:///var/run/netbird.sock"
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
defaultDaemonAddr = "tcp://127.0.0.1:41731"
|
||||||
|
}
|
||||||
|
flag.StringVar(&daemonAddr, "daemon-addr", defaultDaemonAddr, "Daemon service address to serve CLI requests [unix|tcp]://[path|host:port]")
|
||||||
|
flag.BoolVar(&showSettings, "settings", false, "run settings window")
|
||||||
|
flag.BoolVar(&showNetworks, "networks", false, "run networks window")
|
||||||
|
flag.StringVar(&errorMsg, "error-msg", "", "displays an error message window")
|
||||||
|
|
||||||
|
tmpDir := "/tmp"
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
tmpDir = os.TempDir()
|
||||||
|
}
|
||||||
|
flag.BoolVar(&saveLogsInFile, "use-log-file", false, fmt.Sprintf("save logs in a file: %s/netbird-ui-PID.log", tmpDir))
|
||||||
|
flag.Parse()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// initLogFile initializes logging into a file.
|
||||||
|
func initLogFile() error {
|
||||||
|
tmpDir := "/tmp"
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
tmpDir = os.TempDir()
|
||||||
|
}
|
||||||
|
logFile := path.Join(tmpDir, fmt.Sprintf("netbird-ui-%d.log", os.Getpid()))
|
||||||
|
return util.InitLog("trace", logFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
// watchSettingsChanges listens for Fyne theme/settings changes and updates the client icon.
|
||||||
|
func watchSettingsChanges(a fyne.App, client *serviceClient) {
|
||||||
settingsChangeChan := make(chan fyne.Settings)
|
settingsChangeChan := make(chan fyne.Settings)
|
||||||
a.Settings().AddChangeListener(settingsChangeChan)
|
a.Settings().AddChangeListener(settingsChangeChan)
|
||||||
go func() {
|
for range settingsChangeChan {
|
||||||
for range settingsChangeChan {
|
client.updateIcon()
|
||||||
client.updateIcon()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
if showSettings || showRoutes {
|
|
||||||
a.Run()
|
|
||||||
} else {
|
|
||||||
running, err := isAnotherProcessRunning()
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("error while checking process: %v", err)
|
|
||||||
}
|
|
||||||
if running {
|
|
||||||
log.Warn("another process is running")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
client.setDefaultFonts()
|
|
||||||
systray.Run(client.onTrayReady, client.onTrayExit)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:embed netbird-systemtray-connected-macos.png
|
// showErrorMessage displays an error message in a simple window.
|
||||||
|
func showErrorMessage(msg string) {
|
||||||
|
a := app.New()
|
||||||
|
w := a.NewWindow("NetBird Error")
|
||||||
|
label := widget.NewLabel(msg)
|
||||||
|
label.Wrapping = fyne.TextWrapWord
|
||||||
|
w.SetContent(label)
|
||||||
|
w.Resize(fyne.NewSize(400, 100))
|
||||||
|
w.Show()
|
||||||
|
a.Run()
|
||||||
|
}
|
||||||
|
|
||||||
|
//go:embed assets/netbird-systemtray-connected-macos.png
|
||||||
var iconConnectedMacOS []byte
|
var iconConnectedMacOS []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-disconnected-macos.png
|
//go:embed assets/netbird-systemtray-disconnected-macos.png
|
||||||
var iconDisconnectedMacOS []byte
|
var iconDisconnectedMacOS []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-update-disconnected-macos.png
|
//go:embed assets/netbird-systemtray-update-disconnected-macos.png
|
||||||
var iconUpdateDisconnectedMacOS []byte
|
var iconUpdateDisconnectedMacOS []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-update-connected-macos.png
|
//go:embed assets/netbird-systemtray-update-connected-macos.png
|
||||||
var iconUpdateConnectedMacOS []byte
|
var iconUpdateConnectedMacOS []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-connecting-macos.png
|
//go:embed assets/netbird-systemtray-connecting-macos.png
|
||||||
var iconConnectingMacOS []byte
|
var iconConnectingMacOS []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-error-macos.png
|
//go:embed assets/netbird-systemtray-error-macos.png
|
||||||
var iconErrorMacOS []byte
|
var iconErrorMacOS []byte
|
||||||
|
|
||||||
type serviceClient struct {
|
type serviceClient struct {
|
||||||
@ -301,18 +334,6 @@ func (s *serviceClient) showSettingsUI() {
|
|||||||
s.wSettings.Show()
|
s.wSettings.Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
// showErrorMSG opens a fyne app window to display the supplied message
|
|
||||||
func showErrorMSG(msg string) {
|
|
||||||
app := app.New()
|
|
||||||
w := app.NewWindow("NetBird Error")
|
|
||||||
content := widget.NewLabel(msg)
|
|
||||||
content.Wrapping = fyne.TextWrapWord
|
|
||||||
w.SetContent(content)
|
|
||||||
w.Resize(fyne.NewSize(400, 100))
|
|
||||||
w.Show()
|
|
||||||
app.Run()
|
|
||||||
}
|
|
||||||
|
|
||||||
// getSettingsForm to embed it into settings window.
|
// getSettingsForm to embed it into settings window.
|
||||||
func (s *serviceClient) getSettingsForm() *widget.Form {
|
func (s *serviceClient) getSettingsForm() *widget.Form {
|
||||||
return &widget.Form{
|
return &widget.Form{
|
||||||
@ -328,7 +349,7 @@ func (s *serviceClient) getSettingsForm() *widget.Form {
|
|||||||
},
|
},
|
||||||
SubmitText: "Save",
|
SubmitText: "Save",
|
||||||
OnSubmit: func() {
|
OnSubmit: func() {
|
||||||
if s.iPreSharedKey.Text != "" && s.iPreSharedKey.Text != "**********" {
|
if s.iPreSharedKey.Text != "" && s.iPreSharedKey.Text != censoredPreSharedKey {
|
||||||
// validate preSharedKey if it added
|
// validate preSharedKey if it added
|
||||||
if _, err := wgtypes.ParseKey(s.iPreSharedKey.Text); err != nil {
|
if _, err := wgtypes.ParseKey(s.iPreSharedKey.Text); err != nil {
|
||||||
dialog.ShowError(fmt.Errorf("Invalid Pre-shared Key Value"), s.wSettings)
|
dialog.ShowError(fmt.Errorf("Invalid Pre-shared Key Value"), s.wSettings)
|
||||||
@ -366,7 +387,7 @@ func (s *serviceClient) getSettingsForm() *widget.Form {
|
|||||||
WireguardPort: &port,
|
WireguardPort: &port,
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.iPreSharedKey.Text != "**********" {
|
if s.iPreSharedKey.Text != censoredPreSharedKey {
|
||||||
loginRequest.OptionalPreSharedKey = &s.iPreSharedKey.Text
|
loginRequest.OptionalPreSharedKey = &s.iPreSharedKey.Text
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -588,21 +609,21 @@ func (s *serviceClient) onTrayReady() {
|
|||||||
s.mAdminPanel = systray.AddMenuItem("Admin Panel", "Netbird Admin Panel")
|
s.mAdminPanel = systray.AddMenuItem("Admin Panel", "Netbird Admin Panel")
|
||||||
systray.AddSeparator()
|
systray.AddSeparator()
|
||||||
|
|
||||||
s.mSettings = systray.AddMenuItem("Settings", "Settings of the application")
|
s.mSettings = systray.AddMenuItem("Settings", settingsMenuDescr)
|
||||||
s.mAllowSSH = s.mSettings.AddSubMenuItemCheckbox("Allow SSH", "Allow SSH connections", false)
|
s.mAllowSSH = s.mSettings.AddSubMenuItemCheckbox("Allow SSH", allowSSHMenuDescr, false)
|
||||||
s.mAutoConnect = s.mSettings.AddSubMenuItemCheckbox("Connect on Startup", "Connect automatically when the service starts", false)
|
s.mAutoConnect = s.mSettings.AddSubMenuItemCheckbox("Connect on Startup", autoConnectMenuDescr, false)
|
||||||
s.mEnableRosenpass = s.mSettings.AddSubMenuItemCheckbox("Enable Quantum-Resistance", "Enable post-quantum security via Rosenpass", false)
|
s.mEnableRosenpass = s.mSettings.AddSubMenuItemCheckbox("Enable Quantum-Resistance", quantumResistanceMenuDescr, false)
|
||||||
s.mNotifications = s.mSettings.AddSubMenuItemCheckbox("Notifications", "Enable notifications", false)
|
s.mNotifications = s.mSettings.AddSubMenuItemCheckbox("Notifications", notificationsMenuDescr, false)
|
||||||
s.mAdvancedSettings = s.mSettings.AddSubMenuItem("Advanced Settings", "Advanced settings of the application")
|
s.mAdvancedSettings = s.mSettings.AddSubMenuItem("Advanced Settings", advancedSettingsMenuDescr)
|
||||||
s.mCreateDebugBundle = s.mSettings.AddSubMenuItem("Create Debug Bundle", "Create and open debug information bundle")
|
s.mCreateDebugBundle = s.mSettings.AddSubMenuItem("Create Debug Bundle", debugBundleMenuDescr)
|
||||||
s.loadSettings()
|
s.loadSettings()
|
||||||
|
|
||||||
s.exitNodeMu.Lock()
|
s.exitNodeMu.Lock()
|
||||||
s.mExitNode = systray.AddMenuItem("Exit Node", "Select exit node for routing traffic")
|
s.mExitNode = systray.AddMenuItem("Exit Node", exitNodeMenuDescr)
|
||||||
s.mExitNode.Disable()
|
s.mExitNode.Disable()
|
||||||
s.exitNodeMu.Unlock()
|
s.exitNodeMu.Unlock()
|
||||||
|
|
||||||
s.mNetworks = systray.AddMenuItem("Networks", "Open the networks management window")
|
s.mNetworks = systray.AddMenuItem("Networks", networksMenuDescr)
|
||||||
s.mNetworks.Disable()
|
s.mNetworks.Disable()
|
||||||
systray.AddSeparator()
|
systray.AddSeparator()
|
||||||
|
|
||||||
@ -619,11 +640,11 @@ func (s *serviceClient) onTrayReady() {
|
|||||||
s.mVersionDaemon.Disable()
|
s.mVersionDaemon.Disable()
|
||||||
s.mVersionDaemon.Hide()
|
s.mVersionDaemon.Hide()
|
||||||
|
|
||||||
s.mUpdate = s.mAbout.AddSubMenuItem("Download latest version", "Download latest version")
|
s.mUpdate = s.mAbout.AddSubMenuItem("Download latest version", latestVersionMenuDescr)
|
||||||
s.mUpdate.Hide()
|
s.mUpdate.Hide()
|
||||||
|
|
||||||
systray.AddSeparator()
|
systray.AddSeparator()
|
||||||
s.mQuit = systray.AddMenuItem("Quit", "Quit the client app")
|
s.mQuit = systray.AddMenuItem("Quit", quitMenuDescr)
|
||||||
|
|
||||||
// update exit node menu in case service is already connected
|
// update exit node menu in case service is already connected
|
||||||
go s.updateExitNodes()
|
go s.updateExitNodes()
|
||||||
|
15
client/ui/const.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
const (
|
||||||
|
settingsMenuDescr = "Settings of the application"
|
||||||
|
allowSSHMenuDescr = "Allow SSH connections"
|
||||||
|
autoConnectMenuDescr = "Connect automatically when the service starts"
|
||||||
|
quantumResistanceMenuDescr = "Enable post-quantum security via Rosenpass"
|
||||||
|
notificationsMenuDescr = "Enable notifications"
|
||||||
|
advancedSettingsMenuDescr = "Advanced settings of the application"
|
||||||
|
debugBundleMenuDescr = "Create and open debug information bundle"
|
||||||
|
exitNodeMenuDescr = "Select exit node for routing traffic"
|
||||||
|
networksMenuDescr = "Open the networks management window"
|
||||||
|
latestVersionMenuDescr = "Download latest version"
|
||||||
|
quitMenuDescr = "Quit the client app"
|
||||||
|
)
|
@ -6,38 +6,38 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed netbird.png
|
//go:embed assets/netbird.png
|
||||||
var iconAbout []byte
|
var iconAbout []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-connected.png
|
//go:embed assets/netbird-systemtray-connected.png
|
||||||
var iconConnected []byte
|
var iconConnected []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-connected-dark.png
|
//go:embed assets/netbird-systemtray-connected-dark.png
|
||||||
var iconConnectedDark []byte
|
var iconConnectedDark []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-disconnected.png
|
//go:embed assets/netbird-systemtray-disconnected.png
|
||||||
var iconDisconnected []byte
|
var iconDisconnected []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-update-disconnected.png
|
//go:embed assets/netbird-systemtray-update-disconnected.png
|
||||||
var iconUpdateDisconnected []byte
|
var iconUpdateDisconnected []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-update-disconnected-dark.png
|
//go:embed assets/netbird-systemtray-update-disconnected-dark.png
|
||||||
var iconUpdateDisconnectedDark []byte
|
var iconUpdateDisconnectedDark []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-update-connected.png
|
//go:embed assets/netbird-systemtray-update-connected.png
|
||||||
var iconUpdateConnected []byte
|
var iconUpdateConnected []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-update-connected-dark.png
|
//go:embed assets/netbird-systemtray-update-connected-dark.png
|
||||||
var iconUpdateConnectedDark []byte
|
var iconUpdateConnectedDark []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-connecting.png
|
//go:embed assets/netbird-systemtray-connecting.png
|
||||||
var iconConnecting []byte
|
var iconConnecting []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-connecting-dark.png
|
//go:embed assets/netbird-systemtray-connecting-dark.png
|
||||||
var iconConnectingDark []byte
|
var iconConnectingDark []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-error.png
|
//go:embed assets/netbird-systemtray-error.png
|
||||||
var iconError []byte
|
var iconError []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-error-dark.png
|
//go:embed assets/netbird-systemtray-error-dark.png
|
||||||
var iconErrorDark []byte
|
var iconErrorDark []byte
|
||||||
|
@ -1,41 +1,41 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed netbird.ico
|
//go:embed assets/netbird.ico
|
||||||
var iconAbout []byte
|
var iconAbout []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-connected.ico
|
//go:embed assets/netbird-systemtray-connected.ico
|
||||||
var iconConnected []byte
|
var iconConnected []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-connected-dark.ico
|
//go:embed assets/netbird-systemtray-connected-dark.ico
|
||||||
var iconConnectedDark []byte
|
var iconConnectedDark []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-disconnected.ico
|
//go:embed assets/netbird-systemtray-disconnected.ico
|
||||||
var iconDisconnected []byte
|
var iconDisconnected []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-update-disconnected.ico
|
//go:embed assets/netbird-systemtray-update-disconnected.ico
|
||||||
var iconUpdateDisconnected []byte
|
var iconUpdateDisconnected []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-update-disconnected-dark.ico
|
//go:embed assets/netbird-systemtray-update-disconnected-dark.ico
|
||||||
var iconUpdateDisconnectedDark []byte
|
var iconUpdateDisconnectedDark []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-update-connected.ico
|
//go:embed assets/netbird-systemtray-update-connected.ico
|
||||||
var iconUpdateConnected []byte
|
var iconUpdateConnected []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-update-connected-dark.ico
|
//go:embed assets/netbird-systemtray-update-connected-dark.ico
|
||||||
var iconUpdateConnectedDark []byte
|
var iconUpdateConnectedDark []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-connecting.ico
|
//go:embed assets/netbird-systemtray-connecting.ico
|
||||||
var iconConnecting []byte
|
var iconConnecting []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-connecting-dark.ico
|
//go:embed assets/netbird-systemtray-connecting-dark.ico
|
||||||
var iconConnectingDark []byte
|
var iconConnectingDark []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-error.ico
|
//go:embed assets/netbird-systemtray-error.ico
|
||||||
var iconError []byte
|
var iconError []byte
|
||||||
|
|
||||||
//go:embed netbird-systemtray-error-dark.ico
|
//go:embed assets/netbird-systemtray-error-dark.ico
|
||||||
var iconErrorDark []byte
|
var iconErrorDark []byte
|
||||||
|
@ -363,7 +363,7 @@ func (s *serviceClient) recreateExitNodeMenu(exitNodes []*proto.Network) {
|
|||||||
|
|
||||||
if runtime.GOOS == "linux" || runtime.GOOS == "freebsd" {
|
if runtime.GOOS == "linux" || runtime.GOOS == "freebsd" {
|
||||||
s.mExitNode.Remove()
|
s.mExitNode.Remove()
|
||||||
s.mExitNode = systray.AddMenuItem("Exit Node", "Select exit node for routing traffic")
|
s.mExitNode = systray.AddMenuItem("Exit Node", exitNodeMenuDescr)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, node := range exitNodes {
|
for _, node := range exitNodes {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package process
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/shirou/gopsutil/v3/process"
|
"github.com/shirou/gopsutil/v3/process"
|
||||||
)
|
)
|
||||||
|
|
||||||
func isAnotherProcessRunning() (bool, error) {
|
func IsAnotherProcessRunning() (bool, error) {
|
||||||
processes, err := process.Processes()
|
processes, err := process.Processes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
@ -1,6 +1,6 @@
|
|||||||
//go:build !windows
|
//go:build !windows
|
||||||
|
|
||||||
package main
|
package process
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package process
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os/user"
|
"os/user"
|