[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:
Zoltan Papp
2026-05-13 13:07:36 +02:00
parent 74ea03da9b
commit 5efdac11b0
3 changed files with 60 additions and 2 deletions

View File

@@ -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);
}