diff --git a/fluxer_desktop/native/linux-portals/index.d.ts b/fluxer_desktop/native/linux-portals/index.d.ts index 6bf928dba..4ea54f352 100644 --- a/fluxer_desktop/native/linux-portals/index.d.ts +++ b/fluxer_desktop/native/linux-portals/index.d.ts @@ -88,6 +88,12 @@ export declare class SessionStateMonitor { close(): void; } +export declare class LauncherEntry { + constructor(onShellStarted: () => void); + + update(uri: string, count: number, countVisible: boolean): void; +} + export declare function readColorScheme(): 'no-preference' | 'prefer-dark' | 'prefer-light'; export declare function readContrast(): 'no-preference' | 'high'; diff --git a/fluxer_desktop/native/linux-portals/index.js b/fluxer_desktop/native/linux-portals/index.js index 082fdd3b6..9abfc909a 100644 --- a/fluxer_desktop/native/linux-portals/index.js +++ b/fluxer_desktop/native/linux-portals/index.js @@ -64,6 +64,7 @@ module.exports = { requestBackground: binding ? binding.requestBackground : null, GlobalShortcutsPortal: binding ? binding.GlobalShortcutsPortal : null, SessionStateMonitor: binding ? binding.SessionStateMonitor : null, + LauncherEntry: binding ? binding.LauncherEntry : null, readColorScheme: binding ? binding.readColorScheme : () => 'no-preference', readContrast: binding ? binding.readContrast : () => 'no-preference', readAccentColor: binding ? binding.readAccentColor : () => null, diff --git a/fluxer_desktop/native/linux-portals/src/launcher_entry.rs b/fluxer_desktop/native/linux-portals/src/launcher_entry.rs new file mode 100644 index 000000000..fcf66cba8 --- /dev/null +++ b/fluxer_desktop/native/linux-portals/src/launcher_entry.rs @@ -0,0 +1,84 @@ +// SPDX-License-Identifier: AGPL-3.0-or-later + +pub const LAUNCHER_ENTRY_PATH: &str = "/com/canonical/unity/launcherentry"; +pub const LAUNCHER_ENTRY_INTERFACE: &str = "com.canonical.Unity.LauncherEntry"; +pub const UNITY_SERVICE: &str = "com.canonical.Unity"; + +#[cfg(target_os = "linux")] +pub use emitter::LauncherEntryEmitter; + +#[cfg(target_os = "linux")] +mod emitter { + use std::{collections::HashMap, thread}; + + use zbus::{ + MatchRule, + blocking::{Connection, MessageIterator}, + message::Type as MessageType, + zvariant::Value, + }; + + use super::*; + use crate::session_monitor::{BUS_NAME, BUS_PATH}; + + pub struct LauncherEntryEmitter { + connection: Connection, + } + + impl LauncherEntryEmitter { + pub fn connect() -> zbus::Result { + Ok(Self { + connection: Connection::session()?, + }) + } + + pub fn update(&self, uri: &str, count: i64, count_visible: bool) -> zbus::Result<()> { + let properties = HashMap::from([ + ("count", Value::from(count)), + ("count-visible", Value::from(count_visible)), + ]); + self.connection.emit_signal( + None::<&str>, + LAUNCHER_ENTRY_PATH, + LAUNCHER_ENTRY_INTERFACE, + "Update", + &(uri, properties), + ) + } + + pub fn watch_shell( + &self, + on_shell_started: impl Fn() + Send + 'static, + ) -> zbus::Result<()> { + let messages = + MessageIterator::for_match_rule(unity_owner_rule()?, &self.connection, None)?; + thread::Builder::new() + .name("fluxer-linux-portals-launcher-entry".to_string()) + .spawn(move || { + for message in messages.flatten() { + let Ok((_name, _old, new)) = + message.body().deserialize::<(String, String, String)>() + else { + continue; + }; + if !new.is_empty() { + on_shell_started(); + } + } + }) + .map_err(|err| zbus::Error::Failure(err.to_string()))?; + Ok(()) + } + } + + fn unity_owner_rule() -> zbus::Result> { + Ok(MatchRule::builder() + .msg_type(MessageType::Signal) + .sender(BUS_NAME)? + .interface(BUS_NAME)? + .member("NameOwnerChanged")? + .path(BUS_PATH)? + .arg(0, UNITY_SERVICE)? + .build()) + } +} diff --git a/fluxer_desktop/native/linux-portals/src/lib.rs b/fluxer_desktop/native/linux-portals/src/lib.rs index bcd33fb4d..7e20706c4 100644 --- a/fluxer_desktop/native/linux-portals/src/lib.rs +++ b/fluxer_desktop/native/linux-portals/src/lib.rs @@ -4,6 +4,7 @@ pub mod background; pub mod global_shortcuts; pub mod gnome_shell; pub mod kwin; +pub mod launcher_entry; #[cfg(target_os = "linux")] pub mod portal; pub mod session_monitor; @@ -33,6 +34,7 @@ mod napi_bindings { is_valid_token, validate_definitions, }, gnome_shell, kwin, + launcher_entry::{self, LauncherEntryEmitter}, session_monitor::{MonitorEvent, SessionMonitor}, settings::{self, ChangeEvent, ChangePayload}, x11, @@ -441,6 +443,51 @@ mod napi_bindings { } } + type ShellStartedTsfn = ThreadsafeFunction<(), UnknownReturnValue, (), Status, false, true, 0>; + + #[napi] + pub struct LauncherEntry { + emitter: LauncherEntryEmitter, + } + + #[napi] + impl LauncherEntry { + #[napi(constructor)] + pub fn new(on_shell_started: Function<(), UnknownReturnValue>) -> Result { + let callback: ShellStartedTsfn = on_shell_started + .build_threadsafe_function::<()>() + .weak::() + .callee_handled::() + .build() + .map_err(|err| { + generic_error(format!( + "failed to create launcher entry callback: {}", + err.reason + )) + })?; + let emitter = LauncherEntryEmitter::connect() + .map_err(|err| generic_error(format!("failed to open the session bus: {err}")))?; + emitter + .watch_shell(move || { + let _ = callback.call((), ThreadsafeFunctionCallMode::NonBlocking); + }) + .map_err(|err| { + generic_error(format!( + "failed to watch {}: {err}", + launcher_entry::UNITY_SERVICE + )) + })?; + Ok(Self { emitter }) + } + + #[napi] + pub fn update(&self, uri: String, count: i64, count_visible: bool) -> Result<()> { + self.emitter + .update(&uri, count, count_visible) + .map_err(|err| generic_error(format!("LauncherEntry Update failed: {err}"))) + } + } + #[napi(js_name = "readColorScheme")] pub fn read_color_scheme_js() -> &'static str { settings::read_color_scheme().as_str() diff --git a/fluxer_desktop/package.json b/fluxer_desktop/package.json index c3636a993..fb08e194c 100644 --- a/fluxer_desktop/package.json +++ b/fluxer_desktop/package.json @@ -12,6 +12,7 @@ "build": "node scripts/build.mjs", "generate:windows-badges": "electron scripts/generate-windows-badges.mjs", "package:dir": "node scripts/build.mjs && electron-builder --config electron-builder.config.cjs --dir", + "test": "vitest run", "typecheck": "tsc --noEmit" }, "dependencies": { @@ -32,7 +33,8 @@ "electron": "44.10.0", "electron-builder": "27.0.0-alpha.8", "esbuild": "catalog:", - "typescript": "catalog:ts7" + "typescript": "catalog:ts7", + "vitest": "catalog:" }, "optionalDependencies": { "@fluxer/app-store": "file:./native/app-store", diff --git a/fluxer_desktop/packaging/linux/app.fluxer.Fluxer.yml b/fluxer_desktop/packaging/linux/app.fluxer.Fluxer.yml index 2cd6b8a07..fc6e1cae2 100644 --- a/fluxer_desktop/packaging/linux/app.fluxer.Fluxer.yml +++ b/fluxer_desktop/packaging/linux/app.fluxer.Fluxer.yml @@ -27,6 +27,7 @@ finish-args: - --talk-name=org.kde.kwalletd5 - --talk-name=org.kde.kwalletd6 - --talk-name=org.kde.StatusNotifierWatcher + - --talk-name=com.canonical.Unity - --talk-name=org.ayatana.indicator.application - --talk-name=com.canonical.indicator.application - --talk-name=org.gnome.Mutter.IdleMonitor diff --git a/fluxer_desktop/packaging/linux/app.fluxer.FluxerCanary.yml b/fluxer_desktop/packaging/linux/app.fluxer.FluxerCanary.yml index 921e31a17..f389a00a3 100644 --- a/fluxer_desktop/packaging/linux/app.fluxer.FluxerCanary.yml +++ b/fluxer_desktop/packaging/linux/app.fluxer.FluxerCanary.yml @@ -27,6 +27,7 @@ finish-args: - --talk-name=org.kde.kwalletd5 - --talk-name=org.kde.kwalletd6 - --talk-name=org.kde.StatusNotifierWatcher + - --talk-name=com.canonical.Unity - --talk-name=org.ayatana.indicator.application - --talk-name=com.canonical.indicator.application - --talk-name=org.gnome.Mutter.IdleMonitor diff --git a/fluxer_desktop/src/common/DesktopIdentity.ts b/fluxer_desktop/src/common/DesktopIdentity.ts index 3572b434f..328b00c35 100644 --- a/fluxer_desktop/src/common/DesktopIdentity.ts +++ b/fluxer_desktop/src/common/DesktopIdentity.ts @@ -49,6 +49,12 @@ export const LINUX_DESKTOP_ENTRY_ID = LINUX_DESKTOP_ENTRY_IDS[BUILD_CHANNEL]; export const LINUX_PORTAL_SESSION_TOKEN = LINUX_PORTAL_SESSION_TOKENS[BUILD_CHANNEL]; export const LEGACY_LINUX_DESKTOP_ENTRY_ID = LEGACY_LINUX_DESKTOP_ENTRY_IDS[BUILD_CHANNEL]; export const LINUX_ICON_NAME = LEGACY_LINUX_DESKTOP_ENTRY_IDS[BUILD_CHANNEL]; +export const OTHER_CHANNEL_LINUX_DESKTOP_FILES: ReadonlySet = new Set( + (Object.keys(LINUX_DESKTOP_ENTRY_IDS) as Array) + .filter((channel) => channel !== BUILD_CHANNEL) + .flatMap((channel) => [LINUX_DESKTOP_ENTRY_IDS[channel], LEGACY_LINUX_DESKTOP_ENTRY_IDS[channel]]) + .map((id) => `${id}.desktop`), +); export const WINDOWS_SHORTCUT_AUTHOR = 'Fluxer Platform AB'; export const WINDOWS_VELOPACK_ID = WINDOWS_VELOPACK_IDS[BUILD_CHANNEL]; export const WINDOWS_LEGACY_SQUIRREL_ID = 'fluxer_app'; diff --git a/fluxer_desktop/src/main/Autostart.ts b/fluxer_desktop/src/main/Autostart.ts index 88627f507..bb63fdb3b 100644 --- a/fluxer_desktop/src/main/Autostart.ts +++ b/fluxer_desktop/src/main/Autostart.ts @@ -58,21 +58,34 @@ function getFlatpakAutostartStatePath(): string { return path.join(app.getPath('userData'), FLATPAK_AUTOSTART_STATE_FILE); } -function readFlatpakAutostartState(): boolean { +interface FlatpakAutostartState { + enabled?: unknown; + commandline?: unknown; +} + +function readFlatpakAutostartStateFile(): FlatpakAutostartState { try { - const raw = fs.readFileSync(getFlatpakAutostartStatePath(), 'utf8'); - const parsed = JSON.parse(raw) as {enabled?: unknown}; - return parsed.enabled === true; + return JSON.parse(fs.readFileSync(getFlatpakAutostartStatePath(), 'utf8')) as FlatpakAutostartState; } catch { - return false; + return {}; } } +function readFlatpakAutostartState(): boolean { + return readFlatpakAutostartStateFile().enabled === true; +} + async function writeFlatpakAutostartState(enabled: boolean): Promise { try { const statePath = getFlatpakAutostartStatePath(); await fs.promises.mkdir(path.dirname(statePath), {recursive: true}); - await fs.promises.writeFile(statePath, JSON.stringify({version: 1, enabled, updatedAt: new Date().toISOString()}), { + const state = { + version: 1, + enabled, + ...(enabled ? {commandline: getFlatpakAutostartCommandline()} : {}), + updatedAt: new Date().toISOString(), + }; + await fs.promises.writeFile(statePath, JSON.stringify(state), { encoding: 'utf8', mode: 0o600, }); @@ -600,6 +613,23 @@ async function repairLinuxAutostartEntry(): Promise { } } +async function repairFlatpakAutostartEntry(): Promise { + if (!isLinux || !isFlatpakRuntime()) return; + const state = readFlatpakAutostartStateFile(); + if (state.enabled !== true) return; + const commandline = getFlatpakAutostartCommandline(); + if (JSON.stringify(state.commandline) === JSON.stringify(commandline)) return; + try { + await setFlatpakAutostart(true); + log.info('[Autostart] Rewrote the Flatpak autostart entry with the current command', { + previous: state.commandline, + commandline, + }); + } catch (error) { + log.warn('[Autostart] Failed to rewrite the stale Flatpak autostart entry:', error); + } +} + function windowsLaunchItemMissesAutostartArg(item: Electron.LaunchItems): boolean { return ( item.enabled && @@ -684,6 +714,7 @@ async function migrateLegacyLinuxAutostartEntry(): Promise { export function registerAutostartHandlers(): void { void migrateLegacyLinuxAutostartEntry().then(repairLinuxAutostartEntry); + void repairFlatpakAutostartEntry(); void repairWindowsAutostartEntry(); ipcMain.handle('autostart-enable', async (): Promise => { await enableAutostart(); diff --git a/fluxer_desktop/src/main/DesktopEntryText.test.ts b/fluxer_desktop/src/main/DesktopEntryText.test.ts new file mode 100644 index 000000000..39d5445d8 --- /dev/null +++ b/fluxer_desktop/src/main/DesktopEntryText.test.ts @@ -0,0 +1,146 @@ +// SPDX-License-Identifier: AGPL-3.0-or-later + +import { + desktopExecRunsPath, + isAppImageIntegratorEntry, + isWindowDesktopEntry, + readDesktopEntryValue, + setDesktopEntryValue, +} from '@electron/main/DesktopEntryText'; +import {describe, expect, it} from 'vitest'; + +const STABLE_CLASSES = ['app.fluxer.FluxerDesktop', 'fluxer']; + +function entry(...lines: Array): string { + return ['[Desktop Entry]', 'Type=Application', 'Name=Fluxer', ...lines, ''].join('\n'); +} + +describe('readDesktopEntryValue', () => { + it('reads keys written with spaces around the equals sign', () => { + expect(readDesktopEntryValue(entry('StartupWMClass = fluxer'), 'StartupWMClass')).toBe('fluxer'); + }); + + it('ignores localized keys and keys in other groups', () => { + const contents = [ + '[Desktop Entry]', + 'Name[de]=Fluxer DE', + 'Name=Fluxer', + '', + '[Desktop Action new-dm]', + 'Exec=/opt/other %U', + ].join('\n'); + expect(readDesktopEntryValue(contents, 'Name')).toBe('Fluxer'); + expect(readDesktopEntryValue(contents, 'Exec')).toBeNull(); + }); +}); + +describe('setDesktopEntryValue', () => { + it('replaces a spaced key in place without adding a duplicate', () => { + const updated = setDesktopEntryValue( + entry('StartupWMClass = fluxer'), + 'StartupWMClass', + 'app.fluxer.FluxerDesktop', + ); + expect(updated.match(/StartupWMClass/g)).toHaveLength(1); + expect(readDesktopEntryValue(updated, 'StartupWMClass')).toBe('app.fluxer.FluxerDesktop'); + }); + + it('drops repeated keys so the file stays valid', () => { + const updated = setDesktopEntryValue(entry('StartupWMClass=a', 'StartupWMClass=b'), 'StartupWMClass', 'c'); + expect(updated.match(/StartupWMClass/g)).toHaveLength(1); + }); + + it('inserts a missing key at the end of the main group only', () => { + const contents = ['[Desktop Entry]', 'Name=Fluxer', '', '[Desktop Action a]', 'Name=A', ''].join('\n'); + expect(setDesktopEntryValue(contents, 'StartupWMClass', 'x')).toBe( + ['[Desktop Entry]', 'Name=Fluxer', 'StartupWMClass=x', '', '[Desktop Action a]', 'Name=A', ''].join('\n'), + ); + }); +}); + +describe('desktopExecRunsPath', () => { + it('matches the launch command as a whole program token', () => { + expect(desktopExecRunsPath('fluxer %U', 'fluxer')).toBe(true); + expect(desktopExecRunsPath('/usr/bin/fluxer %U', 'fluxer')).toBe(true); + expect(desktopExecRunsPath('env FOO=1 /opt/Fluxer/fluxer %U', '/opt/Fluxer/fluxer')).toBe(true); + }); + + it('does not match other channels or the Flatpak export for the bare fluxer command', () => { + expect(desktopExecRunsPath('/opt/fluxer-canary/fluxer-canary %U', 'fluxer')).toBe(false); + expect(desktopExecRunsPath('fluxer-canary %U', 'fluxer')).toBe(false); + expect( + desktopExecRunsPath( + '/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=fluxer --file-forwarding app.fluxer.Fluxer @@u %U @@', + 'fluxer', + ), + ).toBe(false); + }); + + it('does not match a sibling tar.gz install whose path starts with ours', () => { + expect(desktopExecRunsPath('/home/u/fluxer/fluxer-canary-x64/fluxer-canary %U', '/home/u/fluxer/fluxer')).toBe( + false, + ); + expect(desktopExecRunsPath('/home/u/fluxer/fluxer2 %U', '/home/u/fluxer/fluxer')).toBe(false); + }); + + it('reads paths quoted and escaped the way our own entry writes them', () => { + expect(desktopExecRunsPath('"/home/u/My Apps/Flu\\\\$x.AppImage" %U', '/home/u/My Apps/Flu$x.AppImage')).toBe(true); + expect(desktopExecRunsPath("'/home/u/My Apps/fluxer.appimage' %U", '/home/u/My Apps/fluxer.appimage')).toBe(true); + }); +}); + +describe('isWindowDesktopEntry', () => { + const official = {wmClasses: STABLE_CLASSES, launchPath: '/opt/Fluxer/fluxer'}; + + it('claims legacy entries that name the old window class or our binary', () => { + expect(isWindowDesktopEntry(entry('StartupWMClass=Fluxer', 'Exec=/somewhere/else %U'), official)).toBe(true); + expect(isWindowDesktopEntry(entry('Exec=/opt/Fluxer/fluxer %U'), official)).toBe(true); + }); + + it('skips hidden entries and other channels', () => { + expect(isWindowDesktopEntry(entry('Hidden=true', 'Exec=/opt/Fluxer/fluxer %U'), official)).toBe(false); + expect( + isWindowDesktopEntry( + entry('StartupWMClass=app.fluxer.FluxerDesktopCanary', 'Exec="/opt/fluxer-canary/fluxer-canary" %U'), + {wmClasses: STABLE_CLASSES, launchPath: 'fluxer'}, + ), + ).toBe(false); + }); + + it('never claims other Electron apps when running on a stock Electron binary', () => { + const stock = {wmClasses: STABLE_CLASSES, launchPath: '/usr/lib/electron44/electron'}; + expect(isWindowDesktopEntry(entry('Exec=electron44 /usr/lib/other/app.asar %U'), stock)).toBe(false); + expect(isWindowDesktopEntry(entry('Exec=/usr/lib/electron44/electron %U', 'StartupWMClass=electron'), stock)).toBe( + false, + ); + }); +}); + +describe('isAppImageIntegratorEntry', () => { + const appImage = '/home/u/AppImages/fluxer.appimage'; + + it('accepts the entry Gear Lever writes for the AppImage', () => { + const gearLever = entry( + `Exec=${appImage} %U`, + `TryExec=${appImage}`, + 'X-AppImage-Version=2026.1116.172250', + 'X-AppImage-Name=Fluxer', + ); + expect(isAppImageIntegratorEntry(gearLever, appImage)).toBe(true); + }); + + it('accepts the entry AppImageLauncher writes for the AppImage', () => { + const launcher = entry(`Exec="${appImage}" %U`, 'X-AppImage-Identifier=0d1e'); + expect(isAppImageIntegratorEntry(launcher, appImage)).toBe(true); + }); + + it('leaves hand-written entries alone', () => { + expect(isAppImageIntegratorEntry(entry(`Exec=${appImage} %U`, 'StartupWMClass=fluxer'), appImage)).toBe(false); + }); + + it('leaves integrator entries for other AppImages alone', () => { + const canary = entry('Exec=/home/u/AppImages/fluxer_canary.appimage %U', 'X-AppImage-Name=Fluxer Canary'); + expect(isAppImageIntegratorEntry(canary, appImage)).toBe(false); + expect(isAppImageIntegratorEntry(entry('Exec=fluxer %U', 'X-AppImage-Name=Fluxer'), 'fluxer')).toBe(false); + }); +}); diff --git a/fluxer_desktop/src/main/DesktopEntryText.ts b/fluxer_desktop/src/main/DesktopEntryText.ts new file mode 100644 index 000000000..dd4565ebd --- /dev/null +++ b/fluxer_desktop/src/main/DesktopEntryText.ts @@ -0,0 +1,171 @@ +// SPDX-License-Identifier: AGPL-3.0-or-later + +import path from 'node:path'; + +const MAIN_GROUP = '[Desktop Entry]'; +const KEY_LINE = /^([A-Za-z0-9-]+)\s*=\s*(.*)$/; +const ENV_ASSIGNMENT = /^[A-Za-z_][A-Za-z0-9_]*=/; + +function isGroupHeader(trimmed: string): boolean { + return trimmed.startsWith('[') && trimmed.endsWith(']'); +} + +function matchKey(trimmed: string, key: string): string | null { + const match = KEY_LINE.exec(trimmed); + return match !== null && match[1] === key ? match[2].trim() : null; +} + +export function readDesktopEntryValue(contents: string, key: string): string | null { + let inMainGroup = true; + for (const line of contents.split('\n')) { + const trimmed = line.trim(); + if (isGroupHeader(trimmed)) { + inMainGroup = trimmed === MAIN_GROUP; + continue; + } + if (!inMainGroup) continue; + const value = matchKey(trimmed, key); + if (value !== null) return value; + } + return null; +} + +function hasDesktopEntryKeyPrefix(contents: string, prefix: string): boolean { + let inMainGroup = true; + for (const line of contents.split('\n')) { + const trimmed = line.trim(); + if (isGroupHeader(trimmed)) { + inMainGroup = trimmed === MAIN_GROUP; + continue; + } + if (inMainGroup && trimmed.startsWith(prefix)) return true; + } + return false; +} + +export function setDesktopEntryValue(contents: string, key: string, value: string): string { + const lines = contents.split('\n'); + const groupStart = lines.findIndex((line) => line.trim() === MAIN_GROUP); + if (groupStart === -1) return contents; + let groupEnd = lines.length; + let replaced = false; + const kept: Array = lines.slice(0, groupStart + 1); + for (let index = groupStart + 1; index < lines.length; index++) { + const trimmed = lines[index].trim(); + if (isGroupHeader(trimmed)) { + groupEnd = index; + break; + } + if (matchKey(trimmed, key) !== null) { + if (!replaced) kept.push(`${key}=${value}`); + replaced = true; + continue; + } + kept.push(lines[index]); + } + if (!replaced) { + let insertAt = kept.length; + while (insertAt > groupStart + 1 && kept[insertAt - 1].trim() === '') insertAt--; + kept.splice(insertAt, 0, `${key}=${value}`); + } + return [...kept, ...lines.slice(groupEnd)].join('\n'); +} + +function unescapeDesktopValue(value: string): string { + return value.replace(/\\([sntr\\])/g, (_, code: string) => { + switch (code) { + case 's': + return ' '; + case 'n': + return '\n'; + case 't': + return '\t'; + case 'r': + return '\r'; + default: + return '\\'; + } + }); +} + +function splitExecLine(exec: string): Array { + const tokens: Array = []; + let current = ''; + let started = false; + let quote: '"' | "'" | null = null; + for (let index = 0; index < exec.length; index++) { + const char = exec[index]; + if (quote === '"') { + if (char === '\\' && index + 1 < exec.length) { + current += exec[++index]; + } else if (char === '"') { + quote = null; + } else { + current += char; + } + continue; + } + if (quote === "'") { + if (char === "'") quote = null; + else current += char; + continue; + } + if (char === '"' || char === "'") { + quote = char; + started = true; + } else if (char === ' ' || char === '\t') { + if (started) tokens.push(current); + current = ''; + started = false; + } else { + current += char; + started = true; + } + } + if (started) tokens.push(current); + return tokens; +} + +function getDesktopExecProgram(exec: string): string | null { + const tokens = splitExecLine(unescapeDesktopValue(exec)); + let index = 0; + if (tokens[index] === 'env' || tokens[index] === '/usr/bin/env') { + index++; + while (index < tokens.length && ENV_ASSIGNMENT.test(tokens[index])) index++; + } + return tokens[index] ?? null; +} + +export function desktopExecRunsPath(exec: string | null, launchPath: string): boolean { + if (exec === null || launchPath.length === 0) return false; + const program = getDesktopExecProgram(exec); + if (program === null) return false; + if (program === launchPath) return true; + if (path.isAbsolute(program) && path.isAbsolute(launchPath)) return false; + return path.basename(program) === path.basename(launchPath); +} + +interface WindowIdentity { + wmClasses: ReadonlyArray; + launchPath: string; +} + +function isStockElectron(launchPath: string): boolean { + return /^electron[0-9]*$/.test(path.basename(launchPath)); +} + +export function isWindowDesktopEntry(contents: string, identity: WindowIdentity): boolean { + if (readDesktopEntryValue(contents, 'Hidden') === 'true') return false; + const wmClass = readDesktopEntryValue(contents, 'StartupWMClass')?.toLowerCase(); + if (wmClass !== undefined && identity.wmClasses.some((candidate) => candidate.toLowerCase() === wmClass)) return true; + if (isStockElectron(identity.launchPath)) return false; + return desktopExecRunsPath(readDesktopEntryValue(contents, 'Exec'), identity.launchPath); +} + +export function isAppImageIntegratorEntry(contents: string, appImagePath: string): boolean { + return ( + path.isAbsolute(appImagePath) && + hasDesktopEntryKeyPrefix(contents, 'X-AppImage-') && + getDesktopExecProgram(readDesktopEntryValue(contents, 'Exec') ?? '') === appImagePath + ); +} diff --git a/fluxer_desktop/src/main/DesktopTray.ts b/fluxer_desktop/src/main/DesktopTray.ts index f4b093365..01cf2b5e8 100644 --- a/fluxer_desktop/src/main/DesktopTray.ts +++ b/fluxer_desktop/src/main/DesktopTray.ts @@ -325,9 +325,10 @@ function resolveTrayIcon(): {key: string; image: Electron.NativeImage} | null { trayBaseIcon ??= createTrayIcon(); if (!trayBaseIcon) return null; const settings = getDesktopWindowBehaviorSettings(); + const linuxDesktop = getLinuxDesktop(); const appearance = resolveTrayIconAppearance({ platform: process.platform, - linuxDesktop: getLinuxDesktop(), + linuxDesktop, coloredTrayIcon: settings.coloredTrayIcon, monochromeTone: settings.monochromeTrayIconTone, darkWindowsTaskbar: nativeTheme.shouldUseDarkColorsForSystemIntegratedUI, @@ -337,7 +338,7 @@ function resolveTrayIcon(): {key: string; image: Electron.NativeImage} | null { const key = `${appearance}:${indicator}`; let image = trayIconCache.get(key); if (!image) { - image = renderTrayIcon(trayBaseIcon, appearance, indicator, process.platform); + image = renderTrayIcon(trayBaseIcon, appearance, indicator, process.platform, linuxDesktop); trayIconCache.set(key, image); } return {key, image}; diff --git a/fluxer_desktop/src/main/IpcHandlers.ts b/fluxer_desktop/src/main/IpcHandlers.ts index 0169c1c71..6182cd2df 100644 --- a/fluxer_desktop/src/main/IpcHandlers.ts +++ b/fluxer_desktop/src/main/IpcHandlers.ts @@ -41,6 +41,7 @@ import { readLinuxAppearance, subscribeLinuxAppearance, } from '@electron/main/LinuxAppearance'; +import {setLinuxLauncherBadge} from '@electron/main/LinuxLauncherBadge'; import {refreshTccStatus, registerMacTccIpcHandlers} from '@electron/main/MacTcc'; import {setNativeStrings} from '@electron/main/MainI18n'; import {copyRemoteFileToClipboard, parseClipboardWriteFileOptions} from '@electron/main/MediaClipboard'; @@ -190,6 +191,8 @@ function applyUnreadBadge(badge: number): void { setWindowsBadgeOverlay(getMainWindow(), badge); } else if (process.platform === 'darwin' && badge === UNREAD_BADGE_DOT) { app.dock?.setBadge('•'); + } else if (process.platform === 'linux') { + setLinuxLauncherBadge(launcherBadgeCount(badge)); } else { app.setBadgeCount(launcherBadgeCount(badge)); } @@ -351,7 +354,7 @@ export function registerIpcHandlers(): void { const nextSettings = setDesktopWindowBehaviorSettings(normalizeDesktopWindowBehaviorUpdate(settings)); applyDesktopWindowBehaviorSettings(); refreshWindowsBadgeOverlay(getMainWindow()); - if (process.platform === 'linux') app.setBadgeCount(launcherBadgeCount(lastUnreadBadge)); + if (process.platform === 'linux') setLinuxLauncherBadge(launcherBadgeCount(lastUnreadBadge)); if (!nextSettings.showTrayIcon) { const mainWindow = getMainWindow(); if (mainWindow && !mainWindow.isDestroyed() && !mainWindow.isVisible()) { diff --git a/fluxer_desktop/src/main/LinuxDesktopEntry.ts b/fluxer_desktop/src/main/LinuxDesktopEntry.ts index 278ee4761..1f5df0534 100644 --- a/fluxer_desktop/src/main/LinuxDesktopEntry.ts +++ b/fluxer_desktop/src/main/LinuxDesktopEntry.ts @@ -11,10 +11,17 @@ import { LEGACY_LINUX_DESKTOP_ENTRY_ID, LINUX_DESKTOP_ENTRY_ID, LINUX_ICON_NAME, + OTHER_CHANNEL_LINUX_DESKTOP_FILES, } from '@electron/common/DesktopIdentity'; import {createChildLogger} from '@electron/common/Logger'; import {IS_OFFLINE_BUILD} from '@electron/common/OfflineBuild'; import {getAppResourcesPath} from '@electron/main/DesktopDistributionPath'; +import { + desktopExecRunsPath, + isAppImageIntegratorEntry, + readDesktopEntryValue, + setDesktopEntryValue, +} from '@electron/main/DesktopEntryText'; import {isDirectMessagesAvailable, onDirectMessagesAvailabilityChange, TASK_ARG_PREFIX} from '@electron/main/JumpList'; import {getStableLinuxLaunchPath} from '@electron/main/LinuxLaunchPath'; import {isFlatpakRuntime} from '@electron/main/LinuxSandbox'; @@ -60,6 +67,10 @@ function getUserApplicationsDir(): string { return path.join(getXdgDataHome(), 'applications'); } +export function getLinuxApplicationsDirs(): Array { + return [getUserApplicationsDir(), ...getXdgDataDirs().map((dataDir) => path.join(dataDir, 'applications'))]; +} + function getDesktopFilePath(): string { return path.join(getUserApplicationsDir(), DESKTOP_FILE_BASENAME); } @@ -82,14 +93,23 @@ function findThirdPartyDesktopEntry(execPath: string): string | null { } catch { return null; } - for (const entry of entries) { - if (!entry.endsWith('.desktop') || entry === DESKTOP_FILE_BASENAME) continue; + let firstMatch: string | null = null; + for (const entry of entries.sort()) { + if ( + !entry.endsWith('.desktop') || + entry === DESKTOP_FILE_BASENAME || + OTHER_CHANNEL_LINUX_DESKTOP_FILES.has(entry) + ) { + continue; + } const candidate = path.join(applicationsDir, entry); - try { - if (fs.readFileSync(candidate, 'utf8').includes(execPath)) return candidate; - } catch {} + const contents = readExistingDesktopFile(candidate); + if (contents === null || contents.includes(GENERATED_MARKER)) continue; + if (!desktopExecRunsPath(readDesktopEntryValue(contents, 'Exec'), execPath)) continue; + if (isAppImageIntegratorEntry(contents, execPath)) return candidate; + firstMatch ??= candidate; } - return null; + return firstMatch; } export function escapeDesktopValue(value: string): string { @@ -158,7 +178,7 @@ function buildDesktopFileBody(execPath: string, hidden: boolean): string { 'Terminal=false', 'Categories=Network;InstantMessaging;Chat;', `MimeType=x-scheme-handler/${APP_PROTOCOL};`, - `StartupWMClass=${WM_CLASS}`, + ...(hidden ? [] : [`StartupWMClass=${WM_CLASS}`]), 'SingleMainWindow=true', 'StartupNotify=true', ...(hidden ? ['NoDisplay=true'] : []), @@ -179,15 +199,6 @@ function buildDesktopFileContents(execPath: string, hidden: boolean): string { ); } -function readDesktopEntryValue(contents: string, key: string): string | null { - for (const line of contents.split('\n')) { - const trimmed = line.trim(); - if (trimmed.startsWith('[Desktop Action ')) break; - if (trimmed.startsWith(`${key}=`)) return trimmed.slice(key.length + 1).trim(); - } - return null; -} - function isExecutableFile(candidate: string): boolean { try { if (!fs.statSync(candidate).isFile()) return false; @@ -290,11 +301,12 @@ function removeLegacyGeneratedDesktopEntry(): boolean { return removeFile(legacyPath, 'Removed the generated .desktop entry for the previous desktop id'); } -function writeDesktopFileAtomically(filePath: string, contents: string): void { +function writeDesktopFileAtomically(filePath: string, contents: string, mode = 0o644): void { const tempPath = `${filePath}.${crypto.randomBytes(8).toString('hex')}.tmp`; try { fs.mkdirSync(path.dirname(filePath), {recursive: true}); - fs.writeFileSync(tempPath, contents, {encoding: 'utf8', mode: 0o644, flag: 'wx'}); + fs.writeFileSync(tempPath, contents, {encoding: 'utf8', mode, flag: 'wx'}); + fs.chmodSync(tempPath, mode); fs.renameSync(tempPath, filePath); } catch (error) { try { @@ -304,6 +316,25 @@ function writeDesktopFileAtomically(filePath: string, contents: string): void { } } +function claimThirdPartyWindowClass(filePath: string, execPath: string): boolean { + if (path.dirname(filePath) !== getUserApplicationsDir()) return false; + const contents = readExistingDesktopFile(filePath); + if (contents === null || !isAppImageIntegratorEntry(contents, execPath)) return false; + if (readDesktopEntryValue(contents, 'StartupWMClass') === WM_CLASS) return false; + const updated = setDesktopEntryValue(contents, 'StartupWMClass', WM_CLASS); + if (updated === contents) return false; + try { + const stat = fs.lstatSync(filePath); + if (!stat.isFile()) return false; + writeDesktopFileAtomically(filePath, updated, stat.mode & 0o777); + logger.info('Set our window class on the integrator .desktop entry so the window groups with it', {filePath}); + return true; + } catch (error) { + logger.warn('Failed to set the window class on the integrator .desktop entry', {filePath, error}); + return false; + } +} + function syncUserDesktopEntry(): boolean { const execPath = getStableLinuxLaunchPath(); const filePath = getDesktopFilePath(); @@ -326,10 +357,11 @@ function syncUserDesktopEntry(): boolean { if (thirdPartyEntry) { logger.debug('Another .desktop entry manages the app menu entry; keeping ours hidden', {thirdPartyEntry}); } + const claimed = thirdPartyEntry !== null && claimThirdPartyWindowClass(thirdPartyEntry, execPath); const desired = buildDesktopFileContents(execPath, thirdPartyEntry !== null); if (existing === desired) { logger.debug('Linux .desktop entry already up to date', {filePath}); - return false; + return claimed; } writeDesktopFileAtomically(filePath, desired); logger.info('Wrote Linux .desktop entry', {filePath, execPath}); diff --git a/fluxer_desktop/src/main/LinuxLauncherBadge.ts b/fluxer_desktop/src/main/LinuxLauncherBadge.ts new file mode 100644 index 000000000..2b89c7b28 --- /dev/null +++ b/fluxer_desktop/src/main/LinuxLauncherBadge.ts @@ -0,0 +1,141 @@ +// SPDX-License-Identifier: AGPL-3.0-or-later + +import fs from 'node:fs'; +import {createRequire} from 'node:module'; +import path from 'node:path'; +import { + LEGACY_LINUX_DESKTOP_ENTRY_ID, + LINUX_DESKTOP_ENTRY_ID, + OTHER_CHANNEL_LINUX_DESKTOP_FILES, +} from '@electron/common/DesktopIdentity'; +import {createChildLogger} from '@electron/common/Logger'; +import {isWindowDesktopEntry} from '@electron/main/DesktopEntryText'; +import {getLinuxPortalsMode} from '@electron/main/LaunchOptions'; +import {getLinuxApplicationsDirs} from '@electron/main/LinuxDesktopEntry'; +import {getStableLinuxLaunchPath} from '@electron/main/LinuxLaunchPath'; +import {loadOptionalNativeAddon} from '@electron/main/NativeAddon'; +import {app} from 'electron'; + +const logger = createChildLogger('LinuxLauncherBadge'); +const requireModule = createRequire(import.meta.url); +const SETTLE_REFRESH_MS = 30_000; +const PERIODIC_REFRESH_MS = 10 * 60_000; + +interface LauncherEntryBinding { + update(uri: string, count: number, countVisible: boolean): void; +} + +interface LinuxPortalsBinding { + LauncherEntry: (new (onShellStarted: () => void) => LauncherEntryBinding) | null; + loadError?: Error | null; +} + +const loadLinuxPortals = loadOptionalNativeAddon({ + platform: 'linux', + load: () => requireModule('@fluxer/linux-portals'), + logger, + level: 'warn', + unavailableMessage: 'Failed to load @fluxer/linux-portals, the launcher badge only targets the primary desktop id', + disabled: () => getLinuxPortalsMode(process.argv) === 'off', +}); + +let launcherEntry: LauncherEntryBinding | null | undefined; +let badgeCount = 0; +let windowDesktopIds: ReadonlyArray = []; +let started = false; + +function findWindowDesktopIds(): Array { + const identity = { + wmClasses: [LINUX_DESKTOP_ENTRY_ID, LEGACY_LINUX_DESKTOP_ENTRY_ID], + launchPath: getStableLinuxLaunchPath(), + }; + const primaryDesktopId = process.env.CHROME_DESKTOP; + const seen = new Set(); + const ids: Array = []; + for (const dir of getLinuxApplicationsDirs()) { + let entries: Array; + try { + entries = fs.readdirSync(dir); + } catch { + continue; + } + for (const entry of entries) { + if (!entry.endsWith('.desktop') || seen.has(entry)) continue; + seen.add(entry); + if (entry === primaryDesktopId || OTHER_CHANNEL_LINUX_DESKTOP_FILES.has(entry)) continue; + let contents: string; + try { + contents = fs.readFileSync(path.join(dir, entry), 'utf8'); + } catch { + continue; + } + if (isWindowDesktopEntry(contents, identity)) ids.push(entry); + } + } + return ids; +} + +function getLauncherEntry(): LauncherEntryBinding | null { + if (launcherEntry !== undefined) return launcherEntry; + const LauncherEntry = loadLinuxPortals()?.LauncherEntry ?? null; + try { + launcherEntry = LauncherEntry ? new LauncherEntry(emitBadge) : null; + } catch (error) { + logger.warn('Failed to open the launcher entry emitter', {error}); + launcherEntry = null; + } + return launcherEntry; +} + +function sendToDesktopIds(desktopIds: ReadonlyArray, count: number): void { + if (desktopIds.length === 0) return; + const entry = getLauncherEntry(); + if (!entry) return; + for (const desktopId of desktopIds) { + try { + entry.update(`application://${desktopId}`, count, count !== 0); + } catch (error) { + logger.warn('Failed to send the launcher badge', {desktopId, error}); + } + } +} + +function emitBadge(): void { + app.setBadgeCount(badgeCount); + sendToDesktopIds(windowDesktopIds, badgeCount); +} + +function refreshWindowDesktopIds(): void { + const next = findWindowDesktopIds(); + const added = next.filter((id) => !windowDesktopIds.includes(id)); + if (added.length > 0) { + logger.warn('Other desktop entries claim the Fluxer window, sending the launcher badge to them as well', { + desktopIds: added, + }); + } + sendToDesktopIds( + windowDesktopIds.filter((id) => !next.includes(id)), + 0, + ); + windowDesktopIds = next; + emitBadge(); +} + +export function setLinuxLauncherBadge(count: number): void { + badgeCount = count; + emitBadge(); +} + +export function reemitLinuxLauncherBadge(): void { + emitBadge(); +} + +export function startLinuxLauncherBadge(): void { + if (process.platform !== 'linux' || started) return; + started = true; + refreshWindowDesktopIds(); + getLauncherEntry(); + setTimeout(refreshWindowDesktopIds, SETTLE_REFRESH_MS).unref(); + setInterval(refreshWindowDesktopIds, PERIODIC_REFRESH_MS).unref(); + app.on('will-quit', () => sendToDesktopIds(windowDesktopIds, 0)); +} diff --git a/fluxer_desktop/src/main/TrayIconImage.ts b/fluxer_desktop/src/main/TrayIconImage.ts index b34774789..fda9ad4cd 100644 --- a/fluxer_desktop/src/main/TrayIconImage.ts +++ b/fluxer_desktop/src/main/TrayIconImage.ts @@ -18,6 +18,7 @@ const SUBSAMPLES = 4; const MIN_GLYPH_CONTRAST = 32; const GLYPH_CUTOUT_START = 0.1; const GLYPH_CUTOUT_END = 0.5; +const KDE_MONOCHROME_CANVAS_RATIO = 22 / 16; const LINUX_MAX_PIXMAP_SIZE = 256; const PNG_SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]); const DOT_BGR: Bgr = [0x00, 0x00, 0xdd]; @@ -189,11 +190,21 @@ function downscaleTrayBitmap(bitmap: TrayBitmap, size: number): TrayBitmap { return {buffer, width: size, height: size}; } +function addMonochromeTrayMargins(bitmap: TrayBitmap, size: number): TrayBitmap { + const inset = Math.floor((size - bitmap.width) / 2); + const buffer = Buffer.alloc(size * size * 4); + for (let y = 0; y < bitmap.height; y++) { + bitmap.buffer.copy(buffer, ((inset + y) * size + inset) * 4, y * bitmap.width * 4, (y + 1) * bitmap.width * 4); + } + return {buffer, width: size, height: size}; +} + export function renderTrayIcon( base: NativeImage, appearance: TrayIconAppearance, indicator: boolean, platform: NodeJS.Platform, + linuxDesktop: LinuxDesktopKind, ): NativeImage { const monochrome = appearance === 'white' || appearance === 'black'; if (!monochrome && !indicator) { @@ -202,6 +213,7 @@ export function renderTrayIcon( const result = nativeImage.createEmpty(); const scaleFactors = base.getScaleFactors(); const linuxMonochrome = platform === 'linux' && monochrome; + const kdeMargins = linuxMonochrome && linuxDesktop === 'kde'; const representations: Array<{scaleFactor: number; bitmap: TrayBitmap}> = []; for (const scaleFactor of scaleFactors.length > 0 ? scaleFactors : [1]) { if (!Number.isFinite(scaleFactor) || scaleFactor <= 0) continue; @@ -224,6 +236,10 @@ export function renderTrayIcon( representations.push({scaleFactor, bitmap}); } if (representations.length === 0) return base; + const kdeLogicalCanvasSize = Math.ceil( + Math.max(...representations.map(({scaleFactor, bitmap}) => bitmap.width / scaleFactor)) * + KDE_MONOCHROME_CANVAS_RATIO, + ); for (const {scaleFactor, bitmap: source} of representations) { let bitmap = source; if (monochrome) { @@ -237,7 +253,13 @@ export function renderTrayIcon( appearance === 'template' ? TEMPLATE_DOT_BGR : DOT_BGR, ); } - if (linuxMonochrome) { + if (kdeMargins) { + const canvasSize = Math.min(Math.ceil(kdeLogicalCanvasSize * scaleFactor), LINUX_MAX_PIXMAP_SIZE); + bitmap = addMonochromeTrayMargins( + downscaleTrayBitmap(bitmap, Math.floor(canvasSize / KDE_MONOCHROME_CANVAS_RATIO)), + canvasSize, + ); + } else if (linuxMonochrome) { bitmap = downscaleTrayBitmap(bitmap, LINUX_MAX_PIXMAP_SIZE); } result.addRepresentation({scaleFactor, ...bitmap}); diff --git a/fluxer_desktop/src/main/Window.ts b/fluxer_desktop/src/main/Window.ts index 8b50a571a..ece841c5b 100644 --- a/fluxer_desktop/src/main/Window.ts +++ b/fluxer_desktop/src/main/Window.ts @@ -31,6 +31,7 @@ import {drainPendingDisplayMediaRequests, registerDisplayMediaRequestHandler} fr import {isNativeGatewayPermitted} from '@electron/main/GatewaySocketNativeBoundary'; import {armHiddenWindowMemoryRelease} from '@electron/main/HiddenWindowMemory'; import {shouldDisableV8CodeCache} from '@electron/main/LaunchOptions'; +import {reemitLinuxLauncherBadge} from '@electron/main/LinuxLauncherBadge'; import {getDesktopLocalAppAuthorization} from '@electron/main/LocalAppProtocolAuthorization'; import {isLocalAppRendererDocumentURL, isLocalAppURL} from '@electron/main/LocalAppURL'; import {cancelPendingFullScreenHide, hideWindowLeavingFullScreen} from '@electron/main/MacFullScreenHide'; @@ -1010,6 +1011,10 @@ export function createWindow(options: CreateWindowOptions = {}): BrowserWindow { refreshWindowsBadgeOverlay(mainWindow); }); } + if (process.platform === 'linux') { + mainWindow.on('show', reemitLinuxLauncherBadge); + mainWindow.on('focus', reemitLinuxLauncherBadge); + } const webContents = mainWindow.webContents; const session = webContents.session; runtimeSecurity.install(session); diff --git a/fluxer_desktop/src/main/index.ts b/fluxer_desktop/src/main/index.ts index 2f6efb22a..f79107bcc 100644 --- a/fluxer_desktop/src/main/index.ts +++ b/fluxer_desktop/src/main/index.ts @@ -81,6 +81,7 @@ import {cleanupLegacyHarvestHandlers, registerLegacyHarvestHandlers} from '@elec import {initializeLegacyOriginHarvest} from '@electron/main/LegacyOriginHarvest'; import {cleanupVirtmic, registerVirtmicHandlers} from '@electron/main/LinuxAudioCapture'; import {ensureLinuxDesktopEntry} from '@electron/main/LinuxDesktopEntry'; +import {startLinuxLauncherBadge} from '@electron/main/LinuxLauncherBadge'; import {cleanupDesktopLocalAppProtocol} from '@electron/main/LocalAppProtocol'; import {initializeMainI18n, t} from '@electron/main/MainI18n'; import {createApplicationMenu} from '@electron/main/Menu'; @@ -825,6 +826,11 @@ export async function finishMainAppStartup(): Promise { } catch (error) { log.error('[Init] Failed to ensure the Linux desktop entry:', error); } + try { + runStartupPhase('linux-launcher-badge', startLinuxLauncherBadge); + } catch (error) { + log.error('[Init] Failed to start the Linux launcher badge:', error); + } try { runStartupPhase('jump-list', initializeJumpList); } catch (error) { diff --git a/fluxer_desktop/vitest.config.ts b/fluxer_desktop/vitest.config.ts new file mode 100644 index 000000000..35d26c73e --- /dev/null +++ b/fluxer_desktop/vitest.config.ts @@ -0,0 +1,3 @@ +// SPDX-License-Identifier: AGPL-3.0-or-later + +export {default} from '../tsconfigs/vitest.base.mts'; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a936da869..900c2e5fa 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1810,6 +1810,9 @@ importers: typescript: specifier: catalog:ts7 version: 7.0.2 + vitest: + specifier: 'catalog:' + version: 5.0.5(@opentelemetry/api@1.9.1)(@types/node@24.19.2)(happy-dom@20.14.6)(msw@3.0.3(@types/node@24.19.2)(graphql@16.14.2)(supports-color@7.2.0)(typescript@7.0.2)(vite@8.3.5(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)))(vite@8.3.5(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)) optionalDependencies: '@fluxer/app-store': specifier: file:./native/app-store @@ -6392,7 +6395,9 @@ packages: '@smithy/core@3.37.0': resolution: {integrity: sha512-97imTcCyiPd8k0e9+ts/Sp0W65Dn9Ti357J7M09Ov4tI8Q1JDJVFSoAJtjEVKqfHEr3Pdo2jfolqKCaaiszH0g==} engines: {node: '>=18.0.0'} - deprecated: Deprecated due to a bug in custom logger data redaction. See https://github.com/aws/aws-sdk-js-v3/issues/8393. + deprecated: |- + Deprecated due to a bug in custom logger data redaction. Upgrade to the latest version. If you used a custom logger with this + version, review your logs and rotate any credentials or other secrets. See https://github.com/aws/aws-sdk-js-v3/issues/8393. '@smithy/credential-provider-imds@4.5.2': resolution: {integrity: sha512-A9uSdn72ozbRUSit0eib0TW7nXuNPlaeM0zcGkJ+nE6tFcSDbnmtwoxbTCFBukVQcszDAyvsd7+rTduPTXpygg==} @@ -11051,6 +11056,7 @@ packages: tldts-core@7.4.20: resolution: {integrity: sha512-C630TWXZCZmLq0F2bW4QqwnaaxCQ/svpAqvJwnC4JvgEM5ohhBnGsEzTLSOXcN+xjz+kEaHS5uoWIw2klnqd0A==} + deprecated: Partial release, see https://github.com/remusao/tldts/issues/2735. Use >=7.4.22. tldts@7.4.19: resolution: {integrity: sha512-48dH6aSpQnpbzDUc4vIQZ1VjB8tkK+e8c1yx05/SZK+rkssgjEOlxDd/yU8/a4vGYQ9vRgJr9dwMq9TJ0b3X2Q==} @@ -14454,6 +14460,14 @@ snapshots: '@inquirer/ansi@2.0.10': {} + '@inquirer/confirm@6.3.5(@types/node@24.19.2)': + dependencies: + '@inquirer/core': 12.0.6(@types/node@24.19.2) + '@inquirer/type': 4.2.1(@types/node@24.19.2) + optionalDependencies: + '@types/node': 24.19.2 + optional: true + '@inquirer/confirm@6.3.5(@types/node@26.6.6)': dependencies: '@inquirer/core': 12.0.6(@types/node@26.6.6) @@ -14461,6 +14475,19 @@ snapshots: optionalDependencies: '@types/node': 26.6.6 + '@inquirer/core@12.0.6(@types/node@24.19.2)': + dependencies: + '@inquirer/ansi': 2.0.10 + '@inquirer/figures': 2.0.10 + '@inquirer/type': 4.2.1(@types/node@24.19.2) + cli-width: 4.1.0 + fast-wrap-ansi: 0.2.2 + mute-stream: 3.0.0 + signal-exit: 4.1.0 + optionalDependencies: + '@types/node': 24.19.2 + optional: true + '@inquirer/core@12.0.6(@types/node@26.6.6)': dependencies: '@inquirer/ansi': 2.0.10 @@ -14475,6 +14502,11 @@ snapshots: '@inquirer/figures@2.0.10': {} + '@inquirer/type@4.2.1(@types/node@24.19.2)': + optionalDependencies: + '@types/node': 24.19.2 + optional: true + '@inquirer/type@4.2.1(@types/node@26.6.6)': optionalDependencies: '@types/node': 26.6.6 @@ -16507,6 +16539,16 @@ snapshots: msw: 2.15.0(@types/node@26.6.6)(typescript@7.0.2) vite: 8.3.5(@types/node@26.6.6)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1) + '@vitest/mocker@5.0.5(msw@3.0.3(@types/node@24.19.2)(graphql@16.14.2)(supports-color@7.2.0)(typescript@7.0.2)(vite@8.3.5(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)))(vite@8.3.5(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1))': + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + '@vitest/spy': 5.0.5 + estree-walker: 3.0.3 + magic-string: 1.4.5 + optionalDependencies: + msw: 3.0.3(@types/node@24.19.2)(graphql@16.14.2)(supports-color@7.2.0)(typescript@7.0.2)(vite@8.3.5(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)) + vite: 8.3.5(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1) + '@vitest/mocker@5.0.5(msw@3.0.3(@types/node@26.6.6)(graphql@16.14.2)(supports-color@7.2.0)(typescript@7.0.2)(vite@8.3.5(@types/node@26.6.6)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)))(vite@8.3.5(@types/node@26.6.6)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1))': dependencies: '@jridgewell/trace-mapping': 0.3.31 @@ -19891,6 +19933,29 @@ snapshots: transitivePeerDependencies: - '@types/node' + msw@3.0.3(@types/node@24.19.2)(graphql@16.14.2)(supports-color@7.2.0)(typescript@7.0.2)(vite@8.3.5(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)): + dependencies: + '@inquirer/confirm': 6.3.5(@types/node@24.19.2) + '@msw/url': 0.1.2 + '@mswjs/interceptors': 0.45.10(supports-color@7.2.0) + cookie: 2.0.1 + headers-polyfill: 5.0.1 + is-node-process: 1.2.0 + outvariant: 1.4.3 + rettime: 0.11.12 + tough-cookie: 6.0.2 + type-fest: 5.10.0 + until-async: 3.0.2 + yargs: 18.2.0 + optionalDependencies: + graphql: 16.14.2 + typescript: 7.0.2 + vite: 8.3.5(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1) + transitivePeerDependencies: + - '@types/node' + - supports-color + optional: true + msw@3.0.3(@types/node@26.6.6)(graphql@16.14.2)(supports-color@7.2.0)(typescript@7.0.2)(vite@8.3.5(@types/node@26.6.6)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)): dependencies: '@inquirer/confirm': 6.3.5(@types/node@26.6.6) @@ -21968,6 +22033,21 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.3 + vite@8.3.5(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1): + dependencies: + lightningcss: 1.33.0 + picomatch: 4.0.7 + postcss: 8.5.32 + rolldown: 1.2.16 + tinyglobby: 0.2.17 + optionalDependencies: + '@types/node': 24.19.2 + esbuild: 0.28.2 + fsevents: 2.3.3 + jiti: 2.7.0 + tsx: 4.23.15 + yaml: 2.9.1 + vite@8.3.5(@types/node@26.6.6)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1): dependencies: lightningcss: 1.33.0 @@ -21987,6 +22067,29 @@ snapshots: optionalDependencies: vite: 8.3.5(@types/node@26.6.6)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1) + vitest@5.0.5(@opentelemetry/api@1.9.1)(@types/node@24.19.2)(happy-dom@20.14.6)(msw@3.0.3(@types/node@24.19.2)(graphql@16.14.2)(supports-color@7.2.0)(typescript@7.0.2)(vite@8.3.5(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)))(vite@8.3.5(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)): + dependencies: + '@types/chai': 5.2.3 + '@vitest/mocker': 5.0.5(msw@3.0.3(@types/node@24.19.2)(graphql@16.14.2)(supports-color@7.2.0)(typescript@7.0.2)(vite@8.3.5(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)))(vite@8.3.5(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)) + chai: 6.3.0 + es-module-lexer: 2.3.2 + expect-type: 1.4.0 + magic-string: 1.4.5 + obug: 3.0.0 + picomatch: 4.0.7 + std-env: 4.3.0 + tinybench: 6.2.2 + tinyexec: 1.3.1 + tinyglobby: 0.2.17 + vite: 8.3.5(@types/node@24.19.2)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1) + why-is-node-running: 3.2.1 + optionalDependencies: + '@opentelemetry/api': 1.9.1 + '@types/node': 24.19.2 + happy-dom: 20.14.6 + transitivePeerDependencies: + - msw + vitest@5.0.5(@opentelemetry/api@1.9.1)(@types/node@26.6.6)(happy-dom@20.14.6)(msw@2.15.0(@types/node@26.6.6)(typescript@7.0.2))(vite@8.3.5(@types/node@26.6.6)(esbuild@0.28.2)(jiti@2.7.0)(tsx@4.23.15)(yaml@2.9.1)): dependencies: '@types/chai': 5.2.3