From 6c9b821bf002d5f6f05113ff80d8000c116fd547 Mon Sep 17 00:00:00 2001 From: Zoltan Papp Date: Wed, 13 May 2026 13:07:36 +0200 Subject: [PATCH 01/10] [client/ui] Show active profile name and account email in tray menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Profiles submenu label now reflects the active profile name instead of the static "Profiles" text. A disabled email item appears directly below it in the main menu, matching the legacy Fyne/systray behaviour. Email is read from the per-profile state file via profilemanager in the UI process — not through the daemon RPC — because the daemon runs as root and its getConfigDir() resolves to the root home directory, making the user-owned state file inaccessible from the daemon side. --- .../netbird/client/ui/services/models.ts | 15 +++++++ client/ui/services/profile.go | 17 +++++++- client/ui/tray.go | 41 ++++++++++++++++++- 3 files changed, 70 insertions(+), 3 deletions(-) diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.ts b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.ts index d91da7d75..d561338bf 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.ts +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.ts @@ -755,6 +755,18 @@ export class Profile { "name": string; "isActive": boolean; + /** + * Email is the account address associated with this profile, sourced from + * the per-profile state file written by the CLI after a successful SSO + * login (e.g. ~/Library/Application Support/netbird/default.state.json on + * macOS). The daemon always runs as root, so its getConfigDir() resolves to + * the root home directory and cannot reach the user-owned state file. The + * UI process runs as the logged-in user and can read it directly via + * profilemanager.ProfileManager, which is why the email is fetched here + * instead of being returned by the ListProfiles RPC. + */ + "email": string; + /** Creates a new Profile instance. */ constructor($$source: Partial = {}) { if (!("name" in $$source)) { @@ -763,6 +775,9 @@ export class Profile { if (!("isActive" in $$source)) { this["isActive"] = false; } + if (!("email" in $$source)) { + this["email"] = ""; + } Object.assign(this, $$source); } diff --git a/client/ui/services/profile.go b/client/ui/services/profile.go index 7efcf46bc..8700df606 100644 --- a/client/ui/services/profile.go +++ b/client/ui/services/profile.go @@ -6,6 +6,7 @@ import ( "context" "os/user" + "github.com/netbirdio/netbird/client/internal/profilemanager" "github.com/netbirdio/netbird/client/proto" ) @@ -13,6 +14,15 @@ import ( type Profile struct { Name string `json:"name"` IsActive bool `json:"isActive"` + // Email is the account address associated with this profile, sourced from + // the per-profile state file written by the CLI after a successful SSO + // login (e.g. ~/Library/Application Support/netbird/default.state.json on + // macOS). The daemon always runs as root, so its getConfigDir() resolves to + // the root home directory and cannot reach the user-owned state file. The + // UI process runs as the logged-in user and can read it directly via + // profilemanager.ProfileManager, which is why the email is fetched here + // instead of being returned by the ListProfiles RPC. + Email string `json:"email"` } // ProfileRef identifies a profile by name+username. @@ -55,9 +65,14 @@ func (s *Profiles) List(ctx context.Context, username string) ([]Profile, error) if err != nil { return nil, err } + pm := profilemanager.NewProfileManager() out := make([]Profile, 0, len(resp.GetProfiles())) for _, p := range resp.GetProfiles() { - out = append(out, Profile{Name: p.GetName(), IsActive: p.GetIsActive()}) + prof := Profile{Name: p.GetName(), IsActive: p.GetIsActive()} + if state, err := pm.GetProfileState(p.GetName()); err == nil { + prof.Email = state.Email + } + out = append(out, prof) } return out, nil } diff --git a/client/ui/tray.go b/client/ui/tray.go index d68d00d03..bf849c595 100644 --- a/client/ui/tray.go +++ b/client/ui/tray.go @@ -128,7 +128,9 @@ type Tray struct { downItem *application.MenuItem exitNodeItem *application.MenuItem networksItem *application.MenuItem - profileSubmenu *application.Menu + profileSubmenu *application.Menu + profileSubmenuItem *application.MenuItem + profileEmailItem *application.MenuItem settingsItem *application.MenuItem debugItem *application.MenuItem updateItem *application.MenuItem @@ -220,6 +222,16 @@ func (t *Tray) buildMenu() *application.Menu { // has started — Menu.Update() is a no-op before app.running is true, // so the initial fill is gated on the ApplicationStarted hook. t.profileSubmenu = menu.AddSubmenu(menuProfiles) + // profileSubmenuItem is the parent MenuItem whose label is the active + // profile name. AddSubmenu returns the child *Menu, so we retrieve the + // parent *MenuItem via FindByLabel immediately after insertion. + t.profileSubmenuItem = menu.FindByLabel(menuProfiles) + // profileEmailItem shows the account email of the active profile directly + // in the main menu, below the Profiles submenu — matching the behaviour of + // the legacy Fyne/systray UI. It is hidden until loadProfiles resolves a + // non-empty email for the active profile. + t.profileEmailItem = menu.Add("").SetEnabled(false) + t.profileEmailItem.SetHidden(true) menu.AddSeparator() // Only the action that applies to the current state is visible: Connect // when disconnected, Disconnect when connected. applyStatus swaps them on @@ -736,11 +748,21 @@ func (t *Tray) loadProfiles() { log.Infof("tray loadProfiles: received %d profile(s) for user %q", len(profiles), username) t.profileSubmenu.Clear() + var activeName, activeEmail string for _, p := range profiles { name := p.Name active := p.IsActive log.Infof("tray loadProfiles: profile=%q active=%v", name, active) - item := t.profileSubmenu.AddCheckbox(name, active) + // Use Add instead of AddCheckbox: Wails auto-toggles a checkbox's + // checked state on click (before the OnClick handler fires), so with + // AddCheckbox both the old and the new profile would briefly show as + // checked while the switchProfile goroutine is running. A plain item + // with a "✓ " prefix avoids the race entirely. + label := name + if active { + label = "✓ " + name + } + item := t.profileSubmenu.Add(label) item.OnClick(func(*application.Context) { log.Infof("tray profile click: profile=%q wasActive=%v", name, active) if active { @@ -748,6 +770,21 @@ func (t *Tray) loadProfiles() { } t.switchProfile(name) }) + if active { + activeName = name + activeEmail = p.Email + } + } + if t.profileSubmenuItem != nil && activeName != "" { + t.profileSubmenuItem.SetLabel(activeName) + } + if t.profileEmailItem != nil { + if activeEmail != "" { + t.profileEmailItem.SetLabel(fmt.Sprintf("(%s)", activeEmail)) + t.profileEmailItem.SetHidden(false) + } else { + t.profileEmailItem.SetHidden(true) + } } // Wails v3 alpha's submenu.Update() builds a fresh, detached NSMenu on // darwin that never replaces the empty NSMenu attached to the parent From c0cd88a3d0a20d2177abfc1d81d92f54c4dd5bfa Mon Sep 17 00:00:00 2001 From: Zoltan Papp Date: Wed, 13 May 2026 15:13:20 +0200 Subject: [PATCH 02/10] [client/ui] Fix stale LoginFailed/NeedsLogin state after profile switch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the active profile was in LoginFailed, NeedsLogin, or SessionExpired, switching to another profile left the daemon holding stale management/signal errors. The new profile inherited the error state from the previous one. Two fixes: 1. server.go Down(): reset statusRecorder management/signal errors so the next Up() starts with a clean status snapshot instead of the previous profile's error state. 2. tray.go switchProfile(): add NeedsLogin/LoginFailed/SessionExpired to the needsDown set. Down() is called to flush stale daemon state, but Up() is not — the user initiates login on the new profile manually. --- client/server/server.go | 9 ++++++++ client/ui/tray.go | 51 ++++++++++++++++++++++------------------- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/client/server/server.go b/client/server/server.go index 1daec9973..38fdd0010 100644 --- a/client/server/server.go +++ b/client/server/server.go @@ -866,6 +866,15 @@ func (s *Server) Down(ctx context.Context, _ *proto.DownRequest) (*proto.DownRes // stuck at Connecting long after the user asked to disconnect. internal.CtxGetState(s.rootCtx).Set(internal.StatusIdle) + // Clear stale management/signal errors so the next Up() (typically for a + // different profile) starts with a clean status snapshot. Without this, + // a managementError left over from a LoginFailed cycle persists in the + // statusRecorder and appears in the new profile's initial + // SubscribeStatus snapshot, making the new profile look like it also + // failed to log in. + s.statusRecorder.MarkManagementDisconnected(nil) + s.statusRecorder.MarkSignalDisconnected(nil) + return &proto.DownResponse{}, nil } diff --git a/client/ui/tray.go b/client/ui/tray.go index bf849c595..9e5dc702d 100644 --- a/client/ui/tray.go +++ b/client/ui/tray.go @@ -804,29 +804,33 @@ func (t *Tray) loadProfiles() { // // Reconnect policy by previous daemon status: // -// ┌─────────────────┬──────────────────────┬───────────────────────────────────┐ -// │ Previous status │ Tray action │ Rationale │ -// ├─────────────────┼──────────────────────┼───────────────────────────────────┤ -// │ Connected │ Switch + Down + Up │ Reconnect with the new profile. │ -// │ Connecting │ Switch + Down + Up │ Stop the retry loop still dialing │ -// │ │ │ the old management server, then │ -// │ │ │ restart with new config. │ -// │ Idle │ Switch only │ User chose to be offline; don't │ -// │ │ │ silently flip the daemon online. │ -// │ NeedsLogin │ Switch only │ Login needs interactive SSO; let │ -// │ LoginFailed │ Switch only │ the user trigger the next step. │ -// │ SessionExpired │ Switch only │ │ -// └─────────────────┴──────────────────────┴───────────────────────────────────┘ +// ┌─────────────────┬──────────────────────┬────────────────────────────────────┐ +// │ Previous status │ Tray action │ Rationale │ +// ├─────────────────┼──────────────────────┼────────────────────────────────────┤ +// │ Connected │ Switch + Down + Up │ Reconnect with the new profile. │ +// │ Connecting │ Switch + Down + Up │ Stop the retry loop still dialing │ +// │ │ │ the old management server, then │ +// │ │ │ restart with new config. │ +// │ Idle │ Switch only │ User chose to be offline; don't │ +// │ │ │ silently flip the daemon online. │ +// │ NeedsLogin │ Switch + Down │ Clean stale error state so the new │ +// │ LoginFailed │ Switch + Down │ profile starts from Idle. User │ +// │ SessionExpired │ Switch + Down │ initiates login manually. │ +// └─────────────────┴──────────────────────┴────────────────────────────────────┘ // -// Rule of thumb: auto-reconnect only when the daemon was actively trying -// to be online (Connected or Connecting). Any other state is a deliberate -// waiting point — keep the user in control of the next action. +// Rule of thumb: auto-reconnect only when the daemon was actively trying to be +// online (Connected or Connecting). Login-error states get Down so stale errors +// are cleared, but no Up — the user initiates login on the new profile manually. func (t *Tray) switchProfile(name string) { t.mu.Lock() prevStatus := t.lastStatus t.mu.Unlock() wasActive := strings.EqualFold(prevStatus, statusConnected) || strings.EqualFold(prevStatus, statusConnecting) + needsDown := wasActive || + strings.EqualFold(prevStatus, statusNeedsLogin) || + strings.EqualFold(prevStatus, statusLoginFailed) || + strings.EqualFold(prevStatus, statusSessionExpired) go func() { ctx, cancel := context.WithCancel(context.Background()) @@ -837,8 +841,8 @@ func (t *Tray) switchProfile(name string) { log.Errorf("get current user: %v", err) return } - log.Infof("tray switchProfile: sending SwitchProfile RPC profile=%q user=%q prevStatus=%q wasActive=%v", - name, username, prevStatus, wasActive) + log.Infof("tray switchProfile: sending SwitchProfile RPC profile=%q user=%q prevStatus=%q wasActive=%v needsDown=%v", + name, username, prevStatus, wasActive, needsDown) if err := t.svc.Profiles.Switch(ctx, services.ProfileRef{ ProfileName: name, Username: username, @@ -849,14 +853,15 @@ func (t *Tray) switchProfile(name string) { } log.Infof("tray switchProfile: SwitchProfile RPC succeeded profile=%q", name) - if wasActive { - // Stop the in-flight (or established) connection that's still - // pointing at the previous profile's management server, then - // bring it back up against the new profile. - log.Infof("tray switchProfile: was active (%s), reconnecting with new profile %q", prevStatus, name) + if needsDown { + log.Infof("tray switchProfile: calling Down to clean up previous state (%s)", prevStatus) if err := t.svc.Connection.Down(ctx); err != nil { log.Errorf("tray switchProfile: Down failed: %v", err) } + } + if wasActive { + // Bring the connection back up against the new profile's management server. + log.Infof("tray switchProfile: was active (%s), reconnecting with new profile %q", prevStatus, name) if err := t.svc.Connection.Up(ctx, services.UpParams{ ProfileName: name, Username: username, From 803144e56961112c4c34afb077b4936039f1005b Mon Sep 17 00:00:00 2001 From: Zoltan Papp Date: Wed, 13 May 2026 15:46:00 +0200 Subject: [PATCH 03/10] [client/ui] Unify profile-switching logic in ProfileSwitcher service Both the tray and the React Profiles page previously had separate switching logic: the tray applied a status-aware reconnect policy (Down for error states, Up only when previously Connected/Connecting), while the React page always called Switch + Up unconditionally with no Down for LoginFailed/NeedsLogin/SessionExpired. Introduce a single ProfileSwitcher service that encapsulates the full reconnect policy. SwitchActive queries the current daemon status, calls Switch, and launches Down/Up in a background goroutine so the caller returns immediately after the Switch RPC completes. Both the tray and the React Profiles page now delegate to this service. Export the daemon status string constants (StatusConnected, etc.) from the services package so tray.go no longer duplicates them as private constants. --- .../services/{connection.ts => connection.js} | 38 +- .../client/ui/services/{debug.ts => debug.js} | 26 +- .../services/{forwarding.ts => forwarding.js} | 8 +- .../client/ui/services/{index.ts => index.js} | 3 + .../netbird/client/ui/services/models.js | 1844 +++++++++++++++++ .../netbird/client/ui/services/models.ts | 1194 ----------- .../ui/services/{networks.ts => networks.js} | 22 +- .../client/ui/services/{peers.ts => peers.js} | 11 +- .../ui/services/{profiles.ts => profiles.js} | 41 +- .../client/ui/services/profileswitcher.js | 41 + .../ui/services/{settings.ts => settings.js} | 26 +- .../ui/services/{update.ts => update.js} | 22 +- .../{eventcreate.ts => eventcreate.js} | 0 .../notifications/{index.ts => index.js} | 1 + .../v3/pkg/services/notifications/models.js | 192 ++ .../v3/pkg/services/notifications/models.ts | 107 - .../notifications/notificationservice.js | 101 + .../notifications/notificationservice.ts | 62 - client/ui/frontend/src/pages/Profiles.tsx | 4 +- client/ui/main.go | 15 +- client/ui/services/peers.go | 9 + client/ui/services/profileswitcher.go | 82 + client/ui/tray.go | 135 +- 23 files changed, 2463 insertions(+), 1521 deletions(-) rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{connection.ts => connection.js} (63%) rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{debug.ts => debug.js} (58%) rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{forwarding.ts => forwarding.js} (81%) rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{index.ts => index.js} (92%) create mode 100644 client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.js delete mode 100644 client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.ts rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{networks.ts => networks.js} (64%) rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{peers.ts => peers.js} (85%) rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{profiles.ts => profiles.js} (57%) create mode 100644 client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profileswitcher.js rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{settings.ts => settings.js} (59%) rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{update.ts => update.js} (69%) rename client/ui/frontend/bindings/github.com/wailsapp/wails/v3/internal/{eventcreate.ts => eventcreate.js} (100%) rename client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/{index.ts => index.js} (96%) create mode 100644 client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/models.js delete mode 100644 client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/models.ts create mode 100644 client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/notificationservice.js delete mode 100644 client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/notificationservice.ts create mode 100644 client/ui/services/profileswitcher.go diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/connection.ts b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/connection.js similarity index 63% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/connection.ts rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/connection.js index db3e2b556..ca48f6b94 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/connection.ts +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/connection.js @@ -1,3 +1,4 @@ +// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT @@ -14,17 +15,28 @@ import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Cr // @ts-ignore: Unused imports import * as $models from "./models.js"; -export function Down(): $CancellablePromise { +/** + * @returns {$CancellablePromise} + */ +export function Down() { return $Call.ByID(70044537); } -export function Login(p: $models.LoginParams): $CancellablePromise<$models.LoginResult> { - return $Call.ByID(252661358, p).then(($result: any) => { +/** + * @param {$models.LoginParams} p + * @returns {$CancellablePromise<$models.LoginResult>} + */ +export function Login(p) { + return $Call.ByID(252661358, p).then(/** @type {($result: any) => any} */(($result) => { return $$createType0($result); - }); + })); } -export function Logout(p: $models.LogoutParams): $CancellablePromise { +/** + * @param {$models.LogoutParams} p + * @returns {$CancellablePromise} + */ +export function Logout(p) { return $Call.ByID(3824847887, p); } @@ -34,16 +46,26 @@ export function Logout(p: $models.LogoutParams): $CancellablePromise { * the same way as the legacy UI — WebKitGTK's window.open is blocked by the * embedded webview, and asking the user to copy/paste defeats the point of * SSO. Honors $BROWSER first, then falls back to the platform default. + * @param {string} url + * @returns {$CancellablePromise} */ -export function OpenURL(url: string): $CancellablePromise { +export function OpenURL(url) { return $Call.ByID(3786555598, url); } -export function Up(p: $models.UpParams): $CancellablePromise { +/** + * @param {$models.UpParams} p + * @returns {$CancellablePromise} + */ +export function Up(p) { return $Call.ByID(3381092588, p); } -export function WaitSSOLogin(p: $models.WaitSSOParams): $CancellablePromise { +/** + * @param {$models.WaitSSOParams} p + * @returns {$CancellablePromise} + */ +export function WaitSSOLogin(p) { return $Call.ByID(1751351500, p); } diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/debug.ts b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/debug.js similarity index 58% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/debug.ts rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/debug.js index 578dd20b3..40b5bb910 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/debug.ts +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/debug.js @@ -1,3 +1,4 @@ +// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT @@ -14,19 +15,30 @@ import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Cr // @ts-ignore: Unused imports import * as $models from "./models.js"; -export function Bundle(p: $models.DebugBundleParams): $CancellablePromise<$models.DebugBundleResult> { - return $Call.ByID(617551238, p).then(($result: any) => { +/** + * @param {$models.DebugBundleParams} p + * @returns {$CancellablePromise<$models.DebugBundleResult>} + */ +export function Bundle(p) { + return $Call.ByID(617551238, p).then(/** @type {($result: any) => any} */(($result) => { return $$createType0($result); - }); + })); } -export function GetLogLevel(): $CancellablePromise<$models.LogLevel> { - return $Call.ByID(3832950014).then(($result: any) => { +/** + * @returns {$CancellablePromise<$models.LogLevel>} + */ +export function GetLogLevel() { + return $Call.ByID(3832950014).then(/** @type {($result: any) => any} */(($result) => { return $$createType1($result); - }); + })); } -export function SetLogLevel(lvl: $models.LogLevel): $CancellablePromise { +/** + * @param {$models.LogLevel} lvl + * @returns {$CancellablePromise} + */ +export function SetLogLevel(lvl) { return $Call.ByID(4122411498, lvl); } diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/forwarding.ts b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/forwarding.js similarity index 81% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/forwarding.ts rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/forwarding.js index 803afe6b0..c0484e931 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/forwarding.ts +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/forwarding.js @@ -1,3 +1,4 @@ +// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT @@ -17,11 +18,12 @@ import * as $models from "./models.js"; /** * List returns the current set of forwarding rules from the daemon's * reverse proxy. The frontend renders these as the "exposed services" list. + * @returns {$CancellablePromise<$models.ForwardingRule[]>} */ -export function List(): $CancellablePromise<$models.ForwardingRule[]> { - return $Call.ByID(3831092172).then(($result: any) => { +export function List() { + return $Call.ByID(3831092172).then(/** @type {($result: any) => any} */(($result) => { return $$createType1($result); - }); + })); } // Private type creation functions diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/index.ts b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/index.js similarity index 92% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/index.ts rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/index.js index bb3a7b821..030b3bdd4 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/index.ts +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/index.js @@ -1,3 +1,4 @@ +// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT @@ -6,6 +7,7 @@ import * as Debug from "./debug.js"; import * as Forwarding from "./forwarding.js"; import * as Networks from "./networks.js"; import * as Peers from "./peers.js"; +import * as ProfileSwitcher from "./profileswitcher.js"; import * as Profiles from "./profiles.js"; import * as Settings from "./settings.js"; import * as Update from "./update.js"; @@ -15,6 +17,7 @@ export { Forwarding, Networks, Peers, + ProfileSwitcher, Profiles, Settings, Update diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.js b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.js new file mode 100644 index 000000000..dd3ee3a03 --- /dev/null +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.js @@ -0,0 +1,1844 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import { Create as $Create } from "@wailsio/runtime"; + +/** + * ActiveProfile is the result of GetActiveProfile. + */ +export class ActiveProfile { + /** + * Creates a new ActiveProfile instance. + * @param {Partial} [$$source = {}] - The source object to create the ActiveProfile. + */ + constructor($$source = {}) { + if (!("profileName" in $$source)) { + /** + * @member + * @type {string} + */ + this["profileName"] = ""; + } + if (!("username" in $$source)) { + /** + * @member + * @type {string} + */ + this["username"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new ActiveProfile instance from a string or object. + * @param {any} [$$source = {}] + * @returns {ActiveProfile} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new ActiveProfile(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * Config is the daemon configuration the UI exposes in the settings window. + * Pointer fields mark "set" vs "unset" so the UI can omit a value to keep the + * daemon's current setting (matching SetConfigRequest's optional semantics). + */ +export class Config { + /** + * Creates a new Config instance. + * @param {Partial} [$$source = {}] - The source object to create the Config. + */ + constructor($$source = {}) { + if (!("managementUrl" in $$source)) { + /** + * @member + * @type {string} + */ + this["managementUrl"] = ""; + } + if (!("adminUrl" in $$source)) { + /** + * @member + * @type {string} + */ + this["adminUrl"] = ""; + } + if (!("configFile" in $$source)) { + /** + * @member + * @type {string} + */ + this["configFile"] = ""; + } + if (!("logFile" in $$source)) { + /** + * @member + * @type {string} + */ + this["logFile"] = ""; + } + if (!("preSharedKey" in $$source)) { + /** + * @member + * @type {string} + */ + this["preSharedKey"] = ""; + } + if (!("interfaceName" in $$source)) { + /** + * @member + * @type {string} + */ + this["interfaceName"] = ""; + } + if (!("wireguardPort" in $$source)) { + /** + * @member + * @type {number} + */ + this["wireguardPort"] = 0; + } + if (!("mtu" in $$source)) { + /** + * @member + * @type {number} + */ + this["mtu"] = 0; + } + if (!("disableAutoConnect" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["disableAutoConnect"] = false; + } + if (!("serverSshAllowed" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["serverSshAllowed"] = false; + } + if (!("rosenpassEnabled" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["rosenpassEnabled"] = false; + } + if (!("rosenpassPermissive" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["rosenpassPermissive"] = false; + } + if (!("disableNotifications" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["disableNotifications"] = false; + } + if (!("lazyConnectionEnabled" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["lazyConnectionEnabled"] = false; + } + if (!("blockInbound" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["blockInbound"] = false; + } + if (!("networkMonitor" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["networkMonitor"] = false; + } + if (!("disableClientRoutes" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["disableClientRoutes"] = false; + } + if (!("disableServerRoutes" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["disableServerRoutes"] = false; + } + if (!("disableDns" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["disableDns"] = false; + } + if (!("disableIpv6" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["disableIpv6"] = false; + } + if (!("blockLanAccess" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["blockLanAccess"] = false; + } + if (!("enableSshRoot" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["enableSshRoot"] = false; + } + if (!("enableSshSftp" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["enableSshSftp"] = false; + } + if (!("enableSshLocalPortForwarding" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["enableSshLocalPortForwarding"] = false; + } + if (!("enableSshRemotePortForwarding" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["enableSshRemotePortForwarding"] = false; + } + if (!("disableSshAuth" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["disableSshAuth"] = false; + } + if (!("sshJwtCacheTtl" in $$source)) { + /** + * @member + * @type {number} + */ + this["sshJwtCacheTtl"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Config instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Config} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Config(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * ConfigParams selects which profile/user to read or write config for. + */ +export class ConfigParams { + /** + * Creates a new ConfigParams instance. + * @param {Partial} [$$source = {}] - The source object to create the ConfigParams. + */ + constructor($$source = {}) { + if (!("profileName" in $$source)) { + /** + * @member + * @type {string} + */ + this["profileName"] = ""; + } + if (!("username" in $$source)) { + /** + * @member + * @type {string} + */ + this["username"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new ConfigParams instance from a string or object. + * @param {any} [$$source = {}] + * @returns {ConfigParams} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new ConfigParams(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * DebugBundleParams configures what the daemon collects when generating a + * debug bundle. + */ +export class DebugBundleParams { + /** + * Creates a new DebugBundleParams instance. + * @param {Partial} [$$source = {}] - The source object to create the DebugBundleParams. + */ + constructor($$source = {}) { + if (!("anonymize" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["anonymize"] = false; + } + if (!("systemInfo" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["systemInfo"] = false; + } + if (!("uploadUrl" in $$source)) { + /** + * @member + * @type {string} + */ + this["uploadUrl"] = ""; + } + if (!("logFileCount" in $$source)) { + /** + * @member + * @type {number} + */ + this["logFileCount"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new DebugBundleParams instance from a string or object. + * @param {any} [$$source = {}] + * @returns {DebugBundleParams} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new DebugBundleParams(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * DebugBundleResult mirrors DebugBundleResponse — Path is set on local-only + * bundles, UploadedKey on successful uploads, UploadFailureReason on failed + * uploads. + */ +export class DebugBundleResult { + /** + * Creates a new DebugBundleResult instance. + * @param {Partial} [$$source = {}] - The source object to create the DebugBundleResult. + */ + constructor($$source = {}) { + if (!("path" in $$source)) { + /** + * @member + * @type {string} + */ + this["path"] = ""; + } + if (!("uploadedKey" in $$source)) { + /** + * @member + * @type {string} + */ + this["uploadedKey"] = ""; + } + if (!("uploadFailureReason" in $$source)) { + /** + * @member + * @type {string} + */ + this["uploadFailureReason"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new DebugBundleResult instance from a string or object. + * @param {any} [$$source = {}] + * @returns {DebugBundleResult} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new DebugBundleResult(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * Features reports which UI surfaces the daemon has disabled. The Fyne UI uses + * these flags to grey out menu items the operator turned off server-side. + */ +export class Features { + /** + * Creates a new Features instance. + * @param {Partial} [$$source = {}] - The source object to create the Features. + */ + constructor($$source = {}) { + if (!("disableProfiles" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["disableProfiles"] = false; + } + if (!("disableUpdateSettings" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["disableUpdateSettings"] = false; + } + if (!("disableNetworks" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["disableNetworks"] = false; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Features instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Features} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Features(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * ForwardingRule is one entry from the daemon's reverse-proxy table — + * what we ship to the frontend's "exposed services" view. + */ +export class ForwardingRule { + /** + * Creates a new ForwardingRule instance. + * @param {Partial} [$$source = {}] - The source object to create the ForwardingRule. + */ + constructor($$source = {}) { + if (!("protocol" in $$source)) { + /** + * @member + * @type {string} + */ + this["protocol"] = ""; + } + if (!("destinationPort" in $$source)) { + /** + * @member + * @type {PortInfo} + */ + this["destinationPort"] = (new PortInfo()); + } + if (!("translatedAddress" in $$source)) { + /** + * @member + * @type {string} + */ + this["translatedAddress"] = ""; + } + if (!("translatedHostname" in $$source)) { + /** + * @member + * @type {string} + */ + this["translatedHostname"] = ""; + } + if (!("translatedPort" in $$source)) { + /** + * @member + * @type {PortInfo} + */ + this["translatedPort"] = (new PortInfo()); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new ForwardingRule instance from a string or object. + * @param {any} [$$source = {}] + * @returns {ForwardingRule} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType0; + const $$createField4_0 = $$createType0; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("destinationPort" in $$parsedSource) { + $$parsedSource["destinationPort"] = $$createField1_0($$parsedSource["destinationPort"]); + } + if ("translatedPort" in $$parsedSource) { + $$parsedSource["translatedPort"] = $$createField4_0($$parsedSource["translatedPort"]); + } + return new ForwardingRule(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * LocalPeer mirrors LocalPeerState — what this client looks like on the mesh. + */ +export class LocalPeer { + /** + * Creates a new LocalPeer instance. + * @param {Partial} [$$source = {}] - The source object to create the LocalPeer. + */ + constructor($$source = {}) { + if (!("ip" in $$source)) { + /** + * @member + * @type {string} + */ + this["ip"] = ""; + } + if (!("pubKey" in $$source)) { + /** + * @member + * @type {string} + */ + this["pubKey"] = ""; + } + if (!("fqdn" in $$source)) { + /** + * @member + * @type {string} + */ + this["fqdn"] = ""; + } + if (!("networks" in $$source)) { + /** + * @member + * @type {string[]} + */ + this["networks"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new LocalPeer instance from a string or object. + * @param {any} [$$source = {}] + * @returns {LocalPeer} + */ + static createFrom($$source = {}) { + const $$createField3_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("networks" in $$parsedSource) { + $$parsedSource["networks"] = $$createField3_0($$parsedSource["networks"]); + } + return new LocalPeer(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * LogLevel is a single log-level value the daemon understands ("error", + * "warn", "info", "debug", "trace"). + */ +export class LogLevel { + /** + * Creates a new LogLevel instance. + * @param {Partial} [$$source = {}] - The source object to create the LogLevel. + */ + constructor($$source = {}) { + if (!("level" in $$source)) { + /** + * @member + * @type {string} + */ + this["level"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new LogLevel instance from a string or object. + * @param {any} [$$source = {}] + * @returns {LogLevel} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new LogLevel(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * LoginParams carries the fields the UI sets when starting a login. + */ +export class LoginParams { + /** + * Creates a new LoginParams instance. + * @param {Partial} [$$source = {}] - The source object to create the LoginParams. + */ + constructor($$source = {}) { + if (!("profileName" in $$source)) { + /** + * @member + * @type {string} + */ + this["profileName"] = ""; + } + if (!("username" in $$source)) { + /** + * @member + * @type {string} + */ + this["username"] = ""; + } + if (!("managementUrl" in $$source)) { + /** + * @member + * @type {string} + */ + this["managementUrl"] = ""; + } + if (!("setupKey" in $$source)) { + /** + * @member + * @type {string} + */ + this["setupKey"] = ""; + } + if (!("preSharedKey" in $$source)) { + /** + * @member + * @type {string} + */ + this["preSharedKey"] = ""; + } + if (!("hostname" in $$source)) { + /** + * @member + * @type {string} + */ + this["hostname"] = ""; + } + if (!("hint" in $$source)) { + /** + * @member + * @type {string} + */ + this["hint"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new LoginParams instance from a string or object. + * @param {any} [$$source = {}] + * @returns {LoginParams} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new LoginParams(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * LoginResult is the daemon's reply to a Login call. + */ +export class LoginResult { + /** + * Creates a new LoginResult instance. + * @param {Partial} [$$source = {}] - The source object to create the LoginResult. + */ + constructor($$source = {}) { + if (!("needsSsoLogin" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["needsSsoLogin"] = false; + } + if (!("userCode" in $$source)) { + /** + * @member + * @type {string} + */ + this["userCode"] = ""; + } + if (!("verificationUri" in $$source)) { + /** + * @member + * @type {string} + */ + this["verificationUri"] = ""; + } + if (!("verificationUriComplete" in $$source)) { + /** + * @member + * @type {string} + */ + this["verificationUriComplete"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new LoginResult instance from a string or object. + * @param {any} [$$source = {}] + * @returns {LoginResult} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new LoginResult(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * LogoutParams selects the profile the daemon should log out. + */ +export class LogoutParams { + /** + * Creates a new LogoutParams instance. + * @param {Partial} [$$source = {}] - The source object to create the LogoutParams. + */ + constructor($$source = {}) { + if (!("profileName" in $$source)) { + /** + * @member + * @type {string} + */ + this["profileName"] = ""; + } + if (!("username" in $$source)) { + /** + * @member + * @type {string} + */ + this["username"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new LogoutParams instance from a string or object. + * @param {any} [$$source = {}] + * @returns {LogoutParams} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new LogoutParams(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * Network is one routed network the daemon offers to the client. + */ +export class Network { + /** + * Creates a new Network instance. + * @param {Partial} [$$source = {}] - The source object to create the Network. + */ + constructor($$source = {}) { + if (!("id" in $$source)) { + /** + * @member + * @type {string} + */ + this["id"] = ""; + } + if (!("range" in $$source)) { + /** + * @member + * @type {string} + */ + this["range"] = ""; + } + if (!("selected" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["selected"] = false; + } + if (!("domains" in $$source)) { + /** + * @member + * @type {string[]} + */ + this["domains"] = []; + } + if (!("resolvedIps" in $$source)) { + /** + * @member + * @type {{ [_ in string]?: string[] }} + */ + this["resolvedIps"] = {}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Network instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Network} + */ + static createFrom($$source = {}) { + const $$createField3_0 = $$createType1; + const $$createField4_0 = $$createType2; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("domains" in $$parsedSource) { + $$parsedSource["domains"] = $$createField3_0($$parsedSource["domains"]); + } + if ("resolvedIps" in $$parsedSource) { + $$parsedSource["resolvedIps"] = $$createField4_0($$parsedSource["resolvedIps"]); + } + return new Network(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * PeerLink is one of the named connections between this peer and its mgmt + * or signal server. + */ +export class PeerLink { + /** + * Creates a new PeerLink instance. + * @param {Partial} [$$source = {}] - The source object to create the PeerLink. + */ + constructor($$source = {}) { + if (!("url" in $$source)) { + /** + * @member + * @type {string} + */ + this["url"] = ""; + } + if (!("connected" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["connected"] = false; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {string | undefined} + */ + this["error"] = undefined; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new PeerLink instance from a string or object. + * @param {any} [$$source = {}] + * @returns {PeerLink} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new PeerLink(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * PeerStatus is the frontend-facing shape of a daemon PeerState. Carries + * enough detail for the dashboard's compact peer row plus the on-click + * troubleshooting expansion (ICE candidate types, endpoints, handshake age). + */ +export class PeerStatus { + /** + * Creates a new PeerStatus instance. + * @param {Partial} [$$source = {}] - The source object to create the PeerStatus. + */ + constructor($$source = {}) { + if (!("ip" in $$source)) { + /** + * @member + * @type {string} + */ + this["ip"] = ""; + } + if (!("pubKey" in $$source)) { + /** + * @member + * @type {string} + */ + this["pubKey"] = ""; + } + if (!("connStatus" in $$source)) { + /** + * @member + * @type {string} + */ + this["connStatus"] = ""; + } + if (!("connStatusUpdateUnix" in $$source)) { + /** + * @member + * @type {number} + */ + this["connStatusUpdateUnix"] = 0; + } + if (!("relayed" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["relayed"] = false; + } + if (!("localIceCandidateType" in $$source)) { + /** + * @member + * @type {string} + */ + this["localIceCandidateType"] = ""; + } + if (!("remoteIceCandidateType" in $$source)) { + /** + * @member + * @type {string} + */ + this["remoteIceCandidateType"] = ""; + } + if (!("localIceCandidateEndpoint" in $$source)) { + /** + * @member + * @type {string} + */ + this["localIceCandidateEndpoint"] = ""; + } + if (!("remoteIceCandidateEndpoint" in $$source)) { + /** + * @member + * @type {string} + */ + this["remoteIceCandidateEndpoint"] = ""; + } + if (!("fqdn" in $$source)) { + /** + * @member + * @type {string} + */ + this["fqdn"] = ""; + } + if (!("bytesRx" in $$source)) { + /** + * @member + * @type {number} + */ + this["bytesRx"] = 0; + } + if (!("bytesTx" in $$source)) { + /** + * @member + * @type {number} + */ + this["bytesTx"] = 0; + } + if (!("latencyMs" in $$source)) { + /** + * @member + * @type {number} + */ + this["latencyMs"] = 0; + } + if (!("relayAddress" in $$source)) { + /** + * @member + * @type {string} + */ + this["relayAddress"] = ""; + } + if (!("lastHandshakeUnix" in $$source)) { + /** + * @member + * @type {number} + */ + this["lastHandshakeUnix"] = 0; + } + if (!("rosenpassEnabled" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["rosenpassEnabled"] = false; + } + if (!("networks" in $$source)) { + /** + * @member + * @type {string[]} + */ + this["networks"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new PeerStatus instance from a string or object. + * @param {any} [$$source = {}] + * @returns {PeerStatus} + */ + static createFrom($$source = {}) { + const $$createField16_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("networks" in $$parsedSource) { + $$parsedSource["networks"] = $$createField16_0($$parsedSource["networks"]); + } + return new PeerStatus(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * PortInfo carries the destination or translated port for a forwarding rule. + * Exactly one of Port or Range is populated, mirroring the daemon's oneof. + */ +export class PortInfo { + /** + * Creates a new PortInfo instance. + * @param {Partial} [$$source = {}] - The source object to create the PortInfo. + */ + constructor($$source = {}) { + if (/** @type {any} */(false)) { + /** + * @member + * @type {number | null | undefined} + */ + this["port"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {PortRange | null | undefined} + */ + this["range"] = undefined; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new PortInfo instance from a string or object. + * @param {any} [$$source = {}] + * @returns {PortInfo} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType4; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("range" in $$parsedSource) { + $$parsedSource["range"] = $$createField1_0($$parsedSource["range"]); + } + return new PortInfo(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * PortRange describes a contiguous port range. Both ends are inclusive. + */ +export class PortRange { + /** + * Creates a new PortRange instance. + * @param {Partial} [$$source = {}] - The source object to create the PortRange. + */ + constructor($$source = {}) { + if (!("start" in $$source)) { + /** + * @member + * @type {number} + */ + this["start"] = 0; + } + if (!("end" in $$source)) { + /** + * @member + * @type {number} + */ + this["end"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new PortRange instance from a string or object. + * @param {any} [$$source = {}] + * @returns {PortRange} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new PortRange(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * Profile is one named daemon profile. + */ +export class Profile { + /** + * Creates a new Profile instance. + * @param {Partial} [$$source = {}] - The source object to create the Profile. + */ + constructor($$source = {}) { + if (!("name" in $$source)) { + /** + * @member + * @type {string} + */ + this["name"] = ""; + } + if (!("isActive" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["isActive"] = false; + } + if (!("email" in $$source)) { + /** + * Email is the account address associated with this profile, sourced from + * the per-profile state file written by the CLI after a successful SSO + * login (e.g. ~/Library/Application Support/netbird/default.state.json on + * macOS). The daemon always runs as root, so its getConfigDir() resolves to + * the root home directory and cannot reach the user-owned state file. The + * UI process runs as the logged-in user and can read it directly via + * profilemanager.ProfileManager, which is why the email is fetched here + * instead of being returned by the ListProfiles RPC. + * @member + * @type {string} + */ + this["email"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Profile instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Profile} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Profile(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * ProfileRef identifies a profile by name+username. + */ +export class ProfileRef { + /** + * Creates a new ProfileRef instance. + * @param {Partial} [$$source = {}] - The source object to create the ProfileRef. + */ + constructor($$source = {}) { + if (!("profileName" in $$source)) { + /** + * @member + * @type {string} + */ + this["profileName"] = ""; + } + if (!("username" in $$source)) { + /** + * @member + * @type {string} + */ + this["username"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new ProfileRef instance from a string or object. + * @param {any} [$$source = {}] + * @returns {ProfileRef} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new ProfileRef(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * SelectNetworksParams selects which networks to enable / disable. + * All means "every available network" (used by Select-All / Deselect-All buttons); + * Append means "leave the existing selection in place and merge these IDs in". + */ +export class SelectNetworksParams { + /** + * Creates a new SelectNetworksParams instance. + * @param {Partial} [$$source = {}] - The source object to create the SelectNetworksParams. + */ + constructor($$source = {}) { + if (!("networkIds" in $$source)) { + /** + * @member + * @type {string[]} + */ + this["networkIds"] = []; + } + if (!("append" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["append"] = false; + } + if (!("all" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["all"] = false; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new SelectNetworksParams instance from a string or object. + * @param {any} [$$source = {}] + * @returns {SelectNetworksParams} + */ + static createFrom($$source = {}) { + const $$createField0_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("networkIds" in $$parsedSource) { + $$parsedSource["networkIds"] = $$createField0_0($$parsedSource["networkIds"]); + } + return new SelectNetworksParams(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * SetConfigParams is a partial update — only fields with non-nil pointers + * are sent to the daemon. The frontend uses this to flip individual toggles. + */ +export class SetConfigParams { + /** + * Creates a new SetConfigParams instance. + * @param {Partial} [$$source = {}] - The source object to create the SetConfigParams. + */ + constructor($$source = {}) { + if (!("profileName" in $$source)) { + /** + * @member + * @type {string} + */ + this["profileName"] = ""; + } + if (!("username" in $$source)) { + /** + * @member + * @type {string} + */ + this["username"] = ""; + } + if (!("managementUrl" in $$source)) { + /** + * @member + * @type {string} + */ + this["managementUrl"] = ""; + } + if (!("adminUrl" in $$source)) { + /** + * @member + * @type {string} + */ + this["adminUrl"] = ""; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {string | null | undefined} + */ + this["interfaceName"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {number | null | undefined} + */ + this["wireguardPort"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {number | null | undefined} + */ + this["mtu"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {string | null | undefined} + */ + this["preSharedKey"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["disableAutoConnect"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["serverSshAllowed"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["rosenpassEnabled"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["rosenpassPermissive"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["disableNotifications"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["lazyConnectionEnabled"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["blockInbound"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["networkMonitor"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["disableClientRoutes"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["disableServerRoutes"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["disableDns"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["disableIpv6"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["disableFirewall"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["blockLanAccess"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["enableSshRoot"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["enableSshSftp"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["enableSshLocalPortForwarding"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["enableSshRemotePortForwarding"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | null | undefined} + */ + this["disableSshAuth"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {number | null | undefined} + */ + this["sshJwtCacheTtl"] = undefined; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new SetConfigParams instance from a string or object. + * @param {any} [$$source = {}] + * @returns {SetConfigParams} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new SetConfigParams(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * Status is the snapshot the frontend renders on the dashboard. + */ +export class Status { + /** + * Creates a new Status instance. + * @param {Partial} [$$source = {}] - The source object to create the Status. + */ + constructor($$source = {}) { + if (!("status" in $$source)) { + /** + * @member + * @type {string} + */ + this["status"] = ""; + } + if (!("daemonVersion" in $$source)) { + /** + * @member + * @type {string} + */ + this["daemonVersion"] = ""; + } + if (!("management" in $$source)) { + /** + * @member + * @type {PeerLink} + */ + this["management"] = (new PeerLink()); + } + if (!("signal" in $$source)) { + /** + * @member + * @type {PeerLink} + */ + this["signal"] = (new PeerLink()); + } + if (!("local" in $$source)) { + /** + * @member + * @type {LocalPeer} + */ + this["local"] = (new LocalPeer()); + } + if (!("peers" in $$source)) { + /** + * @member + * @type {PeerStatus[]} + */ + this["peers"] = []; + } + if (!("events" in $$source)) { + /** + * @member + * @type {SystemEvent[]} + */ + this["events"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Status instance from a string or object. + * @param {any} [$$source = {}] + * @returns {Status} + */ + static createFrom($$source = {}) { + const $$createField2_0 = $$createType5; + const $$createField3_0 = $$createType5; + const $$createField4_0 = $$createType6; + const $$createField5_0 = $$createType8; + const $$createField6_0 = $$createType10; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("management" in $$parsedSource) { + $$parsedSource["management"] = $$createField2_0($$parsedSource["management"]); + } + if ("signal" in $$parsedSource) { + $$parsedSource["signal"] = $$createField3_0($$parsedSource["signal"]); + } + if ("local" in $$parsedSource) { + $$parsedSource["local"] = $$createField4_0($$parsedSource["local"]); + } + if ("peers" in $$parsedSource) { + $$parsedSource["peers"] = $$createField5_0($$parsedSource["peers"]); + } + if ("events" in $$parsedSource) { + $$parsedSource["events"] = $$createField6_0($$parsedSource["events"]); + } + return new Status(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * SystemEvent is the frontend-facing shape of a daemon SystemEvent. + */ +export class SystemEvent { + /** + * Creates a new SystemEvent instance. + * @param {Partial} [$$source = {}] - The source object to create the SystemEvent. + */ + constructor($$source = {}) { + if (!("id" in $$source)) { + /** + * @member + * @type {string} + */ + this["id"] = ""; + } + if (!("severity" in $$source)) { + /** + * @member + * @type {string} + */ + this["severity"] = ""; + } + if (!("category" in $$source)) { + /** + * @member + * @type {string} + */ + this["category"] = ""; + } + if (!("message" in $$source)) { + /** + * @member + * @type {string} + */ + this["message"] = ""; + } + if (!("userMessage" in $$source)) { + /** + * @member + * @type {string} + */ + this["userMessage"] = ""; + } + if (!("timestamp" in $$source)) { + /** + * @member + * @type {number} + */ + this["timestamp"] = 0; + } + if (!("metadata" in $$source)) { + /** + * @member + * @type {{ [_ in string]?: string }} + */ + this["metadata"] = {}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new SystemEvent instance from a string or object. + * @param {any} [$$source = {}] + * @returns {SystemEvent} + */ + static createFrom($$source = {}) { + const $$createField6_0 = $$createType11; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("metadata" in $$parsedSource) { + $$parsedSource["metadata"] = $$createField6_0($$parsedSource["metadata"]); + } + return new SystemEvent(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * UpParams selects the profile the daemon should bring up. + */ +export class UpParams { + /** + * Creates a new UpParams instance. + * @param {Partial} [$$source = {}] - The source object to create the UpParams. + */ + constructor($$source = {}) { + if (!("profileName" in $$source)) { + /** + * @member + * @type {string} + */ + this["profileName"] = ""; + } + if (!("username" in $$source)) { + /** + * @member + * @type {string} + */ + this["username"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new UpParams instance from a string or object. + * @param {any} [$$source = {}] + * @returns {UpParams} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new UpParams(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * UpdateAvailable carries the new_version_available metadata. + */ +export class UpdateAvailable { + /** + * Creates a new UpdateAvailable instance. + * @param {Partial} [$$source = {}] - The source object to create the UpdateAvailable. + */ + constructor($$source = {}) { + if (!("version" in $$source)) { + /** + * @member + * @type {string} + */ + this["version"] = ""; + } + if (!("enforced" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["enforced"] = false; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new UpdateAvailable instance from a string or object. + * @param {any} [$$source = {}] + * @returns {UpdateAvailable} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new UpdateAvailable(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * UpdateProgress carries the progress_window metadata. + */ +export class UpdateProgress { + /** + * Creates a new UpdateProgress instance. + * @param {Partial} [$$source = {}] - The source object to create the UpdateProgress. + */ + constructor($$source = {}) { + if (!("action" in $$source)) { + /** + * @member + * @type {string} + */ + this["action"] = ""; + } + if (!("version" in $$source)) { + /** + * @member + * @type {string} + */ + this["version"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new UpdateProgress instance from a string or object. + * @param {any} [$$source = {}] + * @returns {UpdateProgress} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new UpdateProgress(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * UpdateResult mirrors TriggerUpdateResponse: Success false carries an error + * message in ErrorMsg. + */ +export class UpdateResult { + /** + * Creates a new UpdateResult instance. + * @param {Partial} [$$source = {}] - The source object to create the UpdateResult. + */ + constructor($$source = {}) { + if (!("success" in $$source)) { + /** + * @member + * @type {boolean} + */ + this["success"] = false; + } + if (!("errorMsg" in $$source)) { + /** + * @member + * @type {string} + */ + this["errorMsg"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new UpdateResult instance from a string or object. + * @param {any} [$$source = {}] + * @returns {UpdateResult} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new UpdateResult(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * WaitSSOParams carries the fields the UI passes to WaitSSOLogin. + */ +export class WaitSSOParams { + /** + * Creates a new WaitSSOParams instance. + * @param {Partial} [$$source = {}] - The source object to create the WaitSSOParams. + */ + constructor($$source = {}) { + if (!("userCode" in $$source)) { + /** + * @member + * @type {string} + */ + this["userCode"] = ""; + } + if (!("hostname" in $$source)) { + /** + * @member + * @type {string} + */ + this["hostname"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new WaitSSOParams instance from a string or object. + * @param {any} [$$source = {}] + * @returns {WaitSSOParams} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new WaitSSOParams(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = PortInfo.createFrom; +const $$createType1 = $Create.Array($Create.Any); +const $$createType2 = $Create.Map($Create.Any, $$createType1); +const $$createType3 = PortRange.createFrom; +const $$createType4 = $Create.Nullable($$createType3); +const $$createType5 = PeerLink.createFrom; +const $$createType6 = LocalPeer.createFrom; +const $$createType7 = PeerStatus.createFrom; +const $$createType8 = $Create.Array($$createType7); +const $$createType9 = SystemEvent.createFrom; +const $$createType10 = $Create.Array($$createType9); +const $$createType11 = $Create.Map($Create.Any, $Create.Any); diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.ts b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.ts deleted file mode 100644 index d561338bf..000000000 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.ts +++ /dev/null @@ -1,1194 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import { Create as $Create } from "@wailsio/runtime"; - -/** - * ActiveProfile is the result of GetActiveProfile. - */ -export class ActiveProfile { - "profileName": string; - "username": string; - - /** Creates a new ActiveProfile instance. */ - constructor($$source: Partial = {}) { - if (!("profileName" in $$source)) { - this["profileName"] = ""; - } - if (!("username" in $$source)) { - this["username"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new ActiveProfile instance from a string or object. - */ - static createFrom($$source: any = {}): ActiveProfile { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new ActiveProfile($$parsedSource as Partial); - } -} - -/** - * Config is the daemon configuration the UI exposes in the settings window. - * Pointer fields mark "set" vs "unset" so the UI can omit a value to keep the - * daemon's current setting (matching SetConfigRequest's optional semantics). - */ -export class Config { - "managementUrl": string; - "adminUrl": string; - "configFile": string; - "logFile": string; - "preSharedKey": string; - "interfaceName": string; - "wireguardPort": number; - "mtu": number; - "disableAutoConnect": boolean; - "serverSshAllowed": boolean; - "rosenpassEnabled": boolean; - "rosenpassPermissive": boolean; - "disableNotifications": boolean; - "lazyConnectionEnabled": boolean; - "blockInbound": boolean; - "networkMonitor": boolean; - "disableClientRoutes": boolean; - "disableServerRoutes": boolean; - "disableDns": boolean; - "disableIpv6": boolean; - "blockLanAccess": boolean; - "enableSshRoot": boolean; - "enableSshSftp": boolean; - "enableSshLocalPortForwarding": boolean; - "enableSshRemotePortForwarding": boolean; - "disableSshAuth": boolean; - "sshJwtCacheTtl": number; - - /** Creates a new Config instance. */ - constructor($$source: Partial = {}) { - if (!("managementUrl" in $$source)) { - this["managementUrl"] = ""; - } - if (!("adminUrl" in $$source)) { - this["adminUrl"] = ""; - } - if (!("configFile" in $$source)) { - this["configFile"] = ""; - } - if (!("logFile" in $$source)) { - this["logFile"] = ""; - } - if (!("preSharedKey" in $$source)) { - this["preSharedKey"] = ""; - } - if (!("interfaceName" in $$source)) { - this["interfaceName"] = ""; - } - if (!("wireguardPort" in $$source)) { - this["wireguardPort"] = 0; - } - if (!("mtu" in $$source)) { - this["mtu"] = 0; - } - if (!("disableAutoConnect" in $$source)) { - this["disableAutoConnect"] = false; - } - if (!("serverSshAllowed" in $$source)) { - this["serverSshAllowed"] = false; - } - if (!("rosenpassEnabled" in $$source)) { - this["rosenpassEnabled"] = false; - } - if (!("rosenpassPermissive" in $$source)) { - this["rosenpassPermissive"] = false; - } - if (!("disableNotifications" in $$source)) { - this["disableNotifications"] = false; - } - if (!("lazyConnectionEnabled" in $$source)) { - this["lazyConnectionEnabled"] = false; - } - if (!("blockInbound" in $$source)) { - this["blockInbound"] = false; - } - if (!("networkMonitor" in $$source)) { - this["networkMonitor"] = false; - } - if (!("disableClientRoutes" in $$source)) { - this["disableClientRoutes"] = false; - } - if (!("disableServerRoutes" in $$source)) { - this["disableServerRoutes"] = false; - } - if (!("disableDns" in $$source)) { - this["disableDns"] = false; - } - if (!("disableIpv6" in $$source)) { - this["disableIpv6"] = false; - } - if (!("blockLanAccess" in $$source)) { - this["blockLanAccess"] = false; - } - if (!("enableSshRoot" in $$source)) { - this["enableSshRoot"] = false; - } - if (!("enableSshSftp" in $$source)) { - this["enableSshSftp"] = false; - } - if (!("enableSshLocalPortForwarding" in $$source)) { - this["enableSshLocalPortForwarding"] = false; - } - if (!("enableSshRemotePortForwarding" in $$source)) { - this["enableSshRemotePortForwarding"] = false; - } - if (!("disableSshAuth" in $$source)) { - this["disableSshAuth"] = false; - } - if (!("sshJwtCacheTtl" in $$source)) { - this["sshJwtCacheTtl"] = 0; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Config instance from a string or object. - */ - static createFrom($$source: any = {}): Config { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Config($$parsedSource as Partial); - } -} - -/** - * ConfigParams selects which profile/user to read or write config for. - */ -export class ConfigParams { - "profileName": string; - "username": string; - - /** Creates a new ConfigParams instance. */ - constructor($$source: Partial = {}) { - if (!("profileName" in $$source)) { - this["profileName"] = ""; - } - if (!("username" in $$source)) { - this["username"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new ConfigParams instance from a string or object. - */ - static createFrom($$source: any = {}): ConfigParams { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new ConfigParams($$parsedSource as Partial); - } -} - -/** - * DebugBundleParams configures what the daemon collects when generating a - * debug bundle. - */ -export class DebugBundleParams { - "anonymize": boolean; - "systemInfo": boolean; - "uploadUrl": string; - "logFileCount": number; - - /** Creates a new DebugBundleParams instance. */ - constructor($$source: Partial = {}) { - if (!("anonymize" in $$source)) { - this["anonymize"] = false; - } - if (!("systemInfo" in $$source)) { - this["systemInfo"] = false; - } - if (!("uploadUrl" in $$source)) { - this["uploadUrl"] = ""; - } - if (!("logFileCount" in $$source)) { - this["logFileCount"] = 0; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new DebugBundleParams instance from a string or object. - */ - static createFrom($$source: any = {}): DebugBundleParams { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new DebugBundleParams($$parsedSource as Partial); - } -} - -/** - * DebugBundleResult mirrors DebugBundleResponse — Path is set on local-only - * bundles, UploadedKey on successful uploads, UploadFailureReason on failed - * uploads. - */ -export class DebugBundleResult { - "path": string; - "uploadedKey": string; - "uploadFailureReason": string; - - /** Creates a new DebugBundleResult instance. */ - constructor($$source: Partial = {}) { - if (!("path" in $$source)) { - this["path"] = ""; - } - if (!("uploadedKey" in $$source)) { - this["uploadedKey"] = ""; - } - if (!("uploadFailureReason" in $$source)) { - this["uploadFailureReason"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new DebugBundleResult instance from a string or object. - */ - static createFrom($$source: any = {}): DebugBundleResult { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new DebugBundleResult($$parsedSource as Partial); - } -} - -/** - * Features reports which UI surfaces the daemon has disabled. The Fyne UI uses - * these flags to grey out menu items the operator turned off server-side. - */ -export class Features { - "disableProfiles": boolean; - "disableUpdateSettings": boolean; - "disableNetworks": boolean; - - /** Creates a new Features instance. */ - constructor($$source: Partial = {}) { - if (!("disableProfiles" in $$source)) { - this["disableProfiles"] = false; - } - if (!("disableUpdateSettings" in $$source)) { - this["disableUpdateSettings"] = false; - } - if (!("disableNetworks" in $$source)) { - this["disableNetworks"] = false; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Features instance from a string or object. - */ - static createFrom($$source: any = {}): Features { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Features($$parsedSource as Partial); - } -} - -/** - * ForwardingRule is one entry from the daemon's reverse-proxy table — - * what we ship to the frontend's "exposed services" view. - */ -export class ForwardingRule { - "protocol": string; - "destinationPort": PortInfo; - "translatedAddress": string; - "translatedHostname": string; - "translatedPort": PortInfo; - - /** Creates a new ForwardingRule instance. */ - constructor($$source: Partial = {}) { - if (!("protocol" in $$source)) { - this["protocol"] = ""; - } - if (!("destinationPort" in $$source)) { - this["destinationPort"] = (new PortInfo()); - } - if (!("translatedAddress" in $$source)) { - this["translatedAddress"] = ""; - } - if (!("translatedHostname" in $$source)) { - this["translatedHostname"] = ""; - } - if (!("translatedPort" in $$source)) { - this["translatedPort"] = (new PortInfo()); - } - - Object.assign(this, $$source); - } - - /** - * Creates a new ForwardingRule instance from a string or object. - */ - static createFrom($$source: any = {}): ForwardingRule { - const $$createField1_0 = $$createType0; - const $$createField4_0 = $$createType0; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("destinationPort" in $$parsedSource) { - $$parsedSource["destinationPort"] = $$createField1_0($$parsedSource["destinationPort"]); - } - if ("translatedPort" in $$parsedSource) { - $$parsedSource["translatedPort"] = $$createField4_0($$parsedSource["translatedPort"]); - } - return new ForwardingRule($$parsedSource as Partial); - } -} - -/** - * LocalPeer mirrors LocalPeerState — what this client looks like on the mesh. - */ -export class LocalPeer { - "ip": string; - "pubKey": string; - "fqdn": string; - "networks": string[]; - - /** Creates a new LocalPeer instance. */ - constructor($$source: Partial = {}) { - if (!("ip" in $$source)) { - this["ip"] = ""; - } - if (!("pubKey" in $$source)) { - this["pubKey"] = ""; - } - if (!("fqdn" in $$source)) { - this["fqdn"] = ""; - } - if (!("networks" in $$source)) { - this["networks"] = []; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new LocalPeer instance from a string or object. - */ - static createFrom($$source: any = {}): LocalPeer { - const $$createField3_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("networks" in $$parsedSource) { - $$parsedSource["networks"] = $$createField3_0($$parsedSource["networks"]); - } - return new LocalPeer($$parsedSource as Partial); - } -} - -/** - * LogLevel is a single log-level value the daemon understands ("error", - * "warn", "info", "debug", "trace"). - */ -export class LogLevel { - "level": string; - - /** Creates a new LogLevel instance. */ - constructor($$source: Partial = {}) { - if (!("level" in $$source)) { - this["level"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new LogLevel instance from a string or object. - */ - static createFrom($$source: any = {}): LogLevel { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new LogLevel($$parsedSource as Partial); - } -} - -/** - * LoginParams carries the fields the UI sets when starting a login. - */ -export class LoginParams { - "profileName": string; - "username": string; - "managementUrl": string; - "setupKey": string; - "preSharedKey": string; - "hostname": string; - "hint": string; - - /** Creates a new LoginParams instance. */ - constructor($$source: Partial = {}) { - if (!("profileName" in $$source)) { - this["profileName"] = ""; - } - if (!("username" in $$source)) { - this["username"] = ""; - } - if (!("managementUrl" in $$source)) { - this["managementUrl"] = ""; - } - if (!("setupKey" in $$source)) { - this["setupKey"] = ""; - } - if (!("preSharedKey" in $$source)) { - this["preSharedKey"] = ""; - } - if (!("hostname" in $$source)) { - this["hostname"] = ""; - } - if (!("hint" in $$source)) { - this["hint"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new LoginParams instance from a string or object. - */ - static createFrom($$source: any = {}): LoginParams { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new LoginParams($$parsedSource as Partial); - } -} - -/** - * LoginResult is the daemon's reply to a Login call. - */ -export class LoginResult { - "needsSsoLogin": boolean; - "userCode": string; - "verificationUri": string; - "verificationUriComplete": string; - - /** Creates a new LoginResult instance. */ - constructor($$source: Partial = {}) { - if (!("needsSsoLogin" in $$source)) { - this["needsSsoLogin"] = false; - } - if (!("userCode" in $$source)) { - this["userCode"] = ""; - } - if (!("verificationUri" in $$source)) { - this["verificationUri"] = ""; - } - if (!("verificationUriComplete" in $$source)) { - this["verificationUriComplete"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new LoginResult instance from a string or object. - */ - static createFrom($$source: any = {}): LoginResult { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new LoginResult($$parsedSource as Partial); - } -} - -/** - * LogoutParams selects the profile the daemon should log out. - */ -export class LogoutParams { - "profileName": string; - "username": string; - - /** Creates a new LogoutParams instance. */ - constructor($$source: Partial = {}) { - if (!("profileName" in $$source)) { - this["profileName"] = ""; - } - if (!("username" in $$source)) { - this["username"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new LogoutParams instance from a string or object. - */ - static createFrom($$source: any = {}): LogoutParams { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new LogoutParams($$parsedSource as Partial); - } -} - -/** - * Network is one routed network the daemon offers to the client. - */ -export class Network { - "id": string; - "range": string; - "selected": boolean; - "domains": string[]; - "resolvedIps": { [_ in string]?: string[] }; - - /** Creates a new Network instance. */ - constructor($$source: Partial = {}) { - if (!("id" in $$source)) { - this["id"] = ""; - } - if (!("range" in $$source)) { - this["range"] = ""; - } - if (!("selected" in $$source)) { - this["selected"] = false; - } - if (!("domains" in $$source)) { - this["domains"] = []; - } - if (!("resolvedIps" in $$source)) { - this["resolvedIps"] = {}; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Network instance from a string or object. - */ - static createFrom($$source: any = {}): Network { - const $$createField3_0 = $$createType1; - const $$createField4_0 = $$createType2; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("domains" in $$parsedSource) { - $$parsedSource["domains"] = $$createField3_0($$parsedSource["domains"]); - } - if ("resolvedIps" in $$parsedSource) { - $$parsedSource["resolvedIps"] = $$createField4_0($$parsedSource["resolvedIps"]); - } - return new Network($$parsedSource as Partial); - } -} - -/** - * PeerLink is one of the named connections between this peer and its mgmt - * or signal server. - */ -export class PeerLink { - "url": string; - "connected": boolean; - "error"?: string; - - /** Creates a new PeerLink instance. */ - constructor($$source: Partial = {}) { - if (!("url" in $$source)) { - this["url"] = ""; - } - if (!("connected" in $$source)) { - this["connected"] = false; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new PeerLink instance from a string or object. - */ - static createFrom($$source: any = {}): PeerLink { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new PeerLink($$parsedSource as Partial); - } -} - -/** - * PeerStatus is the frontend-facing shape of a daemon PeerState. Carries - * enough detail for the dashboard's compact peer row plus the on-click - * troubleshooting expansion (ICE candidate types, endpoints, handshake age). - */ -export class PeerStatus { - "ip": string; - "pubKey": string; - "connStatus": string; - "connStatusUpdateUnix": number; - "relayed": boolean; - "localIceCandidateType": string; - "remoteIceCandidateType": string; - "localIceCandidateEndpoint": string; - "remoteIceCandidateEndpoint": string; - "fqdn": string; - "bytesRx": number; - "bytesTx": number; - "latencyMs": number; - "relayAddress": string; - "lastHandshakeUnix": number; - "rosenpassEnabled": boolean; - "networks": string[]; - - /** Creates a new PeerStatus instance. */ - constructor($$source: Partial = {}) { - if (!("ip" in $$source)) { - this["ip"] = ""; - } - if (!("pubKey" in $$source)) { - this["pubKey"] = ""; - } - if (!("connStatus" in $$source)) { - this["connStatus"] = ""; - } - if (!("connStatusUpdateUnix" in $$source)) { - this["connStatusUpdateUnix"] = 0; - } - if (!("relayed" in $$source)) { - this["relayed"] = false; - } - if (!("localIceCandidateType" in $$source)) { - this["localIceCandidateType"] = ""; - } - if (!("remoteIceCandidateType" in $$source)) { - this["remoteIceCandidateType"] = ""; - } - if (!("localIceCandidateEndpoint" in $$source)) { - this["localIceCandidateEndpoint"] = ""; - } - if (!("remoteIceCandidateEndpoint" in $$source)) { - this["remoteIceCandidateEndpoint"] = ""; - } - if (!("fqdn" in $$source)) { - this["fqdn"] = ""; - } - if (!("bytesRx" in $$source)) { - this["bytesRx"] = 0; - } - if (!("bytesTx" in $$source)) { - this["bytesTx"] = 0; - } - if (!("latencyMs" in $$source)) { - this["latencyMs"] = 0; - } - if (!("relayAddress" in $$source)) { - this["relayAddress"] = ""; - } - if (!("lastHandshakeUnix" in $$source)) { - this["lastHandshakeUnix"] = 0; - } - if (!("rosenpassEnabled" in $$source)) { - this["rosenpassEnabled"] = false; - } - if (!("networks" in $$source)) { - this["networks"] = []; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new PeerStatus instance from a string or object. - */ - static createFrom($$source: any = {}): PeerStatus { - const $$createField16_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("networks" in $$parsedSource) { - $$parsedSource["networks"] = $$createField16_0($$parsedSource["networks"]); - } - return new PeerStatus($$parsedSource as Partial); - } -} - -/** - * PortInfo carries the destination or translated port for a forwarding rule. - * Exactly one of Port or Range is populated, mirroring the daemon's oneof. - */ -export class PortInfo { - "port"?: number | null; - "range"?: PortRange | null; - - /** Creates a new PortInfo instance. */ - constructor($$source: Partial = {}) { - - Object.assign(this, $$source); - } - - /** - * Creates a new PortInfo instance from a string or object. - */ - static createFrom($$source: any = {}): PortInfo { - const $$createField1_0 = $$createType4; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("range" in $$parsedSource) { - $$parsedSource["range"] = $$createField1_0($$parsedSource["range"]); - } - return new PortInfo($$parsedSource as Partial); - } -} - -/** - * PortRange describes a contiguous port range. Both ends are inclusive. - */ -export class PortRange { - "start": number; - "end": number; - - /** Creates a new PortRange instance. */ - constructor($$source: Partial = {}) { - if (!("start" in $$source)) { - this["start"] = 0; - } - if (!("end" in $$source)) { - this["end"] = 0; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new PortRange instance from a string or object. - */ - static createFrom($$source: any = {}): PortRange { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new PortRange($$parsedSource as Partial); - } -} - -/** - * Profile is one named daemon profile. - */ -export class Profile { - "name": string; - "isActive": boolean; - - /** - * Email is the account address associated with this profile, sourced from - * the per-profile state file written by the CLI after a successful SSO - * login (e.g. ~/Library/Application Support/netbird/default.state.json on - * macOS). The daemon always runs as root, so its getConfigDir() resolves to - * the root home directory and cannot reach the user-owned state file. The - * UI process runs as the logged-in user and can read it directly via - * profilemanager.ProfileManager, which is why the email is fetched here - * instead of being returned by the ListProfiles RPC. - */ - "email": string; - - /** Creates a new Profile instance. */ - constructor($$source: Partial = {}) { - if (!("name" in $$source)) { - this["name"] = ""; - } - if (!("isActive" in $$source)) { - this["isActive"] = false; - } - if (!("email" in $$source)) { - this["email"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Profile instance from a string or object. - */ - static createFrom($$source: any = {}): Profile { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Profile($$parsedSource as Partial); - } -} - -/** - * ProfileRef identifies a profile by name+username. - */ -export class ProfileRef { - "profileName": string; - "username": string; - - /** Creates a new ProfileRef instance. */ - constructor($$source: Partial = {}) { - if (!("profileName" in $$source)) { - this["profileName"] = ""; - } - if (!("username" in $$source)) { - this["username"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new ProfileRef instance from a string or object. - */ - static createFrom($$source: any = {}): ProfileRef { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new ProfileRef($$parsedSource as Partial); - } -} - -/** - * SelectNetworksParams selects which networks to enable / disable. - * All means "every available network" (used by Select-All / Deselect-All buttons); - * Append means "leave the existing selection in place and merge these IDs in". - */ -export class SelectNetworksParams { - "networkIds": string[]; - "append": boolean; - "all": boolean; - - /** Creates a new SelectNetworksParams instance. */ - constructor($$source: Partial = {}) { - if (!("networkIds" in $$source)) { - this["networkIds"] = []; - } - if (!("append" in $$source)) { - this["append"] = false; - } - if (!("all" in $$source)) { - this["all"] = false; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new SelectNetworksParams instance from a string or object. - */ - static createFrom($$source: any = {}): SelectNetworksParams { - const $$createField0_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("networkIds" in $$parsedSource) { - $$parsedSource["networkIds"] = $$createField0_0($$parsedSource["networkIds"]); - } - return new SelectNetworksParams($$parsedSource as Partial); - } -} - -/** - * SetConfigParams is a partial update — only fields with non-nil pointers - * are sent to the daemon. The frontend uses this to flip individual toggles. - */ -export class SetConfigParams { - "profileName": string; - "username": string; - "managementUrl": string; - "adminUrl": string; - "interfaceName"?: string | null; - "wireguardPort"?: number | null; - "mtu"?: number | null; - "preSharedKey"?: string | null; - "disableAutoConnect"?: boolean | null; - "serverSshAllowed"?: boolean | null; - "rosenpassEnabled"?: boolean | null; - "rosenpassPermissive"?: boolean | null; - "disableNotifications"?: boolean | null; - "lazyConnectionEnabled"?: boolean | null; - "blockInbound"?: boolean | null; - "networkMonitor"?: boolean | null; - "disableClientRoutes"?: boolean | null; - "disableServerRoutes"?: boolean | null; - "disableDns"?: boolean | null; - "disableIpv6"?: boolean | null; - "disableFirewall"?: boolean | null; - "blockLanAccess"?: boolean | null; - "enableSshRoot"?: boolean | null; - "enableSshSftp"?: boolean | null; - "enableSshLocalPortForwarding"?: boolean | null; - "enableSshRemotePortForwarding"?: boolean | null; - "disableSshAuth"?: boolean | null; - "sshJwtCacheTtl"?: number | null; - - /** Creates a new SetConfigParams instance. */ - constructor($$source: Partial = {}) { - if (!("profileName" in $$source)) { - this["profileName"] = ""; - } - if (!("username" in $$source)) { - this["username"] = ""; - } - if (!("managementUrl" in $$source)) { - this["managementUrl"] = ""; - } - if (!("adminUrl" in $$source)) { - this["adminUrl"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new SetConfigParams instance from a string or object. - */ - static createFrom($$source: any = {}): SetConfigParams { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new SetConfigParams($$parsedSource as Partial); - } -} - -/** - * Status is the snapshot the frontend renders on the dashboard. - */ -export class Status { - "status": string; - "daemonVersion": string; - "management": PeerLink; - "signal": PeerLink; - "local": LocalPeer; - "peers": PeerStatus[]; - "events": SystemEvent[]; - - /** Creates a new Status instance. */ - constructor($$source: Partial = {}) { - if (!("status" in $$source)) { - this["status"] = ""; - } - if (!("daemonVersion" in $$source)) { - this["daemonVersion"] = ""; - } - if (!("management" in $$source)) { - this["management"] = (new PeerLink()); - } - if (!("signal" in $$source)) { - this["signal"] = (new PeerLink()); - } - if (!("local" in $$source)) { - this["local"] = (new LocalPeer()); - } - if (!("peers" in $$source)) { - this["peers"] = []; - } - if (!("events" in $$source)) { - this["events"] = []; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Status instance from a string or object. - */ - static createFrom($$source: any = {}): Status { - const $$createField2_0 = $$createType5; - const $$createField3_0 = $$createType5; - const $$createField4_0 = $$createType6; - const $$createField5_0 = $$createType8; - const $$createField6_0 = $$createType10; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("management" in $$parsedSource) { - $$parsedSource["management"] = $$createField2_0($$parsedSource["management"]); - } - if ("signal" in $$parsedSource) { - $$parsedSource["signal"] = $$createField3_0($$parsedSource["signal"]); - } - if ("local" in $$parsedSource) { - $$parsedSource["local"] = $$createField4_0($$parsedSource["local"]); - } - if ("peers" in $$parsedSource) { - $$parsedSource["peers"] = $$createField5_0($$parsedSource["peers"]); - } - if ("events" in $$parsedSource) { - $$parsedSource["events"] = $$createField6_0($$parsedSource["events"]); - } - return new Status($$parsedSource as Partial); - } -} - -/** - * SystemEvent is the frontend-facing shape of a daemon SystemEvent. - */ -export class SystemEvent { - "id": string; - "severity": string; - "category": string; - "message": string; - "userMessage": string; - "timestamp": number; - "metadata": { [_ in string]?: string }; - - /** Creates a new SystemEvent instance. */ - constructor($$source: Partial = {}) { - if (!("id" in $$source)) { - this["id"] = ""; - } - if (!("severity" in $$source)) { - this["severity"] = ""; - } - if (!("category" in $$source)) { - this["category"] = ""; - } - if (!("message" in $$source)) { - this["message"] = ""; - } - if (!("userMessage" in $$source)) { - this["userMessage"] = ""; - } - if (!("timestamp" in $$source)) { - this["timestamp"] = 0; - } - if (!("metadata" in $$source)) { - this["metadata"] = {}; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new SystemEvent instance from a string or object. - */ - static createFrom($$source: any = {}): SystemEvent { - const $$createField6_0 = $$createType11; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("metadata" in $$parsedSource) { - $$parsedSource["metadata"] = $$createField6_0($$parsedSource["metadata"]); - } - return new SystemEvent($$parsedSource as Partial); - } -} - -/** - * UpParams selects the profile the daemon should bring up. - */ -export class UpParams { - "profileName": string; - "username": string; - - /** Creates a new UpParams instance. */ - constructor($$source: Partial = {}) { - if (!("profileName" in $$source)) { - this["profileName"] = ""; - } - if (!("username" in $$source)) { - this["username"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new UpParams instance from a string or object. - */ - static createFrom($$source: any = {}): UpParams { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new UpParams($$parsedSource as Partial); - } -} - -/** - * UpdateAvailable carries the new_version_available metadata. - */ -export class UpdateAvailable { - "version": string; - "enforced": boolean; - - /** Creates a new UpdateAvailable instance. */ - constructor($$source: Partial = {}) { - if (!("version" in $$source)) { - this["version"] = ""; - } - if (!("enforced" in $$source)) { - this["enforced"] = false; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new UpdateAvailable instance from a string or object. - */ - static createFrom($$source: any = {}): UpdateAvailable { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new UpdateAvailable($$parsedSource as Partial); - } -} - -/** - * UpdateProgress carries the progress_window metadata. - */ -export class UpdateProgress { - "action": string; - "version": string; - - /** Creates a new UpdateProgress instance. */ - constructor($$source: Partial = {}) { - if (!("action" in $$source)) { - this["action"] = ""; - } - if (!("version" in $$source)) { - this["version"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new UpdateProgress instance from a string or object. - */ - static createFrom($$source: any = {}): UpdateProgress { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new UpdateProgress($$parsedSource as Partial); - } -} - -/** - * UpdateResult mirrors TriggerUpdateResponse: Success false carries an error - * message in ErrorMsg. - */ -export class UpdateResult { - "success": boolean; - "errorMsg": string; - - /** Creates a new UpdateResult instance. */ - constructor($$source: Partial = {}) { - if (!("success" in $$source)) { - this["success"] = false; - } - if (!("errorMsg" in $$source)) { - this["errorMsg"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new UpdateResult instance from a string or object. - */ - static createFrom($$source: any = {}): UpdateResult { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new UpdateResult($$parsedSource as Partial); - } -} - -/** - * WaitSSOParams carries the fields the UI passes to WaitSSOLogin. - */ -export class WaitSSOParams { - "userCode": string; - "hostname": string; - - /** Creates a new WaitSSOParams instance. */ - constructor($$source: Partial = {}) { - if (!("userCode" in $$source)) { - this["userCode"] = ""; - } - if (!("hostname" in $$source)) { - this["hostname"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new WaitSSOParams instance from a string or object. - */ - static createFrom($$source: any = {}): WaitSSOParams { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new WaitSSOParams($$parsedSource as Partial); - } -} - -// Private type creation functions -const $$createType0 = PortInfo.createFrom; -const $$createType1 = $Create.Array($Create.Any); -const $$createType2 = $Create.Map($Create.Any, $$createType1); -const $$createType3 = PortRange.createFrom; -const $$createType4 = $Create.Nullable($$createType3); -const $$createType5 = PeerLink.createFrom; -const $$createType6 = LocalPeer.createFrom; -const $$createType7 = PeerStatus.createFrom; -const $$createType8 = $Create.Array($$createType7); -const $$createType9 = SystemEvent.createFrom; -const $$createType10 = $Create.Array($$createType9); -const $$createType11 = $Create.Map($Create.Any, $Create.Any); diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/networks.ts b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/networks.js similarity index 64% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/networks.ts rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/networks.js index 82a8d870f..b0b8fe666 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/networks.ts +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/networks.js @@ -1,3 +1,4 @@ +// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT @@ -14,17 +15,28 @@ import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Cr // @ts-ignore: Unused imports import * as $models from "./models.js"; -export function Deselect(p: $models.SelectNetworksParams): $CancellablePromise { +/** + * @param {$models.SelectNetworksParams} p + * @returns {$CancellablePromise} + */ +export function Deselect(p) { return $Call.ByID(3382210947, p); } -export function List(): $CancellablePromise<$models.Network[]> { - return $Call.ByID(1550842096).then(($result: any) => { +/** + * @returns {$CancellablePromise<$models.Network[]>} + */ +export function List() { + return $Call.ByID(1550842096).then(/** @type {($result: any) => any} */(($result) => { return $$createType1($result); - }); + })); } -export function Select(p: $models.SelectNetworksParams): $CancellablePromise { +/** + * @param {$models.SelectNetworksParams} p + * @returns {$CancellablePromise} + */ +export function Select(p) { return $Call.ByID(1339338400, p); } diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/peers.ts b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/peers.js similarity index 85% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/peers.ts rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/peers.js index f70d8cc7c..7b41f718d 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/peers.ts +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/peers.js @@ -1,3 +1,4 @@ +// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT @@ -17,11 +18,12 @@ import * as $models from "./models.js"; /** * Get returns the current daemon status snapshot. + * @returns {$CancellablePromise<$models.Status>} */ -export function Get(): $CancellablePromise<$models.Status> { - return $Call.ByID(3266051360).then(($result: any) => { +export function Get() { + return $Call.ByID(3266051360).then(/** @type {($result: any) => any} */(($result) => { return $$createType0($result); - }); + })); } /** @@ -37,8 +39,9 @@ export function Get(): $CancellablePromise<$models.Status> { * * Safe to call once at boot; both loops self-restart on stream errors * via exponential backoff. + * @returns {$CancellablePromise} */ -export function Watch(): $CancellablePromise { +export function Watch() { return $Call.ByID(2799871735); } diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profiles.ts b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profiles.js similarity index 57% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profiles.ts rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profiles.js index 9a4577e0b..5a207d6ca 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profiles.ts +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profiles.js @@ -1,3 +1,4 @@ +// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT @@ -14,35 +15,55 @@ import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Cr // @ts-ignore: Unused imports import * as $models from "./models.js"; -export function Add(p: $models.ProfileRef): $CancellablePromise { +/** + * @param {$models.ProfileRef} p + * @returns {$CancellablePromise} + */ +export function Add(p) { return $Call.ByID(722930578, p); } -export function GetActive(): $CancellablePromise<$models.ActiveProfile> { - return $Call.ByID(3458449443).then(($result: any) => { +/** + * @returns {$CancellablePromise<$models.ActiveProfile>} + */ +export function GetActive() { + return $Call.ByID(3458449443).then(/** @type {($result: any) => any} */(($result) => { return $$createType0($result); - }); + })); } -export function List(username: string): $CancellablePromise<$models.Profile[]> { - return $Call.ByID(3702185167, username).then(($result: any) => { +/** + * @param {string} username + * @returns {$CancellablePromise<$models.Profile[]>} + */ +export function List(username) { + return $Call.ByID(3702185167, username).then(/** @type {($result: any) => any} */(($result) => { return $$createType2($result); - }); + })); } -export function Remove(p: $models.ProfileRef): $CancellablePromise { +/** + * @param {$models.ProfileRef} p + * @returns {$CancellablePromise} + */ +export function Remove(p) { return $Call.ByID(2365690315, p); } -export function Switch(p: $models.ProfileRef): $CancellablePromise { +/** + * @param {$models.ProfileRef} p + * @returns {$CancellablePromise} + */ +export function Switch(p) { return $Call.ByID(3209858855, p); } /** * Username returns the OS username the daemon expects for profile lookups. * The frontend calls this once at boot and reuses the result. + * @returns {$CancellablePromise} */ -export function Username(): $CancellablePromise { +export function Username() { return $Call.ByID(262345647); } diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profileswitcher.js b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profileswitcher.js new file mode 100644 index 000000000..6020c6fc2 --- /dev/null +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profileswitcher.js @@ -0,0 +1,41 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * ProfileSwitcher encapsulates the full profile-switching reconnect policy so + * both the tray and the React frontend use identical logic. + * + * Reconnect policy: + * + * ┌─────────────────┬──────────────────────┬────────────────────────────────────┐ + * │ Previous status │ Action │ Rationale │ + * ├─────────────────┼──────────────────────┼────────────────────────────────────┤ + * │ Connected │ Switch + Down + Up │ Reconnect with the new profile. │ + * │ Connecting │ Switch + Down + Up │ Stop old retry loop, restart. │ + * │ NeedsLogin │ Switch + Down │ Clear stale error; user logs in. │ + * │ LoginFailed │ Switch + Down │ Clear stale error; user logs in. │ + * │ SessionExpired │ Switch + Down │ Clear stale error; user logs in. │ + * │ Idle │ Switch only │ User chose offline; don't connect. │ + * └─────────────────┴──────────────────────┴────────────────────────────────────┘ + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as $models from "./models.js"; + +/** + * SwitchActive switches to the named profile applying the reconnect policy. + * It returns after the Switch RPC completes so the caller can refresh its UI + * immediately; Down and Up run in a background goroutine. + * @param {$models.ProfileRef} p + * @returns {$CancellablePromise} + */ +export function SwitchActive(p) { + return $Call.ByID(4025913103, p); +} diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/settings.ts b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/settings.js similarity index 59% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/settings.ts rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/settings.js index bc7b7b2d1..9d5bf6e77 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/settings.ts +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/settings.js @@ -1,3 +1,4 @@ +// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT @@ -14,19 +15,30 @@ import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Cr // @ts-ignore: Unused imports import * as $models from "./models.js"; -export function GetConfig(p: $models.ConfigParams): $CancellablePromise<$models.Config> { - return $Call.ByID(59246988, p).then(($result: any) => { +/** + * @param {$models.ConfigParams} p + * @returns {$CancellablePromise<$models.Config>} + */ +export function GetConfig(p) { + return $Call.ByID(59246988, p).then(/** @type {($result: any) => any} */(($result) => { return $$createType0($result); - }); + })); } -export function GetFeatures(): $CancellablePromise<$models.Features> { - return $Call.ByID(2056724965).then(($result: any) => { +/** + * @returns {$CancellablePromise<$models.Features>} + */ +export function GetFeatures() { + return $Call.ByID(2056724965).then(/** @type {($result: any) => any} */(($result) => { return $$createType1($result); - }); + })); } -export function SetConfig(p: $models.SetConfigParams): $CancellablePromise { +/** + * @param {$models.SetConfigParams} p + * @returns {$CancellablePromise} + */ +export function SetConfig(p) { return $Call.ByID(26939944, p); } diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/update.ts b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/update.js similarity index 69% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/update.ts rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/update.js index c2bdd85e9..668d0d670 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/update.ts +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/update.js @@ -1,3 +1,4 @@ +// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT @@ -14,10 +15,13 @@ import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Cr // @ts-ignore: Unused imports import * as $models from "./models.js"; -export function GetInstallerResult(): $CancellablePromise<$models.UpdateResult> { - return $Call.ByID(2533624807).then(($result: any) => { +/** + * @returns {$CancellablePromise<$models.UpdateResult>} + */ +export function GetInstallerResult() { + return $Call.ByID(2533624807).then(/** @type {($result: any) => any} */(($result) => { return $$createType0($result); - }); + })); } /** @@ -26,15 +30,19 @@ export function GetInstallerResult(): $CancellablePromise<$models.UpdateResult> * Fyne UI's app.Quit() in showInstallerResult. Schedules the actual exit * off the calling goroutine so the JS-side caller's response can return * before the runtime tears down. + * @returns {$CancellablePromise} */ -export function Quit(): $CancellablePromise { +export function Quit() { return $Call.ByID(409602657); } -export function Trigger(): $CancellablePromise<$models.UpdateResult> { - return $Call.ByID(166270378).then(($result: any) => { +/** + * @returns {$CancellablePromise<$models.UpdateResult>} + */ +export function Trigger() { + return $Call.ByID(166270378).then(/** @type {($result: any) => any} */(($result) => { return $$createType0($result); - }); + })); } // Private type creation functions diff --git a/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/internal/eventcreate.ts b/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/internal/eventcreate.js similarity index 100% rename from client/ui/frontend/bindings/github.com/wailsapp/wails/v3/internal/eventcreate.ts rename to client/ui/frontend/bindings/github.com/wailsapp/wails/v3/internal/eventcreate.js diff --git a/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/index.ts b/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/index.js similarity index 96% rename from client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/index.ts rename to client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/index.js index 71eda3bb9..e2c2be532 100644 --- a/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/index.ts +++ b/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/index.js @@ -1,3 +1,4 @@ +// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT diff --git a/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/models.js b/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/models.js new file mode 100644 index 000000000..6cdc2516f --- /dev/null +++ b/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/models.js @@ -0,0 +1,192 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import { Create as $Create } from "@wailsio/runtime"; + +/** + * NotificationAction represents an action button for a notification. + */ +export class NotificationAction { + /** + * Creates a new NotificationAction instance. + * @param {Partial} [$$source = {}] - The source object to create the NotificationAction. + */ + constructor($$source = {}) { + if (/** @type {any} */(false)) { + /** + * @member + * @type {string | undefined} + */ + this["id"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {string | undefined} + */ + this["title"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * (macOS-specific) + * @member + * @type {boolean | undefined} + */ + this["destructive"] = undefined; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new NotificationAction instance from a string or object. + * @param {any} [$$source = {}] + * @returns {NotificationAction} + */ + static createFrom($$source = {}) { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new NotificationAction(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * NotificationCategory groups actions for notifications. + */ +export class NotificationCategory { + /** + * Creates a new NotificationCategory instance. + * @param {Partial} [$$source = {}] - The source object to create the NotificationCategory. + */ + constructor($$source = {}) { + if (/** @type {any} */(false)) { + /** + * @member + * @type {string | undefined} + */ + this["id"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {NotificationAction[] | undefined} + */ + this["actions"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {boolean | undefined} + */ + this["hasReplyField"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {string | undefined} + */ + this["replyPlaceholder"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {string | undefined} + */ + this["replyButtonTitle"] = undefined; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new NotificationCategory instance from a string or object. + * @param {any} [$$source = {}] + * @returns {NotificationCategory} + */ + static createFrom($$source = {}) { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("actions" in $$parsedSource) { + $$parsedSource["actions"] = $$createField1_0($$parsedSource["actions"]); + } + return new NotificationCategory(/** @type {Partial} */($$parsedSource)); + } +} + +/** + * NotificationOptions contains configuration for a notification + */ +export class NotificationOptions { + /** + * Creates a new NotificationOptions instance. + * @param {Partial} [$$source = {}] - The source object to create the NotificationOptions. + */ + constructor($$source = {}) { + if (!("id" in $$source)) { + /** + * @member + * @type {string} + */ + this["id"] = ""; + } + if (!("title" in $$source)) { + /** + * @member + * @type {string} + */ + this["title"] = ""; + } + if (/** @type {any} */(false)) { + /** + * (macOS and Linux only) + * @member + * @type {string | undefined} + */ + this["subtitle"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {string | undefined} + */ + this["body"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {string | undefined} + */ + this["categoryId"] = undefined; + } + if (/** @type {any} */(false)) { + /** + * @member + * @type {{ [_ in string]?: any } | undefined} + */ + this["data"] = undefined; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new NotificationOptions instance from a string or object. + * @param {any} [$$source = {}] + * @returns {NotificationOptions} + */ + static createFrom($$source = {}) { + const $$createField5_0 = $$createType2; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("data" in $$parsedSource) { + $$parsedSource["data"] = $$createField5_0($$parsedSource["data"]); + } + return new NotificationOptions(/** @type {Partial} */($$parsedSource)); + } +} + +// Private type creation functions +const $$createType0 = NotificationAction.createFrom; +const $$createType1 = $Create.Array($$createType0); +const $$createType2 = $Create.Map($Create.Any, $Create.Any); diff --git a/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/models.ts b/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/models.ts deleted file mode 100644 index 3fbcb8270..000000000 --- a/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/models.ts +++ /dev/null @@ -1,107 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import { Create as $Create } from "@wailsio/runtime"; - -/** - * NotificationAction represents an action button for a notification. - */ -export class NotificationAction { - "id"?: string; - "title"?: string; - - /** - * (macOS-specific) - */ - "destructive"?: boolean; - - /** Creates a new NotificationAction instance. */ - constructor($$source: Partial = {}) { - - Object.assign(this, $$source); - } - - /** - * Creates a new NotificationAction instance from a string or object. - */ - static createFrom($$source: any = {}): NotificationAction { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new NotificationAction($$parsedSource as Partial); - } -} - -/** - * NotificationCategory groups actions for notifications. - */ -export class NotificationCategory { - "id"?: string; - "actions"?: NotificationAction[]; - "hasReplyField"?: boolean; - "replyPlaceholder"?: string; - "replyButtonTitle"?: string; - - /** Creates a new NotificationCategory instance. */ - constructor($$source: Partial = {}) { - - Object.assign(this, $$source); - } - - /** - * Creates a new NotificationCategory instance from a string or object. - */ - static createFrom($$source: any = {}): NotificationCategory { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("actions" in $$parsedSource) { - $$parsedSource["actions"] = $$createField1_0($$parsedSource["actions"]); - } - return new NotificationCategory($$parsedSource as Partial); - } -} - -/** - * NotificationOptions contains configuration for a notification - */ -export class NotificationOptions { - "id": string; - "title": string; - - /** - * (macOS and Linux only) - */ - "subtitle"?: string; - "body"?: string; - "categoryId"?: string; - "data"?: { [_ in string]?: any }; - - /** Creates a new NotificationOptions instance. */ - constructor($$source: Partial = {}) { - if (!("id" in $$source)) { - this["id"] = ""; - } - if (!("title" in $$source)) { - this["title"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new NotificationOptions instance from a string or object. - */ - static createFrom($$source: any = {}): NotificationOptions { - const $$createField5_0 = $$createType2; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("data" in $$parsedSource) { - $$parsedSource["data"] = $$createField5_0($$parsedSource["data"]); - } - return new NotificationOptions($$parsedSource as Partial); - } -} - -// Private type creation functions -const $$createType0 = NotificationAction.createFrom; -const $$createType1 = $Create.Array($$createType0); -const $$createType2 = $Create.Map($Create.Any, $Create.Any); diff --git a/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/notificationservice.js b/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/notificationservice.js new file mode 100644 index 000000000..e16f96b80 --- /dev/null +++ b/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/notificationservice.js @@ -0,0 +1,101 @@ +// @ts-check +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * Service represents the notifications service + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as $models from "./models.js"; + +/** + * @returns {$CancellablePromise} + */ +export function CheckNotificationAuthorization() { + return $Call.ByID(2216952893); +} + +/** + * @param {$models.NotificationCategory} category + * @returns {$CancellablePromise} + */ +export function RegisterNotificationCategory(category) { + return $Call.ByID(2917562919, category); +} + +/** + * @returns {$CancellablePromise} + */ +export function RemoveAllDeliveredNotifications() { + return $Call.ByID(3956282340); +} + +/** + * @returns {$CancellablePromise} + */ +export function RemoveAllPendingNotifications() { + return $Call.ByID(108821341); +} + +/** + * @param {string} identifier + * @returns {$CancellablePromise} + */ +export function RemoveDeliveredNotification(identifier) { + return $Call.ByID(975691940, identifier); +} + +/** + * @param {string} identifier + * @returns {$CancellablePromise} + */ +export function RemoveNotification(identifier) { + return $Call.ByID(3966653866, identifier); +} + +/** + * @param {string} categoryID + * @returns {$CancellablePromise} + */ +export function RemoveNotificationCategory(categoryID) { + return $Call.ByID(2032615554, categoryID); +} + +/** + * @param {string} identifier + * @returns {$CancellablePromise} + */ +export function RemovePendingNotification(identifier) { + return $Call.ByID(3729049703, identifier); +} + +/** + * Public methods that delegate to the implementation. + * @returns {$CancellablePromise} + */ +export function RequestNotificationAuthorization() { + return $Call.ByID(3933442950); +} + +/** + * @param {$models.NotificationOptions} options + * @returns {$CancellablePromise} + */ +export function SendNotification(options) { + return $Call.ByID(3968228732, options); +} + +/** + * @param {$models.NotificationOptions} options + * @returns {$CancellablePromise} + */ +export function SendNotificationWithActions(options) { + return $Call.ByID(1886542847, options); +} diff --git a/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/notificationservice.ts b/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/notificationservice.ts deleted file mode 100644 index 859f3570f..000000000 --- a/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/notificationservice.ts +++ /dev/null @@ -1,62 +0,0 @@ -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -/** - * Service represents the notifications service - * @module - */ - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; - -export function CheckNotificationAuthorization(): $CancellablePromise { - return $Call.ByID(2216952893); -} - -export function RegisterNotificationCategory(category: $models.NotificationCategory): $CancellablePromise { - return $Call.ByID(2917562919, category); -} - -export function RemoveAllDeliveredNotifications(): $CancellablePromise { - return $Call.ByID(3956282340); -} - -export function RemoveAllPendingNotifications(): $CancellablePromise { - return $Call.ByID(108821341); -} - -export function RemoveDeliveredNotification(identifier: string): $CancellablePromise { - return $Call.ByID(975691940, identifier); -} - -export function RemoveNotification(identifier: string): $CancellablePromise { - return $Call.ByID(3966653866, identifier); -} - -export function RemoveNotificationCategory(categoryID: string): $CancellablePromise { - return $Call.ByID(2032615554, categoryID); -} - -export function RemovePendingNotification(identifier: string): $CancellablePromise { - return $Call.ByID(3729049703, identifier); -} - -/** - * Public methods that delegate to the implementation. - */ -export function RequestNotificationAuthorization(): $CancellablePromise { - return $Call.ByID(3933442950); -} - -export function SendNotification(options: $models.NotificationOptions): $CancellablePromise { - return $Call.ByID(3968228732, options); -} - -export function SendNotificationWithActions(options: $models.NotificationOptions): $CancellablePromise { - return $Call.ByID(1886542847, options); -} diff --git a/client/ui/frontend/src/pages/Profiles.tsx b/client/ui/frontend/src/pages/Profiles.tsx index d6be78890..5f66e7c20 100644 --- a/client/ui/frontend/src/pages/Profiles.tsx +++ b/client/ui/frontend/src/pages/Profiles.tsx @@ -3,6 +3,7 @@ import { Plus, RefreshCw } from "lucide-react"; import { Profiles as ProfilesSvc, Connection, + ProfileSwitcher, } from "../../bindings/github.com/netbirdio/netbird/client/ui/services"; import type { Profile } from "../../bindings/github.com/netbirdio/netbird/client/ui/services/models.js"; import { Button } from "../components/Button"; @@ -33,8 +34,7 @@ export default function Profiles() { const select = async (name: string) => { try { - await ProfilesSvc.Switch({ profileName: name, username }); - await Connection.Up({ profileName: name, username }); + await ProfileSwitcher.SwitchActive({ profileName: name, username }); await refresh(); } catch (e) { setError(String(e)); diff --git a/client/ui/main.go b/client/ui/main.go index 6fc38a971..f9437be52 100644 --- a/client/ui/main.go +++ b/client/ui/main.go @@ -103,6 +103,7 @@ func main() { peers := services.NewPeers(conn, app.Event) update := services.NewUpdate(conn) notifier := notifications.New() + profileSwitcher := services.NewProfileSwitcher(profiles, connection, peers) app.RegisterService(application.NewService(connection)) app.RegisterService(application.NewService(settings)) @@ -113,6 +114,7 @@ func main() { app.RegisterService(application.NewService(update)) app.RegisterService(application.NewService(peers)) app.RegisterService(application.NewService(notifier)) + app.RegisterService(application.NewService(profileSwitcher)) window := app.Window.NewWithOptions(application.WebviewWindowOptions{ Title: "NetBird", @@ -146,12 +148,13 @@ func main() { startStatusNotifierWatcher() tray = NewTray(app, window, TrayServices{ - Connection: connection, - Settings: settings, - Profiles: profiles, - Peers: peers, - Notifier: notifier, - Update: update, + Connection: connection, + Settings: settings, + Profiles: profiles, + Peers: peers, + Notifier: notifier, + Update: update, + ProfileSwitcher: profileSwitcher, }) listenForShowSignal(context.Background(), tray) diff --git a/client/ui/services/peers.go b/client/ui/services/peers.go index b658cf9aa..0adeeba25 100644 --- a/client/ui/services/peers.go +++ b/client/ui/services/peers.go @@ -37,6 +37,15 @@ const ( // permission, etc.). Real daemon statuses come straight from // internal.Status* — none of those collide with this label. StatusDaemonUnavailable = "DaemonUnavailable" + + // Daemon connection status strings — mirror internal.Status* in + // client/internal/state.go. + StatusConnected = "Connected" + StatusConnecting = "Connecting" + StatusIdle = "Idle" + StatusNeedsLogin = "NeedsLogin" + StatusLoginFailed = "LoginFailed" + StatusSessionExpired = "SessionExpired" ) // Emitter is what peers.Watch needs from the host application: a simple diff --git a/client/ui/services/profileswitcher.go b/client/ui/services/profileswitcher.go new file mode 100644 index 000000000..a63364ec7 --- /dev/null +++ b/client/ui/services/profileswitcher.go @@ -0,0 +1,82 @@ +//go:build !android && !ios && !freebsd && !js + +package services + +import ( + "context" + "fmt" + "strings" + + log "github.com/sirupsen/logrus" +) + +// ProfileSwitcher encapsulates the full profile-switching reconnect policy so +// both the tray and the React frontend use identical logic. +// +// Reconnect policy: +// +// ┌─────────────────┬──────────────────────┬────────────────────────────────────┐ +// │ Previous status │ Action │ Rationale │ +// ├─────────────────┼──────────────────────┼────────────────────────────────────┤ +// │ Connected │ Switch + Down + Up │ Reconnect with the new profile. │ +// │ Connecting │ Switch + Down + Up │ Stop old retry loop, restart. │ +// │ NeedsLogin │ Switch + Down │ Clear stale error; user logs in. │ +// │ LoginFailed │ Switch + Down │ Clear stale error; user logs in. │ +// │ SessionExpired │ Switch + Down │ Clear stale error; user logs in. │ +// │ Idle │ Switch only │ User chose offline; don't connect. │ +// └─────────────────┴──────────────────────┴────────────────────────────────────┘ +type ProfileSwitcher struct { + profiles *Profiles + connection *Connection + peers *Peers +} + +// NewProfileSwitcher creates a ProfileSwitcher backed by the given services. +func NewProfileSwitcher(profiles *Profiles, connection *Connection, peers *Peers) *ProfileSwitcher { + return &ProfileSwitcher{profiles: profiles, connection: connection, peers: peers} +} + +// SwitchActive switches to the named profile applying the reconnect policy. +// It returns after the Switch RPC completes so the caller can refresh its UI +// immediately; Down and Up run in a background goroutine. +func (s *ProfileSwitcher) SwitchActive(ctx context.Context, p ProfileRef) error { + prevStatus := "" + if st, err := s.peers.Get(ctx); err == nil { + prevStatus = st.Status + } else { + log.Warnf("profileswitcher: get status: %v", err) + } + + wasActive := strings.EqualFold(prevStatus, StatusConnected) || + strings.EqualFold(prevStatus, StatusConnecting) + needsDown := wasActive || + strings.EqualFold(prevStatus, StatusNeedsLogin) || + strings.EqualFold(prevStatus, StatusLoginFailed) || + strings.EqualFold(prevStatus, StatusSessionExpired) + + log.Infof("profileswitcher: switch profile=%q prevStatus=%q wasActive=%v needsDown=%v", + p.ProfileName, prevStatus, wasActive, needsDown) + + if err := s.profiles.Switch(ctx, p); err != nil { + return fmt.Errorf("switch profile %q: %w", p.ProfileName, err) + } + + go func() { + bgCtx := context.Background() + if needsDown { + if err := s.connection.Down(bgCtx); err != nil { + log.Errorf("profileswitcher: Down: %v", err) + } + } + if wasActive { + if err := s.connection.Up(bgCtx, UpParams{ + ProfileName: p.ProfileName, + Username: p.Username, + }); err != nil { + log.Errorf("profileswitcher: Up %s: %v", p.ProfileName, err) + } + } + }() + + return nil +} diff --git a/client/ui/tray.go b/client/ui/tray.go index 9e5dc702d..63938ba17 100644 --- a/client/ui/tray.go +++ b/client/ui/tray.go @@ -75,25 +75,9 @@ const ( notifyIDTrayError = "netbird-tray-error" notifyIDSessionExpired = "netbird-session-expired" - // Daemon status strings mirroring internal.Status* — kept in sync - // with client/internal/state.go. - statusConnected = "Connected" - statusConnecting = "Connecting" - statusIdle = "Idle" - statusError = "Error" - // Daemon status string for an SSO session that has expired and needs - // re-authentication. Mirrors internal.StatusSessionExpired. - statusSessionExpired = "SessionExpired" - // statusNeedsLogin is what the daemon publishes before the user has - // completed an SSO authentication on this profile. Mirrors - // internal.StatusNeedsLogin. - statusNeedsLogin = "NeedsLogin" - // statusLoginFailed is what the daemon publishes when a login attempt - // failed with a non-auth error (management unreachable, init error, - // etc.). The CLI groups it with NeedsLogin/SessionExpired and prompts - // the user to run "netbird up", so we mirror that here. Mirrors - // internal.StatusLoginFailed. - statusLoginFailed = "LoginFailed" + // statusError is a tray-only synthetic label used for the error icon; + // it does not come from the daemon and is not exported. + statusError = "Error" // External URLs. urlGitHubRepo = "https://github.com/netbirdio/netbird" @@ -108,12 +92,13 @@ const ( // linter's parameter-count threshold and so adding another service later // is a one-line struct change instead of a NewTray signature break. type TrayServices struct { - Connection *services.Connection - Settings *services.Settings - Profiles *services.Profiles - Peers *services.Peers - Notifier *notifications.NotificationService - Update *services.Update + Connection *services.Connection + Settings *services.Settings + Profiles *services.Profiles + Peers *services.Peers + Notifier *notifications.NotificationService + Update *services.Update + ProfileSwitcher *services.ProfileSwitcher } type Tray struct { @@ -466,15 +451,15 @@ func (t *Tray) onUpdateProgress(ev *application.CustomEvent) { // otherwise spam Shell_NotifyIcon and the log. func (t *Tray) applyStatus(st services.Status) { t.mu.Lock() - connected := strings.EqualFold(st.Status, statusConnected) + connected := strings.EqualFold(st.Status, services.StatusConnected) iconChanged := connected != t.connected || st.Status != t.lastStatus // Detect the transition into SessionExpired: the daemon emits the // state on every Status snapshot for as long as the session stays // expired, so without this guard we would re-fire the notification // on every push. Mirrors the legacy Fyne client's sendNotification // flag in onSessionExpire. - sessionExpiredEnter := strings.EqualFold(st.Status, statusSessionExpired) && - !strings.EqualFold(t.lastStatus, statusSessionExpired) + sessionExpiredEnter := strings.EqualFold(st.Status, services.StatusSessionExpired) && + !strings.EqualFold(t.lastStatus, services.StatusSessionExpired) daemonVersionChanged := st.DaemonVersion != "" && st.DaemonVersion != t.lastDaemonVersion t.connected = connected t.lastStatus = st.Status @@ -489,11 +474,11 @@ func (t *Tray) applyStatus(st services.Status) { if iconChanged { t.applyIcon() - needsLogin := strings.EqualFold(st.Status, statusNeedsLogin) || - strings.EqualFold(st.Status, statusSessionExpired) || - strings.EqualFold(st.Status, statusLoginFailed) + needsLogin := strings.EqualFold(st.Status, services.StatusNeedsLogin) || + strings.EqualFold(st.Status, services.StatusSessionExpired) || + strings.EqualFold(st.Status, services.StatusLoginFailed) daemonUnavailable := strings.EqualFold(st.Status, services.StatusDaemonUnavailable) - connecting := strings.EqualFold(st.Status, statusConnecting) + connecting := strings.EqualFold(st.Status, services.StatusConnecting) if t.statusItem != nil { // When the daemon needs re-authentication the status row turns // into the actionable Login entry — Connect would only fail. @@ -503,7 +488,7 @@ func (t *Tray) applyStatus(st services.Status) { switch { case daemonUnavailable: label = menuStatusDaemonUnavailable - case strings.EqualFold(st.Status, statusIdle): + case strings.EqualFold(st.Status, services.StatusIdle): label = menuStatusDisconnected } t.statusItem.SetLabel(label) @@ -603,14 +588,14 @@ func (t *Tray) applyStatusIndicator(status string) { func statusIndicatorBitmap(status string) []byte { switch { - case strings.EqualFold(status, statusConnected): + case strings.EqualFold(status, services.StatusConnected): return iconMenuDotConnected - case strings.EqualFold(status, statusConnecting): + case strings.EqualFold(status, services.StatusConnecting): return iconMenuDotConnecting - case strings.EqualFold(status, statusNeedsLogin), - strings.EqualFold(status, statusSessionExpired): + case strings.EqualFold(status, services.StatusNeedsLogin), + strings.EqualFold(status, services.StatusSessionExpired): return iconMenuDotLogin - case strings.EqualFold(status, statusLoginFailed), + case strings.EqualFold(status, services.StatusLoginFailed), strings.EqualFold(status, statusError): return iconMenuDotError case strings.EqualFold(status, services.StatusDaemonUnavailable): @@ -648,12 +633,12 @@ func (t *Tray) iconForState() (icon, dark []byte) { statusLabel := t.lastStatus t.mu.Unlock() - connecting := strings.EqualFold(statusLabel, statusConnecting) + connecting := strings.EqualFold(statusLabel, services.StatusConnecting) errored := strings.EqualFold(statusLabel, statusError) || strings.EqualFold(statusLabel, services.StatusDaemonUnavailable) - needsLogin := strings.EqualFold(statusLabel, statusNeedsLogin) || - strings.EqualFold(statusLabel, statusSessionExpired) || - strings.EqualFold(statusLabel, statusLoginFailed) + needsLogin := strings.EqualFold(statusLabel, services.StatusNeedsLogin) || + strings.EqualFold(statusLabel, services.StatusSessionExpired) || + strings.EqualFold(statusLabel, services.StatusLoginFailed) if runtime.GOOS == "darwin" { switch { @@ -799,78 +784,30 @@ func (t *Tray) loadProfiles() { } } -// switchProfile runs the daemon RPC in a goroutine so the menu click -// returns immediately, then reloads the submenu to move the checkmark. -// -// Reconnect policy by previous daemon status: -// -// ┌─────────────────┬──────────────────────┬────────────────────────────────────┐ -// │ Previous status │ Tray action │ Rationale │ -// ├─────────────────┼──────────────────────┼────────────────────────────────────┤ -// │ Connected │ Switch + Down + Up │ Reconnect with the new profile. │ -// │ Connecting │ Switch + Down + Up │ Stop the retry loop still dialing │ -// │ │ │ the old management server, then │ -// │ │ │ restart with new config. │ -// │ Idle │ Switch only │ User chose to be offline; don't │ -// │ │ │ silently flip the daemon online. │ -// │ NeedsLogin │ Switch + Down │ Clean stale error state so the new │ -// │ LoginFailed │ Switch + Down │ profile starts from Idle. User │ -// │ SessionExpired │ Switch + Down │ initiates login manually. │ -// └─────────────────┴──────────────────────┴────────────────────────────────────┘ -// -// Rule of thumb: auto-reconnect only when the daemon was actively trying to be -// online (Connected or Connecting). Login-error states get Down so stale errors -// are cleared, but no Up — the user initiates login on the new profile manually. +// switchProfile delegates to ProfileSwitcher.SwitchActive in a goroutine so +// the menu click returns immediately. The menu is refreshed as soon as the +// Switch RPC completes (before Down/Up finishes in the background). func (t *Tray) switchProfile(name string) { - t.mu.Lock() - prevStatus := t.lastStatus - t.mu.Unlock() - wasActive := strings.EqualFold(prevStatus, statusConnected) || - strings.EqualFold(prevStatus, statusConnecting) - needsDown := wasActive || - strings.EqualFold(prevStatus, statusNeedsLogin) || - strings.EqualFold(prevStatus, statusLoginFailed) || - strings.EqualFold(prevStatus, statusSessionExpired) - go func() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() username, err := t.svc.Profiles.Username() if err != nil { - log.Errorf("get current user: %v", err) + log.Errorf("tray switchProfile: get current user: %v", err) return } - log.Infof("tray switchProfile: sending SwitchProfile RPC profile=%q user=%q prevStatus=%q wasActive=%v needsDown=%v", - name, username, prevStatus, wasActive, needsDown) - if err := t.svc.Profiles.Switch(ctx, services.ProfileRef{ + if err := t.svc.ProfileSwitcher.SwitchActive(ctx, services.ProfileRef{ ProfileName: name, Username: username, }); err != nil { - log.Errorf("tray switchProfile: SwitchProfile RPC failed profile=%q err=%v", name, err) + log.Errorf("tray switchProfile: %v", err) t.notifyError(fmt.Sprintf("Failed to switch to %s", name)) return } - log.Infof("tray switchProfile: SwitchProfile RPC succeeded profile=%q", name) - - if needsDown { - log.Infof("tray switchProfile: calling Down to clean up previous state (%s)", prevStatus) - if err := t.svc.Connection.Down(ctx); err != nil { - log.Errorf("tray switchProfile: Down failed: %v", err) - } - } - if wasActive { - // Bring the connection back up against the new profile's management server. - log.Infof("tray switchProfile: was active (%s), reconnecting with new profile %q", prevStatus, name) - if err := t.svc.Connection.Up(ctx, services.UpParams{ - ProfileName: name, - Username: username, - }); err != nil { - log.Errorf("tray switchProfile: Up failed: %v", err) - t.notifyError(fmt.Sprintf("Failed to reconnect with %s", name)) - } - } - + // SwitchActive returns after the Switch RPC — active_profile.json is + // updated; Down/Up run in the background. Refresh menu now so the + // checkmark moves immediately. t.loadProfiles() }() } From 53b2fb8dc139b95d08b02ae111039fa6040ccc0f Mon Sep 17 00:00:00 2001 From: Zoltan Papp Date: Wed, 13 May 2026 15:51:36 +0200 Subject: [PATCH 04/10] [client/ui] Add async Up mode to avoid blocking profile switches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The daemon's Up RPC previously always blocked in waitForUp (up to 50s) until the engine connected. The UI does not need this — status updates already flow through the SubscribeStatus stream. Add bool async = 4 to UpRequest. When true the daemon starts connectWithRetryRuns and returns immediately; the CLI path (async=false, the default) is unchanged. ProfileSwitcher.SwitchActive now sets Async:true so all three RPCs (Status, Switch, Down, Up) return quickly. The background goroutine and its associated race condition are removed entirely. --- client/proto/daemon.pb.go | 26 +++++++++++++++++----- client/proto/daemon.proto | 6 +++++ client/server/server.go | 3 +++ client/ui/services/connection.go | 7 +++++- client/ui/services/profileswitcher.go | 32 +++++++++++++-------------- 5 files changed, 51 insertions(+), 23 deletions(-) diff --git a/client/proto/daemon.pb.go b/client/proto/daemon.pb.go index 789d7c2b2..3d54f5735 100644 --- a/client/proto/daemon.pb.go +++ b/client/proto/daemon.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.6 -// protoc v7.34.1 +// protoc v3.21.12 // source: daemon.proto package proto @@ -823,9 +823,15 @@ func (x *WaitSSOLoginResponse) GetEmail() string { } type UpRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - ProfileName *string `protobuf:"bytes,1,opt,name=profileName,proto3,oneof" json:"profileName,omitempty"` - Username *string `protobuf:"bytes,2,opt,name=username,proto3,oneof" json:"username,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + ProfileName *string `protobuf:"bytes,1,opt,name=profileName,proto3,oneof" json:"profileName,omitempty"` + Username *string `protobuf:"bytes,2,opt,name=username,proto3,oneof" json:"username,omitempty"` + // async instructs the daemon to start the connection attempt and return + // immediately without waiting for the engine to become ready. Status updates + // are delivered via the SubscribeStatus stream. When false (the default) the + // RPC blocks until the engine is running or gives up, which is the behaviour + // needed by the CLI. + Async bool `protobuf:"varint,4,opt,name=async,proto3" json:"async,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -874,6 +880,13 @@ func (x *UpRequest) GetUsername() string { return "" } +func (x *UpRequest) GetAsync() bool { + if x != nil { + return x.Async + } + return false +} + type UpResponse struct { state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields @@ -6309,10 +6322,11 @@ const file_daemon_proto_rawDesc = "" + "\buserCode\x18\x01 \x01(\tR\buserCode\x12\x1a\n" + "\bhostname\x18\x02 \x01(\tR\bhostname\",\n" + "\x14WaitSSOLoginResponse\x12\x14\n" + - "\x05email\x18\x01 \x01(\tR\x05email\"v\n" + + "\x05email\x18\x01 \x01(\tR\x05email\"\x8c\x01\n" + "\tUpRequest\x12%\n" + "\vprofileName\x18\x01 \x01(\tH\x00R\vprofileName\x88\x01\x01\x12\x1f\n" + - "\busername\x18\x02 \x01(\tH\x01R\busername\x88\x01\x01B\x0e\n" + + "\busername\x18\x02 \x01(\tH\x01R\busername\x88\x01\x01\x12\x14\n" + + "\x05async\x18\x04 \x01(\bR\x05asyncB\x0e\n" + "\f_profileNameB\v\n" + "\t_usernameJ\x04\b\x03\x10\x04\"\f\n" + "\n" + diff --git a/client/proto/daemon.proto b/client/proto/daemon.proto index 1676f255e..aa7b121a0 100644 --- a/client/proto/daemon.proto +++ b/client/proto/daemon.proto @@ -233,6 +233,12 @@ message UpRequest { optional string profileName = 1; optional string username = 2; reserved 3; + // async instructs the daemon to start the connection attempt and return + // immediately without waiting for the engine to become ready. Status updates + // are delivered via the SubscribeStatus stream. When false (the default) the + // RPC blocks until the engine is running or gives up, which is the behaviour + // needed by the CLI. + bool async = 4; } message UpResponse {} diff --git a/client/server/server.go b/client/server/server.go index 38fdd0010..0bc6358e3 100644 --- a/client/server/server.go +++ b/client/server/server.go @@ -747,6 +747,9 @@ func (s *Server) Up(callerCtx context.Context, msg *proto.UpRequest) (*proto.UpR go s.connectWithRetryRuns(ctx, s.config, s.statusRecorder, s.clientRunningChan, s.clientGiveUpChan) s.mutex.Unlock() + if msg.GetAsync() { + return &proto.UpResponse{}, nil + } return s.waitForUp(callerCtx) } diff --git a/client/ui/services/connection.go b/client/ui/services/connection.go index 84b4652ba..ada90d621 100644 --- a/client/ui/services/connection.go +++ b/client/ui/services/connection.go @@ -42,6 +42,11 @@ type WaitSSOParams struct { type UpParams struct { ProfileName string `json:"profileName"` Username string `json:"username"` + // Async instructs the daemon to start the connection and return + // immediately. Status updates flow via the SubscribeStatus stream. + // When false (the default) the RPC blocks until connected, which is + // the CLI behaviour. + Async bool `json:"async"` } // LogoutParams selects the profile the daemon should log out. @@ -147,7 +152,7 @@ func (s *Connection) Up(ctx context.Context, p UpParams) error { if err != nil { return err } - req := &proto.UpRequest{} + req := &proto.UpRequest{Async: p.Async} if p.ProfileName != "" { req.ProfileName = ptrStr(p.ProfileName) } diff --git a/client/ui/services/profileswitcher.go b/client/ui/services/profileswitcher.go index a63364ec7..12d92101f 100644 --- a/client/ui/services/profileswitcher.go +++ b/client/ui/services/profileswitcher.go @@ -37,8 +37,9 @@ func NewProfileSwitcher(profiles *Profiles, connection *Connection, peers *Peers } // SwitchActive switches to the named profile applying the reconnect policy. -// It returns after the Switch RPC completes so the caller can refresh its UI -// immediately; Down and Up run in a background goroutine. +// All RPCs complete quickly: Up uses async mode so the daemon starts the +// connection attempt and returns immediately; status updates flow via the +// SubscribeStatus stream. func (s *ProfileSwitcher) SwitchActive(ctx context.Context, p ProfileRef) error { prevStatus := "" if st, err := s.peers.Get(ctx); err == nil { @@ -61,22 +62,21 @@ func (s *ProfileSwitcher) SwitchActive(ctx context.Context, p ProfileRef) error return fmt.Errorf("switch profile %q: %w", p.ProfileName, err) } - go func() { - bgCtx := context.Background() - if needsDown { - if err := s.connection.Down(bgCtx); err != nil { - log.Errorf("profileswitcher: Down: %v", err) - } + if needsDown { + if err := s.connection.Down(ctx); err != nil { + log.Errorf("profileswitcher: Down: %v", err) } - if wasActive { - if err := s.connection.Up(bgCtx, UpParams{ - ProfileName: p.ProfileName, - Username: p.Username, - }); err != nil { - log.Errorf("profileswitcher: Up %s: %v", p.ProfileName, err) - } + } + + if wasActive { + if err := s.connection.Up(ctx, UpParams{ + ProfileName: p.ProfileName, + Username: p.Username, + Async: true, + }); err != nil { + return fmt.Errorf("reconnect %q: %w", p.ProfileName, err) } - }() + } return nil } From 67988c240747bb0bf18bcf6f713f5bb31341cafd Mon Sep 17 00:00:00 2001 From: Zoltan Papp Date: Wed, 13 May 2026 15:54:33 +0200 Subject: [PATCH 05/10] [client/ui] Make profile Switch sync, Down+Up async in ProfileSwitcher Switch RPC errors are now returned synchronously to the caller so the tray can show a toast immediately on invalid-profile or other early failures. Down and Up run in a background goroutine so the caller returns fast; Up still uses async=true so the goroutine is short-lived. --- client/ui/services/profileswitcher.go | 30 +++++++++++++++------------ 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/client/ui/services/profileswitcher.go b/client/ui/services/profileswitcher.go index 12d92101f..12bea0181 100644 --- a/client/ui/services/profileswitcher.go +++ b/client/ui/services/profileswitcher.go @@ -62,21 +62,25 @@ func (s *ProfileSwitcher) SwitchActive(ctx context.Context, p ProfileRef) error return fmt.Errorf("switch profile %q: %w", p.ProfileName, err) } - if needsDown { - if err := s.connection.Down(ctx); err != nil { - log.Errorf("profileswitcher: Down: %v", err) + // Down and Up run in a goroutine so the caller returns immediately after + // the Switch RPC. Up uses async mode so the goroutine itself is short-lived. + go func() { + bgCtx := context.Background() + if needsDown { + if err := s.connection.Down(bgCtx); err != nil { + log.Errorf("profileswitcher: Down: %v", err) + } } - } - - if wasActive { - if err := s.connection.Up(ctx, UpParams{ - ProfileName: p.ProfileName, - Username: p.Username, - Async: true, - }); err != nil { - return fmt.Errorf("reconnect %q: %w", p.ProfileName, err) + if wasActive { + if err := s.connection.Up(bgCtx, UpParams{ + ProfileName: p.ProfileName, + Username: p.Username, + Async: true, + }); err != nil { + log.Errorf("profileswitcher: Up %s: %v", p.ProfileName, err) + } } - } + }() return nil } From 2bd56ecf672540907cbf71be8b242a8034b7fc46 Mon Sep 17 00:00:00 2001 From: Zoltan Papp Date: Wed, 13 May 2026 15:55:59 +0200 Subject: [PATCH 06/10] [client/ui] Remove goroutine from ProfileSwitcher.SwitchActive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Down and Up(async=true) are both fast RPCs; no background goroutine is needed. SwitchActive is now fully synchronous — the tray wraps the call in its own goroutine, and Wails handles React calls similarly. --- client/ui/services/profileswitcher.go | 30 ++++++++++++--------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/client/ui/services/profileswitcher.go b/client/ui/services/profileswitcher.go index 12bea0181..12d92101f 100644 --- a/client/ui/services/profileswitcher.go +++ b/client/ui/services/profileswitcher.go @@ -62,25 +62,21 @@ func (s *ProfileSwitcher) SwitchActive(ctx context.Context, p ProfileRef) error return fmt.Errorf("switch profile %q: %w", p.ProfileName, err) } - // Down and Up run in a goroutine so the caller returns immediately after - // the Switch RPC. Up uses async mode so the goroutine itself is short-lived. - go func() { - bgCtx := context.Background() - if needsDown { - if err := s.connection.Down(bgCtx); err != nil { - log.Errorf("profileswitcher: Down: %v", err) - } + if needsDown { + if err := s.connection.Down(ctx); err != nil { + log.Errorf("profileswitcher: Down: %v", err) } - if wasActive { - if err := s.connection.Up(bgCtx, UpParams{ - ProfileName: p.ProfileName, - Username: p.Username, - Async: true, - }); err != nil { - log.Errorf("profileswitcher: Up %s: %v", p.ProfileName, err) - } + } + + if wasActive { + if err := s.connection.Up(ctx, UpParams{ + ProfileName: p.ProfileName, + Username: p.Username, + Async: true, + }); err != nil { + return fmt.Errorf("reconnect %q: %w", p.ProfileName, err) } - }() + } return nil } From 209f14fc2ff1946d0008496b038298a81b920008 Mon Sep 17 00:00:00 2001 From: Zoltan Papp Date: Wed, 13 May 2026 16:00:31 +0200 Subject: [PATCH 07/10] [client/ui] Cancel in-flight profile switch on rapid profile changes Store a switchCancel in Tray. Each switchProfile call cancels the previous in-flight goroutine before starting a new one. Because gRPC respects context cancellation, the previous Down/Up RPCs are aborted and rapid clicks always converge to the last selected profile. --- client/ui/tray.go | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/client/ui/tray.go b/client/ui/tray.go index 63938ba17..a861d84ec 100644 --- a/client/ui/tray.go +++ b/client/ui/tray.go @@ -132,6 +132,7 @@ type Tray struct { notificationsEnabled bool activeProfile string activeUsername string + switchCancel context.CancelFunc } func NewTray(app *application.App, window *application.WebviewWindow, svc TrayServices) *Tray { @@ -784,14 +785,19 @@ func (t *Tray) loadProfiles() { } } -// switchProfile delegates to ProfileSwitcher.SwitchActive in a goroutine so -// the menu click returns immediately. The menu is refreshed as soon as the -// Switch RPC completes (before Down/Up finishes in the background). +// switchProfile cancels any in-flight profile switch, then starts a new one. +// Cancelling the previous context aborts its in-flight gRPC calls (Down/Up) +// so rapid clicks always converge to the last selected profile. func (t *Tray) switchProfile(name string) { - go func() { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() + t.mu.Lock() + if t.switchCancel != nil { + t.switchCancel() + } + ctx, cancel := context.WithCancel(context.Background()) + t.switchCancel = cancel + t.mu.Unlock() + go func() { username, err := t.svc.Profiles.Username() if err != nil { log.Errorf("tray switchProfile: get current user: %v", err) @@ -801,13 +807,13 @@ func (t *Tray) switchProfile(name string) { ProfileName: name, Username: username, }); err != nil { + if ctx.Err() != nil { + return + } log.Errorf("tray switchProfile: %v", err) t.notifyError(fmt.Sprintf("Failed to switch to %s", name)) return } - // SwitchActive returns after the Switch RPC — active_profile.json is - // updated; Down/Up run in the background. Refresh menu now so the - // checkmark moves immediately. t.loadProfiles() }() } From eb6be5a2f37d4fc2a4eb3ab21ddd58078cd7f46e Mon Sep 17 00:00:00 2001 From: Zoltan Papp Date: Wed, 13 May 2026 16:02:24 +0200 Subject: [PATCH 08/10] [client/ui] Always use async Up in the UI service layer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The UI never needs to block on Up — status updates flow via the SubscribeStatus stream. Hardcode Async:true in Connection.Up and remove the Async field from UpParams so frontend callers are unaffected. --- .../netbird/client/ui/services/profileswitcher.js | 5 +++-- client/ui/services/connection.go | 8 ++------ client/ui/services/profileswitcher.go | 1 - 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profileswitcher.js b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profileswitcher.js index 6020c6fc2..f0d5a4004 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profileswitcher.js +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profileswitcher.js @@ -31,8 +31,9 @@ import * as $models from "./models.js"; /** * SwitchActive switches to the named profile applying the reconnect policy. - * It returns after the Switch RPC completes so the caller can refresh its UI - * immediately; Down and Up run in a background goroutine. + * All RPCs complete quickly: Up uses async mode so the daemon starts the + * connection attempt and returns immediately; status updates flow via the + * SubscribeStatus stream. * @param {$models.ProfileRef} p * @returns {$CancellablePromise} */ diff --git a/client/ui/services/connection.go b/client/ui/services/connection.go index ada90d621..97653dc33 100644 --- a/client/ui/services/connection.go +++ b/client/ui/services/connection.go @@ -42,11 +42,6 @@ type WaitSSOParams struct { type UpParams struct { ProfileName string `json:"profileName"` Username string `json:"username"` - // Async instructs the daemon to start the connection and return - // immediately. Status updates flow via the SubscribeStatus stream. - // When false (the default) the RPC blocks until connected, which is - // the CLI behaviour. - Async bool `json:"async"` } // LogoutParams selects the profile the daemon should log out. @@ -152,7 +147,8 @@ func (s *Connection) Up(ctx context.Context, p UpParams) error { if err != nil { return err } - req := &proto.UpRequest{Async: p.Async} + // The UI always uses async mode: status updates flow via SubscribeStatus. + req := &proto.UpRequest{Async: true} if p.ProfileName != "" { req.ProfileName = ptrStr(p.ProfileName) } diff --git a/client/ui/services/profileswitcher.go b/client/ui/services/profileswitcher.go index 12d92101f..855097749 100644 --- a/client/ui/services/profileswitcher.go +++ b/client/ui/services/profileswitcher.go @@ -72,7 +72,6 @@ func (s *ProfileSwitcher) SwitchActive(ctx context.Context, p ProfileRef) error if err := s.connection.Up(ctx, UpParams{ ProfileName: p.ProfileName, Username: p.Username, - Async: true, }); err != nil { return fmt.Errorf("reconnect %q: %w", p.ProfileName, err) } From df1935da6df61b69e5db080ad0e231c5a333463d Mon Sep 17 00:00:00 2001 From: Zoltan Papp Date: Wed, 13 May 2026 16:05:46 +0200 Subject: [PATCH 09/10] [client/ui] Regenerate Wails bindings after UpParams and ProfileSwitcher changes --- .../services/{connection.js => connection.ts} | 38 +- .../client/ui/services/{debug.js => debug.ts} | 26 +- .../services/{forwarding.js => forwarding.ts} | 8 +- .../client/ui/services/{index.js => index.ts} | 1 - .../netbird/client/ui/services/models.js | 1844 ----------------- .../netbird/client/ui/services/models.ts | 1194 +++++++++++ .../ui/services/{networks.js => networks.ts} | 22 +- .../client/ui/services/{peers.js => peers.ts} | 11 +- .../ui/services/{profiles.js => profiles.ts} | 41 +- ...{profileswitcher.js => profileswitcher.ts} | 5 +- .../ui/services/{settings.js => settings.ts} | 26 +- .../ui/services/{update.js => update.ts} | 22 +- .../{eventcreate.js => eventcreate.ts} | 0 .../notifications/{index.js => index.ts} | 1 - .../v3/pkg/services/notifications/models.js | 192 -- .../v3/pkg/services/notifications/models.ts | 107 + .../notifications/notificationservice.js | 101 - .../notifications/notificationservice.ts | 62 + 18 files changed, 1415 insertions(+), 2286 deletions(-) rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{connection.js => connection.ts} (63%) rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{debug.js => debug.ts} (58%) rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{forwarding.js => forwarding.ts} (81%) rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{index.js => index.ts} (98%) delete mode 100644 client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.js create mode 100644 client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.ts rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{networks.js => networks.ts} (64%) rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{peers.js => peers.ts} (85%) rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{profiles.js => profiles.ts} (57%) rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{profileswitcher.js => profileswitcher.ts} (95%) rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{settings.js => settings.ts} (59%) rename client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/{update.js => update.ts} (69%) rename client/ui/frontend/bindings/github.com/wailsapp/wails/v3/internal/{eventcreate.js => eventcreate.ts} (100%) rename client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/{index.js => index.ts} (96%) delete mode 100644 client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/models.js create mode 100644 client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/models.ts delete mode 100644 client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/notificationservice.js create mode 100644 client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/notificationservice.ts diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/connection.js b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/connection.ts similarity index 63% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/connection.js rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/connection.ts index ca48f6b94..db3e2b556 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/connection.js +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/connection.ts @@ -1,4 +1,3 @@ -// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT @@ -15,28 +14,17 @@ import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Cr // @ts-ignore: Unused imports import * as $models from "./models.js"; -/** - * @returns {$CancellablePromise} - */ -export function Down() { +export function Down(): $CancellablePromise { return $Call.ByID(70044537); } -/** - * @param {$models.LoginParams} p - * @returns {$CancellablePromise<$models.LoginResult>} - */ -export function Login(p) { - return $Call.ByID(252661358, p).then(/** @type {($result: any) => any} */(($result) => { +export function Login(p: $models.LoginParams): $CancellablePromise<$models.LoginResult> { + return $Call.ByID(252661358, p).then(($result: any) => { return $$createType0($result); - })); + }); } -/** - * @param {$models.LogoutParams} p - * @returns {$CancellablePromise} - */ -export function Logout(p) { +export function Logout(p: $models.LogoutParams): $CancellablePromise { return $Call.ByID(3824847887, p); } @@ -46,26 +34,16 @@ export function Logout(p) { * the same way as the legacy UI — WebKitGTK's window.open is blocked by the * embedded webview, and asking the user to copy/paste defeats the point of * SSO. Honors $BROWSER first, then falls back to the platform default. - * @param {string} url - * @returns {$CancellablePromise} */ -export function OpenURL(url) { +export function OpenURL(url: string): $CancellablePromise { return $Call.ByID(3786555598, url); } -/** - * @param {$models.UpParams} p - * @returns {$CancellablePromise} - */ -export function Up(p) { +export function Up(p: $models.UpParams): $CancellablePromise { return $Call.ByID(3381092588, p); } -/** - * @param {$models.WaitSSOParams} p - * @returns {$CancellablePromise} - */ -export function WaitSSOLogin(p) { +export function WaitSSOLogin(p: $models.WaitSSOParams): $CancellablePromise { return $Call.ByID(1751351500, p); } diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/debug.js b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/debug.ts similarity index 58% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/debug.js rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/debug.ts index 40b5bb910..578dd20b3 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/debug.js +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/debug.ts @@ -1,4 +1,3 @@ -// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT @@ -15,30 +14,19 @@ import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Cr // @ts-ignore: Unused imports import * as $models from "./models.js"; -/** - * @param {$models.DebugBundleParams} p - * @returns {$CancellablePromise<$models.DebugBundleResult>} - */ -export function Bundle(p) { - return $Call.ByID(617551238, p).then(/** @type {($result: any) => any} */(($result) => { +export function Bundle(p: $models.DebugBundleParams): $CancellablePromise<$models.DebugBundleResult> { + return $Call.ByID(617551238, p).then(($result: any) => { return $$createType0($result); - })); + }); } -/** - * @returns {$CancellablePromise<$models.LogLevel>} - */ -export function GetLogLevel() { - return $Call.ByID(3832950014).then(/** @type {($result: any) => any} */(($result) => { +export function GetLogLevel(): $CancellablePromise<$models.LogLevel> { + return $Call.ByID(3832950014).then(($result: any) => { return $$createType1($result); - })); + }); } -/** - * @param {$models.LogLevel} lvl - * @returns {$CancellablePromise} - */ -export function SetLogLevel(lvl) { +export function SetLogLevel(lvl: $models.LogLevel): $CancellablePromise { return $Call.ByID(4122411498, lvl); } diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/forwarding.js b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/forwarding.ts similarity index 81% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/forwarding.js rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/forwarding.ts index c0484e931..803afe6b0 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/forwarding.js +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/forwarding.ts @@ -1,4 +1,3 @@ -// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT @@ -18,12 +17,11 @@ import * as $models from "./models.js"; /** * List returns the current set of forwarding rules from the daemon's * reverse proxy. The frontend renders these as the "exposed services" list. - * @returns {$CancellablePromise<$models.ForwardingRule[]>} */ -export function List() { - return $Call.ByID(3831092172).then(/** @type {($result: any) => any} */(($result) => { +export function List(): $CancellablePromise<$models.ForwardingRule[]> { + return $Call.ByID(3831092172).then(($result: any) => { return $$createType1($result); - })); + }); } // Private type creation functions diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/index.js b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/index.ts similarity index 98% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/index.js rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/index.ts index 030b3bdd4..f604f9327 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/index.js +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/index.ts @@ -1,4 +1,3 @@ -// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.js b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.js deleted file mode 100644 index dd3ee3a03..000000000 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.js +++ /dev/null @@ -1,1844 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import { Create as $Create } from "@wailsio/runtime"; - -/** - * ActiveProfile is the result of GetActiveProfile. - */ -export class ActiveProfile { - /** - * Creates a new ActiveProfile instance. - * @param {Partial} [$$source = {}] - The source object to create the ActiveProfile. - */ - constructor($$source = {}) { - if (!("profileName" in $$source)) { - /** - * @member - * @type {string} - */ - this["profileName"] = ""; - } - if (!("username" in $$source)) { - /** - * @member - * @type {string} - */ - this["username"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new ActiveProfile instance from a string or object. - * @param {any} [$$source = {}] - * @returns {ActiveProfile} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new ActiveProfile(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * Config is the daemon configuration the UI exposes in the settings window. - * Pointer fields mark "set" vs "unset" so the UI can omit a value to keep the - * daemon's current setting (matching SetConfigRequest's optional semantics). - */ -export class Config { - /** - * Creates a new Config instance. - * @param {Partial} [$$source = {}] - The source object to create the Config. - */ - constructor($$source = {}) { - if (!("managementUrl" in $$source)) { - /** - * @member - * @type {string} - */ - this["managementUrl"] = ""; - } - if (!("adminUrl" in $$source)) { - /** - * @member - * @type {string} - */ - this["adminUrl"] = ""; - } - if (!("configFile" in $$source)) { - /** - * @member - * @type {string} - */ - this["configFile"] = ""; - } - if (!("logFile" in $$source)) { - /** - * @member - * @type {string} - */ - this["logFile"] = ""; - } - if (!("preSharedKey" in $$source)) { - /** - * @member - * @type {string} - */ - this["preSharedKey"] = ""; - } - if (!("interfaceName" in $$source)) { - /** - * @member - * @type {string} - */ - this["interfaceName"] = ""; - } - if (!("wireguardPort" in $$source)) { - /** - * @member - * @type {number} - */ - this["wireguardPort"] = 0; - } - if (!("mtu" in $$source)) { - /** - * @member - * @type {number} - */ - this["mtu"] = 0; - } - if (!("disableAutoConnect" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["disableAutoConnect"] = false; - } - if (!("serverSshAllowed" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["serverSshAllowed"] = false; - } - if (!("rosenpassEnabled" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["rosenpassEnabled"] = false; - } - if (!("rosenpassPermissive" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["rosenpassPermissive"] = false; - } - if (!("disableNotifications" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["disableNotifications"] = false; - } - if (!("lazyConnectionEnabled" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["lazyConnectionEnabled"] = false; - } - if (!("blockInbound" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["blockInbound"] = false; - } - if (!("networkMonitor" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["networkMonitor"] = false; - } - if (!("disableClientRoutes" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["disableClientRoutes"] = false; - } - if (!("disableServerRoutes" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["disableServerRoutes"] = false; - } - if (!("disableDns" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["disableDns"] = false; - } - if (!("disableIpv6" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["disableIpv6"] = false; - } - if (!("blockLanAccess" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["blockLanAccess"] = false; - } - if (!("enableSshRoot" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["enableSshRoot"] = false; - } - if (!("enableSshSftp" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["enableSshSftp"] = false; - } - if (!("enableSshLocalPortForwarding" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["enableSshLocalPortForwarding"] = false; - } - if (!("enableSshRemotePortForwarding" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["enableSshRemotePortForwarding"] = false; - } - if (!("disableSshAuth" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["disableSshAuth"] = false; - } - if (!("sshJwtCacheTtl" in $$source)) { - /** - * @member - * @type {number} - */ - this["sshJwtCacheTtl"] = 0; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Config instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Config} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Config(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * ConfigParams selects which profile/user to read or write config for. - */ -export class ConfigParams { - /** - * Creates a new ConfigParams instance. - * @param {Partial} [$$source = {}] - The source object to create the ConfigParams. - */ - constructor($$source = {}) { - if (!("profileName" in $$source)) { - /** - * @member - * @type {string} - */ - this["profileName"] = ""; - } - if (!("username" in $$source)) { - /** - * @member - * @type {string} - */ - this["username"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new ConfigParams instance from a string or object. - * @param {any} [$$source = {}] - * @returns {ConfigParams} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new ConfigParams(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * DebugBundleParams configures what the daemon collects when generating a - * debug bundle. - */ -export class DebugBundleParams { - /** - * Creates a new DebugBundleParams instance. - * @param {Partial} [$$source = {}] - The source object to create the DebugBundleParams. - */ - constructor($$source = {}) { - if (!("anonymize" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["anonymize"] = false; - } - if (!("systemInfo" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["systemInfo"] = false; - } - if (!("uploadUrl" in $$source)) { - /** - * @member - * @type {string} - */ - this["uploadUrl"] = ""; - } - if (!("logFileCount" in $$source)) { - /** - * @member - * @type {number} - */ - this["logFileCount"] = 0; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new DebugBundleParams instance from a string or object. - * @param {any} [$$source = {}] - * @returns {DebugBundleParams} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new DebugBundleParams(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * DebugBundleResult mirrors DebugBundleResponse — Path is set on local-only - * bundles, UploadedKey on successful uploads, UploadFailureReason on failed - * uploads. - */ -export class DebugBundleResult { - /** - * Creates a new DebugBundleResult instance. - * @param {Partial} [$$source = {}] - The source object to create the DebugBundleResult. - */ - constructor($$source = {}) { - if (!("path" in $$source)) { - /** - * @member - * @type {string} - */ - this["path"] = ""; - } - if (!("uploadedKey" in $$source)) { - /** - * @member - * @type {string} - */ - this["uploadedKey"] = ""; - } - if (!("uploadFailureReason" in $$source)) { - /** - * @member - * @type {string} - */ - this["uploadFailureReason"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new DebugBundleResult instance from a string or object. - * @param {any} [$$source = {}] - * @returns {DebugBundleResult} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new DebugBundleResult(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * Features reports which UI surfaces the daemon has disabled. The Fyne UI uses - * these flags to grey out menu items the operator turned off server-side. - */ -export class Features { - /** - * Creates a new Features instance. - * @param {Partial} [$$source = {}] - The source object to create the Features. - */ - constructor($$source = {}) { - if (!("disableProfiles" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["disableProfiles"] = false; - } - if (!("disableUpdateSettings" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["disableUpdateSettings"] = false; - } - if (!("disableNetworks" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["disableNetworks"] = false; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Features instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Features} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Features(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * ForwardingRule is one entry from the daemon's reverse-proxy table — - * what we ship to the frontend's "exposed services" view. - */ -export class ForwardingRule { - /** - * Creates a new ForwardingRule instance. - * @param {Partial} [$$source = {}] - The source object to create the ForwardingRule. - */ - constructor($$source = {}) { - if (!("protocol" in $$source)) { - /** - * @member - * @type {string} - */ - this["protocol"] = ""; - } - if (!("destinationPort" in $$source)) { - /** - * @member - * @type {PortInfo} - */ - this["destinationPort"] = (new PortInfo()); - } - if (!("translatedAddress" in $$source)) { - /** - * @member - * @type {string} - */ - this["translatedAddress"] = ""; - } - if (!("translatedHostname" in $$source)) { - /** - * @member - * @type {string} - */ - this["translatedHostname"] = ""; - } - if (!("translatedPort" in $$source)) { - /** - * @member - * @type {PortInfo} - */ - this["translatedPort"] = (new PortInfo()); - } - - Object.assign(this, $$source); - } - - /** - * Creates a new ForwardingRule instance from a string or object. - * @param {any} [$$source = {}] - * @returns {ForwardingRule} - */ - static createFrom($$source = {}) { - const $$createField1_0 = $$createType0; - const $$createField4_0 = $$createType0; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("destinationPort" in $$parsedSource) { - $$parsedSource["destinationPort"] = $$createField1_0($$parsedSource["destinationPort"]); - } - if ("translatedPort" in $$parsedSource) { - $$parsedSource["translatedPort"] = $$createField4_0($$parsedSource["translatedPort"]); - } - return new ForwardingRule(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * LocalPeer mirrors LocalPeerState — what this client looks like on the mesh. - */ -export class LocalPeer { - /** - * Creates a new LocalPeer instance. - * @param {Partial} [$$source = {}] - The source object to create the LocalPeer. - */ - constructor($$source = {}) { - if (!("ip" in $$source)) { - /** - * @member - * @type {string} - */ - this["ip"] = ""; - } - if (!("pubKey" in $$source)) { - /** - * @member - * @type {string} - */ - this["pubKey"] = ""; - } - if (!("fqdn" in $$source)) { - /** - * @member - * @type {string} - */ - this["fqdn"] = ""; - } - if (!("networks" in $$source)) { - /** - * @member - * @type {string[]} - */ - this["networks"] = []; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new LocalPeer instance from a string or object. - * @param {any} [$$source = {}] - * @returns {LocalPeer} - */ - static createFrom($$source = {}) { - const $$createField3_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("networks" in $$parsedSource) { - $$parsedSource["networks"] = $$createField3_0($$parsedSource["networks"]); - } - return new LocalPeer(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * LogLevel is a single log-level value the daemon understands ("error", - * "warn", "info", "debug", "trace"). - */ -export class LogLevel { - /** - * Creates a new LogLevel instance. - * @param {Partial} [$$source = {}] - The source object to create the LogLevel. - */ - constructor($$source = {}) { - if (!("level" in $$source)) { - /** - * @member - * @type {string} - */ - this["level"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new LogLevel instance from a string or object. - * @param {any} [$$source = {}] - * @returns {LogLevel} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new LogLevel(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * LoginParams carries the fields the UI sets when starting a login. - */ -export class LoginParams { - /** - * Creates a new LoginParams instance. - * @param {Partial} [$$source = {}] - The source object to create the LoginParams. - */ - constructor($$source = {}) { - if (!("profileName" in $$source)) { - /** - * @member - * @type {string} - */ - this["profileName"] = ""; - } - if (!("username" in $$source)) { - /** - * @member - * @type {string} - */ - this["username"] = ""; - } - if (!("managementUrl" in $$source)) { - /** - * @member - * @type {string} - */ - this["managementUrl"] = ""; - } - if (!("setupKey" in $$source)) { - /** - * @member - * @type {string} - */ - this["setupKey"] = ""; - } - if (!("preSharedKey" in $$source)) { - /** - * @member - * @type {string} - */ - this["preSharedKey"] = ""; - } - if (!("hostname" in $$source)) { - /** - * @member - * @type {string} - */ - this["hostname"] = ""; - } - if (!("hint" in $$source)) { - /** - * @member - * @type {string} - */ - this["hint"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new LoginParams instance from a string or object. - * @param {any} [$$source = {}] - * @returns {LoginParams} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new LoginParams(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * LoginResult is the daemon's reply to a Login call. - */ -export class LoginResult { - /** - * Creates a new LoginResult instance. - * @param {Partial} [$$source = {}] - The source object to create the LoginResult. - */ - constructor($$source = {}) { - if (!("needsSsoLogin" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["needsSsoLogin"] = false; - } - if (!("userCode" in $$source)) { - /** - * @member - * @type {string} - */ - this["userCode"] = ""; - } - if (!("verificationUri" in $$source)) { - /** - * @member - * @type {string} - */ - this["verificationUri"] = ""; - } - if (!("verificationUriComplete" in $$source)) { - /** - * @member - * @type {string} - */ - this["verificationUriComplete"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new LoginResult instance from a string or object. - * @param {any} [$$source = {}] - * @returns {LoginResult} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new LoginResult(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * LogoutParams selects the profile the daemon should log out. - */ -export class LogoutParams { - /** - * Creates a new LogoutParams instance. - * @param {Partial} [$$source = {}] - The source object to create the LogoutParams. - */ - constructor($$source = {}) { - if (!("profileName" in $$source)) { - /** - * @member - * @type {string} - */ - this["profileName"] = ""; - } - if (!("username" in $$source)) { - /** - * @member - * @type {string} - */ - this["username"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new LogoutParams instance from a string or object. - * @param {any} [$$source = {}] - * @returns {LogoutParams} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new LogoutParams(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * Network is one routed network the daemon offers to the client. - */ -export class Network { - /** - * Creates a new Network instance. - * @param {Partial} [$$source = {}] - The source object to create the Network. - */ - constructor($$source = {}) { - if (!("id" in $$source)) { - /** - * @member - * @type {string} - */ - this["id"] = ""; - } - if (!("range" in $$source)) { - /** - * @member - * @type {string} - */ - this["range"] = ""; - } - if (!("selected" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["selected"] = false; - } - if (!("domains" in $$source)) { - /** - * @member - * @type {string[]} - */ - this["domains"] = []; - } - if (!("resolvedIps" in $$source)) { - /** - * @member - * @type {{ [_ in string]?: string[] }} - */ - this["resolvedIps"] = {}; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Network instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Network} - */ - static createFrom($$source = {}) { - const $$createField3_0 = $$createType1; - const $$createField4_0 = $$createType2; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("domains" in $$parsedSource) { - $$parsedSource["domains"] = $$createField3_0($$parsedSource["domains"]); - } - if ("resolvedIps" in $$parsedSource) { - $$parsedSource["resolvedIps"] = $$createField4_0($$parsedSource["resolvedIps"]); - } - return new Network(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * PeerLink is one of the named connections between this peer and its mgmt - * or signal server. - */ -export class PeerLink { - /** - * Creates a new PeerLink instance. - * @param {Partial} [$$source = {}] - The source object to create the PeerLink. - */ - constructor($$source = {}) { - if (!("url" in $$source)) { - /** - * @member - * @type {string} - */ - this["url"] = ""; - } - if (!("connected" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["connected"] = false; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {string | undefined} - */ - this["error"] = undefined; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new PeerLink instance from a string or object. - * @param {any} [$$source = {}] - * @returns {PeerLink} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new PeerLink(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * PeerStatus is the frontend-facing shape of a daemon PeerState. Carries - * enough detail for the dashboard's compact peer row plus the on-click - * troubleshooting expansion (ICE candidate types, endpoints, handshake age). - */ -export class PeerStatus { - /** - * Creates a new PeerStatus instance. - * @param {Partial} [$$source = {}] - The source object to create the PeerStatus. - */ - constructor($$source = {}) { - if (!("ip" in $$source)) { - /** - * @member - * @type {string} - */ - this["ip"] = ""; - } - if (!("pubKey" in $$source)) { - /** - * @member - * @type {string} - */ - this["pubKey"] = ""; - } - if (!("connStatus" in $$source)) { - /** - * @member - * @type {string} - */ - this["connStatus"] = ""; - } - if (!("connStatusUpdateUnix" in $$source)) { - /** - * @member - * @type {number} - */ - this["connStatusUpdateUnix"] = 0; - } - if (!("relayed" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["relayed"] = false; - } - if (!("localIceCandidateType" in $$source)) { - /** - * @member - * @type {string} - */ - this["localIceCandidateType"] = ""; - } - if (!("remoteIceCandidateType" in $$source)) { - /** - * @member - * @type {string} - */ - this["remoteIceCandidateType"] = ""; - } - if (!("localIceCandidateEndpoint" in $$source)) { - /** - * @member - * @type {string} - */ - this["localIceCandidateEndpoint"] = ""; - } - if (!("remoteIceCandidateEndpoint" in $$source)) { - /** - * @member - * @type {string} - */ - this["remoteIceCandidateEndpoint"] = ""; - } - if (!("fqdn" in $$source)) { - /** - * @member - * @type {string} - */ - this["fqdn"] = ""; - } - if (!("bytesRx" in $$source)) { - /** - * @member - * @type {number} - */ - this["bytesRx"] = 0; - } - if (!("bytesTx" in $$source)) { - /** - * @member - * @type {number} - */ - this["bytesTx"] = 0; - } - if (!("latencyMs" in $$source)) { - /** - * @member - * @type {number} - */ - this["latencyMs"] = 0; - } - if (!("relayAddress" in $$source)) { - /** - * @member - * @type {string} - */ - this["relayAddress"] = ""; - } - if (!("lastHandshakeUnix" in $$source)) { - /** - * @member - * @type {number} - */ - this["lastHandshakeUnix"] = 0; - } - if (!("rosenpassEnabled" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["rosenpassEnabled"] = false; - } - if (!("networks" in $$source)) { - /** - * @member - * @type {string[]} - */ - this["networks"] = []; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new PeerStatus instance from a string or object. - * @param {any} [$$source = {}] - * @returns {PeerStatus} - */ - static createFrom($$source = {}) { - const $$createField16_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("networks" in $$parsedSource) { - $$parsedSource["networks"] = $$createField16_0($$parsedSource["networks"]); - } - return new PeerStatus(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * PortInfo carries the destination or translated port for a forwarding rule. - * Exactly one of Port or Range is populated, mirroring the daemon's oneof. - */ -export class PortInfo { - /** - * Creates a new PortInfo instance. - * @param {Partial} [$$source = {}] - The source object to create the PortInfo. - */ - constructor($$source = {}) { - if (/** @type {any} */(false)) { - /** - * @member - * @type {number | null | undefined} - */ - this["port"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {PortRange | null | undefined} - */ - this["range"] = undefined; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new PortInfo instance from a string or object. - * @param {any} [$$source = {}] - * @returns {PortInfo} - */ - static createFrom($$source = {}) { - const $$createField1_0 = $$createType4; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("range" in $$parsedSource) { - $$parsedSource["range"] = $$createField1_0($$parsedSource["range"]); - } - return new PortInfo(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * PortRange describes a contiguous port range. Both ends are inclusive. - */ -export class PortRange { - /** - * Creates a new PortRange instance. - * @param {Partial} [$$source = {}] - The source object to create the PortRange. - */ - constructor($$source = {}) { - if (!("start" in $$source)) { - /** - * @member - * @type {number} - */ - this["start"] = 0; - } - if (!("end" in $$source)) { - /** - * @member - * @type {number} - */ - this["end"] = 0; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new PortRange instance from a string or object. - * @param {any} [$$source = {}] - * @returns {PortRange} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new PortRange(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * Profile is one named daemon profile. - */ -export class Profile { - /** - * Creates a new Profile instance. - * @param {Partial} [$$source = {}] - The source object to create the Profile. - */ - constructor($$source = {}) { - if (!("name" in $$source)) { - /** - * @member - * @type {string} - */ - this["name"] = ""; - } - if (!("isActive" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["isActive"] = false; - } - if (!("email" in $$source)) { - /** - * Email is the account address associated with this profile, sourced from - * the per-profile state file written by the CLI after a successful SSO - * login (e.g. ~/Library/Application Support/netbird/default.state.json on - * macOS). The daemon always runs as root, so its getConfigDir() resolves to - * the root home directory and cannot reach the user-owned state file. The - * UI process runs as the logged-in user and can read it directly via - * profilemanager.ProfileManager, which is why the email is fetched here - * instead of being returned by the ListProfiles RPC. - * @member - * @type {string} - */ - this["email"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Profile instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Profile} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new Profile(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * ProfileRef identifies a profile by name+username. - */ -export class ProfileRef { - /** - * Creates a new ProfileRef instance. - * @param {Partial} [$$source = {}] - The source object to create the ProfileRef. - */ - constructor($$source = {}) { - if (!("profileName" in $$source)) { - /** - * @member - * @type {string} - */ - this["profileName"] = ""; - } - if (!("username" in $$source)) { - /** - * @member - * @type {string} - */ - this["username"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new ProfileRef instance from a string or object. - * @param {any} [$$source = {}] - * @returns {ProfileRef} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new ProfileRef(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * SelectNetworksParams selects which networks to enable / disable. - * All means "every available network" (used by Select-All / Deselect-All buttons); - * Append means "leave the existing selection in place and merge these IDs in". - */ -export class SelectNetworksParams { - /** - * Creates a new SelectNetworksParams instance. - * @param {Partial} [$$source = {}] - The source object to create the SelectNetworksParams. - */ - constructor($$source = {}) { - if (!("networkIds" in $$source)) { - /** - * @member - * @type {string[]} - */ - this["networkIds"] = []; - } - if (!("append" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["append"] = false; - } - if (!("all" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["all"] = false; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new SelectNetworksParams instance from a string or object. - * @param {any} [$$source = {}] - * @returns {SelectNetworksParams} - */ - static createFrom($$source = {}) { - const $$createField0_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("networkIds" in $$parsedSource) { - $$parsedSource["networkIds"] = $$createField0_0($$parsedSource["networkIds"]); - } - return new SelectNetworksParams(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * SetConfigParams is a partial update — only fields with non-nil pointers - * are sent to the daemon. The frontend uses this to flip individual toggles. - */ -export class SetConfigParams { - /** - * Creates a new SetConfigParams instance. - * @param {Partial} [$$source = {}] - The source object to create the SetConfigParams. - */ - constructor($$source = {}) { - if (!("profileName" in $$source)) { - /** - * @member - * @type {string} - */ - this["profileName"] = ""; - } - if (!("username" in $$source)) { - /** - * @member - * @type {string} - */ - this["username"] = ""; - } - if (!("managementUrl" in $$source)) { - /** - * @member - * @type {string} - */ - this["managementUrl"] = ""; - } - if (!("adminUrl" in $$source)) { - /** - * @member - * @type {string} - */ - this["adminUrl"] = ""; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {string | null | undefined} - */ - this["interfaceName"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {number | null | undefined} - */ - this["wireguardPort"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {number | null | undefined} - */ - this["mtu"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {string | null | undefined} - */ - this["preSharedKey"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["disableAutoConnect"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["serverSshAllowed"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["rosenpassEnabled"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["rosenpassPermissive"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["disableNotifications"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["lazyConnectionEnabled"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["blockInbound"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["networkMonitor"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["disableClientRoutes"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["disableServerRoutes"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["disableDns"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["disableIpv6"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["disableFirewall"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["blockLanAccess"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["enableSshRoot"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["enableSshSftp"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["enableSshLocalPortForwarding"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["enableSshRemotePortForwarding"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | null | undefined} - */ - this["disableSshAuth"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {number | null | undefined} - */ - this["sshJwtCacheTtl"] = undefined; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new SetConfigParams instance from a string or object. - * @param {any} [$$source = {}] - * @returns {SetConfigParams} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new SetConfigParams(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * Status is the snapshot the frontend renders on the dashboard. - */ -export class Status { - /** - * Creates a new Status instance. - * @param {Partial} [$$source = {}] - The source object to create the Status. - */ - constructor($$source = {}) { - if (!("status" in $$source)) { - /** - * @member - * @type {string} - */ - this["status"] = ""; - } - if (!("daemonVersion" in $$source)) { - /** - * @member - * @type {string} - */ - this["daemonVersion"] = ""; - } - if (!("management" in $$source)) { - /** - * @member - * @type {PeerLink} - */ - this["management"] = (new PeerLink()); - } - if (!("signal" in $$source)) { - /** - * @member - * @type {PeerLink} - */ - this["signal"] = (new PeerLink()); - } - if (!("local" in $$source)) { - /** - * @member - * @type {LocalPeer} - */ - this["local"] = (new LocalPeer()); - } - if (!("peers" in $$source)) { - /** - * @member - * @type {PeerStatus[]} - */ - this["peers"] = []; - } - if (!("events" in $$source)) { - /** - * @member - * @type {SystemEvent[]} - */ - this["events"] = []; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new Status instance from a string or object. - * @param {any} [$$source = {}] - * @returns {Status} - */ - static createFrom($$source = {}) { - const $$createField2_0 = $$createType5; - const $$createField3_0 = $$createType5; - const $$createField4_0 = $$createType6; - const $$createField5_0 = $$createType8; - const $$createField6_0 = $$createType10; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("management" in $$parsedSource) { - $$parsedSource["management"] = $$createField2_0($$parsedSource["management"]); - } - if ("signal" in $$parsedSource) { - $$parsedSource["signal"] = $$createField3_0($$parsedSource["signal"]); - } - if ("local" in $$parsedSource) { - $$parsedSource["local"] = $$createField4_0($$parsedSource["local"]); - } - if ("peers" in $$parsedSource) { - $$parsedSource["peers"] = $$createField5_0($$parsedSource["peers"]); - } - if ("events" in $$parsedSource) { - $$parsedSource["events"] = $$createField6_0($$parsedSource["events"]); - } - return new Status(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * SystemEvent is the frontend-facing shape of a daemon SystemEvent. - */ -export class SystemEvent { - /** - * Creates a new SystemEvent instance. - * @param {Partial} [$$source = {}] - The source object to create the SystemEvent. - */ - constructor($$source = {}) { - if (!("id" in $$source)) { - /** - * @member - * @type {string} - */ - this["id"] = ""; - } - if (!("severity" in $$source)) { - /** - * @member - * @type {string} - */ - this["severity"] = ""; - } - if (!("category" in $$source)) { - /** - * @member - * @type {string} - */ - this["category"] = ""; - } - if (!("message" in $$source)) { - /** - * @member - * @type {string} - */ - this["message"] = ""; - } - if (!("userMessage" in $$source)) { - /** - * @member - * @type {string} - */ - this["userMessage"] = ""; - } - if (!("timestamp" in $$source)) { - /** - * @member - * @type {number} - */ - this["timestamp"] = 0; - } - if (!("metadata" in $$source)) { - /** - * @member - * @type {{ [_ in string]?: string }} - */ - this["metadata"] = {}; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new SystemEvent instance from a string or object. - * @param {any} [$$source = {}] - * @returns {SystemEvent} - */ - static createFrom($$source = {}) { - const $$createField6_0 = $$createType11; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("metadata" in $$parsedSource) { - $$parsedSource["metadata"] = $$createField6_0($$parsedSource["metadata"]); - } - return new SystemEvent(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * UpParams selects the profile the daemon should bring up. - */ -export class UpParams { - /** - * Creates a new UpParams instance. - * @param {Partial} [$$source = {}] - The source object to create the UpParams. - */ - constructor($$source = {}) { - if (!("profileName" in $$source)) { - /** - * @member - * @type {string} - */ - this["profileName"] = ""; - } - if (!("username" in $$source)) { - /** - * @member - * @type {string} - */ - this["username"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new UpParams instance from a string or object. - * @param {any} [$$source = {}] - * @returns {UpParams} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new UpParams(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * UpdateAvailable carries the new_version_available metadata. - */ -export class UpdateAvailable { - /** - * Creates a new UpdateAvailable instance. - * @param {Partial} [$$source = {}] - The source object to create the UpdateAvailable. - */ - constructor($$source = {}) { - if (!("version" in $$source)) { - /** - * @member - * @type {string} - */ - this["version"] = ""; - } - if (!("enforced" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["enforced"] = false; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new UpdateAvailable instance from a string or object. - * @param {any} [$$source = {}] - * @returns {UpdateAvailable} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new UpdateAvailable(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * UpdateProgress carries the progress_window metadata. - */ -export class UpdateProgress { - /** - * Creates a new UpdateProgress instance. - * @param {Partial} [$$source = {}] - The source object to create the UpdateProgress. - */ - constructor($$source = {}) { - if (!("action" in $$source)) { - /** - * @member - * @type {string} - */ - this["action"] = ""; - } - if (!("version" in $$source)) { - /** - * @member - * @type {string} - */ - this["version"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new UpdateProgress instance from a string or object. - * @param {any} [$$source = {}] - * @returns {UpdateProgress} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new UpdateProgress(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * UpdateResult mirrors TriggerUpdateResponse: Success false carries an error - * message in ErrorMsg. - */ -export class UpdateResult { - /** - * Creates a new UpdateResult instance. - * @param {Partial} [$$source = {}] - The source object to create the UpdateResult. - */ - constructor($$source = {}) { - if (!("success" in $$source)) { - /** - * @member - * @type {boolean} - */ - this["success"] = false; - } - if (!("errorMsg" in $$source)) { - /** - * @member - * @type {string} - */ - this["errorMsg"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new UpdateResult instance from a string or object. - * @param {any} [$$source = {}] - * @returns {UpdateResult} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new UpdateResult(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * WaitSSOParams carries the fields the UI passes to WaitSSOLogin. - */ -export class WaitSSOParams { - /** - * Creates a new WaitSSOParams instance. - * @param {Partial} [$$source = {}] - The source object to create the WaitSSOParams. - */ - constructor($$source = {}) { - if (!("userCode" in $$source)) { - /** - * @member - * @type {string} - */ - this["userCode"] = ""; - } - if (!("hostname" in $$source)) { - /** - * @member - * @type {string} - */ - this["hostname"] = ""; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new WaitSSOParams instance from a string or object. - * @param {any} [$$source = {}] - * @returns {WaitSSOParams} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new WaitSSOParams(/** @type {Partial} */($$parsedSource)); - } -} - -// Private type creation functions -const $$createType0 = PortInfo.createFrom; -const $$createType1 = $Create.Array($Create.Any); -const $$createType2 = $Create.Map($Create.Any, $$createType1); -const $$createType3 = PortRange.createFrom; -const $$createType4 = $Create.Nullable($$createType3); -const $$createType5 = PeerLink.createFrom; -const $$createType6 = LocalPeer.createFrom; -const $$createType7 = PeerStatus.createFrom; -const $$createType8 = $Create.Array($$createType7); -const $$createType9 = SystemEvent.createFrom; -const $$createType10 = $Create.Array($$createType9); -const $$createType11 = $Create.Map($Create.Any, $Create.Any); diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.ts b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.ts new file mode 100644 index 000000000..d561338bf --- /dev/null +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/models.ts @@ -0,0 +1,1194 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import { Create as $Create } from "@wailsio/runtime"; + +/** + * ActiveProfile is the result of GetActiveProfile. + */ +export class ActiveProfile { + "profileName": string; + "username": string; + + /** Creates a new ActiveProfile instance. */ + constructor($$source: Partial = {}) { + if (!("profileName" in $$source)) { + this["profileName"] = ""; + } + if (!("username" in $$source)) { + this["username"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new ActiveProfile instance from a string or object. + */ + static createFrom($$source: any = {}): ActiveProfile { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new ActiveProfile($$parsedSource as Partial); + } +} + +/** + * Config is the daemon configuration the UI exposes in the settings window. + * Pointer fields mark "set" vs "unset" so the UI can omit a value to keep the + * daemon's current setting (matching SetConfigRequest's optional semantics). + */ +export class Config { + "managementUrl": string; + "adminUrl": string; + "configFile": string; + "logFile": string; + "preSharedKey": string; + "interfaceName": string; + "wireguardPort": number; + "mtu": number; + "disableAutoConnect": boolean; + "serverSshAllowed": boolean; + "rosenpassEnabled": boolean; + "rosenpassPermissive": boolean; + "disableNotifications": boolean; + "lazyConnectionEnabled": boolean; + "blockInbound": boolean; + "networkMonitor": boolean; + "disableClientRoutes": boolean; + "disableServerRoutes": boolean; + "disableDns": boolean; + "disableIpv6": boolean; + "blockLanAccess": boolean; + "enableSshRoot": boolean; + "enableSshSftp": boolean; + "enableSshLocalPortForwarding": boolean; + "enableSshRemotePortForwarding": boolean; + "disableSshAuth": boolean; + "sshJwtCacheTtl": number; + + /** Creates a new Config instance. */ + constructor($$source: Partial = {}) { + if (!("managementUrl" in $$source)) { + this["managementUrl"] = ""; + } + if (!("adminUrl" in $$source)) { + this["adminUrl"] = ""; + } + if (!("configFile" in $$source)) { + this["configFile"] = ""; + } + if (!("logFile" in $$source)) { + this["logFile"] = ""; + } + if (!("preSharedKey" in $$source)) { + this["preSharedKey"] = ""; + } + if (!("interfaceName" in $$source)) { + this["interfaceName"] = ""; + } + if (!("wireguardPort" in $$source)) { + this["wireguardPort"] = 0; + } + if (!("mtu" in $$source)) { + this["mtu"] = 0; + } + if (!("disableAutoConnect" in $$source)) { + this["disableAutoConnect"] = false; + } + if (!("serverSshAllowed" in $$source)) { + this["serverSshAllowed"] = false; + } + if (!("rosenpassEnabled" in $$source)) { + this["rosenpassEnabled"] = false; + } + if (!("rosenpassPermissive" in $$source)) { + this["rosenpassPermissive"] = false; + } + if (!("disableNotifications" in $$source)) { + this["disableNotifications"] = false; + } + if (!("lazyConnectionEnabled" in $$source)) { + this["lazyConnectionEnabled"] = false; + } + if (!("blockInbound" in $$source)) { + this["blockInbound"] = false; + } + if (!("networkMonitor" in $$source)) { + this["networkMonitor"] = false; + } + if (!("disableClientRoutes" in $$source)) { + this["disableClientRoutes"] = false; + } + if (!("disableServerRoutes" in $$source)) { + this["disableServerRoutes"] = false; + } + if (!("disableDns" in $$source)) { + this["disableDns"] = false; + } + if (!("disableIpv6" in $$source)) { + this["disableIpv6"] = false; + } + if (!("blockLanAccess" in $$source)) { + this["blockLanAccess"] = false; + } + if (!("enableSshRoot" in $$source)) { + this["enableSshRoot"] = false; + } + if (!("enableSshSftp" in $$source)) { + this["enableSshSftp"] = false; + } + if (!("enableSshLocalPortForwarding" in $$source)) { + this["enableSshLocalPortForwarding"] = false; + } + if (!("enableSshRemotePortForwarding" in $$source)) { + this["enableSshRemotePortForwarding"] = false; + } + if (!("disableSshAuth" in $$source)) { + this["disableSshAuth"] = false; + } + if (!("sshJwtCacheTtl" in $$source)) { + this["sshJwtCacheTtl"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Config instance from a string or object. + */ + static createFrom($$source: any = {}): Config { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Config($$parsedSource as Partial); + } +} + +/** + * ConfigParams selects which profile/user to read or write config for. + */ +export class ConfigParams { + "profileName": string; + "username": string; + + /** Creates a new ConfigParams instance. */ + constructor($$source: Partial = {}) { + if (!("profileName" in $$source)) { + this["profileName"] = ""; + } + if (!("username" in $$source)) { + this["username"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new ConfigParams instance from a string or object. + */ + static createFrom($$source: any = {}): ConfigParams { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new ConfigParams($$parsedSource as Partial); + } +} + +/** + * DebugBundleParams configures what the daemon collects when generating a + * debug bundle. + */ +export class DebugBundleParams { + "anonymize": boolean; + "systemInfo": boolean; + "uploadUrl": string; + "logFileCount": number; + + /** Creates a new DebugBundleParams instance. */ + constructor($$source: Partial = {}) { + if (!("anonymize" in $$source)) { + this["anonymize"] = false; + } + if (!("systemInfo" in $$source)) { + this["systemInfo"] = false; + } + if (!("uploadUrl" in $$source)) { + this["uploadUrl"] = ""; + } + if (!("logFileCount" in $$source)) { + this["logFileCount"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new DebugBundleParams instance from a string or object. + */ + static createFrom($$source: any = {}): DebugBundleParams { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new DebugBundleParams($$parsedSource as Partial); + } +} + +/** + * DebugBundleResult mirrors DebugBundleResponse — Path is set on local-only + * bundles, UploadedKey on successful uploads, UploadFailureReason on failed + * uploads. + */ +export class DebugBundleResult { + "path": string; + "uploadedKey": string; + "uploadFailureReason": string; + + /** Creates a new DebugBundleResult instance. */ + constructor($$source: Partial = {}) { + if (!("path" in $$source)) { + this["path"] = ""; + } + if (!("uploadedKey" in $$source)) { + this["uploadedKey"] = ""; + } + if (!("uploadFailureReason" in $$source)) { + this["uploadFailureReason"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new DebugBundleResult instance from a string or object. + */ + static createFrom($$source: any = {}): DebugBundleResult { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new DebugBundleResult($$parsedSource as Partial); + } +} + +/** + * Features reports which UI surfaces the daemon has disabled. The Fyne UI uses + * these flags to grey out menu items the operator turned off server-side. + */ +export class Features { + "disableProfiles": boolean; + "disableUpdateSettings": boolean; + "disableNetworks": boolean; + + /** Creates a new Features instance. */ + constructor($$source: Partial = {}) { + if (!("disableProfiles" in $$source)) { + this["disableProfiles"] = false; + } + if (!("disableUpdateSettings" in $$source)) { + this["disableUpdateSettings"] = false; + } + if (!("disableNetworks" in $$source)) { + this["disableNetworks"] = false; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Features instance from a string or object. + */ + static createFrom($$source: any = {}): Features { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Features($$parsedSource as Partial); + } +} + +/** + * ForwardingRule is one entry from the daemon's reverse-proxy table — + * what we ship to the frontend's "exposed services" view. + */ +export class ForwardingRule { + "protocol": string; + "destinationPort": PortInfo; + "translatedAddress": string; + "translatedHostname": string; + "translatedPort": PortInfo; + + /** Creates a new ForwardingRule instance. */ + constructor($$source: Partial = {}) { + if (!("protocol" in $$source)) { + this["protocol"] = ""; + } + if (!("destinationPort" in $$source)) { + this["destinationPort"] = (new PortInfo()); + } + if (!("translatedAddress" in $$source)) { + this["translatedAddress"] = ""; + } + if (!("translatedHostname" in $$source)) { + this["translatedHostname"] = ""; + } + if (!("translatedPort" in $$source)) { + this["translatedPort"] = (new PortInfo()); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new ForwardingRule instance from a string or object. + */ + static createFrom($$source: any = {}): ForwardingRule { + const $$createField1_0 = $$createType0; + const $$createField4_0 = $$createType0; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("destinationPort" in $$parsedSource) { + $$parsedSource["destinationPort"] = $$createField1_0($$parsedSource["destinationPort"]); + } + if ("translatedPort" in $$parsedSource) { + $$parsedSource["translatedPort"] = $$createField4_0($$parsedSource["translatedPort"]); + } + return new ForwardingRule($$parsedSource as Partial); + } +} + +/** + * LocalPeer mirrors LocalPeerState — what this client looks like on the mesh. + */ +export class LocalPeer { + "ip": string; + "pubKey": string; + "fqdn": string; + "networks": string[]; + + /** Creates a new LocalPeer instance. */ + constructor($$source: Partial = {}) { + if (!("ip" in $$source)) { + this["ip"] = ""; + } + if (!("pubKey" in $$source)) { + this["pubKey"] = ""; + } + if (!("fqdn" in $$source)) { + this["fqdn"] = ""; + } + if (!("networks" in $$source)) { + this["networks"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new LocalPeer instance from a string or object. + */ + static createFrom($$source: any = {}): LocalPeer { + const $$createField3_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("networks" in $$parsedSource) { + $$parsedSource["networks"] = $$createField3_0($$parsedSource["networks"]); + } + return new LocalPeer($$parsedSource as Partial); + } +} + +/** + * LogLevel is a single log-level value the daemon understands ("error", + * "warn", "info", "debug", "trace"). + */ +export class LogLevel { + "level": string; + + /** Creates a new LogLevel instance. */ + constructor($$source: Partial = {}) { + if (!("level" in $$source)) { + this["level"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new LogLevel instance from a string or object. + */ + static createFrom($$source: any = {}): LogLevel { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new LogLevel($$parsedSource as Partial); + } +} + +/** + * LoginParams carries the fields the UI sets when starting a login. + */ +export class LoginParams { + "profileName": string; + "username": string; + "managementUrl": string; + "setupKey": string; + "preSharedKey": string; + "hostname": string; + "hint": string; + + /** Creates a new LoginParams instance. */ + constructor($$source: Partial = {}) { + if (!("profileName" in $$source)) { + this["profileName"] = ""; + } + if (!("username" in $$source)) { + this["username"] = ""; + } + if (!("managementUrl" in $$source)) { + this["managementUrl"] = ""; + } + if (!("setupKey" in $$source)) { + this["setupKey"] = ""; + } + if (!("preSharedKey" in $$source)) { + this["preSharedKey"] = ""; + } + if (!("hostname" in $$source)) { + this["hostname"] = ""; + } + if (!("hint" in $$source)) { + this["hint"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new LoginParams instance from a string or object. + */ + static createFrom($$source: any = {}): LoginParams { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new LoginParams($$parsedSource as Partial); + } +} + +/** + * LoginResult is the daemon's reply to a Login call. + */ +export class LoginResult { + "needsSsoLogin": boolean; + "userCode": string; + "verificationUri": string; + "verificationUriComplete": string; + + /** Creates a new LoginResult instance. */ + constructor($$source: Partial = {}) { + if (!("needsSsoLogin" in $$source)) { + this["needsSsoLogin"] = false; + } + if (!("userCode" in $$source)) { + this["userCode"] = ""; + } + if (!("verificationUri" in $$source)) { + this["verificationUri"] = ""; + } + if (!("verificationUriComplete" in $$source)) { + this["verificationUriComplete"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new LoginResult instance from a string or object. + */ + static createFrom($$source: any = {}): LoginResult { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new LoginResult($$parsedSource as Partial); + } +} + +/** + * LogoutParams selects the profile the daemon should log out. + */ +export class LogoutParams { + "profileName": string; + "username": string; + + /** Creates a new LogoutParams instance. */ + constructor($$source: Partial = {}) { + if (!("profileName" in $$source)) { + this["profileName"] = ""; + } + if (!("username" in $$source)) { + this["username"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new LogoutParams instance from a string or object. + */ + static createFrom($$source: any = {}): LogoutParams { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new LogoutParams($$parsedSource as Partial); + } +} + +/** + * Network is one routed network the daemon offers to the client. + */ +export class Network { + "id": string; + "range": string; + "selected": boolean; + "domains": string[]; + "resolvedIps": { [_ in string]?: string[] }; + + /** Creates a new Network instance. */ + constructor($$source: Partial = {}) { + if (!("id" in $$source)) { + this["id"] = ""; + } + if (!("range" in $$source)) { + this["range"] = ""; + } + if (!("selected" in $$source)) { + this["selected"] = false; + } + if (!("domains" in $$source)) { + this["domains"] = []; + } + if (!("resolvedIps" in $$source)) { + this["resolvedIps"] = {}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Network instance from a string or object. + */ + static createFrom($$source: any = {}): Network { + const $$createField3_0 = $$createType1; + const $$createField4_0 = $$createType2; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("domains" in $$parsedSource) { + $$parsedSource["domains"] = $$createField3_0($$parsedSource["domains"]); + } + if ("resolvedIps" in $$parsedSource) { + $$parsedSource["resolvedIps"] = $$createField4_0($$parsedSource["resolvedIps"]); + } + return new Network($$parsedSource as Partial); + } +} + +/** + * PeerLink is one of the named connections between this peer and its mgmt + * or signal server. + */ +export class PeerLink { + "url": string; + "connected": boolean; + "error"?: string; + + /** Creates a new PeerLink instance. */ + constructor($$source: Partial = {}) { + if (!("url" in $$source)) { + this["url"] = ""; + } + if (!("connected" in $$source)) { + this["connected"] = false; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new PeerLink instance from a string or object. + */ + static createFrom($$source: any = {}): PeerLink { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new PeerLink($$parsedSource as Partial); + } +} + +/** + * PeerStatus is the frontend-facing shape of a daemon PeerState. Carries + * enough detail for the dashboard's compact peer row plus the on-click + * troubleshooting expansion (ICE candidate types, endpoints, handshake age). + */ +export class PeerStatus { + "ip": string; + "pubKey": string; + "connStatus": string; + "connStatusUpdateUnix": number; + "relayed": boolean; + "localIceCandidateType": string; + "remoteIceCandidateType": string; + "localIceCandidateEndpoint": string; + "remoteIceCandidateEndpoint": string; + "fqdn": string; + "bytesRx": number; + "bytesTx": number; + "latencyMs": number; + "relayAddress": string; + "lastHandshakeUnix": number; + "rosenpassEnabled": boolean; + "networks": string[]; + + /** Creates a new PeerStatus instance. */ + constructor($$source: Partial = {}) { + if (!("ip" in $$source)) { + this["ip"] = ""; + } + if (!("pubKey" in $$source)) { + this["pubKey"] = ""; + } + if (!("connStatus" in $$source)) { + this["connStatus"] = ""; + } + if (!("connStatusUpdateUnix" in $$source)) { + this["connStatusUpdateUnix"] = 0; + } + if (!("relayed" in $$source)) { + this["relayed"] = false; + } + if (!("localIceCandidateType" in $$source)) { + this["localIceCandidateType"] = ""; + } + if (!("remoteIceCandidateType" in $$source)) { + this["remoteIceCandidateType"] = ""; + } + if (!("localIceCandidateEndpoint" in $$source)) { + this["localIceCandidateEndpoint"] = ""; + } + if (!("remoteIceCandidateEndpoint" in $$source)) { + this["remoteIceCandidateEndpoint"] = ""; + } + if (!("fqdn" in $$source)) { + this["fqdn"] = ""; + } + if (!("bytesRx" in $$source)) { + this["bytesRx"] = 0; + } + if (!("bytesTx" in $$source)) { + this["bytesTx"] = 0; + } + if (!("latencyMs" in $$source)) { + this["latencyMs"] = 0; + } + if (!("relayAddress" in $$source)) { + this["relayAddress"] = ""; + } + if (!("lastHandshakeUnix" in $$source)) { + this["lastHandshakeUnix"] = 0; + } + if (!("rosenpassEnabled" in $$source)) { + this["rosenpassEnabled"] = false; + } + if (!("networks" in $$source)) { + this["networks"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new PeerStatus instance from a string or object. + */ + static createFrom($$source: any = {}): PeerStatus { + const $$createField16_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("networks" in $$parsedSource) { + $$parsedSource["networks"] = $$createField16_0($$parsedSource["networks"]); + } + return new PeerStatus($$parsedSource as Partial); + } +} + +/** + * PortInfo carries the destination or translated port for a forwarding rule. + * Exactly one of Port or Range is populated, mirroring the daemon's oneof. + */ +export class PortInfo { + "port"?: number | null; + "range"?: PortRange | null; + + /** Creates a new PortInfo instance. */ + constructor($$source: Partial = {}) { + + Object.assign(this, $$source); + } + + /** + * Creates a new PortInfo instance from a string or object. + */ + static createFrom($$source: any = {}): PortInfo { + const $$createField1_0 = $$createType4; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("range" in $$parsedSource) { + $$parsedSource["range"] = $$createField1_0($$parsedSource["range"]); + } + return new PortInfo($$parsedSource as Partial); + } +} + +/** + * PortRange describes a contiguous port range. Both ends are inclusive. + */ +export class PortRange { + "start": number; + "end": number; + + /** Creates a new PortRange instance. */ + constructor($$source: Partial = {}) { + if (!("start" in $$source)) { + this["start"] = 0; + } + if (!("end" in $$source)) { + this["end"] = 0; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new PortRange instance from a string or object. + */ + static createFrom($$source: any = {}): PortRange { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new PortRange($$parsedSource as Partial); + } +} + +/** + * Profile is one named daemon profile. + */ +export class Profile { + "name": string; + "isActive": boolean; + + /** + * Email is the account address associated with this profile, sourced from + * the per-profile state file written by the CLI after a successful SSO + * login (e.g. ~/Library/Application Support/netbird/default.state.json on + * macOS). The daemon always runs as root, so its getConfigDir() resolves to + * the root home directory and cannot reach the user-owned state file. The + * UI process runs as the logged-in user and can read it directly via + * profilemanager.ProfileManager, which is why the email is fetched here + * instead of being returned by the ListProfiles RPC. + */ + "email": string; + + /** Creates a new Profile instance. */ + constructor($$source: Partial = {}) { + if (!("name" in $$source)) { + this["name"] = ""; + } + if (!("isActive" in $$source)) { + this["isActive"] = false; + } + if (!("email" in $$source)) { + this["email"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Profile instance from a string or object. + */ + static createFrom($$source: any = {}): Profile { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new Profile($$parsedSource as Partial); + } +} + +/** + * ProfileRef identifies a profile by name+username. + */ +export class ProfileRef { + "profileName": string; + "username": string; + + /** Creates a new ProfileRef instance. */ + constructor($$source: Partial = {}) { + if (!("profileName" in $$source)) { + this["profileName"] = ""; + } + if (!("username" in $$source)) { + this["username"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new ProfileRef instance from a string or object. + */ + static createFrom($$source: any = {}): ProfileRef { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new ProfileRef($$parsedSource as Partial); + } +} + +/** + * SelectNetworksParams selects which networks to enable / disable. + * All means "every available network" (used by Select-All / Deselect-All buttons); + * Append means "leave the existing selection in place and merge these IDs in". + */ +export class SelectNetworksParams { + "networkIds": string[]; + "append": boolean; + "all": boolean; + + /** Creates a new SelectNetworksParams instance. */ + constructor($$source: Partial = {}) { + if (!("networkIds" in $$source)) { + this["networkIds"] = []; + } + if (!("append" in $$source)) { + this["append"] = false; + } + if (!("all" in $$source)) { + this["all"] = false; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new SelectNetworksParams instance from a string or object. + */ + static createFrom($$source: any = {}): SelectNetworksParams { + const $$createField0_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("networkIds" in $$parsedSource) { + $$parsedSource["networkIds"] = $$createField0_0($$parsedSource["networkIds"]); + } + return new SelectNetworksParams($$parsedSource as Partial); + } +} + +/** + * SetConfigParams is a partial update — only fields with non-nil pointers + * are sent to the daemon. The frontend uses this to flip individual toggles. + */ +export class SetConfigParams { + "profileName": string; + "username": string; + "managementUrl": string; + "adminUrl": string; + "interfaceName"?: string | null; + "wireguardPort"?: number | null; + "mtu"?: number | null; + "preSharedKey"?: string | null; + "disableAutoConnect"?: boolean | null; + "serverSshAllowed"?: boolean | null; + "rosenpassEnabled"?: boolean | null; + "rosenpassPermissive"?: boolean | null; + "disableNotifications"?: boolean | null; + "lazyConnectionEnabled"?: boolean | null; + "blockInbound"?: boolean | null; + "networkMonitor"?: boolean | null; + "disableClientRoutes"?: boolean | null; + "disableServerRoutes"?: boolean | null; + "disableDns"?: boolean | null; + "disableIpv6"?: boolean | null; + "disableFirewall"?: boolean | null; + "blockLanAccess"?: boolean | null; + "enableSshRoot"?: boolean | null; + "enableSshSftp"?: boolean | null; + "enableSshLocalPortForwarding"?: boolean | null; + "enableSshRemotePortForwarding"?: boolean | null; + "disableSshAuth"?: boolean | null; + "sshJwtCacheTtl"?: number | null; + + /** Creates a new SetConfigParams instance. */ + constructor($$source: Partial = {}) { + if (!("profileName" in $$source)) { + this["profileName"] = ""; + } + if (!("username" in $$source)) { + this["username"] = ""; + } + if (!("managementUrl" in $$source)) { + this["managementUrl"] = ""; + } + if (!("adminUrl" in $$source)) { + this["adminUrl"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new SetConfigParams instance from a string or object. + */ + static createFrom($$source: any = {}): SetConfigParams { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new SetConfigParams($$parsedSource as Partial); + } +} + +/** + * Status is the snapshot the frontend renders on the dashboard. + */ +export class Status { + "status": string; + "daemonVersion": string; + "management": PeerLink; + "signal": PeerLink; + "local": LocalPeer; + "peers": PeerStatus[]; + "events": SystemEvent[]; + + /** Creates a new Status instance. */ + constructor($$source: Partial = {}) { + if (!("status" in $$source)) { + this["status"] = ""; + } + if (!("daemonVersion" in $$source)) { + this["daemonVersion"] = ""; + } + if (!("management" in $$source)) { + this["management"] = (new PeerLink()); + } + if (!("signal" in $$source)) { + this["signal"] = (new PeerLink()); + } + if (!("local" in $$source)) { + this["local"] = (new LocalPeer()); + } + if (!("peers" in $$source)) { + this["peers"] = []; + } + if (!("events" in $$source)) { + this["events"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new Status instance from a string or object. + */ + static createFrom($$source: any = {}): Status { + const $$createField2_0 = $$createType5; + const $$createField3_0 = $$createType5; + const $$createField4_0 = $$createType6; + const $$createField5_0 = $$createType8; + const $$createField6_0 = $$createType10; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("management" in $$parsedSource) { + $$parsedSource["management"] = $$createField2_0($$parsedSource["management"]); + } + if ("signal" in $$parsedSource) { + $$parsedSource["signal"] = $$createField3_0($$parsedSource["signal"]); + } + if ("local" in $$parsedSource) { + $$parsedSource["local"] = $$createField4_0($$parsedSource["local"]); + } + if ("peers" in $$parsedSource) { + $$parsedSource["peers"] = $$createField5_0($$parsedSource["peers"]); + } + if ("events" in $$parsedSource) { + $$parsedSource["events"] = $$createField6_0($$parsedSource["events"]); + } + return new Status($$parsedSource as Partial); + } +} + +/** + * SystemEvent is the frontend-facing shape of a daemon SystemEvent. + */ +export class SystemEvent { + "id": string; + "severity": string; + "category": string; + "message": string; + "userMessage": string; + "timestamp": number; + "metadata": { [_ in string]?: string }; + + /** Creates a new SystemEvent instance. */ + constructor($$source: Partial = {}) { + if (!("id" in $$source)) { + this["id"] = ""; + } + if (!("severity" in $$source)) { + this["severity"] = ""; + } + if (!("category" in $$source)) { + this["category"] = ""; + } + if (!("message" in $$source)) { + this["message"] = ""; + } + if (!("userMessage" in $$source)) { + this["userMessage"] = ""; + } + if (!("timestamp" in $$source)) { + this["timestamp"] = 0; + } + if (!("metadata" in $$source)) { + this["metadata"] = {}; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new SystemEvent instance from a string or object. + */ + static createFrom($$source: any = {}): SystemEvent { + const $$createField6_0 = $$createType11; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("metadata" in $$parsedSource) { + $$parsedSource["metadata"] = $$createField6_0($$parsedSource["metadata"]); + } + return new SystemEvent($$parsedSource as Partial); + } +} + +/** + * UpParams selects the profile the daemon should bring up. + */ +export class UpParams { + "profileName": string; + "username": string; + + /** Creates a new UpParams instance. */ + constructor($$source: Partial = {}) { + if (!("profileName" in $$source)) { + this["profileName"] = ""; + } + if (!("username" in $$source)) { + this["username"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new UpParams instance from a string or object. + */ + static createFrom($$source: any = {}): UpParams { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new UpParams($$parsedSource as Partial); + } +} + +/** + * UpdateAvailable carries the new_version_available metadata. + */ +export class UpdateAvailable { + "version": string; + "enforced": boolean; + + /** Creates a new UpdateAvailable instance. */ + constructor($$source: Partial = {}) { + if (!("version" in $$source)) { + this["version"] = ""; + } + if (!("enforced" in $$source)) { + this["enforced"] = false; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new UpdateAvailable instance from a string or object. + */ + static createFrom($$source: any = {}): UpdateAvailable { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new UpdateAvailable($$parsedSource as Partial); + } +} + +/** + * UpdateProgress carries the progress_window metadata. + */ +export class UpdateProgress { + "action": string; + "version": string; + + /** Creates a new UpdateProgress instance. */ + constructor($$source: Partial = {}) { + if (!("action" in $$source)) { + this["action"] = ""; + } + if (!("version" in $$source)) { + this["version"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new UpdateProgress instance from a string or object. + */ + static createFrom($$source: any = {}): UpdateProgress { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new UpdateProgress($$parsedSource as Partial); + } +} + +/** + * UpdateResult mirrors TriggerUpdateResponse: Success false carries an error + * message in ErrorMsg. + */ +export class UpdateResult { + "success": boolean; + "errorMsg": string; + + /** Creates a new UpdateResult instance. */ + constructor($$source: Partial = {}) { + if (!("success" in $$source)) { + this["success"] = false; + } + if (!("errorMsg" in $$source)) { + this["errorMsg"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new UpdateResult instance from a string or object. + */ + static createFrom($$source: any = {}): UpdateResult { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new UpdateResult($$parsedSource as Partial); + } +} + +/** + * WaitSSOParams carries the fields the UI passes to WaitSSOLogin. + */ +export class WaitSSOParams { + "userCode": string; + "hostname": string; + + /** Creates a new WaitSSOParams instance. */ + constructor($$source: Partial = {}) { + if (!("userCode" in $$source)) { + this["userCode"] = ""; + } + if (!("hostname" in $$source)) { + this["hostname"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new WaitSSOParams instance from a string or object. + */ + static createFrom($$source: any = {}): WaitSSOParams { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new WaitSSOParams($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = PortInfo.createFrom; +const $$createType1 = $Create.Array($Create.Any); +const $$createType2 = $Create.Map($Create.Any, $$createType1); +const $$createType3 = PortRange.createFrom; +const $$createType4 = $Create.Nullable($$createType3); +const $$createType5 = PeerLink.createFrom; +const $$createType6 = LocalPeer.createFrom; +const $$createType7 = PeerStatus.createFrom; +const $$createType8 = $Create.Array($$createType7); +const $$createType9 = SystemEvent.createFrom; +const $$createType10 = $Create.Array($$createType9); +const $$createType11 = $Create.Map($Create.Any, $Create.Any); diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/networks.js b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/networks.ts similarity index 64% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/networks.js rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/networks.ts index b0b8fe666..82a8d870f 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/networks.js +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/networks.ts @@ -1,4 +1,3 @@ -// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT @@ -15,28 +14,17 @@ import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Cr // @ts-ignore: Unused imports import * as $models from "./models.js"; -/** - * @param {$models.SelectNetworksParams} p - * @returns {$CancellablePromise} - */ -export function Deselect(p) { +export function Deselect(p: $models.SelectNetworksParams): $CancellablePromise { return $Call.ByID(3382210947, p); } -/** - * @returns {$CancellablePromise<$models.Network[]>} - */ -export function List() { - return $Call.ByID(1550842096).then(/** @type {($result: any) => any} */(($result) => { +export function List(): $CancellablePromise<$models.Network[]> { + return $Call.ByID(1550842096).then(($result: any) => { return $$createType1($result); - })); + }); } -/** - * @param {$models.SelectNetworksParams} p - * @returns {$CancellablePromise} - */ -export function Select(p) { +export function Select(p: $models.SelectNetworksParams): $CancellablePromise { return $Call.ByID(1339338400, p); } diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/peers.js b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/peers.ts similarity index 85% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/peers.js rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/peers.ts index 7b41f718d..f70d8cc7c 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/peers.js +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/peers.ts @@ -1,4 +1,3 @@ -// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT @@ -18,12 +17,11 @@ import * as $models from "./models.js"; /** * Get returns the current daemon status snapshot. - * @returns {$CancellablePromise<$models.Status>} */ -export function Get() { - return $Call.ByID(3266051360).then(/** @type {($result: any) => any} */(($result) => { +export function Get(): $CancellablePromise<$models.Status> { + return $Call.ByID(3266051360).then(($result: any) => { return $$createType0($result); - })); + }); } /** @@ -39,9 +37,8 @@ export function Get() { * * Safe to call once at boot; both loops self-restart on stream errors * via exponential backoff. - * @returns {$CancellablePromise} */ -export function Watch() { +export function Watch(): $CancellablePromise { return $Call.ByID(2799871735); } diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profiles.js b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profiles.ts similarity index 57% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profiles.js rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profiles.ts index 5a207d6ca..9a4577e0b 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profiles.js +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profiles.ts @@ -1,4 +1,3 @@ -// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT @@ -15,55 +14,35 @@ import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Cr // @ts-ignore: Unused imports import * as $models from "./models.js"; -/** - * @param {$models.ProfileRef} p - * @returns {$CancellablePromise} - */ -export function Add(p) { +export function Add(p: $models.ProfileRef): $CancellablePromise { return $Call.ByID(722930578, p); } -/** - * @returns {$CancellablePromise<$models.ActiveProfile>} - */ -export function GetActive() { - return $Call.ByID(3458449443).then(/** @type {($result: any) => any} */(($result) => { +export function GetActive(): $CancellablePromise<$models.ActiveProfile> { + return $Call.ByID(3458449443).then(($result: any) => { return $$createType0($result); - })); + }); } -/** - * @param {string} username - * @returns {$CancellablePromise<$models.Profile[]>} - */ -export function List(username) { - return $Call.ByID(3702185167, username).then(/** @type {($result: any) => any} */(($result) => { +export function List(username: string): $CancellablePromise<$models.Profile[]> { + return $Call.ByID(3702185167, username).then(($result: any) => { return $$createType2($result); - })); + }); } -/** - * @param {$models.ProfileRef} p - * @returns {$CancellablePromise} - */ -export function Remove(p) { +export function Remove(p: $models.ProfileRef): $CancellablePromise { return $Call.ByID(2365690315, p); } -/** - * @param {$models.ProfileRef} p - * @returns {$CancellablePromise} - */ -export function Switch(p) { +export function Switch(p: $models.ProfileRef): $CancellablePromise { return $Call.ByID(3209858855, p); } /** * Username returns the OS username the daemon expects for profile lookups. * The frontend calls this once at boot and reuses the result. - * @returns {$CancellablePromise} */ -export function Username() { +export function Username(): $CancellablePromise { return $Call.ByID(262345647); } diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profileswitcher.js b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profileswitcher.ts similarity index 95% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profileswitcher.js rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profileswitcher.ts index f0d5a4004..0f42d6f49 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profileswitcher.js +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/profileswitcher.ts @@ -1,4 +1,3 @@ -// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT @@ -34,9 +33,7 @@ import * as $models from "./models.js"; * All RPCs complete quickly: Up uses async mode so the daemon starts the * connection attempt and returns immediately; status updates flow via the * SubscribeStatus stream. - * @param {$models.ProfileRef} p - * @returns {$CancellablePromise} */ -export function SwitchActive(p) { +export function SwitchActive(p: $models.ProfileRef): $CancellablePromise { return $Call.ByID(4025913103, p); } diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/settings.js b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/settings.ts similarity index 59% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/settings.js rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/settings.ts index 9d5bf6e77..bc7b7b2d1 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/settings.js +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/settings.ts @@ -1,4 +1,3 @@ -// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT @@ -15,30 +14,19 @@ import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Cr // @ts-ignore: Unused imports import * as $models from "./models.js"; -/** - * @param {$models.ConfigParams} p - * @returns {$CancellablePromise<$models.Config>} - */ -export function GetConfig(p) { - return $Call.ByID(59246988, p).then(/** @type {($result: any) => any} */(($result) => { +export function GetConfig(p: $models.ConfigParams): $CancellablePromise<$models.Config> { + return $Call.ByID(59246988, p).then(($result: any) => { return $$createType0($result); - })); + }); } -/** - * @returns {$CancellablePromise<$models.Features>} - */ -export function GetFeatures() { - return $Call.ByID(2056724965).then(/** @type {($result: any) => any} */(($result) => { +export function GetFeatures(): $CancellablePromise<$models.Features> { + return $Call.ByID(2056724965).then(($result: any) => { return $$createType1($result); - })); + }); } -/** - * @param {$models.SetConfigParams} p - * @returns {$CancellablePromise} - */ -export function SetConfig(p) { +export function SetConfig(p: $models.SetConfigParams): $CancellablePromise { return $Call.ByID(26939944, p); } diff --git a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/update.js b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/update.ts similarity index 69% rename from client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/update.js rename to client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/update.ts index 668d0d670..c2bdd85e9 100644 --- a/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/update.js +++ b/client/ui/frontend/bindings/github.com/netbirdio/netbird/client/ui/services/update.ts @@ -1,4 +1,3 @@ -// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT @@ -15,13 +14,10 @@ import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Cr // @ts-ignore: Unused imports import * as $models from "./models.js"; -/** - * @returns {$CancellablePromise<$models.UpdateResult>} - */ -export function GetInstallerResult() { - return $Call.ByID(2533624807).then(/** @type {($result: any) => any} */(($result) => { +export function GetInstallerResult(): $CancellablePromise<$models.UpdateResult> { + return $Call.ByID(2533624807).then(($result: any) => { return $$createType0($result); - })); + }); } /** @@ -30,19 +26,15 @@ export function GetInstallerResult() { * Fyne UI's app.Quit() in showInstallerResult. Schedules the actual exit * off the calling goroutine so the JS-side caller's response can return * before the runtime tears down. - * @returns {$CancellablePromise} */ -export function Quit() { +export function Quit(): $CancellablePromise { return $Call.ByID(409602657); } -/** - * @returns {$CancellablePromise<$models.UpdateResult>} - */ -export function Trigger() { - return $Call.ByID(166270378).then(/** @type {($result: any) => any} */(($result) => { +export function Trigger(): $CancellablePromise<$models.UpdateResult> { + return $Call.ByID(166270378).then(($result: any) => { return $$createType0($result); - })); + }); } // Private type creation functions diff --git a/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/internal/eventcreate.js b/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/internal/eventcreate.ts similarity index 100% rename from client/ui/frontend/bindings/github.com/wailsapp/wails/v3/internal/eventcreate.js rename to client/ui/frontend/bindings/github.com/wailsapp/wails/v3/internal/eventcreate.ts diff --git a/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/index.js b/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/index.ts similarity index 96% rename from client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/index.js rename to client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/index.ts index e2c2be532..71eda3bb9 100644 --- a/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/index.js +++ b/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/index.ts @@ -1,4 +1,3 @@ -// @ts-check // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT diff --git a/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/models.js b/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/models.js deleted file mode 100644 index 6cdc2516f..000000000 --- a/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/models.js +++ /dev/null @@ -1,192 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import { Create as $Create } from "@wailsio/runtime"; - -/** - * NotificationAction represents an action button for a notification. - */ -export class NotificationAction { - /** - * Creates a new NotificationAction instance. - * @param {Partial} [$$source = {}] - The source object to create the NotificationAction. - */ - constructor($$source = {}) { - if (/** @type {any} */(false)) { - /** - * @member - * @type {string | undefined} - */ - this["id"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {string | undefined} - */ - this["title"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * (macOS-specific) - * @member - * @type {boolean | undefined} - */ - this["destructive"] = undefined; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new NotificationAction instance from a string or object. - * @param {any} [$$source = {}] - * @returns {NotificationAction} - */ - static createFrom($$source = {}) { - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - return new NotificationAction(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * NotificationCategory groups actions for notifications. - */ -export class NotificationCategory { - /** - * Creates a new NotificationCategory instance. - * @param {Partial} [$$source = {}] - The source object to create the NotificationCategory. - */ - constructor($$source = {}) { - if (/** @type {any} */(false)) { - /** - * @member - * @type {string | undefined} - */ - this["id"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {NotificationAction[] | undefined} - */ - this["actions"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {boolean | undefined} - */ - this["hasReplyField"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {string | undefined} - */ - this["replyPlaceholder"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {string | undefined} - */ - this["replyButtonTitle"] = undefined; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new NotificationCategory instance from a string or object. - * @param {any} [$$source = {}] - * @returns {NotificationCategory} - */ - static createFrom($$source = {}) { - const $$createField1_0 = $$createType1; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("actions" in $$parsedSource) { - $$parsedSource["actions"] = $$createField1_0($$parsedSource["actions"]); - } - return new NotificationCategory(/** @type {Partial} */($$parsedSource)); - } -} - -/** - * NotificationOptions contains configuration for a notification - */ -export class NotificationOptions { - /** - * Creates a new NotificationOptions instance. - * @param {Partial} [$$source = {}] - The source object to create the NotificationOptions. - */ - constructor($$source = {}) { - if (!("id" in $$source)) { - /** - * @member - * @type {string} - */ - this["id"] = ""; - } - if (!("title" in $$source)) { - /** - * @member - * @type {string} - */ - this["title"] = ""; - } - if (/** @type {any} */(false)) { - /** - * (macOS and Linux only) - * @member - * @type {string | undefined} - */ - this["subtitle"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {string | undefined} - */ - this["body"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {string | undefined} - */ - this["categoryId"] = undefined; - } - if (/** @type {any} */(false)) { - /** - * @member - * @type {{ [_ in string]?: any } | undefined} - */ - this["data"] = undefined; - } - - Object.assign(this, $$source); - } - - /** - * Creates a new NotificationOptions instance from a string or object. - * @param {any} [$$source = {}] - * @returns {NotificationOptions} - */ - static createFrom($$source = {}) { - const $$createField5_0 = $$createType2; - let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; - if ("data" in $$parsedSource) { - $$parsedSource["data"] = $$createField5_0($$parsedSource["data"]); - } - return new NotificationOptions(/** @type {Partial} */($$parsedSource)); - } -} - -// Private type creation functions -const $$createType0 = NotificationAction.createFrom; -const $$createType1 = $Create.Array($$createType0); -const $$createType2 = $Create.Map($Create.Any, $Create.Any); diff --git a/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/models.ts b/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/models.ts new file mode 100644 index 000000000..3fbcb8270 --- /dev/null +++ b/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/models.ts @@ -0,0 +1,107 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import { Create as $Create } from "@wailsio/runtime"; + +/** + * NotificationAction represents an action button for a notification. + */ +export class NotificationAction { + "id"?: string; + "title"?: string; + + /** + * (macOS-specific) + */ + "destructive"?: boolean; + + /** Creates a new NotificationAction instance. */ + constructor($$source: Partial = {}) { + + Object.assign(this, $$source); + } + + /** + * Creates a new NotificationAction instance from a string or object. + */ + static createFrom($$source: any = {}): NotificationAction { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new NotificationAction($$parsedSource as Partial); + } +} + +/** + * NotificationCategory groups actions for notifications. + */ +export class NotificationCategory { + "id"?: string; + "actions"?: NotificationAction[]; + "hasReplyField"?: boolean; + "replyPlaceholder"?: string; + "replyButtonTitle"?: string; + + /** Creates a new NotificationCategory instance. */ + constructor($$source: Partial = {}) { + + Object.assign(this, $$source); + } + + /** + * Creates a new NotificationCategory instance from a string or object. + */ + static createFrom($$source: any = {}): NotificationCategory { + const $$createField1_0 = $$createType1; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("actions" in $$parsedSource) { + $$parsedSource["actions"] = $$createField1_0($$parsedSource["actions"]); + } + return new NotificationCategory($$parsedSource as Partial); + } +} + +/** + * NotificationOptions contains configuration for a notification + */ +export class NotificationOptions { + "id": string; + "title": string; + + /** + * (macOS and Linux only) + */ + "subtitle"?: string; + "body"?: string; + "categoryId"?: string; + "data"?: { [_ in string]?: any }; + + /** Creates a new NotificationOptions instance. */ + constructor($$source: Partial = {}) { + if (!("id" in $$source)) { + this["id"] = ""; + } + if (!("title" in $$source)) { + this["title"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new NotificationOptions instance from a string or object. + */ + static createFrom($$source: any = {}): NotificationOptions { + const $$createField5_0 = $$createType2; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("data" in $$parsedSource) { + $$parsedSource["data"] = $$createField5_0($$parsedSource["data"]); + } + return new NotificationOptions($$parsedSource as Partial); + } +} + +// Private type creation functions +const $$createType0 = NotificationAction.createFrom; +const $$createType1 = $Create.Array($$createType0); +const $$createType2 = $Create.Map($Create.Any, $Create.Any); diff --git a/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/notificationservice.js b/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/notificationservice.js deleted file mode 100644 index e16f96b80..000000000 --- a/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/notificationservice.js +++ /dev/null @@ -1,101 +0,0 @@ -// @ts-check -// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL -// This file is automatically generated. DO NOT EDIT - -/** - * Service represents the notifications service - * @module - */ - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore: Unused imports -import * as $models from "./models.js"; - -/** - * @returns {$CancellablePromise} - */ -export function CheckNotificationAuthorization() { - return $Call.ByID(2216952893); -} - -/** - * @param {$models.NotificationCategory} category - * @returns {$CancellablePromise} - */ -export function RegisterNotificationCategory(category) { - return $Call.ByID(2917562919, category); -} - -/** - * @returns {$CancellablePromise} - */ -export function RemoveAllDeliveredNotifications() { - return $Call.ByID(3956282340); -} - -/** - * @returns {$CancellablePromise} - */ -export function RemoveAllPendingNotifications() { - return $Call.ByID(108821341); -} - -/** - * @param {string} identifier - * @returns {$CancellablePromise} - */ -export function RemoveDeliveredNotification(identifier) { - return $Call.ByID(975691940, identifier); -} - -/** - * @param {string} identifier - * @returns {$CancellablePromise} - */ -export function RemoveNotification(identifier) { - return $Call.ByID(3966653866, identifier); -} - -/** - * @param {string} categoryID - * @returns {$CancellablePromise} - */ -export function RemoveNotificationCategory(categoryID) { - return $Call.ByID(2032615554, categoryID); -} - -/** - * @param {string} identifier - * @returns {$CancellablePromise} - */ -export function RemovePendingNotification(identifier) { - return $Call.ByID(3729049703, identifier); -} - -/** - * Public methods that delegate to the implementation. - * @returns {$CancellablePromise} - */ -export function RequestNotificationAuthorization() { - return $Call.ByID(3933442950); -} - -/** - * @param {$models.NotificationOptions} options - * @returns {$CancellablePromise} - */ -export function SendNotification(options) { - return $Call.ByID(3968228732, options); -} - -/** - * @param {$models.NotificationOptions} options - * @returns {$CancellablePromise} - */ -export function SendNotificationWithActions(options) { - return $Call.ByID(1886542847, options); -} diff --git a/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/notificationservice.ts b/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/notificationservice.ts new file mode 100644 index 000000000..859f3570f --- /dev/null +++ b/client/ui/frontend/bindings/github.com/wailsapp/wails/v3/pkg/services/notifications/notificationservice.ts @@ -0,0 +1,62 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * Service represents the notifications service + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as $models from "./models.js"; + +export function CheckNotificationAuthorization(): $CancellablePromise { + return $Call.ByID(2216952893); +} + +export function RegisterNotificationCategory(category: $models.NotificationCategory): $CancellablePromise { + return $Call.ByID(2917562919, category); +} + +export function RemoveAllDeliveredNotifications(): $CancellablePromise { + return $Call.ByID(3956282340); +} + +export function RemoveAllPendingNotifications(): $CancellablePromise { + return $Call.ByID(108821341); +} + +export function RemoveDeliveredNotification(identifier: string): $CancellablePromise { + return $Call.ByID(975691940, identifier); +} + +export function RemoveNotification(identifier: string): $CancellablePromise { + return $Call.ByID(3966653866, identifier); +} + +export function RemoveNotificationCategory(categoryID: string): $CancellablePromise { + return $Call.ByID(2032615554, categoryID); +} + +export function RemovePendingNotification(identifier: string): $CancellablePromise { + return $Call.ByID(3729049703, identifier); +} + +/** + * Public methods that delegate to the implementation. + */ +export function RequestNotificationAuthorization(): $CancellablePromise { + return $Call.ByID(3933442950); +} + +export function SendNotification(options: $models.NotificationOptions): $CancellablePromise { + return $Call.ByID(3968228732, options); +} + +export function SendNotificationWithActions(options: $models.NotificationOptions): $CancellablePromise { + return $Call.ByID(1886542847, options); +} From d33b841a3394e96b57bb2e2cac0492874d0e96a8 Mon Sep 17 00:00:00 2001 From: Zoltan Papp Date: Wed, 13 May 2026 16:07:21 +0200 Subject: [PATCH 10/10] [client/ui] Use type conversion for ProfileRef to UpParams (staticcheck) --- client/ui/services/profileswitcher.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/client/ui/services/profileswitcher.go b/client/ui/services/profileswitcher.go index 855097749..1b3d2ba43 100644 --- a/client/ui/services/profileswitcher.go +++ b/client/ui/services/profileswitcher.go @@ -69,10 +69,7 @@ func (s *ProfileSwitcher) SwitchActive(ctx context.Context, p ProfileRef) error } if wasActive { - if err := s.connection.Up(ctx, UpParams{ - ProfileName: p.ProfileName, - Username: p.Username, - }); err != nil { + if err := s.connection.Up(ctx, UpParams(p)); err != nil { return fmt.Errorf("reconnect %q: %w", p.ProfileName, err) } }