mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-13 04:57:29 +00:00
fix(startup): enforce keychain consent before credential access
Keep credential-store operations behind a per-process consent gate, prevent duplicate native grant requests, and defer legacy token migration until explicit consent. Harden the RTL/sidebar, custom window controls, bidi copy, and queue editor fixes. Refs #17
This commit is contained in:
@@ -7,14 +7,16 @@ describe('shouldUseCustomWindowControls', () => {
|
||||
expect(shouldUseCustomWindowControls('unknown', 'Mozilla/5.0 (X11; Linux x86_64)')).toBe(true);
|
||||
});
|
||||
|
||||
it('does not render custom controls for macOS', () => {
|
||||
expect(shouldUseCustomWindowControls('unknown', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 14_0)')).toBe(false);
|
||||
expect(shouldUseCustomWindowControls('macos', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 14_0)')).toBe(false);
|
||||
it('keeps custom controls present for macOS while platform detection is unresolved', () => {
|
||||
expect(shouldUseCustomWindowControls('unknown', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 14_0)')).toBe(true);
|
||||
expect(shouldUseCustomWindowControls('macos', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 14_0)')).toBe(true);
|
||||
});
|
||||
|
||||
it('only opts into the supported desktop platforms', () => {
|
||||
expect(shouldUseCustomWindowControls('windows', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)')).toBe(true);
|
||||
expect(shouldUseCustomWindowControls('linux', 'Mozilla/5.0 (X11; Linux x86_64)')).toBe(true);
|
||||
expect(shouldUseCustomWindowControls('macos', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 14_0)')).toBe(true);
|
||||
expect(shouldUseCustomWindowControls('android', 'Mozilla/5.0 (Linux; Android 14)')).toBe(false);
|
||||
expect(shouldUseCustomWindowControls('unknown', 'Mozilla/5.0 (Linux; Android 14; Mobile)')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -9,8 +9,15 @@ const fallback: PlatformInfo = {
|
||||
portable: false
|
||||
};
|
||||
|
||||
export const shouldUseCustomWindowControls = (os: string, userAgent: string): boolean =>
|
||||
!userAgent.includes('Mac') && (os === 'windows' || os === 'linux' || os === 'unknown');
|
||||
export const shouldUseCustomWindowControls = (os: string, userAgent: string): boolean => {
|
||||
if (os === 'windows' || os === 'linux' || os === 'macos') return true;
|
||||
if (os !== 'unknown') return false;
|
||||
|
||||
// Keep the custom titlebar visible while the native platform query is
|
||||
// resolving. Mobile user agents are the only unknown targets that must not
|
||||
// receive desktop window controls.
|
||||
return !/Android|iPhone|iPad|iPod|Mobile/i.test(userAgent);
|
||||
};
|
||||
|
||||
let cached: PlatformInfo | null = null;
|
||||
let pending: Promise<PlatformInfo> | null = null;
|
||||
|
||||
Reference in New Issue
Block a user