mirror of
https://github.com/netbirdio/netbird.git
synced 2026-05-14 04:39:54 +00:00
[client/ui] Show active profile name and account email in tray menu
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.
This commit is contained in:
@@ -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<Profile> = {}) {
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user