experiments in a post-browser web
10
fork

Configure Feed

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

fix datastore tableName param mismatch and migrate 6 features to v2 settings API

+40 -35
+1
.yarn/releases
··· 1 + /Users/dietrich/misc/mpeek/.yarn/releases
+15 -9
backend/electron/tile-ipc.ts
··· 3915 3915 3916 3916 ipcMain.handle('tile:datastore:get-table', async (_event, args: { 3917 3917 token: string; 3918 - table: string; 3918 + table?: string; 3919 + tableName?: string; 3919 3920 }) => { 3920 - const check = validateTileDatastoreRequest(args?.token, [args?.table]); 3921 + const table = args?.tableName ?? args?.table; 3922 + const check = validateTileDatastoreRequest(args?.token, [table as string]); 3921 3923 if ('error' in check) { handleDatastoreViolation(args?.token, 'datastore:get-table', check.error); return { error: check.error }; } 3922 3924 try { 3923 - const data = dsGetTable(args.table as TableName); 3925 + const data = dsGetTable(table as TableName); 3924 3926 return { success: true, data }; 3925 3927 } catch (error) { 3926 3928 return { success: false, error: error instanceof Error ? error.message : String(error) }; ··· 3929 3931 3930 3932 ipcMain.handle('tile:datastore:get-row', async (_event, args: { 3931 3933 token: string; 3932 - table: string; 3934 + table?: string; 3935 + tableName?: string; 3933 3936 rowId: string; 3934 3937 }) => { 3935 - const check = validateTileDatastoreRequest(args?.token, [args?.table]); 3938 + const table = args?.tableName ?? args?.table; 3939 + const check = validateTileDatastoreRequest(args?.token, [table as string]); 3936 3940 if ('error' in check) { handleDatastoreViolation(args?.token, 'datastore:get-row', check.error); return { error: check.error }; } 3937 3941 try { 3938 - const data = dsGetRow(args.table as TableName, args.rowId); 3942 + const data = dsGetRow(table as TableName, args.rowId); 3939 3943 return { success: true, data }; 3940 3944 } catch (error) { 3941 3945 return { success: false, error: error instanceof Error ? error.message : String(error) }; ··· 3944 3948 3945 3949 ipcMain.handle('tile:datastore:set-row', async (_event, args: { 3946 3950 token: string; 3947 - table: string; 3951 + table?: string; 3952 + tableName?: string; 3948 3953 rowId: string; 3949 3954 rowData: Record<string, unknown>; 3950 3955 }) => { 3951 - const check = validateTileDatastoreRequest(args?.token, [args?.table]); 3956 + const table = args?.tableName ?? args?.table; 3957 + const check = validateTileDatastoreRequest(args?.token, [table as string]); 3952 3958 if ('error' in check) { handleDatastoreViolation(args?.token, 'datastore:set-row', check.error); return { error: check.error }; } 3953 3959 try { 3954 - dsSetRow(args.table as TableName, args.rowId, args.rowData || {}); 3960 + dsSetRow(table as TableName, args.rowId, args.rowData || {}); 3955 3961 return { success: true }; 3956 3962 } catch (error) { 3957 3963 return { success: false, error: error instanceof Error ? error.message : String(error) };
+3 -3
features/lists/background.js
··· 33 33 * @returns {Promise<{prefs: object}>} 34 34 */ 35 35 const loadSettings = async () => { 36 - const result = await api.settings.get(); 36 + const result = await api.settings.get('prefs'); 37 37 if (result.success && result.data) { 38 38 return { 39 - prefs: result.data.prefs || defaults.prefs 39 + prefs: result.data 40 40 }; 41 41 } 42 42 return { prefs: defaults.prefs }; ··· 47 47 * @param {object} settings - Settings object with prefs 48 48 */ 49 49 const saveSettings = async (settings) => { 50 - const result = await api.settings.set(settings); 50 + const result = await api.settings.set('prefs', settings.prefs); 51 51 if (!result.success) { 52 52 console.error('[ext:lists] Failed to save settings:', result.error); 53 53 }
+2 -2
features/peeks/background.js
··· 28 28 * @returns {Promise<{prefs: object, items: array}>} 29 29 */ 30 30 const loadSettings = async () => { 31 - const result = await api.settings.get(); 31 + const result = await api.settings.get('data'); 32 32 if (result.success && result.data) { 33 33 return { 34 34 prefs: result.data.prefs || defaults.prefs, ··· 43 43 * @param {object} settings - Settings object with prefs and items 44 44 */ 45 45 const saveSettings = async (settings) => { 46 - const result = await api.settings.set(settings); 46 + const result = await api.settings.set('data', settings); 47 47 if (!result.success) { 48 48 console.error('[ext:peeks] Failed to save settings:', result.error); 49 49 }
+2 -2
features/scripts/background.js
··· 63 63 * Load scripts from datastore 64 64 */ 65 65 const loadSettings = async () => { 66 - const result = await api.settings.get(); 66 + const result = await api.settings.get('data'); 67 67 if (result.success && result.data) { 68 68 return { 69 69 scripts: result.data.scripts || defaults.scripts ··· 76 76 * Save scripts to datastore 77 77 */ 78 78 const saveSettings = async (settings) => { 79 - const result = await api.settings.set(settings); 79 + const result = await api.settings.set('data', settings); 80 80 if (!result.success) { 81 81 console.error('[ext:scripts] Failed to save settings:', result.error); 82 82 }
+8 -9
features/sheets/background.js
··· 18 18 * Get all sheet configs from feature_settings 19 19 */ 20 20 const listSheets = async () => { 21 - const result = await api.settings.get(); 21 + const result = await api.settings.get('sheets'); 22 22 if (!result.success || !result.data) return []; 23 23 24 - const sheets = []; 25 - for (const [key, value] of Object.entries(result.data)) { 26 - if (key.startsWith('sheet:')) { 27 - sheets.push({ key, ...value }); 28 - } 29 - } 30 - return sheets; 24 + const sheetsMap = result.data; 25 + return Object.entries(sheetsMap).map(([key, value]) => ({ key, ...value })); 31 26 }; 32 27 33 28 /** ··· 43 38 items: [] 44 39 }; 45 40 46 - const result = await api.settings.set(key, config); 41 + // Load existing sheets, add new one, save back 42 + const existing = await api.settings.get('sheets'); 43 + const sheetsMap = (existing.success && existing.data) || {}; 44 + sheetsMap[key] = config; 45 + const result = await api.settings.set('sheets', sheetsMap); 47 46 if (result && result.error) { 48 47 console.error('[ext:sheets] Failed to save sheet:', result.error); 49 48 }
+2 -2
features/tag-actions/background.js
··· 27 27 // ==================== Settings ==================== 28 28 29 29 const loadSettings = async () => { 30 - const result = await api.settings.get(); 30 + const result = await api.settings.get('data'); 31 31 if (result.success && result.data) { 32 32 // Support new pairs format 33 33 if (Array.isArray(result.data.pairs)) { ··· 49 49 }; 50 50 51 51 const saveSettings = async () => { 52 - const result = await api.settings.set({ pairs: currentPairs }); 52 + const result = await api.settings.set('data', { pairs: currentPairs }); 53 53 if (!result.success) { 54 54 console.error('[tag-actions] Failed to save settings:', result.error); 55 55 }
+6 -8
features/websearch/background.js
··· 61 61 * Load settings from datastore 62 62 */ 63 63 const loadSettings = async () => { 64 - const result = await api.settings.get(); 64 + const result = await api.settings.get('prefs'); 65 65 if (result.success && result.data) { 66 66 return { 67 - prefs: { ...defaults.prefs, ...(result.data.prefs || {}) } 67 + prefs: { ...defaults.prefs, ...(result.data || {}) } 68 68 }; 69 69 } 70 70 return { prefs: { ...defaults.prefs } }; ··· 74 74 * Save settings to datastore 75 75 */ 76 76 const saveSettings = async (settings) => { 77 - const result = await api.settings.set(settings); 77 + const result = await api.settings.set('prefs', settings.prefs); 78 78 if (!result.success) { 79 79 console.error('[ext:websearch] Failed to save settings:', result.error); 80 80 } ··· 86 86 * Load custom/discovered engines from settings 87 87 */ 88 88 const loadEngines = async () => { 89 - const result = await api.settings.get(); 90 - const customEngines = (result.success && result.data && result.data.engines) || []; 89 + const result = await api.settings.get('engines'); 90 + const customEngines = (result.success && result.data) || []; 91 91 92 92 // Merge built-in with custom, custom engines can override built-in ones by ID 93 93 const customIds = new Set(customEngines.map(e => e.id)); ··· 104 104 */ 105 105 const saveEngines = async () => { 106 106 const customEngines = engines.filter(e => !e.isBuiltIn); 107 - const result = await api.settings.get(); 108 - const currentData = (result.success && result.data) || {}; 109 - await api.settings.set({ ...currentData, engines: customEngines }); 107 + await api.settings.set('engines', customEngines); 110 108 }; 111 109 112 110 /**
+1
node_modules
··· 1 + /Users/dietrich/misc/mpeek/node_modules