MCPcopy
hub / github.com/jgraph/drawio-desktop / migrateLegacyRecentsOnce

Function migrateLegacyRecentsOnce

src/main/electron.js:285–315  ·  view source on GitHub ↗
(webContents)

Source from the content-addressed store, hash-verified

283const BLESSED_PATHS_MIGRATION_KEY = 'blessedPathsLegacyMigrated';
284
285async function migrateLegacyRecentsOnce(webContents)
286{
287 if (store == null) return;
288 if (store.get(BLESSED_PATHS_MIGRATION_KEY)) return;
289
290 try
291 {
292 const recentsJson = await webContents.executeJavaScript(
293 'try { localStorage.getItem(".recent") } catch (e) { null }');
294
295 if (typeof recentsJson === 'string')
296 {
297 const recents = JSON.parse(recentsJson);
298
299 if (Array.isArray(recents))
300 {
301 for (const entry of recents)
302 {
303 if (entry != null && typeof entry.id === 'string' &&
304 entry.id && fs.existsSync(entry.id))
305 {
306 blessPath(entry.id);
307 }
308 }
309 }
310 }
311 }
312 catch (e) {} // Migration is best-effort; never block app startup.
313
314 try { store.set(BLESSED_PATHS_MIGRATION_KEY, true); } catch (e) {}
315}
316let appZoom = 1;
317// Disabled by default
318let isGoogleFontsEnabled = store != null ? (store.get('isGoogleFontsEnabled') != null? store.get('isGoogleFontsEnabled') : false) : false;

Callers 1

electron.jsFile · 0.85

Calls 1

blessPathFunction · 0.85

Tested by

no test coverage detected