experiments in a post-browser web
10
fork

Configure Feed

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

refactor(tile-preload,ipc): flip app-control to strict + delete legacy (Phase 3.6f)

Flip api.log, api.quit, api.restart in tile-preload.cts to use strict
tile:log:write / tile:app:quit / tile:app:restart channels (with token).
Delete legacy ipcMain.on handlers for renderer-log, app-quit, app-restart
from ipc.ts. Remove now-redundant tileQuit/tileRestart/tileLog shims added
in Phase 3.5f. Pre-audit confirmed no direct callers of the legacy channels
in app/ or features/.

+2 -57
-19
backend/electron/ipc.ts
··· 3475 3475 * Register miscellaneous IPC handlers (shortcuts, pubsub, commands, etc.) 3476 3476 */ 3477 3477 export function registerMiscHandlers(onQuit: () => void): void { 3478 - // Renderer log forwarding - prints renderer console.log to terminal 3479 - ipcMain.on(IPC_CHANNELS.RENDERER_LOG, (_ev, msg) => { 3480 - const shortSource = msg.source?.replace('peek://app/', '').replace('peek://ext/', 'ext/') || 'unknown'; 3481 - console.log(`[${shortSource}]`, ...(msg.args || [])); 3482 - }); 3483 - 3484 3478 // Get app-level preferences 3485 3479 ipcMain.handle('get-app-prefs', () => { 3486 3480 return getPrefs(); ··· 3740 3734 DEBUG && console.log('ipc:subscribe:notification', msg); 3741 3735 ev.reply(msg.replyTopic, data); 3742 3736 }); 3743 - }); 3744 - 3745 - // App quit request 3746 - ipcMain.on(IPC_CHANNELS.APP_QUIT, (_ev, msg) => { 3747 - DEBUG && console.log('app-quit requested from:', msg?.source); 3748 - onQuit(); 3749 - }); 3750 - 3751 - // App restart request 3752 - ipcMain.on(IPC_CHANNELS.APP_RESTART, (_ev, msg) => { 3753 - DEBUG && console.log('app-restart requested from:', msg?.source); 3754 - app.relaunch(); 3755 - onQuit(); 3756 3737 }); 3757 3738 3758 3739 // Modify window
+2 -38
backend/electron/tile-preload.cts
··· 1888 1888 // ── Log (always available) ── 1889 1889 1890 1890 api.log = (...args: unknown[]) => { 1891 - ipcRenderer.send('renderer-log', { source: sourceAddress, args }); 1891 + ipcRenderer.send('tile:log:write', { token: tileToken, source: sourceAddress, args }); 1892 1892 }; 1893 1893 1894 1894 // ── Privileged escape hatch (trustedBuiltin only) ──────────────────── ··· 2028 2028 console.warn('[tile-preload] api.quit requires trustedBuiltin — ignored'); 2029 2029 return; 2030 2030 } 2031 - ipcRenderer.send('app-quit', { source: sourceAddress }); 2031 + ipcRenderer.send('tile:app:quit', { token: tileToken, source: sourceAddress }); 2032 2032 }; 2033 2033 2034 2034 api.restart = () => { ··· 2036 2036 console.warn('[tile-preload] api.restart requires trustedBuiltin — ignored'); 2037 2037 return; 2038 2038 } 2039 - ipcRenderer.send('app-restart', { source: sourceAddress }); 2040 - }; 2041 - 2042 - // ── tile:app:quit / tile:app:restart strict shims (Phase 3.5f) ────── 2043 - // 2044 - // New strict-channel counterparts to api.quit / api.restart above. 2045 - // Route through tile:app:* channels which enforce trustedBuiltin gating 2046 - // on the main-process side (tile-ipc.ts). The token is passed so the 2047 - // handler can validate the grant without relying on the sender's origin. 2048 - // 2049 - // Wave 3.6f will flip api.quit / api.restart to call these methods and 2050 - // delete the legacy app-quit / app-restart ipcMain.on handlers from ipc.ts. 2051 - api.tileQuit = () => { 2052 - if (!trustedBuiltin) { 2053 - console.warn('[tile-preload] api.tileQuit requires trustedBuiltin — ignored'); 2054 - return; 2055 - } 2056 - ipcRenderer.send('tile:app:quit', { token: tileToken, source: sourceAddress }); 2057 - }; 2058 - 2059 - api.tileRestart = () => { 2060 - if (!trustedBuiltin) { 2061 - console.warn('[tile-preload] api.tileRestart requires trustedBuiltin — ignored'); 2062 - return; 2063 - } 2064 2039 ipcRenderer.send('tile:app:restart', { token: tileToken, source: sourceAddress }); 2065 - }; 2066 - 2067 - // ── tile:log:write strict shim (Phase 3.5f) ────────────────────────── 2068 - // 2069 - // New strict-channel counterpart to api.log above (which still sends to 2070 - // the legacy `renderer-log` channel). Routes through tile:log:write with 2071 - // token validation on the main-process side. Any tile with a valid token 2072 - // may log — no additional capability check. Wave 3.6f will flip api.log 2073 - // to use this channel and delete the legacy renderer-log handler. 2074 - api.tileLog = (...args: unknown[]) => { 2075 - ipcRenderer.send('tile:log:write', { token: tileToken, source: sourceAddress, args }); 2076 2040 }; 2077 2041 2078 2042 // ── Theme (trustedBuiltin extensions) ────────────────────────────────