@64mb/freelens-power 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/out/main/common/dashboard-picker.js +4 -4
  3. package/out/main/common/dashboard-picker.js.map +1 -1
  4. package/out/main/common/dashboard-readiness.js +17 -47
  5. package/out/main/common/dashboard-readiness.js.map +1 -1
  6. package/out/main/common/dashboard-selector.js +40 -6
  7. package/out/main/common/dashboard-selector.js.map +1 -1
  8. package/out/main/common/dashboard.js +1 -0
  9. package/out/main/common/dashboard.js.map +1 -1
  10. package/out/main/common/settings-export.js +1 -1
  11. package/out/main/common/settings-export.js.map +1 -1
  12. package/out/main/common/store/dashboard-preferences-store.js +2 -1
  13. package/out/main/common/store/dashboard-preferences-store.js.map +1 -1
  14. package/out/main/dashboard-picker.js +1 -4
  15. package/out/main/dashboard-picker.js.map +1 -1
  16. package/out/main/dashboard-preload.js +110 -0
  17. package/out/main/dashboard-preload.js.map +1 -0
  18. package/out/main/dashboard-views.js +216 -61
  19. package/out/main/dashboard-views.js.map +1 -1
  20. package/out/main/dock-icon.js +25 -10
  21. package/out/main/dock-icon.js.map +1 -1
  22. package/out/main/index.js +2 -0
  23. package/out/main/index.js.map +1 -1
  24. package/out/main/splash-accent.js +84 -0
  25. package/out/main/splash-accent.js.map +1 -0
  26. package/out/renderer/appearance.js +6 -2
  27. package/out/renderer/appearance.js.map +1 -1
  28. package/out/renderer/dashboard.js +69 -15
  29. package/out/renderer/dashboard.js.map +1 -1
  30. package/out/renderer/preferences/dashboard-preferences.js +16 -1
  31. package/out/renderer/preferences/dashboard-preferences.js.map +1 -1
  32. package/out/renderer/preferences/settings-modal.js.map +1 -1
  33. package/out/renderer/src/common/dashboard-picker.js.map +1 -1
  34. package/out/renderer/src/common/dashboard-selector.js.map +1 -1
  35. package/out/renderer/src/common/dashboard.js +1 -0
  36. package/out/renderer/src/common/dashboard.js.map +1 -1
  37. package/out/renderer/src/common/settings-export.js.map +1 -1
  38. package/out/renderer/src/common/store/dashboard-preferences-store.js +2 -1
  39. package/out/renderer/src/common/store/dashboard-preferences-store.js.map +1 -1
  40. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard-views.js","names":[],"sources":["../../src/main/dashboard-views.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { join } from \"node:path\";\nimport {\n app,\n BrowserWindow,\n type IpcMainInvokeEvent,\n ipcMain,\n nativeTheme,\n type Rectangle,\n session,\n shell,\n View,\n type WebContents,\n WebContentsView,\n} from \"electron\";\nimport { reaction } from \"mobx\";\nimport { sanitizeDashboardCards } from \"../common/dashboard\";\nimport { dashboardReadinessScript } from \"../common/dashboard-readiness\";\nimport { dashboardSelectorScript } from \"../common/dashboard-selector\";\nimport {\n DASHBOARD_SITE_ICONS,\n DASHBOARD_VIEWS_LOADING,\n DASHBOARD_VIEWS_PIN,\n DASHBOARD_VIEWS_PINNED,\n type DashboardSiteIcon,\n} from \"../common/dashboard-views\";\nimport { DashboardPreferencesStore } from \"../common/store/dashboard-preferences-store\";\nimport { boundedDashboardIcons, loadDashboardIcons, saveDashboardIcons } from \"./dashboard-icon-cache\";\nimport { observeDashboardNetwork } from \"./dashboard-network\";\n\nconst syncChannel = \"freelens-power:dashboard-views:sync\";\nconst reloadChannel = \"freelens-power:dashboard-views:reload\";\nconst clearChannel = \"freelens-power:dashboard-views:clear\";\nconst dashboardPath = \"/extension/freelens-power/dashboard\";\nconst websiteStyles =\n \"* { scrollbar-width: none !important; } *::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }\";\n\nfunction rendererUrl(value: string, dashboardOnly = false): boolean {\n try {\n const url = new URL(value);\n return (\n url.protocol === \"https:\" &&\n (url.hostname === \"renderer.freelens.app\" || url.hostname.endsWith(\".renderer.freelens.app\")) &&\n (!dashboardOnly || url.pathname === dashboardPath)\n );\n } catch {\n return false;\n }\n}\nfunction dashboardUrl(value: string): boolean {\n return rendererUrl(value, true);\n}\nfunction webUrl(value: string): boolean {\n try {\n return [\"https:\", \"http:\"].includes(new URL(value).protocol);\n } catch {\n return false;\n }\n}\nfunction rectangle(value: unknown): Rectangle | undefined {\n if (!value || typeof value !== \"object\") return;\n const rect = value as Rectangle;\n if (\n ![rect.x, rect.y, rect.width, rect.height].every(\n (n) => Number.isFinite(n) && Number.isInteger(n) && Math.abs(n) <= 32768,\n ) ||\n rect.width <= 0 ||\n rect.height <= 0\n )\n return;\n return { x: rect.x, y: rect.y, width: rect.width, height: rect.height };\n}\n\ntype CardView = {\n container: View;\n view: WebContentsView;\n url: string;\n failed: boolean;\n loading: boolean;\n visible: boolean;\n generation: number;\n stopPreparation?: () => void;\n selector?: string;\n pending?: Promise<void>;\n favicon?: string;\n faviconRequest?: AbortController;\n refreshTimer?: ReturnType<typeof setInterval>;\n floating?: BrowserWindow;\n floatingPreparation?: { refresh: () => Promise<boolean>; selectorChanged: () => void; stop: () => void };\n};\ntype Owner = { window: BrowserWindow; cards: Map<string, CardView>; cleanup: () => void };\n\nasync function waitForReadiness(\n contents: WebContents,\n network: ReturnType<typeof observeDashboardNetwork>,\n selector: () => string | undefined,\n current: () => boolean,\n): Promise<void> {\n let deadline: ReturnType<typeof setTimeout> | undefined;\n try {\n await Promise.race([\n (async () => {\n if (!current()) return;\n await network.ready();\n if (!current()) return;\n await contents\n .executeJavaScriptInIsolatedWorld(1004, [{ code: dashboardSelectorScript(selector()) }])\n .catch(() => {});\n do {\n await network.wait();\n if (!current()) return;\n await contents.executeJavaScriptInIsolatedWorld(1004, [{ code: dashboardReadinessScript(selector()) }]);\n } while (current() && !network.quiet());\n })().catch(() => new Promise<void>((resolve) => setTimeout(resolve, 200))),\n new Promise<void>((resolve) => {\n deadline = setTimeout(resolve, 8500);\n }),\n ]);\n } finally {\n clearTimeout(deadline);\n }\n}\n\nexport function startDashboardViews(): () => void {\n const websiteSession = session.fromPartition(\"persist:freelens-power-websites\");\n websiteSession.setPermissionRequestHandler((_contents, _permission, callback) => callback(false));\n websiteSession.setPermissionCheckHandler(() => false);\n const owners = new Map<WebContents, Owner>();\n const icons = new Map<string, DashboardSiteIcon>();\n const remove = (owner: Owner, id: string) => {\n const card = owner.cards.get(id);\n if (!card) return;\n owner.cards.delete(id);\n card.stopPreparation?.();\n card.faviconRequest?.abort();\n clearInterval(card.refreshTimer);\n card.floatingPreparation?.stop();\n card.floating?.destroy();\n card.floating = undefined;\n if (!owner.window.isDestroyed()) owner.window.contentView.removeChildView(card.container);\n if (!card.view.webContents.isDestroyed()) card.view.webContents.close();\n };\n const clear = (sender: WebContents) => {\n const owner = owners.get(sender);\n if (!owner) return;\n owners.delete(sender);\n for (const id of owner.cards.keys()) remove(owner, id);\n owner.cleanup();\n };\n const hide = (sender: WebContents) => {\n for (const card of owners.get(sender)?.cards.values() ?? []) {\n card.visible = false;\n card.container.setVisible(false);\n }\n };\n const configuredCards = () =>\n sanitizeDashboardCards(DashboardPreferencesStore.getInstanceOrCreate<DashboardPreferencesStore>().cards);\n const cachePath = join(app.getPath(\"userData\"), \"freelens-power\", \"dashboard-icons.json\");\n const ready = loadDashboardIcons(cachePath).then((saved) => {\n const configured = configuredCards();\n for (const icon of saved) {\n if (!icons.has(icon.id) && configured.some((card) => card.id === icon.id && card.url === icon.pageUrl))\n icons.set(icon.id, icon);\n }\n });\n let writes = ready;\n const persistIcons = () => {\n writes = writes\n .then(async () => {\n const configured = configuredCards();\n const bounded = boundedDashboardIcons(\n [...icons.values()].filter((icon) =>\n configured.some((card) => card.id === icon.id && card.url === icon.pageUrl),\n ),\n );\n icons.clear();\n for (const icon of bounded) icons.set(icon.id, icon);\n await saveDashboardIcons(cachePath, bounded);\n })\n .catch(() => {});\n };\n persistIcons();\n const publishLoading = (card: CardView) => {\n for (const [sender, owner] of owners) {\n const id = [...owner.cards].find(([, candidate]) => candidate === card)?.[0];\n if (\n !id ||\n sender.isDestroyed() ||\n !dashboardUrl(sender.mainFrame.url) ||\n !dashboardUrl(sender.getURL()) ||\n !configuredCards().some((configured) => configured.id === id && configured.url === card.url)\n )\n continue;\n sender.send(DASHBOARD_VIEWS_LOADING, { id, url: card.url, loading: card.loading, failed: card.failed });\n }\n };\n const reload = (card: CardView, configuredUrl: string, initial = false) => {\n const current = card.view.webContents.getURL();\n const target = !initial && card.url === configuredUrl && webUrl(current) ? current : configuredUrl;\n card.faviconRequest?.abort();\n card.url = configuredUrl;\n card.failed = false;\n card.loading = true;\n card.stopPreparation?.();\n const contents = card.view.webContents;\n const backgroundThrottling = contents.getBackgroundThrottling();\n if (backgroundThrottling) contents.setBackgroundThrottling(false);\n const network = observeDashboardNetwork(card.view.webContents);\n let stopped = false;\n const stopPreparation = () => {\n if (stopped) return;\n stopped = true;\n network.dispose();\n contents.removeListener(\"destroyed\", stopPreparation);\n if (!contents.isDestroyed() && backgroundThrottling && !contents.getBackgroundThrottling())\n contents.setBackgroundThrottling(backgroundThrottling);\n if (card.stopPreparation === stopPreparation) card.stopPreparation = undefined;\n };\n card.stopPreparation = stopPreparation;\n contents.once(\"destroyed\", stopPreparation);\n const generation = ++card.generation;\n card.container.setVisible(false);\n publishLoading(card);\n const settled = (failed: boolean) => {\n if (card.generation !== generation || card.view.webContents.isDestroyed()) return;\n card.failed = failed;\n card.loading = false;\n for (const [sender, owner] of owners) {\n if (![...owner.cards.values()].includes(card)) continue;\n card.container.setVisible(card.visible && !card.floating && !failed && dashboardUrl(sender.getURL()));\n }\n publishLoading(card);\n };\n const load = () => {\n if (\n card.generation !== generation ||\n card.view.webContents.isDestroyed() ||\n ![...owners.values()].some((owner) => [...owner.cards.values()].includes(card))\n )\n return Promise.resolve();\n return card.view.webContents.loadURL(target);\n };\n card.pending = load().then(\n async () => {\n let preparing = true;\n const current = () =>\n preparing &&\n card.generation === generation &&\n !card.view.webContents.isDestroyed() &&\n [...owners.values()].some((owner) => [...owner.cards.values()].includes(card));\n try {\n await waitForReadiness(contents, network, () => card.selector, current);\n } finally {\n preparing = false;\n stopPreparation();\n }\n settled(false);\n },\n () => {\n stopPreparation();\n settled(true);\n },\n );\n return card.pending;\n };\n const applySelector = (card: { view: { webContents: WebContents }; selector?: string }) => {\n if (card.view.webContents.isDestroyed()) return Promise.resolve();\n return card.view.webContents\n .executeJavaScriptInIsolatedWorld(1004, [{ code: dashboardSelectorScript(card.selector) }])\n .catch(() => {});\n };\n const refreshTimers = () => {\n const configured = configuredCards();\n for (const [id, icon] of icons) {\n if (!configured.some((card) => card.id === id && card.url === icon.pageUrl)) {\n icons.delete(id);\n persistIcons();\n }\n }\n for (const [sender, owner] of owners) {\n for (const [id, card] of owner.cards) {\n const setting = configured.find((item) => item.id === id);\n if (!setting || setting.url !== card.url) {\n remove(owner, id);\n continue;\n }\n if (card.selector !== setting.selector) {\n card.selector = setting.selector;\n applySelector(card);\n card.floatingPreparation?.selectorChanged();\n }\n if (card.floating && !card.floating.isDestroyed()) card.floating.setTitle(setting.title);\n if (!setting.autoRefresh) {\n clearInterval(card.refreshTimer);\n card.refreshTimer = undefined;\n continue;\n }\n if (card.refreshTimer) continue;\n card.refreshTimer = setInterval(() => {\n const latest = configuredCards().find((item) => item.id === id);\n if (\n owners.get(sender) !== owner ||\n card.floating ||\n dashboardUrl(sender.getURL()) ||\n owner.cards.get(id) !== card ||\n !latest?.autoRefresh ||\n latest.url !== card.url ||\n card.view.webContents.isDestroyed() ||\n card.view.webContents.isLoading()\n )\n return;\n void reload(card, latest.url);\n }, 600000);\n }\n }\n };\n const stopSettingsReaction = reaction(\n () =>\n JSON.stringify(\n configuredCards().map(({ id, title, url, autoRefresh, selector }) => ({\n id,\n title,\n url,\n autoRefresh,\n selector,\n })),\n ),\n refreshTimers,\n );\n const trusted = (event: IpcMainInvokeEvent) =>\n event.senderFrame === event.sender.mainFrame &&\n dashboardUrl(event.senderFrame?.url ?? \"\") &&\n dashboardUrl(event.sender.getURL());\n ipcMain.handle(DASHBOARD_SITE_ICONS, async (event) => {\n if (\n event.senderFrame !== event.sender.mainFrame ||\n !rendererUrl(event.senderFrame?.url ?? \"\") ||\n !rendererUrl(event.sender.getURL()) ||\n !BrowserWindow.fromWebContents(event.sender)\n )\n return [];\n await ready;\n return configuredCards().flatMap((card) => {\n const icon = icons.get(card.id);\n return icon?.pageUrl === card.url ? [icon] : [];\n });\n });\n ipcMain.handle(syncChannel, async (event, payload: unknown) => {\n if (!trusted(event)) return;\n const window = BrowserWindow.fromWebContents(event.sender);\n if (!window || window.isDestroyed()) return;\n const requested =\n payload && typeof payload === \"object\" && \"cards\" in payload && Array.isArray(payload.cards) ? payload.cards : [];\n const cards = sanitizeDashboardCards(\n DashboardPreferencesStore.getInstanceOrCreate<DashboardPreferencesStore>().cards,\n );\n let owner = owners.get(event.sender);\n if (!owner) {\n const sender = event.sender;\n const navigation = (_event: unknown, url: string) => {\n if (!dashboardUrl(url)) hide(sender);\n };\n const destroyed = () => clear(sender);\n sender.on(\"did-navigate\", navigation);\n sender.on(\"did-navigate-in-page\", navigation);\n sender.on(\"destroyed\", destroyed);\n owner = {\n window,\n cards: new Map(),\n cleanup: () => {\n sender.removeListener(\"did-navigate\", navigation);\n sender.removeListener(\"did-navigate-in-page\", navigation);\n sender.removeListener(\"destroyed\", destroyed);\n },\n };\n owners.set(sender, owner);\n }\n if (payload && typeof payload === \"object\" && \"hidden\" in payload && payload.hidden === true) {\n hide(event.sender);\n return { failed: [], pinned: [...owner.cards].filter(([, card]) => card.floating).map(([id]) => id) };\n }\n const visible = new Set<string>();\n for (const item of requested.slice(0, cards.length)) {\n if (!item || typeof item !== \"object\" || typeof item.id !== \"string\" || visible.has(item.id)) continue;\n const configured = cards.find((card) => card.id === item.id);\n const bounds = rectangle(item.bounds);\n const clip = rectangle(item.clip);\n if (\n !configured ||\n !bounds ||\n !clip ||\n clip.x < bounds.x ||\n clip.y < bounds.y ||\n clip.x + clip.width > bounds.x + bounds.width ||\n clip.y + clip.height > bounds.y + bounds.height\n )\n continue;\n visible.add(item.id);\n let card = owner.cards.get(item.id);\n if (card?.floating) {\n card.visible = false;\n card.container.setVisible(false);\n continue;\n }\n if (!card) {\n const container = new View();\n container.setBackgroundColor(\"#00000000\");\n const view = new WebContentsView({\n webPreferences: {\n nodeIntegration: false,\n nodeIntegrationInSubFrames: false,\n contextIsolation: true,\n sandbox: true,\n webSecurity: true,\n partition: \"persist:freelens-power-websites\",\n },\n });\n view.setBackgroundColor(\"#00000000\");\n view.webContents.on(\"did-finish-load\", () => {\n if (!view.webContents.isDestroyed())\n void view.webContents.insertCSS(websiteStyles, { cssOrigin: \"user\" }).catch(() => {});\n });\n view.webContents.setWindowOpenHandler(({ url }) => {\n if (webUrl(url)) void shell.openExternal(url).catch(() => {});\n return { action: \"deny\" };\n });\n const navigation = (event: Electron.Event, url: string) => {\n if (!webUrl(url)) event.preventDefault();\n };\n view.webContents.on(\"will-navigate\", navigation);\n view.webContents.on(\"will-redirect\", navigation);\n view.webContents.on(\"will-frame-navigate\", (event) => {\n if (!webUrl(event.url)) event.preventDefault();\n });\n container.addChildView(view);\n window.contentView.addChildView(container);\n card = { container, view, url: \"\", failed: false, loading: false, visible: false, generation: 0 };\n owner.cards.set(item.id, card);\n const created = card;\n view.webContents.on(\"before-input-event\", (_event, input: Electron.Input) => {\n if (\n input.type !== \"keyDown\" ||\n input.key !== \"Escape\" ||\n owners.get(event.sender) !== owner ||\n owner.cards.get(item.id) !== created ||\n !trusted(event)\n )\n return;\n event.sender.send(\"freelens-power:dashboard-escape\");\n });\n created.selector = configured.selector;\n view.webContents.on(\"did-finish-load\", () => applySelector(created));\n view.webContents.on(\"page-favicon-updated\", (_event, favicons: string[]) => {\n const favicon = favicons.find((value) => {\n if (!webUrl(value)) return false;\n const parsed = new URL(value);\n return !parsed.username && !parsed.password;\n });\n if (!favicon || owners.get(event.sender) !== owner || owner.cards.get(item.id) !== created) return;\n created.faviconRequest?.abort();\n const request = new AbortController();\n created.faviconRequest = request;\n created.favicon = favicon;\n const publish = (url: string) => {\n if (\n request.signal.aborted ||\n owners.get(event.sender) !== owner ||\n owner.cards.get(item.id) !== created ||\n event.senderFrame !== event.sender.mainFrame\n )\n return;\n created.favicon = url;\n if (\n url.startsWith(\"data:\") &&\n configuredCards().some((card) => card.id === item.id && card.url === created.url)\n ) {\n icons.set(item.id, { id: item.id, pageUrl: created.url, dataUrl: url });\n persistIcons();\n if (rendererUrl(event.senderFrame?.url ?? \"\") && rendererUrl(event.sender.getURL()))\n event.sender.send(DASHBOARD_SITE_ICONS);\n }\n if (!trusted(event)) return;\n event.sender.send(\"freelens-power:dashboard-site-icon\", { id: item.id, url });\n };\n publish(favicon);\n const timeout = setTimeout(() => request.abort(), 5000);\n void (async () => {\n let current = favicon;\n for (let redirects = 0; redirects <= 5; redirects++) {\n const response = await websiteSession.fetch(current, {\n signal: request.signal,\n redirect: \"manual\",\n credentials: \"include\",\n });\n if (response.status >= 300 && response.status < 400) {\n await response.body?.cancel();\n const location = response.headers.get(\"location\");\n if (!location) return;\n const next = new URL(location, current);\n if (!webUrl(next.href) || next.username || next.password) return;\n current = next.href;\n continue;\n }\n const mime = response.headers.get(\"content-type\")?.split(\";\")[0].trim().toLowerCase();\n if (\n !response.ok ||\n !mime ||\n ![\n \"image/png\",\n \"image/jpeg\",\n \"image/gif\",\n \"image/webp\",\n \"image/x-icon\",\n \"image/vnd.microsoft.icon\",\n \"image/svg+xml\",\n ].includes(mime) ||\n Number(response.headers.get(\"content-length\")) > 524288\n ) {\n await response.body?.cancel();\n return;\n }\n const reader = response.body?.getReader();\n if (!reader) return;\n const chunks: Uint8Array[] = [];\n let size = 0;\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n size += value.length;\n if (size > 524288) {\n await reader.cancel();\n return;\n }\n chunks.push(value);\n }\n if (size) publish(`data:${mime};base64,${Buffer.concat(chunks).toString(\"base64\")}`);\n return;\n }\n })()\n .catch(() => {})\n .finally(() => clearTimeout(timeout));\n });\n }\n card.visible = true;\n card.container.setVisible(!card.loading && !card.failed && card.url === configured.url);\n const zoom = event.sender.getZoomFactor();\n card.container.setBorderRadius(Math.round(12 * zoom));\n card.view.setBorderRadius(Math.round(12 * zoom));\n const scale = (rect: Rectangle): Rectangle => ({\n x: Math.round(rect.x * zoom),\n y: Math.round(rect.y * zoom),\n width: Math.round(rect.width * zoom),\n height: Math.round(rect.height * zoom),\n });\n card.container.setBounds(scale(clip));\n card.view.setBounds(\n scale({ x: bounds.x - clip.x, y: bounds.y - clip.y, width: bounds.width, height: bounds.height }),\n );\n if (card.url !== configured.url) {\n card.favicon = undefined;\n card.faviconRequest?.abort();\n void reload(card, configured.url, true);\n }\n publishLoading(card);\n if (card.favicon) event.sender.send(\"freelens-power:dashboard-site-icon\", { id: item.id, url: card.favicon });\n }\n for (const [id, card] of owner.cards) {\n if (!cards.some((configured) => configured.id === id)) remove(owner, id);\n else if (!visible.has(id)) {\n card.visible = false;\n card.container.setVisible(false);\n }\n }\n refreshTimers();\n await Promise.all([...owner.cards.values()].map((card) => card.pending));\n return {\n failed: [...owner.cards.entries()].filter(([, card]) => card.failed).map(([id]) => id),\n pinned: [...owner.cards].filter(([, card]) => card.floating).map(([id]) => id),\n };\n });\n const publishPinned = (sender: WebContents, owner: Owner) => {\n if (!sender.isDestroyed())\n sender.send(\n DASHBOARD_VIEWS_PINNED,\n [...owner.cards].filter(([, card]) => card.floating).map(([id]) => id),\n );\n };\n ipcMain.handle(DASHBOARD_VIEWS_PIN, (event, payload: unknown) => {\n if (\n !trusted(event) ||\n !payload ||\n typeof payload !== \"object\" ||\n !(\"id\" in payload) ||\n typeof payload.id !== \"string\" ||\n !((\"pinned\" in payload && typeof payload.pinned === \"boolean\") || (\"focus\" in payload && payload.focus === true))\n )\n return;\n const id = payload.id;\n const owner = owners.get(event.sender);\n const card = owner?.cards.get(payload.id);\n const configured = configuredCards().find((item) => item.id === payload.id);\n if (\n !owner ||\n !card ||\n !configured ||\n card.url !== configured.url ||\n owner.window.isDestroyed() ||\n BrowserWindow.fromWebContents(event.sender) !== owner.window ||\n card.view.webContents.isDestroyed()\n )\n return;\n if (\"focus\" in payload && payload.focus === true) {\n card.floating?.show();\n card.floating?.focus();\n } else if (!(\"pinned\" in payload) || !payload.pinned) {\n card.floating?.close();\n } else if (!card.floating) {\n const floating = new BrowserWindow({\n title: configured.title,\n width: 800,\n height: 600,\n minWidth: 240,\n minHeight: 160,\n resizable: true,\n alwaysOnTop: true,\n autoHideMenuBar: true,\n show: false,\n webPreferences: {\n nodeIntegration: false,\n nodeIntegrationInSubFrames: false,\n contextIsolation: true,\n sandbox: true,\n webSecurity: true,\n partition: \"persist:freelens-power-websites\",\n },\n });\n floating.setMenu(null);\n floating.setAlwaysOnTop(true, \"floating\");\n floating.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true });\n card.floating = floating;\n card.container.setVisible(false);\n const contents = floating.webContents;\n contents.setWindowOpenHandler(({ url }) => {\n if (webUrl(url)) void shell.openExternal(url).catch(() => {});\n return { action: \"deny\" };\n });\n const navigation = (event: Electron.Event, url: string) => {\n if (!webUrl(url)) event.preventDefault();\n };\n contents.on(\"will-navigate\", navigation);\n contents.on(\"will-redirect\", navigation);\n contents.on(\"will-frame-navigate\", (event) => {\n if (!webUrl(event.url)) event.preventDefault();\n });\n contents.on(\"page-title-updated\", (event) => event.preventDefault());\n contents.on(\"will-prevent-unload\", (event) => event.preventDefault());\n const skeleton = new View();\n skeleton.setBackgroundColor(nativeTheme.shouldUseDarkColors ? \"#202124\" : \"#ffffff\");\n const bars = Array.from({ length: 4 }, () => {\n const bar = new View();\n bar.setBackgroundColor(nativeTheme.shouldUseDarkColors ? \"#393b40\" : \"#e8e9eb\");\n bar.setBorderRadius(6);\n skeleton.addChildView(bar);\n return bar;\n });\n const layoutSkeleton = () => {\n const { width, height } = floating.getContentBounds();\n skeleton.setBounds({ x: 0, y: 0, width, height });\n bars.forEach((bar, index) => {\n bar.setBounds({\n x: 20,\n y: index === 0 ? 20 : 60 + (index - 1) * 24,\n width: Math.max(1, Math.round((width - 40) * (index === 0 ? 0.45 : 1))),\n height: index === 0 ? 20 : index === 3 ? Math.max(30, height - 128) : 12,\n });\n });\n };\n floating.contentView.addChildView(skeleton);\n floating.on(\"resize\", layoutSkeleton);\n layoutSkeleton();\n let generation = 0;\n let stopPreparation = () => {};\n let finishLoad: (() => Promise<boolean>) | undefined;\n const begin = () => {\n stopPreparation();\n const token = ++generation;\n const backgroundThrottling = contents.getBackgroundThrottling();\n if (backgroundThrottling) contents.setBackgroundThrottling(false);\n const network = observeDashboardNetwork(contents);\n let active = true;\n let finishing: Promise<boolean> | undefined;\n const current = () => active && generation === token && card.floating === floating && !contents.isDestroyed();\n skeleton.setVisible(true);\n stopPreparation = () => {\n if (!active) return;\n active = false;\n network.dispose();\n if (!contents.isDestroyed() && backgroundThrottling) contents.setBackgroundThrottling(true);\n };\n const stop = stopPreparation;\n const finish = () => {\n finishing ??= (async () => {\n await waitForReadiness(contents, network, () => card.selector, current);\n if (!current()) return false;\n skeleton.setVisible(false);\n stop();\n return false;\n })();\n return finishing;\n };\n finishLoad = finish;\n return {\n finish,\n fail: () => {\n if (current()) {\n skeleton.setVisible(false);\n stop();\n }\n },\n };\n };\n const refresh = () => {\n const preparation = begin();\n const current = contents.getURL();\n return contents.loadURL(webUrl(current) ? current : configured.url).then(\n () => finishLoad?.() ?? false,\n () => {\n preparation.fail();\n return !contents.isDestroyed();\n },\n );\n };\n card.floatingPreparation = {\n refresh,\n selectorChanged: () => {\n const preparation = begin();\n if (!contents.isLoading()) void preparation.finish();\n },\n stop: () => {\n ++generation;\n stopPreparation();\n },\n };\n contents.on(\"did-start-navigation\", (_event, _url, inPlace, mainFrame) => {\n if (!mainFrame) return;\n const preparation = begin();\n if (inPlace) void preparation.finish();\n });\n contents.on(\"did-finish-load\", () => {\n if (contents.isDestroyed()) return;\n void contents.insertCSS(websiteStyles, { cssOrigin: \"user\" }).catch(() => {});\n void finishLoad?.();\n });\n contents.on(\"did-fail-load\", (_event, code, _description, _url, mainFrame) => {\n if (!mainFrame || code === -3) return;\n stopPreparation();\n skeleton.setVisible(false);\n });\n contents.once(\"destroyed\", () => {\n ++generation;\n stopPreparation();\n });\n floating.on(\"closed\", () => {\n if (card.floating !== floating) return;\n card.floatingPreparation?.stop();\n card.floatingPreparation = undefined;\n card.floating = undefined;\n if (owner.cards.get(id) === card) publishPinned(event.sender, owner);\n });\n const initial = begin();\n void contents.loadURL(configured.url).then(() => finishLoad?.(), initial.fail);\n floating.show();\n }\n publishPinned(event.sender, owner);\n return { pinned: [...owner.cards].filter(([, item]) => item.floating).map(([id]) => id) };\n });\n ipcMain.handle(clearChannel, (event) => {\n if (\n event.senderFrame === event.sender.mainFrame &&\n rendererUrl(event.senderFrame?.url ?? \"\") &&\n rendererUrl(event.sender.getURL())\n )\n hide(event.sender);\n });\n ipcMain.handle(reloadChannel, async (event, payload: unknown) => {\n if (\n !trusted(event) ||\n !payload ||\n typeof payload !== \"object\" ||\n !(\"id\" in payload) ||\n typeof payload.id !== \"string\"\n )\n return;\n const owner = owners.get(event.sender);\n const card = owner?.cards.get(payload.id);\n const configured = sanitizeDashboardCards(\n DashboardPreferencesStore.getInstanceOrCreate<DashboardPreferencesStore>().cards,\n ).find((item) => item.id === payload.id);\n if (!card || !configured || card.view.webContents.isDestroyed()) return;\n const [, floatingFailed] = await Promise.all([\n reload(card, configured.url),\n card.floatingPreparation?.refresh() ?? Promise.resolve(false),\n ]);\n return { failed: card.failed || floatingFailed ? [payload.id] : [] };\n });\n return () => {\n stopSettingsReaction();\n ipcMain.removeHandler(DASHBOARD_VIEWS_PIN);\n ipcMain.removeHandler(DASHBOARD_SITE_ICONS);\n ipcMain.removeHandler(syncChannel);\n ipcMain.removeHandler(clearChannel);\n ipcMain.removeHandler(reloadChannel);\n for (const sender of owners.keys()) clear(sender);\n };\n}\n"],"mappings":";;;;;;;;;;;AA8BA,IAAM,cAAc;AACpB,IAAM,gBAAgB;AACtB,IAAM,eAAe;AACrB,IAAM,gBAAgB;AACtB,IAAM,gBACJ;AAEF,SAAS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AC,EAAE;CACrE,CAAC;CACD,aAAa;EACX,qBAAqB;EACrB,SAAA,QAAQ,cAAc,wBAAA,mBAAmB;EACzC,SAAA,QAAQ,cAAc,wBAAA,oBAAoB;EAC1C,SAAA,QAAQ,cAAc,WAAW;EACjC,SAAA,QAAQ,cAAc,YAAY;EAClC,SAAA,QAAQ,cAAc,aAAa;EACnC,KAAK,MAAM,UAAU,OAAO,KAAK,GAAG,MAAM,MAAM;CAClD;AACF"}
