Complete Phase E theming, onboarding, and Windows share integration

Adds theme presets (Toffee/Slate/Evergreen/Lavender) with a "follow system"
mode and high-contrast awareness, a first-run welcome screen, and the
Windows analog of Android's share sheet for a Win32 app: an aerofetch://
protocol handler plus an Explorer "Send to AeroFetch" entry, both routed
through a single-instance lock so a second launch hands its link to the
already-running window instead of opening a duplicate.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-23 08:45:09 -04:00
parent a822a2bb52
commit fa78b13cac
17 changed files with 883 additions and 77 deletions
+72
View File
@@ -0,0 +1,72 @@
import { describe, it, expect, afterEach } from 'vitest'
import { mkdtempSync, writeFileSync, rmSync } from 'fs'
import { tmpdir } from 'os'
import { join } from 'path'
import { extractIncomingUrl } from '../src/main/deeplink'
const TARGET = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
let dir: string | null = null
function urlFile(name: string, contents: string): string {
dir ??= mkdtempSync(join(tmpdir(), 'aerofetch-deeplink-'))
const path = join(dir, name)
writeFileSync(path, contents)
return path
}
afterEach(() => {
if (dir) rmSync(dir, { recursive: true, force: true })
dir = null
})
describe('extractIncomingUrl — aerofetch:// protocol', () => {
it('extracts the url= query param', () => {
const arg = `aerofetch://download?url=${encodeURIComponent(TARGET)}`
expect(extractIncomingUrl(['AeroFetch.exe', arg])).toBe(TARGET)
})
it('finds the protocol arg regardless of its position in argv', () => {
const arg = `aerofetch://download?url=${encodeURIComponent(TARGET)}`
expect(extractIncomingUrl(['AeroFetch.exe', '--some-flag', arg])).toBe(TARGET)
})
it('rejects a non-http(s) target (defence in depth)', () => {
const arg = `aerofetch://download?url=${encodeURIComponent('file:///C:/secrets.txt')}`
expect(extractIncomingUrl(['AeroFetch.exe', arg])).toBeNull()
})
it('ignores a malformed protocol invocation', () => {
expect(extractIncomingUrl(['AeroFetch.exe', 'aerofetch://'])).toBeNull()
})
it('returns null when there is no url= param', () => {
expect(extractIncomingUrl(['AeroFetch.exe', 'aerofetch://download'])).toBeNull()
})
})
describe('extractIncomingUrl — .url Internet Shortcut (Explorer "Send to")', () => {
it('reads the URL= line from a real .url file', () => {
const path = urlFile('Video.url', `[InternetShortcut]\r\nURL=${TARGET}\r\n`)
expect(extractIncomingUrl(['AeroFetch.exe', path])).toBe(TARGET)
})
it('rejects a .url file whose target is not http(s)', () => {
const path = urlFile('Local.url', '[InternetShortcut]\r\nURL=file:///C:/secrets.txt\r\n')
expect(extractIncomingUrl(['AeroFetch.exe', path])).toBeNull()
})
it('returns null for a .url path that does not exist on disk', () => {
expect(extractIncomingUrl(['AeroFetch.exe', 'C:\\nope\\Missing.url'])).toBeNull()
})
it('ignores files that merely end in .url-like text but are not real paths', () => {
expect(extractIncomingUrl(['AeroFetch.exe', 'not-a-real-path.url'])).toBeNull()
})
})
describe('extractIncomingUrl — no match', () => {
it('returns null for ordinary argv (e.g. plain launch)', () => {
expect(extractIncomingUrl(['AeroFetch.exe'])).toBeNull()
expect(extractIncomingUrl([])).toBeNull()
})
})