experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor(settings): migrate to tile-preload + strict shims (Phase 3.11b-settings1)

Route peek://app/settings/settings.html through tile-preload by hardcoding a
trustedBuiltin capability grant in the window-open handler (ipc.ts), matching
the same pattern used for core glue windows (page-glue, etc.).

Migrate all 6 direct api.invoke() calls in app/settings/settings.js to the
strict tile-preload wrapper methods added in commit 70c7cfb4 (Phase 3.11b-shims):
- api.invoke('default-browser-status') -> api.app.getDefaultBrowserStatus()
- api.invoke('set-default-browser') -> api.app.setDefaultBrowser()
- api.invoke('backup-create') -> api.backup.create()
- api.invoke('backup-list') -> api.backup.list()
- api.invoke('backup-get-config') -> api.backup.getConfig()
- api.invoke('shell-open-path', ...) -> api.shell.openPath(...)

Legacy ipc.ts handlers for these channels are intentionally preserved: they
still serve app/diagnostic.html which has not yet been migrated.

+24 -6
+6 -6
app/settings/settings.js
··· 278 278 // Check current status 279 279 (async () => { 280 280 try { 281 - const result = await api.invoke('default-browser-status'); 281 + const result = await api.app.getDefaultBrowserStatus(); 282 282 if (result.isDefault) { 283 283 defaultBrowserBtn.textContent = 'Already the default handler'; 284 284 defaultBrowserBtn.disabled = true; ··· 293 293 defaultBrowserBtn.disabled = true; 294 294 defaultBrowserBtn.textContent = 'Setting...'; 295 295 try { 296 - const result = await api.invoke('set-default-browser'); 296 + const result = await api.app.setDefaultBrowser(); 297 297 if (result.success) { 298 298 defaultBrowserBtn.textContent = 'Already the default handler'; 299 299 defaultBrowserBtn.style.opacity = '0.6'; ··· 3144 3144 backupBtnRow.appendChild(makeBtn('Backup Now', async () => { 3145 3145 backupOutput.textContent = 'Creating backup...'; 3146 3146 try { 3147 - const result = await api.invoke('backup-create'); 3147 + const result = await api.backup.create(); 3148 3148 backupOutput.textContent = result.success 3149 3149 ? `Backup created:\n${result.path}` 3150 3150 : `Failed: ${result.error}`; ··· 3156 3156 backupBtnRow.appendChild(makeBtn('List Backups', async () => { 3157 3157 backupOutput.textContent = 'Loading...'; 3158 3158 try { 3159 - const result = await api.invoke('backup-list'); 3159 + const result = await api.backup.list(); 3160 3160 if (result.success) { 3161 3161 const { backups, backupDir } = result.data; 3162 3162 if (!backupDir) { ··· 3183 3183 3184 3184 backupBtnRow.appendChild(makeBtn('Open Backup Folder', async () => { 3185 3185 try { 3186 - const configResult = await api.invoke('backup-get-config'); 3186 + const configResult = await api.backup.getConfig(); 3187 3187 if (!configResult.success) { 3188 3188 backupOutput.textContent = `Error: ${configResult.error}`; 3189 3189 return; ··· 3193 3193 backupOutput.textContent = 'Backup directory not configured.\nSet it in Core settings.'; 3194 3194 return; 3195 3195 } 3196 - await api.invoke('shell-open-path', { path: backupDir }); 3196 + await api.shell.openPath(backupDir); 3197 3197 backupOutput.textContent = `Opened: ${backupDir}`; 3198 3198 } catch (err) { 3199 3199 backupOutput.textContent = `Error: ${err.message}`;
+18
backend/electron/ipc.ts
··· 1060 1060 }; 1061 1061 } 1062 1062 1063 + // Special-case: peek://app/settings/settings.html is not a registered v2 1064 + // tile (no manifest), but it must load via tile-preload so its api.<ns>.* 1065 + // calls reach the strict tile:* IPC handlers. 1066 + if (!tileWebPrefs && url === 'peek://app/settings/settings.html') { 1067 + const settingsGrant = createTrustedBuiltinGrant('settings'); 1068 + const settingsToken = generateToken('settings', 'main', settingsGrant); 1069 + tileWebPrefs = { 1070 + preload: getTilePreloadPath(), 1071 + additionalArguments: [ 1072 + '--tile-id=settings', 1073 + '--tile-entry=main', 1074 + `--tile-token=${settingsToken}`, 1075 + ], 1076 + tileId: 'settings', 1077 + entryId: 'main', 1078 + }; 1079 + DEBUG && console.log('[window-open] settings window: assigned trustedBuiltin tile-preload token'); 1080 + } 1063 1081 // Prepare browser window options 1064 1082 const winOptions: Electron.BrowserWindowConstructorOptions = { 1065 1083 frame: isWebPage ? false : frameDefault, // Web pages are always frameless