1
+ {"version":3,"file":"dashboard-views.js","names":[],"sources":["../../src/main/dashboard-views.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { join } from \"node:path\";\nimport {\n app,\n BrowserWindow,\n type IpcMainInvokeEvent,\n ipcMain,\n nativeTheme,\n type Rectangle,\n session,\n shell,\n View,\n type WebContents,\n WebContentsView,\n} from \"electron\";\nimport { reaction } from \"mobx\";\nimport { sanitizeDashboardCards } from \"../common/dashboard\";\nimport { dashboardReadinessScript } from \"../common/dashboard-readiness\";\nimport { dashboardSelectorScript } from \"../common/dashboard-selector\";\nimport {\n DASHBOARD_SITE_ICONS,\n DASHBOARD_VIEWS_LOADING,\n DASHBOARD_VIEWS_PIN,\n DASHBOARD_VIEWS_PINNED,\n type DashboardSiteIcon,\n} from \"../common/dashboard-views\";\nimport { DashboardPreferencesStore } from \"../common/store/dashboard-preferences-store\";\nimport { boundedDashboardIcons, loadDashboardIcons, saveDashboardIcons } from \"./dashboard-icon-cache\";\nimport { observeDashboardNetwork } from \"./dashboard-network\";\n\nconst syncChannel = \"freelens-power:dashboard-views:sync\";\nconst reloadChannel = \"freelens-power:dashboard-views:reload\";\nconst clearChannel = \"freelens-power:dashboard-views:clear\";\nconst dashboardPath = \"/extension/freelens-power/dashboard\";\nconst websiteStyles =\n \"* { scrollbar-width: none !important; } *::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }\";\n\nconst expandedWebsiteStyles =\n \"* { scrollbar-width: auto !important; } *::-webkit-scrollbar { display: revert !important; width: revert !important; height: revert !important; }\";\n\nfunction rendererUrl(value: string, dashboardOnly = false): boolean {\n try {\n const url = new URL(value);\n return (\n url.protocol === \"https:\" &&\n (url.hostname === \"renderer.freelens.app\" || url.hostname.endsWith(\".renderer.freelens.app\")) &&\n (!dashboardOnly || url.pathname === dashboardPath)\n );\n } catch {\n return false;\n }\n}\nfunction dashboardUrl(value: string): boolean {\n return rendererUrl(value, true);\n}\nfunction webUrl(value: string): boolean {\n try {\n return [\"https:\", \"http:\"].includes(new URL(value).protocol);\n } catch {\n return false;\n }\n}\nfunction rectangle(value: unknown): Rectangle | undefined {\n if (!value || typeof value !== \"object\") return;\n const rect = value as Rectangle;\n if (\n ![rect.x, rect.y, rect.width, rect.height].every(\n (n) => Number.isFinite(n) && Number.isInteger(n) && Math.abs(n) <= 32768,\n ) ||\n rect.width <= 0 ||\n rect.height <= 0\n )\n return;\n return { x: rect.x, y: rect.y, width: rect.width, height: rect.height };\n}\n\nfunction createDashboardSkeleton() {\n const view = new View();\n view.setBackgroundColor(nativeTheme.shouldUseDarkColors ? \"#202124\" : \"#ffffff\");\n const bars = Array.from({ length: 4 }, () => {\n const bar = new View();\n bar.setBackgroundColor(nativeTheme.shouldUseDarkColors ? \"#393b40\" : \"#e8e9eb\");\n bar.setBorderRadius(6);\n view.addChildView(bar);\n return bar;\n });\n return {\n view,\n layout: (width: number, height: number) => {\n view.setBounds({ x: 0, y: 0, width, height });\n bars.forEach((bar, index) => {\n bar.setBounds({\n x: 20,\n y: index === 0 ? 20 : 60 + (index - 1) * 24,\n width: Math.max(1, Math.round((width - 40) * (index === 0 ? 0.45 : 1))),\n height: index === 0 ? 20 : index === 3 ? Math.max(30, height - 128) : 12,\n });\n });\n },\n };\n}\n\ntype WebsiteStyleState = {\n view: { webContents: WebContents };\n scrollbars?: boolean;\n websiteStylesKey?: string;\n websiteStylesGeneration?: number;\n};\n\ntype CardView = {\n container: View;\n skeleton: ReturnType<typeof createDashboardSkeleton>;\n view: WebContentsView;\n url: string;\n failed: boolean;\n loading: boolean;\n visible: boolean;\n generation: number;\n stopPreparation?: () => void;\n selector?: string;\n scrollbars?: boolean;\n websiteStylesKey?: string;\n websiteStylesGeneration?: number;\n pending?: Promise<void>;\n requestedNavigation?: boolean;\n nativeNavigation?: { finish: () => void; fail: () => void };\n favicon?: string;\n faviconRequest?: AbortController;\n refreshTimer?: ReturnType<typeof setTimeout>;\n refreshInterval?: number;\n refreshGeneration?: number;\n floating?: BrowserWindow;\n floatingStyles?: WebsiteStyleState;\n floatingPreparation?: {\n refresh: () => Promise<boolean>;\n selectorChanged: () => void;\n stop: () => void;\n isPreparing: () => boolean;\n };\n};\ntype Owner = { window: BrowserWindow; cards: Map<string, CardView>; cleanup: () => void };\n\nasync function applyWebsiteStyles(card: WebsiteStyleState): Promise<void> {\n const contents = card.view.webContents;\n const generation = (card.websiteStylesGeneration ?? 0) + 1;\n card.websiteStylesGeneration = generation;\n const previous = card.websiteStylesKey;\n card.websiteStylesKey = undefined;\n if (contents.isDestroyed()) return;\n if (previous) await contents.removeInsertedCSS(previous).catch(() => {});\n if (card.websiteStylesGeneration !== generation || contents.isDestroyed()) return;\n const key = await contents\n .insertCSS(card.scrollbars ? expandedWebsiteStyles : websiteStyles, { cssOrigin: \"user\" })\n .catch(() => undefined);\n if (!key) return;\n if (card.websiteStylesGeneration === generation && !contents.isDestroyed()) card.websiteStylesKey = key;\n else if (!contents.isDestroyed()) await contents.removeInsertedCSS(key).catch(() => {});\n}\n\nasync function waitForReadiness(\n contents: WebContents,\n _network: ReturnType<typeof observeDashboardNetwork>,\n selector: () => string | undefined,\n current: () => boolean,\n): Promise<void> {\n let deadline: ReturnType<typeof setTimeout> | undefined;\n try {\n await Promise.race([\n (async () => {\n if (!current()) return;\n await contents.mainFrame.executeJavaScript(dashboardSelectorScript(selector())).catch(() => {});\n if (!current()) return;\n await contents.mainFrame.executeJavaScript(dashboardReadinessScript(selector()));\n })().catch(() => new Promise<void>((resolve) => setTimeout(resolve, 200))),\n new Promise<void>((resolve) => {\n deadline = setTimeout(resolve, 8500);\n }),\n ]);\n } finally {\n clearTimeout(deadline);\n }\n}\n\nasync function prepareDashboardPage(contents: WebContents): Promise<void> {\n if (contents.isDestroyed()) return;\n let deadline: ReturnType<typeof setTimeout> | undefined;\n try {\n await Promise.race([\n contents.mainFrame\n .executeJavaScript('document.dispatchEvent(new Event(\"freelens-power:dashboard:preparing\"))')\n .catch(() => {}),\n new Promise<void>((resolve) => {\n deadline = setTimeout(resolve, 250);\n }),\n ]);\n } finally {\n clearTimeout(deadline);\n }\n}\n\nfunction releaseDashboardPage(contents: WebContents): Promise<unknown> {\n if (contents.isDestroyed()) return Promise.resolve();\n return contents.mainFrame\n .executeJavaScript('document.dispatchEvent(new Event(\"freelens-power:dashboard:prepared\"))')\n .catch(() => {});\n}\n\nexport function startDashboardViews(): () => void {\n const websiteSession = session.fromPartition(\"persist:freelens-power-websites\");\n websiteSession.setPermissionRequestHandler((_contents, _permission, callback) => callback(false));\n websiteSession.setPermissionCheckHandler(() => false);\n const owners = new Map<WebContents, Owner>();\n const icons = new Map<string, DashboardSiteIcon>();\n const remove = (owner: Owner, id: string) => {\n const card = owner.cards.get(id);\n if (!card) return;\n owner.cards.delete(id);\n card.nativeNavigation?.fail();\n card.stopPreparation?.();\n card.websiteStylesGeneration = (card.websiteStylesGeneration ?? 0) + 1;\n card.faviconRequest?.abort();\n clearTimeout(card.refreshTimer);\n card.floatingPreparation?.stop();\n card.floating?.destroy();\n card.floating = undefined;\n if (!owner.window.isDestroyed()) owner.window.contentView.removeChildView(card.container);\n if (!card.view.webContents.isDestroyed()) card.view.webContents.close();\n };\n const clear = (sender: WebContents) => {\n const owner = owners.get(sender);\n if (!owner) return;\n owners.delete(sender);\n for (const id of owner.cards.keys()) remove(owner, id);\n owner.cleanup();\n };\n const hide = (sender: WebContents) => {\n for (const card of owners.get(sender)?.cards.values() ?? []) {\n card.visible = false;\n card.container.setVisible(false);\n }\n };\n const configuredCards = () =>\n sanitizeDashboardCards(DashboardPreferencesStore.getInstanceOrCreate<DashboardPreferencesStore>().cards);\n const cachePath = join(app.getPath(\"userData\"), \"freelens-power\", \"dashboard-icons.json\");\n const ready = loadDashboardIcons(cachePath).then((saved) => {\n const configured = configuredCards();\n for (const icon of saved) {\n if (!icons.has(icon.id) && configured.some((card) => card.id === icon.id && card.url === icon.pageUrl))\n icons.set(icon.id, icon);\n }\n });\n let writes = ready;\n const persistIcons = () => {\n writes = writes\n .then(async () => {\n const configured = configuredCards();\n const bounded = boundedDashboardIcons(\n [...icons.values()].filter((icon) =>\n configured.some((card) => card.id === icon.id && card.url === icon.pageUrl),\n ),\n );\n icons.clear();\n for (const icon of bounded) icons.set(icon.id, icon);\n await saveDashboardIcons(cachePath, bounded);\n })\n .catch(() => {});\n };\n persistIcons();\n const publishLoading = (card: CardView) => {\n for (const [sender, owner] of owners) {\n const id = [...owner.cards].find(([, candidate]) => candidate === card)?.[0];\n if (\n !id ||\n sender.isDestroyed() ||\n !dashboardUrl(sender.mainFrame.url) ||\n !dashboardUrl(sender.getURL()) ||\n !configuredCards().some((configured) => configured.id === id && configured.url === card.url)\n )\n continue;\n sender.send(DASHBOARD_VIEWS_LOADING, { id, url: card.url, loading: card.loading, failed: card.failed });\n }\n };\n const reload = (card: CardView, configuredUrl: string, initial = false, navigation?: Promise<void>) => {\n const current = card.view.webContents.getURL();\n const target = !initial && card.url === configuredUrl && webUrl(current) ? current : configuredUrl;\n const prepareExisting = !initial && !navigation && !card.loading && !card.failed && webUrl(current);\n card.faviconRequest?.abort();\n if (!navigation) card.nativeNavigation?.fail();\n card.url = configuredUrl;\n card.failed = false;\n card.loading = true;\n card.stopPreparation?.();\n const contents = card.view.webContents;\n const backgroundThrottling = contents.getBackgroundThrottling();\n if (backgroundThrottling) contents.setBackgroundThrottling(false);\n const network = observeDashboardNetwork(card.view.webContents);\n let stopped = false;\n let documentReady: (() => void) | undefined;\n const stopPreparation = () => {\n if (stopped) return;\n stopped = true;\n network.dispose();\n contents.removeListener(\"destroyed\", stopPreparation);\n if (documentReady) contents.removeListener(\"dom-ready\", documentReady);\n if (!contents.isDestroyed() && backgroundThrottling && !contents.getBackgroundThrottling())\n contents.setBackgroundThrottling(backgroundThrottling);\n if (card.stopPreparation === stopPreparation) card.stopPreparation = undefined;\n };\n card.stopPreparation = stopPreparation;\n contents.once(\"destroyed\", stopPreparation);\n const generation = ++card.generation;\n card.skeleton.view.setVisible(true);\n card.container.setVisible(card.visible && !card.floating);\n publishLoading(card);\n const settled = (failed: boolean) => {\n if (card.generation !== generation || card.view.webContents.isDestroyed()) return;\n card.failed = failed;\n card.loading = false;\n card.skeleton.view.setVisible(false);\n for (const [sender, owner] of owners) {\n if (![...owner.cards.values()].includes(card)) continue;\n card.container.setVisible(card.visible && !card.floating && !failed && dashboardUrl(sender.getURL()));\n }\n publishLoading(card);\n };\n const load = () => {\n if (\n card.generation !== generation ||\n card.view.webContents.isDestroyed() ||\n ![...owners.values()].some((owner) => [...owner.cards.values()].includes(card))\n )\n return Promise.resolve();\n if (navigation) return navigation;\n const navigate = () => {\n if (card.generation !== generation || contents.isDestroyed()) return Promise.resolve();\n card.requestedNavigation = true;\n return contents.loadURL(target).finally(() => {\n if (card.generation === generation) card.requestedNavigation = false;\n });\n };\n return prepareExisting ? prepareDashboardPage(contents).then(navigate) : navigate();\n };\n const ready = new Promise<void>((resolve) => {\n documentReady = resolve;\n contents.once(\"dom-ready\", documentReady);\n });\n card.pending = Promise.race([load(), ready]).then(\n async () => {\n let preparing = true;\n const current = () =>\n preparing &&\n card.generation === generation &&\n !card.view.webContents.isDestroyed() &&\n [...owners.values()].some((owner) => [...owner.cards.values()].includes(card));\n try {\n await waitForReadiness(contents, network, () => card.selector, current);\n if (current()) await releaseDashboardPage(contents);\n } finally {\n preparing = false;\n stopPreparation();\n }\n settled(false);\n },\n () => {\n if (card.generation === generation) void releaseDashboardPage(contents);\n stopPreparation();\n settled(true);\n },\n );\n return card.pending;\n };\n const applySelector = (card: { view: { webContents: WebContents }; selector?: string }) => {\n if (card.view.webContents.isDestroyed()) return Promise.resolve();\n return card.view.webContents.mainFrame.executeJavaScript(dashboardSelectorScript(card.selector)).catch(() => {});\n };\n const refreshTimers = () => {\n const configured = configuredCards();\n for (const [id, icon] of icons) {\n if (!configured.some((card) => card.id === id && card.url === icon.pageUrl)) {\n icons.delete(id);\n persistIcons();\n }\n }\n for (const [sender, owner] of owners) {\n for (const [id, card] of owner.cards) {\n const setting = configured.find((item) => item.id === id);\n if (!setting || setting.url !== card.url) {\n remove(owner, id);\n continue;\n }\n if (card.selector !== setting.selector) {\n card.selector = setting.selector;\n applySelector(card);\n card.floatingPreparation?.selectorChanged();\n }\n if (card.floating && !card.floating.isDestroyed()) card.floating.setTitle(setting.title);\n if (card.floatingStyles) {\n const scrollbars = setting.size === \"l\" || setting.size === \"xl\";\n if (card.floatingStyles.scrollbars !== scrollbars) {\n card.floatingStyles.scrollbars = scrollbars;\n void applyWebsiteStyles(card.floatingStyles);\n }\n }\n const interval = setting.refreshEvery10Seconds ? 10000 : setting.autoRefresh ? 600000 : undefined;\n if (card.refreshInterval === interval) continue;\n clearTimeout(card.refreshTimer);\n card.refreshTimer = undefined;\n card.refreshInterval = interval;\n const refreshGeneration = (card.refreshGeneration ?? 0) + 1;\n card.refreshGeneration = refreshGeneration;\n if (!interval) continue;\n const schedule = () => {\n if (\n owners.get(sender) !== owner ||\n owner.cards.get(id) !== card ||\n card.refreshGeneration !== refreshGeneration\n )\n return;\n if (card.loading && card.pending) {\n void card.pending.then(schedule);\n return;\n }\n card.refreshTimer = setTimeout(tick, interval);\n };\n const tick = async () => {\n try {\n const latest = configuredCards().find((item) => item.id === id);\n if (\n owners.get(sender) !== owner ||\n owner.cards.get(id) !== card ||\n !latest ||\n latest.url !== card.url ||\n (latest.refreshEvery10Seconds ? 10000 : latest.autoRefresh ? 600000 : undefined) !== interval ||\n card.view.webContents.isDestroyed()\n )\n return;\n if (card.loading) {\n await card.pending;\n return;\n }\n if (latest.refreshEvery10Seconds) {\n if (card.floating) {\n if (card.floating.isDestroyed() || card.floatingPreparation?.isPreparing()) return;\n await Promise.all([reload(card, latest.url), card.floatingPreparation?.refresh()]);\n } else if (card.visible && dashboardUrl(sender.getURL())) await reload(card, latest.url);\n } else if (!card.floating && !dashboardUrl(sender.getURL())) await reload(card, latest.url);\n } finally {\n schedule();\n }\n };\n schedule();\n }\n }\n };\n const stopSettingsReaction = reaction(\n () =>\n JSON.stringify(\n configuredCards().map(({ id, title, url, size, autoRefresh, refreshEvery10Seconds, selector }) => ({\n id,\n title,\n url,\n size,\n autoRefresh,\n refreshEvery10Seconds,\n selector,\n })),\n ),\n refreshTimers,\n );\n const trusted = (event: IpcMainInvokeEvent) =>\n event.senderFrame === event.sender.mainFrame &&\n dashboardUrl(event.senderFrame?.url ?? \"\") &&\n dashboardUrl(event.sender.getURL());\n ipcMain.handle(DASHBOARD_SITE_ICONS, async (event) => {\n if (\n event.senderFrame !== event.sender.mainFrame ||\n !rendererUrl(event.senderFrame?.url ?? \"\") ||\n !rendererUrl(event.sender.getURL()) ||\n !BrowserWindow.fromWebContents(event.sender)\n )\n return [];\n await ready;\n return configuredCards().flatMap((card) => {\n const icon = icons.get(card.id);\n return icon?.pageUrl === card.url ? [icon] : [];\n });\n });\n ipcMain.handle(syncChannel, async (event, payload: unknown) => {\n if (!trusted(event)) return;\n const window = BrowserWindow.fromWebContents(event.sender);\n if (!window || window.isDestroyed()) return;\n const requested =\n payload && typeof payload === \"object\" && \"cards\" in payload && Array.isArray(payload.cards) ? payload.cards : [];\n const cards = sanitizeDashboardCards(\n DashboardPreferencesStore.getInstanceOrCreate<DashboardPreferencesStore>().cards,\n );\n let owner = owners.get(event.sender);\n if (!owner) {\n const sender = event.sender;\n const navigation = (_event: unknown, url: string) => {\n if (!dashboardUrl(url)) hide(sender);\n };\n const destroyed = () => clear(sender);\n sender.on(\"did-navigate\", navigation);\n sender.on(\"did-navigate-in-page\", navigation);\n sender.on(\"destroyed\", destroyed);\n owner = {\n window,\n cards: new Map(),\n cleanup: () => {\n sender.removeListener(\"did-navigate\", navigation);\n sender.removeListener(\"did-navigate-in-page\", navigation);\n sender.removeListener(\"destroyed\", destroyed);\n },\n };\n owners.set(sender, owner);\n }\n if (payload && typeof payload === \"object\" && \"hidden\" in payload && payload.hidden === true) {\n hide(event.sender);\n return { failed: [], pinned: [...owner.cards].filter(([, card]) => card.floating).map(([id]) => id) };\n }\n const visible = new Set<string>();\n for (const item of requested.slice(0, cards.length)) {\n if (!item || typeof item !== \"object\" || typeof item.id !== \"string\" || visible.has(item.id)) continue;\n const configured = cards.find((card) => card.id === item.id);\n const bounds = rectangle(item.bounds);\n const clip = rectangle(item.clip);\n if (\n !configured ||\n !bounds ||\n !clip ||\n clip.x < bounds.x ||\n clip.y < bounds.y ||\n clip.x + clip.width > bounds.x + bounds.width ||\n clip.y + clip.height > bounds.y + bounds.height\n )\n continue;\n visible.add(item.id);\n let card = owner.cards.get(item.id);\n if (card?.floating) {\n card.visible = false;\n card.container.setVisible(false);\n continue;\n }\n if (!card) {\n const container = new View();\n container.setBackgroundColor(\"#00000000\");\n const view = new WebContentsView({\n webPreferences: {\n nodeIntegration: false,\n nodeIntegrationInSubFrames: false,\n contextIsolation: true,\n sandbox: true,\n webSecurity: true,\n partition: \"persist:freelens-power-websites\",\n preload: join(__dirname, \"dashboard-preload.js\"),\n },\n });\n view.setBackgroundColor(\"#00000000\");\n view.webContents.setWindowOpenHandler(({ url }) => {\n if (webUrl(url)) void shell.openExternal(url).catch(() => {});\n return { action: \"deny\" };\n });\n const navigation = (event: Electron.Event, url: string) => {\n if (!webUrl(url)) event.preventDefault();\n };\n view.webContents.on(\"will-navigate\", navigation);\n view.webContents.on(\"will-redirect\", navigation);\n view.webContents.on(\"will-frame-navigate\", (event) => {\n if (!webUrl(event.url)) event.preventDefault();\n });\n container.addChildView(view);\n const skeleton = createDashboardSkeleton();\n container.addChildView(skeleton.view);\n window.contentView.addChildView(container);\n card = { container, skeleton, view, url: \"\", failed: false, loading: false, visible: false, generation: 0 };\n owner.cards.set(item.id, card);\n const created = card;\n view.webContents.on(\"before-input-event\", (_event, input: Electron.Input) => {\n if (\n input.type !== \"keyDown\" ||\n input.key !== \"Escape\" ||\n owners.get(event.sender) !== owner ||\n owner.cards.get(item.id) !== created ||\n !trusted(event)\n )\n return;\n event.sender.send(\"freelens-power:dashboard-escape\");\n });\n created.selector = configured.selector;\n view.webContents.on(\"did-start-navigation\", (_event, _url, inPlace, mainFrame) => {\n if (!mainFrame) return;\n if (created.requestedNavigation) {\n created.requestedNavigation = false;\n return;\n }\n created.nativeNavigation?.fail();\n const navigation = new Promise<void>((resolve, reject) => {\n created.nativeNavigation = {\n finish: () => {\n created.nativeNavigation = undefined;\n resolve();\n },\n fail: () => {\n created.nativeNavigation = undefined;\n reject(new Error(\"dashboard navigation failed\"));\n },\n };\n });\n if (inPlace)\n void view.webContents.mainFrame\n .executeJavaScript('document.dispatchEvent(new Event(\"freelens-power:dashboard:preparing\"))')\n .catch(() => {});\n void reload(created, created.url, false, navigation);\n if (inPlace) created.nativeNavigation?.finish();\n });\n view.webContents.on(\"did-finish-load\", () => {\n void applyWebsiteStyles(created);\n void applySelector(created);\n created.nativeNavigation?.finish();\n });\n view.webContents.on(\"did-fail-load\", (_event, code, _description, _url, mainFrame) => {\n if (!mainFrame || (code === -3 && view.webContents.isLoading())) return;\n created.nativeNavigation?.fail();\n });\n view.webContents.on(\"page-favicon-updated\", (_event, favicons: string[]) => {\n const favicon = favicons.find((value) => {\n if (!webUrl(value)) return false;\n const parsed = new URL(value);\n return !parsed.username && !parsed.password;\n });\n if (!favicon || owners.get(event.sender) !== owner || owner.cards.get(item.id) !== created) return;\n created.faviconRequest?.abort();\n const request = new AbortController();\n created.faviconRequest = request;\n created.favicon = favicon;\n const publish = (url: string) => {\n if (\n request.signal.aborted ||\n owners.get(event.sender) !== owner ||\n owner.cards.get(item.id) !== created ||\n event.senderFrame !== event.sender.mainFrame\n )\n return;\n created.favicon = url;\n if (\n url.startsWith(\"data:\") &&\n configuredCards().some((card) => card.id === item.id && card.url === created.url)\n ) {\n icons.set(item.id, { id: item.id, pageUrl: created.url, dataUrl: url });\n persistIcons();\n if (rendererUrl(event.senderFrame?.url ?? \"\") && rendererUrl(event.sender.getURL()))\n event.sender.send(DASHBOARD_SITE_ICONS);\n }\n if (!trusted(event)) return;\n event.sender.send(\"freelens-power:dashboard-site-icon\", { id: item.id, url });\n };\n publish(favicon);\n const timeout = setTimeout(() => request.abort(), 5000);\n void (async () => {\n let current = favicon;\n for (let redirects = 0; redirects <= 5; redirects++) {\n const response = await websiteSession.fetch(current, {\n signal: request.signal,\n redirect: \"manual\",\n credentials: \"include\",\n });\n if (response.status >= 300 && response.status < 400) {\n await response.body?.cancel();\n const location = response.headers.get(\"location\");\n if (!location) return;\n const next = new URL(location, current);\n if (!webUrl(next.href) || next.username || next.password) return;\n current = next.href;\n continue;\n }\n const mime = response.headers.get(\"content-type\")?.split(\";\")[0].trim().toLowerCase();\n if (\n !response.ok ||\n !mime ||\n ![\n \"image/png\",\n \"image/jpeg\",\n \"image/gif\",\n \"image/webp\",\n \"image/x-icon\",\n \"image/vnd.microsoft.icon\",\n \"image/svg+xml\",\n ].includes(mime) ||\n Number(response.headers.get(\"content-length\")) > 524288\n ) {\n await response.body?.cancel();\n return;\n }\n const reader = response.body?.getReader();\n if (!reader) return;\n const chunks: Uint8Array[] = [];\n let size = 0;\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n size += value.length;\n if (size > 524288) {\n await reader.cancel();\n return;\n }\n chunks.push(value);\n }\n if (size) publish(`data:${mime};base64,${Buffer.concat(chunks).toString(\"base64\")}`);\n return;\n }\n })()\n .catch(() => {})\n .finally(() => clearTimeout(timeout));\n });\n }\n if (card.scrollbars !== (item.scrollbars === true)) {\n card.scrollbars = item.scrollbars === true;\n void applyWebsiteStyles(card);\n }\n card.visible = true;\n card.container.setVisible(!card.failed && (card.loading || card.url === configured.url));\n const zoom = event.sender.getZoomFactor();\n card.container.setBorderRadius(Math.round(12 * zoom));\n card.view.setBorderRadius(Math.round(12 * zoom));\n const scale = (rect: Rectangle): Rectangle => ({\n x: Math.round(rect.x * zoom),\n y: Math.round(rect.y * zoom),\n width: Math.round(rect.width * zoom),\n height: Math.round(rect.height * zoom),\n });\n card.container.setBounds(scale(clip));\n card.skeleton.layout(Math.round(clip.width * zoom), Math.round(clip.height * zoom));\n card.view.setBounds(\n scale({ x: bounds.x - clip.x, y: bounds.y - clip.y, width: bounds.width, height: bounds.height }),\n );\n if (card.url !== configured.url) {\n card.favicon = undefined;\n card.faviconRequest?.abort();\n void reload(card, configured.url, true);\n }\n publishLoading(card);\n if (card.favicon) event.sender.send(\"freelens-power:dashboard-site-icon\", { id: item.id, url: card.favicon });\n }\n for (const [id, card] of owner.cards) {\n if (!cards.some((configured) => configured.id === id)) remove(owner, id);\n else if (!visible.has(id)) {\n card.visible = false;\n card.container.setVisible(false);\n }\n }\n refreshTimers();\n await Promise.all([...owner.cards.values()].map((card) => card.pending));\n return {\n failed: [...owner.cards.entries()].filter(([, card]) => card.failed).map(([id]) => id),\n pinned: [...owner.cards].filter(([, card]) => card.floating).map(([id]) => id),\n };\n });\n const publishPinned = (sender: WebContents, owner: Owner) => {\n if (!sender.isDestroyed())\n sender.send(\n DASHBOARD_VIEWS_PINNED,\n [...owner.cards].filter(([, card]) => card.floating).map(([id]) => id),\n );\n };\n ipcMain.handle(DASHBOARD_VIEWS_PIN, (event, payload: unknown) => {\n if (\n !trusted(event) ||\n !payload ||\n typeof payload !== \"object\" ||\n !(\"id\" in payload) ||\n typeof payload.id !== \"string\" ||\n !((\"pinned\" in payload && typeof payload.pinned === \"boolean\") || (\"focus\" in payload && payload.focus === true))\n )\n return;\n const id = payload.id;\n const owner = owners.get(event.sender);\n const card = owner?.cards.get(payload.id);\n const configured = configuredCards().find((item) => item.id === payload.id);\n if (\n !owner ||\n !card ||\n !configured ||\n card.url !== configured.url ||\n owner.window.isDestroyed() ||\n BrowserWindow.fromWebContents(event.sender) !== owner.window ||\n card.view.webContents.isDestroyed()\n )\n return;\n if (\"focus\" in payload && payload.focus === true) {\n card.floating?.show();\n card.floating?.focus();\n } else if (!(\"pinned\" in payload) || !payload.pinned) {\n card.floating?.close();\n } else if (!card.floating) {\n const floating = new BrowserWindow({\n title: configured.title,\n width: 800,\n height: 600,\n minWidth: 240,\n minHeight: 160,\n resizable: true,\n alwaysOnTop: true,\n autoHideMenuBar: true,\n show: false,\n webPreferences: {\n nodeIntegration: false,\n nodeIntegrationInSubFrames: false,\n contextIsolation: true,\n sandbox: true,\n webSecurity: true,\n partition: \"persist:freelens-power-websites\",\n preload: join(__dirname, \"dashboard-preload.js\"),\n },\n });\n floating.setMenu(null);\n floating.setAlwaysOnTop(true, \"floating\");\n floating.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true });\n card.floating = floating;\n card.container.setVisible(false);\n const contents = floating.webContents;\n const floatingStyles: WebsiteStyleState = {\n view: { webContents: contents },\n scrollbars: configured.size === \"l\" || configured.size === \"xl\",\n };\n card.floatingStyles = floatingStyles;\n contents.setWindowOpenHandler(({ url }) => {\n if (webUrl(url)) void shell.openExternal(url).catch(() => {});\n return { action: \"deny\" };\n });\n const navigation = (event: Electron.Event, url: string) => {\n if (!webUrl(url)) event.preventDefault();\n };\n contents.on(\"will-navigate\", navigation);\n contents.on(\"will-redirect\", navigation);\n contents.on(\"will-frame-navigate\", (event) => {\n if (!webUrl(event.url)) event.preventDefault();\n });\n contents.on(\"page-title-updated\", (event) => event.preventDefault());\n contents.on(\"will-prevent-unload\", (event) => event.preventDefault());\n const loadingSkeleton = createDashboardSkeleton();\n const skeleton = loadingSkeleton.view;\n const layoutSkeleton = () => {\n const { width, height } = floating.getContentBounds();\n loadingSkeleton.layout(width, height);\n };\n floating.contentView.addChildView(skeleton);\n floating.on(\"resize\", layoutSkeleton);\n layoutSkeleton();\n let generation = 0;\n let floatingPreparing = false;\n let stopPreparation = () => {};\n let finishLoad: (() => Promise<boolean>) | undefined;\n const begin = () => {\n stopPreparation();\n floatingPreparing = true;\n const token = ++generation;\n const backgroundThrottling = contents.getBackgroundThrottling();\n if (backgroundThrottling) contents.setBackgroundThrottling(false);\n const network = observeDashboardNetwork(contents);\n let active = true;\n let finishing: Promise<boolean> | undefined;\n const current = () => active && generation === token && card.floating === floating && !contents.isDestroyed();\n skeleton.setVisible(true);\n stopPreparation = () => {\n if (!active) return;\n active = false;\n floatingPreparing = false;\n network.dispose();\n if (!contents.isDestroyed() && backgroundThrottling) contents.setBackgroundThrottling(true);\n };\n const stop = stopPreparation;\n const finish = () => {\n finishing ??= (async () => {\n await waitForReadiness(contents, network, () => card.selector, current);\n if (!current()) return false;\n await releaseDashboardPage(contents);\n if (!current()) return false;\n skeleton.setVisible(false);\n stop();\n return false;\n })();\n return finishing;\n };\n finishLoad = finish;\n return {\n finish,\n fail: () => {\n if (current()) {\n void releaseDashboardPage(contents);\n skeleton.setVisible(false);\n stop();\n }\n },\n };\n };\n const refresh = () => {\n const preparation = begin();\n const current = contents.getURL();\n let documentReady: () => void;\n const ready = new Promise<boolean>((resolve) => {\n documentReady = () => {\n void (finishLoad?.() ?? Promise.resolve(false)).then(resolve);\n };\n contents.once(\"dom-ready\", documentReady);\n });\n const loading = prepareDashboardPage(contents)\n .then(() => contents.loadURL(webUrl(current) ? current : configured.url))\n .then(\n () => finishLoad?.() ?? false,\n () => {\n preparation.fail();\n return !contents.isDestroyed();\n },\n );\n return Promise.race([loading, ready]).finally(() => {\n contents.removeListener(\"dom-ready\", documentReady);\n });\n };\n card.floatingPreparation = {\n refresh,\n isPreparing: () => floatingPreparing,\n selectorChanged: () => {\n const preparation = begin();\n void preparation.finish();\n },\n stop: () => {\n ++generation;\n stopPreparation();\n },\n };\n contents.on(\"did-start-navigation\", (_event, _url, inPlace, mainFrame) => {\n if (!mainFrame) return;\n const preparation = begin();\n if (inPlace) void preparation.finish();\n });\n contents.on(\"dom-ready\", () => {\n void applyWebsiteStyles(floatingStyles);\n if (!contents.isDestroyed()) void finishLoad?.();\n });\n contents.on(\"did-finish-load\", () => {\n void applyWebsiteStyles(floatingStyles);\n if (!contents.isDestroyed()) void finishLoad?.();\n });\n contents.on(\"did-fail-load\", (_event, code, _description, _url, mainFrame) => {\n if (!mainFrame || code === -3) return;\n stopPreparation();\n void releaseDashboardPage(contents);\n skeleton.setVisible(false);\n });\n contents.once(\"destroyed\", () => {\n ++generation;\n stopPreparation();\n });\n floating.on(\"closed\", () => {\n if (card.floating !== floating) return;\n card.floatingPreparation?.stop();\n card.floatingPreparation = undefined;\n floatingStyles.websiteStylesGeneration = (floatingStyles.websiteStylesGeneration ?? 0) + 1;\n card.floatingStyles = undefined;\n card.floating = undefined;\n if (owner.cards.get(id) === card) publishPinned(event.sender, owner);\n });\n const initial = begin();\n void contents.loadURL(configured.url).then(() => finishLoad?.(), initial.fail);\n floating.show();\n }\n publishPinned(event.sender, owner);\n return { pinned: [...owner.cards].filter(([, item]) => item.floating).map(([id]) => id) };\n });\n ipcMain.handle(clearChannel, (event) => {\n if (\n event.senderFrame === event.sender.mainFrame &&\n rendererUrl(event.senderFrame?.url ?? \"\") &&\n rendererUrl(event.sender.getURL())\n )\n hide(event.sender);\n });\n ipcMain.handle(reloadChannel, async (event, payload: unknown) => {\n if (\n !trusted(event) ||\n !payload ||\n typeof payload !== \"object\" ||\n !(\"id\" in payload) ||\n typeof payload.id !== \"string\"\n )\n return;\n const owner = owners.get(event.sender);\n const card = owner?.cards.get(payload.id);\n const configured = sanitizeDashboardCards(\n DashboardPreferencesStore.getInstanceOrCreate<DashboardPreferencesStore>().cards,\n ).find((item) => item.id === payload.id);\n if (!card || !configured || card.view.webContents.isDestroyed()) return;\n const [, floatingFailed] = await Promise.all([\n reload(card, configured.url),\n card.floatingPreparation?.refresh() ?? Promise.resolve(false),\n ]);\n return { failed: card.failed || floatingFailed ? [payload.id] : [] };\n });\n return () => {\n stopSettingsReaction();\n ipcMain.removeHandler(DASHBOARD_VIEWS_PIN);\n ipcMain.removeHandler(DASHBOARD_SITE_ICONS);\n ipcMain.removeHandler(syncChannel);\n ipcMain.removeHandler(clearChannel);\n ipcMain.removeHandler(reloadChannel);\n for (const sender of owners.keys()) clear(sender);\n };\n}\n"],"mappings":";;;;;;;;;;;AA8BA,IAAM,cAAc;AACpB,IAAM,gBAAgB;AACtB,IAAM,eAAe;AACrB,IAAM,gBAAgB;AACtB,IAAM,gBACJ;AAEF,IAAM,wBACJ;AAEF,SAAS,YAAY,OAAe,gBAAgB,OAAgB;CAClE,IAAI;EACF,MAAM,MAAM,IAAI,IAAI,KAAK;EACzB,OACE,IAAI,aAAa,aAChB,IAAI,aAAa,2BAA2B,IAAI,SAAS,SAAS,wBAAwB,OAC1F,CAAC,iBAAiB,IAAI,aAAa;CAExC,QAAQ;EACN,OAAO;CACT;AACF;AACA,SAAS,aAAa,OAAwB;CAC5C,OAAO,YAAY,OAAO,IAAI;AAChC;AACA,SAAS,OAAO,OAAwB;CACtC,IAAI;EACF,OAAO,CAAC,UAAU,OAAO,CAAC,CAAC,SAAS,IAAI,IAAI,KAAK,CAAC,CAAC,QAAQ;CAC7D,QAAQ;EACN,OAAO;CACT;AACF;AACA,SAAS,UAAU,OAAuC;CACxD,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU;CACzC,MAAM,OAAO;CACb,IACE,CAAC;EAAC,KAAK;EAAG,KAAK;EAAG,KAAK;EAAO,KAAK;CAAM,CAAC,CAAC,OACxC,MAAM,OAAO,SAAS,CAAC,KAAK,OAAO,UAAU,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,KACrE,KACA,KAAK,SAAS,KACd,KAAK,UAAU,GAEf;CACF,OAAO;EAAE,GAAG,KAAK;EAAG,GAAG,KAAK;EAAG,OAAO,KAAK;EAAO,QAAQ,KAAK;CAAO;AACxE;AAEA,SAAS,0BAA0B;CACjC,MAAM,OAAO,IAAI,SAAA,KAAK;CACtB,KAAK,mBAAmB,SAAA,YAAY,sBAAsB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B,SAAA,QAAQ,cAAc,wBAAA,mBAAmB;EACzC,SAAA,QAAQ,cAAc,wBAAA,oBAAoB;EAC1C,SAAA,QAAQ,cAAc,WAAW;EACjC,SAAA,QAAQ,cAAc,YAAY;EAClC,SAAA,QAAQ,cAAc,aAAa;EACnC,KAAK,MAAM,UAAU,OAAO,KAAK,GAAG,MAAM,MAAM;CAClD;AACF"}
@@ -25,22 +25,36 @@ function recolorIconBitmap(bitmap, color) {
25
25
  return result;
26
26
  }
27
27
  async function loadOriginalIcon() {
28
- const path = (0, node_path.join)(process.resourcesPath, "icon.icns");
29
- const direct = electron.nativeImage.createFromPath(path);
30
- if (!direct.isEmpty()) return direct;
28
+ const bundle = (0, node_path.join)((0, node_path.dirname)(electron.app.getPath("exe")), "..", "..");
29
+ if (!bundle.endsWith(".app")) throw new Error("app bundle unavailable");
31
30
  const directory = await (0, node_fs_promises.mkdtemp)((0, node_path.join)(electron.app.getPath("temp"), "freelens-power-icon-"));
32
31
  try {
33
32
  const converted = (0, node_path.join)(directory, "icon.png");
34
- await (0, node_util.promisify)(node_child_process.execFile)("/usr/bin/sips", [
35
- "-s",
36
- "format",
37
- "png",
38
- path,
39
- "--out",
33
+ await (0, node_util.promisify)(node_child_process.execFile)("/usr/bin/osascript", [
34
+ "-l",
35
+ "JavaScript",
36
+ "-e",
37
+ `
38
+ ObjC.import("AppKit");
39
+ function run(argv) {
40
+ var icon = $.NSWorkspace.sharedWorkspace.iconForFile(argv[0]);
41
+ var rendered = $.NSImage.alloc.initWithSize($.NSMakeSize(512, 512));
42
+ rendered.lockFocus;
43
+ icon.drawInRectFromRectOperationFraction($.NSMakeRect(0, 0, 512, 512), $.NSZeroRect, $.NSCompositingOperationCopy, 1);
44
+ rendered.unlockFocus;
45
+ var bitmap = $.NSBitmapImageRep.imageRepWithData(rendered.TIFFRepresentation);
46
+ if (!bitmap.representationUsingTypeProperties($.NSPNGFileType, $({})).writeToFileAtomically(argv[1], true)) {
47
+ throw new Error("could not render app icon");
48
+ }
49
+ }
50
+ `,
51
+ bundle,
40
52
  converted
41
- ]);
53
+ ], { timeout: 1e4 });
42
54
  const original = electron.nativeImage.createFromPath(converted);
43
55
  if (original.isEmpty()) throw new Error("empty app icon");
56
+ const bitmap = original.toBitmap();
57
+ if (recolorIconBitmap(bitmap, "#7060e8").equals(bitmap)) throw new Error("app icon colors unavailable");
44
58
  return original;
45
59
  } finally {
46
60
  await (0, node_fs_promises.rm)(directory, {
@@ -100,6 +114,7 @@ function startDockIconOverride() {
100
114
  };
101
115
  }
102
116
  //#endregion
117
+ exports.loadOriginalIcon = loadOriginalIcon;
103
118
  exports.recolorIconBitmap = recolorIconBitmap;
104
119
  exports.startDockIconOverride = startDockIconOverride;
105
120
 
@@ -1 +1 @@
1
- {"version":3,"file":"dock-icon.js","names":[],"sources":["../../src/main/dock-icon.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { execFile } from \"node:child_process\";\nimport { mkdtemp, rm } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { promisify } from \"node:util\";\nimport { app, type NativeImage, nativeImage } from \"electron\";\nimport { reaction } from \"mobx\";\nimport { AppearancePreferencesStore, isAccentSelection } from \"../common/store/appearance-preferences-store\";\n\n// the bitmap uses premultiplied BGRA channels on macOS\nexport function recolorIconBitmap(bitmap: Buffer, color: string): Buffer {\n const result = Buffer.from(bitmap);\n const target = [5, 3, 1].map((offset) => Number.parseInt(color.slice(offset, offset + 2), 16));\n for (let index = 0; index < result.length; index += 4) {\n const blue = bitmap[index];\n const green = bitmap[index + 1];\n const red = bitmap[index + 2];\n const alpha = bitmap[index + 3];\n // select saturated teal, preserving white logo pixels, neutral shadows and alpha\n if (!alpha || green <= red * 1.3 || blue <= red * 1.3 || Math.abs(green - blue) > Math.max(green, blue) * 0.4) {\n continue;\n }\n // normalize against the original [#23a49c] artwork so its flat fill matches the selected accent\n const brightness = Math.max(green, blue) / 164;\n for (let channel = 0; channel < 3; channel++) {\n result[index + channel] = Math.min(alpha, Math.round(target[channel] * brightness));\n }\n }\n return result;\n}\n\nasync function loadOriginalIcon(): Promise<NativeImage> {\n const path = join(process.resourcesPath, \"icon.icns\");\n const direct = nativeImage.createFromPath(path);\n if (!direct.isEmpty()) return direct;\n\n const directory = await mkdtemp(join(app.getPath(\"temp\"), \"freelens-power-icon-\"));\n try {\n const converted = join(directory, \"icon.png\");\n await promisify(execFile)(\"/usr/bin/sips\", [\"-s\", \"format\", \"png\", path, \"--out\", converted]);\n const original = nativeImage.createFromPath(converted);\n if (original.isEmpty()) throw new Error(\"empty app icon\");\n return original;\n } finally {\n await rm(directory, { recursive: true, force: true });\n }\n}\n\nexport function startDockIconOverride(): () => void {\n if (process.platform !== \"darwin\" || !app.dock) return () => {};\n const dock = app.dock;\n const preferences = AppearancePreferencesStore.getInstanceOrCreate<AppearancePreferencesStore>();\n const cache = new Map<string, NativeImage>();\n let original: NativeImage | undefined;\n let pending: Promise<NativeImage> | undefined;\n let disposed = false;\n let revision = 0;\n let overridden = false;\n\n const restore = () => {\n if (overridden && original) {\n dock.setIcon(original);\n overridden = false;\n }\n };\n const stop = reaction(\n () => [preferences.enabled, preferences.accentColor, preferences.recolorAppIcon] as const,\n ([enabled, color, recolorAppIcon]) => {\n const request = ++revision;\n if (!enabled || !recolorAppIcon || color === \"default\" || !isAccentSelection(color)) {\n restore();\n return;\n }\n pending ??= loadOriginalIcon();\n void pending\n .then((source) => {\n original = source;\n if (disposed || revision !== request) return;\n let tinted = cache.get(color);\n if (!tinted) {\n const size = source.getSize();\n tinted = nativeImage.createFromBitmap(recolorIconBitmap(source.toBitmap(), color), size);\n cache.set(color, tinted);\n }\n dock.setIcon(tinted);\n overridden = true;\n })\n .catch(() => {\n pending = undefined;\n console.warn(\"[freelens-power] Could not update the Dock icon\");\n });\n },\n { fireImmediately: true },\n );\n return () => {\n disposed = true;\n revision++;\n stop();\n restore();\n };\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,kBAAkB,QAAgB,OAAuB;CAC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;CACV;AACF"}
1
+ {"version":3,"file":"dock-icon.js","names":[],"sources":["../../src/main/dock-icon.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { execFile } from \"node:child_process\";\nimport { mkdtemp, rm } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport { promisify } from \"node:util\";\nimport { app, type NativeImage, nativeImage } from \"electron\";\nimport { reaction } from \"mobx\";\nimport { AppearancePreferencesStore, isAccentSelection } from \"../common/store/appearance-preferences-store\";\n\n// the bitmap uses premultiplied BGRA channels on macOS\nexport function recolorIconBitmap(bitmap: Buffer, color: string): Buffer {\n const result = Buffer.from(bitmap);\n const target = [5, 3, 1].map((offset) => Number.parseInt(color.slice(offset, offset + 2), 16));\n for (let index = 0; index < result.length; index += 4) {\n const blue = bitmap[index];\n const green = bitmap[index + 1];\n const red = bitmap[index + 2];\n const alpha = bitmap[index + 3];\n // select saturated teal, preserving white logo pixels, neutral shadows and alpha\n if (!alpha || green <= red * 1.3 || blue <= red * 1.3 || Math.abs(green - blue) > Math.max(green, blue) * 0.4) {\n continue;\n }\n // normalize against the original [#23a49c] artwork so its flat fill matches the selected accent\n const brightness = Math.max(green, blue) / 164;\n for (let channel = 0; channel < 3; channel++) {\n result[index + channel] = Math.min(alpha, Math.round(target[channel] * brightness));\n }\n }\n return result;\n}\n\nexport async function loadOriginalIcon(): Promise<NativeImage> {\n // macOS composes the app's frame and padding outside the raw [icon.icns] artwork\n const bundle = join(dirname(app.getPath(\"exe\")), \"..\", \"..\");\n if (!bundle.endsWith(\".app\")) throw new Error(\"app bundle unavailable\");\n const directory = await mkdtemp(join(app.getPath(\"temp\"), \"freelens-power-icon-\"));\n try {\n const converted = join(directory, \"icon.png\");\n await promisify(execFile)(\n \"/usr/bin/osascript\",\n [\n \"-l\",\n \"JavaScript\",\n \"-e\",\n `\n ObjC.import(\"AppKit\");\n function run(argv) {\n var icon = $.NSWorkspace.sharedWorkspace.iconForFile(argv[0]);\n var rendered = $.NSImage.alloc.initWithSize($.NSMakeSize(512, 512));\n rendered.lockFocus;\n icon.drawInRectFromRectOperationFraction($.NSMakeRect(0, 0, 512, 512), $.NSZeroRect, $.NSCompositingOperationCopy, 1);\n rendered.unlockFocus;\n var bitmap = $.NSBitmapImageRep.imageRepWithData(rendered.TIFFRepresentation);\n if (!bitmap.representationUsingTypeProperties($.NSPNGFileType, $({})).writeToFileAtomically(argv[1], true)) {\n throw new Error(\"could not render app icon\");\n }\n }\n `,\n bundle,\n converted,\n ],\n { timeout: 10_000 },\n );\n const original = nativeImage.createFromPath(converted);\n if (original.isEmpty()) throw new Error(\"empty app icon\");\n const bitmap = original.toBitmap();\n if (recolorIconBitmap(bitmap, \"#7060e8\").equals(bitmap)) throw new Error(\"app icon colors unavailable\");\n return original;\n } finally {\n await rm(directory, { recursive: true, force: true });\n }\n}\n\nexport function startDockIconOverride(): () => void {\n if (process.platform !== \"darwin\" || !app.dock) return () => {};\n const dock = app.dock;\n const preferences = AppearancePreferencesStore.getInstanceOrCreate<AppearancePreferencesStore>();\n const cache = new Map<string, NativeImage>();\n let original: NativeImage | undefined;\n let pending: Promise<NativeImage> | undefined;\n let disposed = false;\n let revision = 0;\n let overridden = false;\n\n const restore = () => {\n if (overridden && original) {\n dock.setIcon(original);\n overridden = false;\n }\n };\n const stop = reaction(\n () => [preferences.enabled, preferences.accentColor, preferences.recolorAppIcon] as const,\n ([enabled, color, recolorAppIcon]) => {\n const request = ++revision;\n if (!enabled || !recolorAppIcon || color === \"default\" || !isAccentSelection(color)) {\n restore();\n return;\n }\n pending ??= loadOriginalIcon();\n void pending\n .then((source) => {\n original = source;\n if (disposed || revision !== request) return;\n let tinted = cache.get(color);\n if (!tinted) {\n const size = source.getSize();\n tinted = nativeImage.createFromBitmap(recolorIconBitmap(source.toBitmap(), color), size);\n cache.set(color, tinted);\n }\n dock.setIcon(tinted);\n overridden = true;\n })\n .catch(() => {\n pending = undefined;\n console.warn(\"[freelens-power] Could not update the Dock icon\");\n });\n },\n {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AA,YAAY,iBAAiB,kBAAkB,OAAO,SAAS,GAAG,KAAK,GAAG,IAAI;IACvF,MAAM,IAAI,OAAO,MAAM;GACzB;GACA,KAAK,QAAQ,MAAM;GACnB,aAAa;EACf,CAAC,CAAC,CACD,YAAY;GACX,UAAU,KAAA;GACV,QAAQ,KAAK,iDAAiD;EAChE,CAAC;CACL,GACA,EAAE,iBAAiB,KAAK,CAC1B;CACA,aAAa;EACX,WAAW;EACX;EACA,KAAK;EACL,QAAQ;CACV;AACF"}
package/out/main/index.js CHANGED
@@ -25,6 +25,7 @@ const require_diagnostics_menu_order = require("./diagnostics-menu-order.js");
25
25
  const require_dock_icon = require("./dock-icon.js");
26
26
  const require_monitoring_history = require("./monitoring-history.js");
27
27
  const require_settings_export = require("./settings-export.js");
28
+ const require_splash_accent = require("./splash-accent.js");
28
29
  //#region src/main/index.ts
29
30
  var FreelensPowerMain = class extends require_extensions.Main.LensExtension {
30
31
  stopFeatures;
@@ -59,6 +60,7 @@ var FreelensPowerMain = class extends require_extensions.Main.LensExtension {
59
60
  require_ai_ipc.startAiIpc(),
60
61
  require_ai_models.startAiModels(),
61
62
  require_dock_icon.startDockIconOverride(),
63
+ require_splash_accent.startSplashAccentOverride(),
62
64
  require_dashboard_views.startDashboardViews(),
63
65
  require_dashboard_picker.startDashboardPicker(),
64
66
  require_dashboard_catalog.registerDashboardCatalog(this),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/main/index.ts"],"sourcesContent":["import { Main } from \"@freelensapp/extensions\";\nimport { reaction } from \"mobx\";\nimport { EXTENSION_DISPLAY_NAME, EXTENSION_ID } from \"../common/extension-info\";\nimport { AiPreferencesStore } from \"../common/store/ai-preferences-store\";\nimport { AiShortcutsStore } from \"../common/store/ai-shortcuts-store\";\nimport { AppearancePreferencesStore } from \"../common/store/appearance-preferences-store\";\nimport { ClusterIconsStore } from \"../common/store/cluster-icons-store\";\nimport { DashboardPreferencesStore } from \"../common/store/dashboard-preferences-store\";\nimport { MonitoringPreferencesStore } from \"../common/store/monitoring-preferences-store\";\nimport { NodeShellPreferencesStore } from \"../common/store/node-shell-preferences-store\";\nimport { PowerPreferencesStore } from \"../common/store/power-preferences-store\";\nimport { ReadOnlyPreferencesStore } from \"../common/store/read-only-preferences-store\";\nimport { startAiIpc } from \"./ai-ipc\";\nimport { startAiModels } from \"./ai-models\";\nimport { startClusterIcons } from \"./cluster-icons\";\nimport { registerClusterIconsCatalog } from \"./cluster-icons-catalog\";\nimport { registerDashboardCatalog } from \"./dashboard-catalog\";\nimport { startDashboardPicker } from \"./dashboard-picker\";\nimport { startDashboardViews } from \"./dashboard-views\";\nimport { startDiagnosticsMenuOrder } from \"./diagnostics-menu-order\";\nimport { startDockIconOverride } from \"./dock-icon\";\nimport { startMonitoringHistory } from \"./monitoring-history\";\nimport { startSettingsExport } from \"./settings-export\";\n\nexport default class FreelensPowerMain extends Main.LensExtension {\n private stopFeatures?: () => void;\n\n get name() {\n return EXTENSION_DISPLAY_NAME;\n }\n get sanitizedExtensionId() {\n return EXTENSION_ID;\n }\n get storeName() {\n return this.manifest.storeName || EXTENSION_ID;\n }\n\n onActivate() {\n const power = PowerPreferencesStore.getInstanceOrCreate<PowerPreferencesStore>();\n power.loadExtension(this);\n AiPreferencesStore.getInstanceOrCreate().loadExtension(this);\n AiShortcutsStore.getInstanceOrCreate().loadExtension(this);\n ReadOnlyPreferencesStore.getInstanceOrCreate().loadExtension(this);\n NodeShellPreferencesStore.getInstanceOrCreate().loadExtension(this);\n MonitoringPreferencesStore.getInstanceOrCreate().loadExtension(this);\n AppearancePreferencesStore.getInstanceOrCreate().loadExtension(this);\n DashboardPreferencesStore.getInstanceOrCreate().loadExtension(this);\n ClusterIconsStore.getInstanceOrCreate().loadExtension(this);\n this.stopFeatures?.();\n const stopExport = startSettingsExport();\n let disposers: (() => void)[] = [];\n const stop = reaction(\n () => power.enabled,\n (enabled) => {\n for (const dispose of disposers) dispose();\n disposers = enabled\n ? [\n startMonitoringHistory(this),\n startDiagnosticsMenuOrder(),\n startAiIpc(),\n startAiModels(),\n startDockIconOverride(),\n startDashboardViews(),\n startDashboardPicker(),\n registerDashboardCatalog(this),\n registerClusterIconsCatalog(this),\n startClusterIcons(),\n ]\n : [];\n },\n { fireImmediately: true },\n );\n this.stopFeatures = () => {\n stop();\n stopExport();\n for (const dispose of disposers) dispose();\n disposers = [];\n };\n }\n\n onDeactivate() {\n this.stopFeatures?.();\n this.stopFeatures = undefined;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAqB,oBAArB,cAA+C,mBAAA,KAAK,cAAc;CAChE;CAEA,IAAI,OAAO;EACT,OAAO,uBAAA;CACT;CACA,IAAI,uBAAuB;EACzB,OAAO,uBAAA;CACT;CACA,IAAI,YAAY;EACd,OAAO,KAAK,SAAS,aAAA;CACvB;CAEA,aAAa;EACX,MAAM,QAAQ,gCAAA,sBAAsB,oBAA2C;EAC/E,MAAM,cAAc,IAAI;EACxB,6BAAA,mBAAmB,oBAAoB,CAAC,CAAC,cAAc,IAAI;EAC3D,2BAAA,iBAAiB,oBAAoB,CAAC,CAAC,cAAc,IAAI;EACzD,oCAAA,yBAAyB,oBAAoB,CAAC,CAAC,cAAc,IAAI;EACjE,qCAAA,0BAA0B,oBAAoB,CAAC,CAAC,cAAc,IAAI;EAClE,qCAAA,2BAA2B,oBAAoB,CAAC,CAAC,cAAc,IAAI;EACnE,qCAAA,2BAA2B,oBAAoB,CAAC,CAAC,cAAc,IAAI;EACnE,oCAAA,0BAA0B,oBAAoB,CAAC,CAAC,cAAc,IAAI;EAClE,4BAAA,kBAAkB,oBAAoB,CAAC,CAAC,cAAc,IAAI;EAC1D,KAAK,eAAe;EACpB,MAAM,aAAa,wBAAA,oBAAoB;EACvC,IAAI,YAA4B,CAAC;EACjC,MAAM,OAAO,8BAAA,eACL,MAAM,UACX,YAAY;GACX,KAAK,MAAM,WAAW,WAAW,QAAQ;GACzC,YAAY,UACR;IACE,2BAAA,uBAAuB,IAAI;IAC3B,+BAAA,0BAA0B;IAC1B,eAAA,WAAW;IACX,kBAAA,cAAc;IACd,kBAAA,sBAAsB;IACtB,wBAAA,oBAAoB;IACpB,yBAAA,qBAAqB;IACrB,0BAAA,yBAAyB,IAAI;IAC7B,8BAAA,4BAA4B,IAAI;IAChC,sBAAA,kBAAkB;GACpB,IACA,CAAC;EACP,GACA,EAAE,iBAAiB,KAAK,CAC1B;EACA,KAAK,qBAAqB;GACxB,KAAK;GACL,WAAW;GACX,KAAK,MAAM,WAAW,WAAW,QAAQ;GACzC,YAAY,CAAC;EACf;CACF;CAEA,eAAe;EACb,KAAK,eAAe;EACpB,KAAK,eAAe,KAAA;CACtB;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/main/index.ts"],"sourcesContent":["import { Main } from \"@freelensapp/extensions\";\nimport { reaction } from \"mobx\";\nimport { EXTENSION_DISPLAY_NAME, EXTENSION_ID } from \"../common/extension-info\";\nimport { AiPreferencesStore } from \"../common/store/ai-preferences-store\";\nimport { AiShortcutsStore } from \"../common/store/ai-shortcuts-store\";\nimport { AppearancePreferencesStore } from \"../common/store/appearance-preferences-store\";\nimport { ClusterIconsStore } from \"../common/store/cluster-icons-store\";\nimport { DashboardPreferencesStore } from \"../common/store/dashboard-preferences-store\";\nimport { MonitoringPreferencesStore } from \"../common/store/monitoring-preferences-store\";\nimport { NodeShellPreferencesStore } from \"../common/store/node-shell-preferences-store\";\nimport { PowerPreferencesStore } from \"../common/store/power-preferences-store\";\nimport { ReadOnlyPreferencesStore } from \"../common/store/read-only-preferences-store\";\nimport { startAiIpc } from \"./ai-ipc\";\nimport { startAiModels } from \"./ai-models\";\nimport { startClusterIcons } from \"./cluster-icons\";\nimport { registerClusterIconsCatalog } from \"./cluster-icons-catalog\";\nimport { registerDashboardCatalog } from \"./dashboard-catalog\";\nimport { startDashboardPicker } from \"./dashboard-picker\";\nimport { startDashboardViews } from \"./dashboard-views\";\nimport { startDiagnosticsMenuOrder } from \"./diagnostics-menu-order\";\nimport { startDockIconOverride } from \"./dock-icon\";\nimport { startMonitoringHistory } from \"./monitoring-history\";\nimport { startSettingsExport } from \"./settings-export\";\nimport { startSplashAccentOverride } from \"./splash-accent\";\n\nexport default class FreelensPowerMain extends Main.LensExtension {\n private stopFeatures?: () => void;\n\n get name() {\n return EXTENSION_DISPLAY_NAME;\n }\n get sanitizedExtensionId() {\n return EXTENSION_ID;\n }\n get storeName() {\n return this.manifest.storeName || EXTENSION_ID;\n }\n\n onActivate() {\n const power = PowerPreferencesStore.getInstanceOrCreate<PowerPreferencesStore>();\n power.loadExtension(this);\n AiPreferencesStore.getInstanceOrCreate().loadExtension(this);\n AiShortcutsStore.getInstanceOrCreate().loadExtension(this);\n ReadOnlyPreferencesStore.getInstanceOrCreate().loadExtension(this);\n NodeShellPreferencesStore.getInstanceOrCreate().loadExtension(this);\n MonitoringPreferencesStore.getInstanceOrCreate().loadExtension(this);\n AppearancePreferencesStore.getInstanceOrCreate().loadExtension(this);\n DashboardPreferencesStore.getInstanceOrCreate().loadExtension(this);\n ClusterIconsStore.getInstanceOrCreate().loadExtension(this);\n this.stopFeatures?.();\n const stopExport = startSettingsExport();\n let disposers: (() => void)[] = [];\n const stop = reaction(\n () => power.enabled,\n (enabled) => {\n for (const dispose of disposers) dispose();\n disposers = enabled\n ? [\n startMonitoringHistory(this),\n startDiagnosticsMenuOrder(),\n startAiIpc(),\n startAiModels(),\n startDockIconOverride(),\n startSplashAccentOverride(),\n startDashboardViews(),\n startDashboardPicker(),\n registerDashboardCatalog(this),\n registerClusterIconsCatalog(this),\n startClusterIcons(),\n ]\n : [];\n },\n { fireImmediately: true },\n );\n this.stopFeatures = () => {\n stop();\n stopExport();\n for (const dispose of disposers) dispose();\n disposers = [];\n };\n }\n\n onDeactivate() {\n this.stopFeatures?.();\n this.stopFeatures = undefined;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAqB,oBA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W,WAAW,QAAQ;GACzC,YAAY,CAAC;EACf;CACF;CAEA,eAAe;EACb,KAAK,eAAe;EACpB,KAAK,eAAe,KAAA;CACtB;AACF"}
@@ -0,0 +1,84 @@
1
+ const require__global_external_mobx = require("./_virtual/_global-external_mobx.js");
2
+ const require_appearance_preferences_store = require("./common/store/appearance-preferences-store.js");
3
+ let electron = require("electron");
4
+ let node_path = require("node:path");
5
+ let node_url = require("node:url");
6
+ //#region src/main/splash-accent.ts
7
+ function isNativeSplashUrl(url, appPath) {
8
+ try {
9
+ const parsed = new URL(url);
10
+ return parsed.protocol === "file:" && !parsed.host && (0, node_url.fileURLToPath)(parsed) === (0, node_path.join)(appPath, "static", "splash.html");
11
+ } catch {
12
+ return false;
13
+ }
14
+ }
15
+ function startSplashAccentOverride() {
16
+ const preferences = require_appearance_preferences_store.AppearancePreferencesStore.getInstanceOrCreate();
17
+ const appPath = electron.app.getAppPath();
18
+ const windows = /* @__PURE__ */ new Map();
19
+ let disposed = false;
20
+ let css = "";
21
+ const attach = (window) => {
22
+ const contents = window.webContents;
23
+ if (disposed || contents.isDestroyed() || windows.has(contents)) return;
24
+ let key;
25
+ let revision = 0;
26
+ let pending = Promise.resolve();
27
+ const refresh = () => {
28
+ const request = ++revision;
29
+ pending = pending.then(async () => {
30
+ if (request !== revision || contents.isDestroyed()) return;
31
+ if (key) {
32
+ const previous = key;
33
+ key = void 0;
34
+ await contents.removeInsertedCSS(previous).catch(() => {});
35
+ }
36
+ if (disposed || request !== revision || !css || contents.isDestroyed() || !isNativeSplashUrl(contents.getURL(), appPath)) return;
37
+ const inserted = await contents.insertCSS(css, { cssOrigin: "user" });
38
+ if (disposed || request !== revision || contents.isDestroyed() || !isNativeSplashUrl(contents.getURL(), appPath)) {
39
+ if (!contents.isDestroyed()) await contents.removeInsertedCSS(inserted).catch(() => {});
40
+ } else key = inserted;
41
+ }).catch(() => {});
42
+ };
43
+ const cleanup = () => {
44
+ contents.removeListener("dom-ready", refresh);
45
+ contents.removeListener("did-start-loading", refresh);
46
+ contents.removeListener("destroyed", cleanup);
47
+ windows.delete(contents);
48
+ refresh();
49
+ };
50
+ windows.set(contents, {
51
+ refresh,
52
+ cleanup
53
+ });
54
+ contents.on("dom-ready", refresh);
55
+ contents.on("did-start-loading", refresh);
56
+ contents.once("destroyed", cleanup);
57
+ refresh();
58
+ };
59
+ const onCreated = (_event, window) => attach(window);
60
+ electron.app.on("browser-window-created", onCreated);
61
+ for (const window of electron.BrowserWindow.getAllWindows()) attach(window);
62
+ const stop = require__global_external_mobx.reaction(() => [
63
+ preferences.enabled,
64
+ preferences.accentColor,
65
+ preferences.recolorAppIcon
66
+ ], ([enabled, color, recolorAppIcon]) => {
67
+ css = enabled && color !== "default" && require_appearance_preferences_store.isAccentSelection(color) ? `.progress, .glow div { background: ${color} !important; box-shadow: 0 0 20px ${color} !important; }
68
+ @keyframes freelens-power-splash-glow { from { opacity: 1; flex: 1; } to { opacity: 0; flex: 10; } }
69
+ .glow div { animation-name: freelens-power-splash-glow !important; }
70
+ ${recolorAppIcon ? `.icon svg path:is([fill="#23a49c"], [fill="#73c3c0"], [fill="#a8d8d6"], [fill="#50b6b4"]) { fill: ${color} !important; }` : ""}` : "";
71
+ for (const state of windows.values()) state.refresh();
72
+ }, { fireImmediately: true });
73
+ return () => {
74
+ disposed = true;
75
+ stop();
76
+ electron.app.removeListener("browser-window-created", onCreated);
77
+ for (const state of [...windows.values()]) state.cleanup();
78
+ };
79
+ }
80
+ //#endregion
81
+ exports.isNativeSplashUrl = isNativeSplashUrl;
82
+ exports.startSplashAccentOverride = startSplashAccentOverride;
83
+
84
+ //# sourceMappingURL=splash-accent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"splash-accent.js","names":[],"sources":["../../src/main/splash-accent.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { app, BrowserWindow, type WebContents } from \"electron\";\nimport { reaction } from \"mobx\";\nimport { AppearancePreferencesStore, isAccentSelection } from \"../common/store/appearance-preferences-store\";\n\nexport function isNativeSplashUrl(url: string, appPath: string): boolean {\n try {\n const parsed = new URL(url);\n return (\n parsed.protocol === \"file:\" && !parsed.host && fileURLToPath(parsed) === join(appPath, \"static\", \"splash.html\")\n );\n } catch {\n return false;\n }\n}\n\nexport function startSplashAccentOverride(): () => void {\n const preferences = AppearancePreferencesStore.getInstanceOrCreate<AppearancePreferencesStore>();\n const appPath = app.getAppPath();\n const windows = new Map<WebContents, { refresh: () => void; cleanup: () => void }>();\n let disposed = false;\n let css = \"\";\n\n const attach = (window: BrowserWindow) => {\n const contents = window.webContents;\n if (disposed || contents.isDestroyed() || windows.has(contents)) return;\n let key: string | undefined;\n let revision = 0;\n let pending = Promise.resolve();\n const refresh = () => {\n const request = ++revision;\n pending = pending\n .then(async () => {\n if (request !== revision || contents.isDestroyed()) return;\n if (key) {\n const previous = key;\n key = undefined;\n await contents.removeInsertedCSS(previous).catch(() => {});\n }\n if (\n disposed ||\n request !== revision ||\n !css ||\n contents.isDestroyed() ||\n !isNativeSplashUrl(contents.getURL(), appPath)\n )\n return;\n const inserted = await contents.insertCSS(css, { cssOrigin: \"user\" });\n if (\n disposed ||\n request !== revision ||\n contents.isDestroyed() ||\n !isNativeSplashUrl(contents.getURL(), appPath)\n ) {\n if (!contents.isDestroyed()) await contents.removeInsertedCSS(inserted).catch(() => {});\n } else key = inserted;\n })\n .catch(() => {});\n };\n const cleanup = () => {\n contents.removeListener(\"dom-ready\", refresh);\n contents.removeListener(\"did-start-loading\", refresh);\n contents.removeListener(\"destroyed\", cleanup);\n windows.delete(contents);\n refresh();\n };\n windows.set(contents, { refresh, cleanup });\n contents.on(\"dom-ready\", refresh);\n contents.on(\"did-start-loading\", refresh);\n contents.once(\"destroyed\", cleanup);\n refresh();\n };\n const onCreated = (_event: Electron.Event, window: BrowserWindow) => attach(window);\n app.on(\"browser-window-created\", onCreated);\n for (const window of BrowserWindow.getAllWindows()) attach(window);\n const stop = reaction(\n () => [preferences.enabled, preferences.accentColor, preferences.recolorAppIcon] as const,\n ([enabled, color, recolorAppIcon]) => {\n css =\n enabled && color !== \"default\" && isAccentSelection(color)\n ? `.progress, .glow div { background: ${color} !important; box-shadow: 0 0 20px ${color} !important; }\n @keyframes freelens-power-splash-glow { from { opacity: 1; flex: 1; } to { opacity: 0; flex: 10; } }\n .glow div { animation-name: freelens-power-splash-glow !important; }\n ${recolorAppIcon ? `.icon svg path:is([fill=\"#23a49c\"], [fill=\"#73c3c0\"], [fill=\"#a8d8d6\"], [fill=\"#50b6b4\"]) { fill: ${color} !important; }` : \"\"}`\n : \"\";\n for (const state of windows.values()) state.refresh();\n },\n { fireImmediately: true },\n );\n return () => {\n disposed = true;\n stop();\n app.removeListener(\"browser-window-created\", onCreated);\n for (const state of [...windows.values()]) state.cleanup();\n };\n}\n"],"mappings":";;;;;;AAOA,SAAgB,kBAAkB,KAAa,SAA0B;CACvE,IAAI;EACF,MAAM,SAAS,IAAI,IAAI,GAAG;EAC1B,OACE,OAAO,aAAa,WAAW,CAAC,OAAO,SAAA,GAAA,SAAA,cAAA,CAAsB,MAAM,OAAA,GAAA,UAAA,KAAA,CAAW,SAAS,UAAU,aAAa;CAElH,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAgB,4BAAwC;CACtD,MAAM,cAAc,qCAAA,2BAA2B,oBAAgD;CAC/F,MAAM,UAAU,SAAA,IAAI,WAAW;CAC/B,MAAM,0BAAU,IAAI,IAA+D;CACnF,IAAI,WAAW;CACf,IAAI,MAAM;CAEV,MAAM,UAAU,WAA0B;EACxC,MAAM,WAAW,OAAO;EACxB,IAAI,YAAY,SAAS,YAAY,KAAK,QAAQ,IAAI,QAAQ,GAAG;EACjE,IAAI;EACJ,IAAI,WAAW;EACf,IAAI,UAAU,QAAQ,QAAQ;EAC9B,MAAM,gBAAgB;GACpB,MAAM,UAAU,EAAE;GAClB,UAAU,QACP,KAAK,YAAY;IAChB,IAAI,YAA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,MAAM,kBAAkB,OAC9I;EACN,KAAK,MAAM,SAAS,QAAQ,OAAO,GAAG,MAAM,QAAQ;CACtD,GACA,EAAE,iBAAiB,KAAK,CAC1B;CACA,aAAa;EACX,WAAW;EACX,KAAK;EACL,SAAA,IAAI,eAAe,0BAA0B,SAAS;EACtD,KAAK,MAAM,SAAS,CAAC,GAAG,QAAQ,OAAO,CAAC,GAAG,MAAM,QAAQ;CAC3D;AACF"}
@@ -5,7 +5,11 @@ function startAppearanceOverride() {
5
5
  const preferences = require_appearance_preferences_store.AppearancePreferencesStore.getInstanceOrCreate();
6
6
  const style = document.createElement("style");
7
7
  style.dataset.freelensPower = "accent-color";
8
- const stop = require__global_external_mobx.reaction(() => [preferences.enabled, preferences.accentColor], ([enabled, color]) => {
8
+ const stop = require__global_external_mobx.reaction(() => [
9
+ preferences.enabled,
10
+ preferences.accentColor,
11
+ preferences.recolorAppIcon
12
+ ], ([enabled, color, recolorAppIcon]) => {
9
13
  if (!enabled || !require_appearance_preferences_store.isAccentSelection(color)) {
10
14
  style.remove();
11
15
  return;
@@ -21,7 +25,7 @@ function startAppearanceOverride() {
21
25
  :root .NamespaceSelectMenu .Select__option--is-selected.Select__option--is-focused { background: color-mix(in srgb, var(--primary) 24%, var(--contentColor)) !important; }
22
26
  :root .NamespaceSelectMenu .Select__option--is-selected .Icon { color: var(--primary); }
23
27
  :root a.link { color: var(--primary); }
24
- .Welcome [data-testid="no-welcome-banners-icon"] svg path[fill="#23a49c"] { fill: var(--primary); }
28
+ ${recolorAppIcon ? ".Welcome [data-testid=\"no-welcome-banners-icon\"] svg path[fill=\"#23a49c\"] { fill: var(--primary); }" : ""}
25
29
  `}\ninput[role="switch"] { --track-color-active: var(--primary) !important; }`;
26
30
  if (!style.isConnected) document.head.append(style);
27
31
  }, { fireImmediately: true });
@@ -1 +1 @@
1
- {"version":3,"file":"appearance.js","names":[],"sources":["../../src/renderer/appearance.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { reaction } from \"mobx\";\nimport { AppearancePreferencesStore, isAccentSelection } from \"../common/store/appearance-preferences-store\";\n\nexport function startAppearanceOverride(): () => void {\n const preferences = AppearancePreferencesStore.getInstanceOrCreate<AppearancePreferencesStore>();\n const style = document.createElement(\"style\");\n style.dataset.freelensPower = \"accent-color\";\n\n const stop = reaction(\n () => [preferences.enabled, preferences.accentColor] as const,\n ([enabled, color]) => {\n if (!enabled || !isAccentSelection(color)) {\n style.remove();\n return;\n }\n\n // [!important] takes precedence over the host theme's inline variables\n const accent =\n color === \"default\"\n ? \"\"\n : `\n :root { --primary: ${color} !important; --buttonPrimaryBackground: ${color} !important; --menuSelectedOptionBgc: ${color} !important; --select-option-focused-bgc: color-mix(in srgb, ${color} 24%, var(--contentColor)) !important; --icon-focus-color: ${color} !important; }\n :root .Checkbox, :root .Drawer .drawer-title, :root .DrawerParamToggler .param-link { --blue: var(--primary); }\n :root [role=\"treeitem\"][class*=\"catalog-tree-module__selected--\"] { --blue: var(--primary); }\n :root .Select:not(.Select--is-disabled) .Select__control--is-focused:not(.Select__control--is-disabled) { border-color: ${color} !important; box-shadow: 0 0 0 1px ${color} !important; }\n :root .Select__option--is-selected { background: var(--primary) !important; color: var(--textColorAccent) !important; }\n :root .NamespaceSelectMenu .Select__option { margin-block: 2px; }\n :root .NamespaceSelectMenu .Select__option--is-selected { background: color-mix(in srgb, var(--primary) 10%, var(--contentColor)) !important; color: var(--textColorAccent) !important; }\n :root .NamespaceSelectMenu .Select__option--is-selected.Select__option--is-focused { background: color-mix(in srgb, var(--primary) 24%, var(--contentColor)) !important; }\n :root .NamespaceSelectMenu .Select__option--is-selected .Icon { color: var(--primary); }\n :root a.link { color: var(--primary); }\n .Welcome [data-testid=\"no-welcome-banners-icon\"] svg path[fill=\"#23a49c\"] { fill: var(--primary); }\n `;\n style.textContent = `${accent}\\ninput[role=\"switch\"] { --track-color-active: var(--primary) !important; }`;\n\n if (!style.isConnected) {\n document.head.append(style);\n }\n },\n { fireImmediately: true },\n );\n\n return () => {\n stop();\n style.remove();\n };\n}\n"],"mappings":";;;AAIA,SAAgB,0BAAsC;CACpD,MAAM,cAAc,qCAAA,2BAA2B,oBAAgD;CAC/F,MAAM,QAAQ,SAAS,cAAc,OAAO;CAC5C,MAAM,QAAQ,gBAAgB;CAE9B,MAAM,OAAO,8BAAA,eACL,CAAC,YAAY,SAAS,YAAY,WAAW,IAClD,CAAC,SAAS,WAAW;EACpB,IAAI,CAAC,WAAW,CAAC,qCAAA,kBAAkB,KAAK,GAAG;GACzC,MAAM,OAAO;GACb;EACF;EAmBA,MAAM,cAAc,GAflB,UAAU,YACN,KACA;6BACiB,MAAM,0CAA0C,MAAM,wCAAwC,MAAM,+DAA+D,MAAM,6DAA6D,MAAM;;;kIAGvI,MAAM,qCAAqC,MAAM;;;;;;;;QAS/I;EAE9B,IAAI,CAAC,MAAM,aACT,SAAS,KAAK,OAAO,KAAK;CAE9B,GACA,EAAE,iBAAiB,KAAK,CAC1B;CAEA,aAAa;EACX,KAAK;EACL,MAAM,OAAO;CACf;AACF"}
1
+ {"version":3,"file":"appearance.js","names":[],"sources":["../../src/renderer/appearance.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { reaction } from \"mobx\";\nimport { AppearancePreferencesStore, isAccentSelection } from \"../common/store/appearance-preferences-store\";\n\nexport function startAppearanceOverride(): () => void {\n const preferences = AppearancePreferencesStore.getInstanceOrCreate<AppearancePreferencesStore>();\n const style = document.createElement(\"style\");\n style.dataset.freelensPower = \"accent-color\";\n\n const stop = reaction(\n () => [preferences.enabled, preferences.accentColor, preferences.recolorAppIcon] as const,\n ([enabled, color, recolorAppIcon]) => {\n if (!enabled || !isAccentSelection(color)) {\n style.remove();\n return;\n }\n\n // [!important] takes precedence over the host theme's inline variables\n const accent =\n color === \"default\"\n ? \"\"\n : `\n :root { --primary: ${color} !important; --buttonPrimaryBackground: ${color} !important; --menuSelectedOptionBgc: ${color} !important; --select-option-focused-bgc: color-mix(in srgb, ${color} 24%, var(--contentColor)) !important; --icon-focus-color: ${color} !important; }\n :root .Checkbox, :root .Drawer .drawer-title, :root .DrawerParamToggler .param-link { --blue: var(--primary); }\n :root [role=\"treeitem\"][class*=\"catalog-tree-module__selected--\"] { --blue: var(--primary); }\n :root .Select:not(.Select--is-disabled) .Select__control--is-focused:not(.Select__control--is-disabled) { border-color: ${color} !important; box-shadow: 0 0 0 1px ${color} !important; }\n :root .Select__option--is-selected { background: var(--primary) !important; color: var(--textColorAccent) !important; }\n :root .NamespaceSelectMenu .Select__option { margin-block: 2px; }\n :root .NamespaceSelectMenu .Select__option--is-selected { background: color-mix(in srgb, var(--primary) 10%, var(--contentColor)) !important; color: var(--textColorAccent) !important; }\n :root .NamespaceSelectMenu .Select__option--is-selected.Select__option--is-focused { background: color-mix(in srgb, var(--primary) 24%, var(--contentColor)) !important; }\n :root .NamespaceSelectMenu .Select__option--is-selected .Icon { color: var(--primary); }\n :root a.link { color: var(--primary); }\n ${recolorAppIcon ? '.Welcome [data-testid=\"no-welcome-banners-icon\"] svg path[fill=\"#23a49c\"] { fill: var(--primary); }' : \"\"}\n `;\n style.textContent = `${accent}\\ninput[role=\"switch\"] { --track-color-active: var(--primary) !important; }`;\n\n if (!style.isConnected) {\n document.head.append(style);\n }\n },\n { fireImmediately: true },\n );\n\n return () => {\n stop();\n style.remove();\n };\n}\n"],"mappings":";;;AAIA,SAAgB,0BAAsC;CACpD,MAAM,cAAc,qCAAA,2BAA2B,oBAAgD;CAC/F,MAAM,QAAQ,SAAS,cAAc,OAAO;CAC5C,MAAM,QAAQ,gBAAgB;CAE9B,MAAM,OAAO,8BAAA,eACL;EAAC,YAAY;EAAS,YAAY;EAAa,YAAY;CAAc,IAC9E,CAAC,SAAS,OAAO,oBAAoB;EACpC,IAAI,CAAC,WAAW,CAAC,qCAAA,kBAAkB,KAAK,GAAG;GACzC,MAAM,OAAO;GACb;EACF;EAmBA,MAAM,cAAc,GAflB,UAAU,YACN,KACA;6BACiB,MAAM,0CAA0C,MAAM,wCAAwC,MAAM,+DAA+D,MAAM,6DAA6D,MAAM;;;kIAGvI,MAAM,qCAAqC,MAAM;;;;;;;UAOzK,iBAAiB,4GAAwG,GAAG;QAElG;EAE9B,IAAI,CAAC,MAAM,aACT,SAAS,KAAK,OAAO,KAAK;CAE9B,GACA,EAAE,iBAAiB,KAAK,CAC1B;CAEA,aAAa;EACX,KAAK;EACL,MAAM,OAAO;CACf;AACF"}