schoolbox web extension :)
0
fork

Configure Feed

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

fix(storage): remove troublesome migrations and perform a final full reset

* legacy migrations are not causing issues but as we are resetting
settings completely we can remove them
* same with schoolboxUrls migrations

willow bef19107 e1ff524e

+4 -60
+4 -60
src/utils/storage.ts
··· 4 4 // Global 5 5 export const globalSettings: StorageState<Types.Settings> = new StorageState<Types.Settings>( 6 6 storage.defineItem<Types.Settings>("local:globalSettings", { 7 - version: 3, 7 + version: 4, 8 8 fallback: { 9 9 global: true, 10 10 plugins: true, ··· 19 19 userSnippets: {}, 20 20 }, 21 21 migrations: { 22 - 2: (oldData) => { 23 - needsRefresh.set(oldData.needsRefresh); 24 - schoolboxUrls.set(oldData.schoolboxUrls); 25 - return { 26 - ...globalSettings.storage.fallback, 27 - global: oldData.global, 28 - }; 29 - }, 30 - 3: (oldData) => { 31 - return { 32 - ...oldData, 33 - ...globalSettings.storage.fallback, 34 - }; 22 + 4: async () => { 23 + await storage.clear("local"); 35 24 }, 36 25 }, 37 26 }), ··· 61 50 62 51 export const schoolboxUrls = new StorageState( 63 52 storage.defineItem<Types.SchoolboxUrls>("local:urls", { 64 - version: 2, 53 + version: 1, 65 54 fallback: { 66 55 urls: ["https://help.schoolbox.com.au"], 67 - }, 68 - migrations: { 69 - 2: () => { 70 - return { urls: ["https://help.schoolbox.com.au"] }; 71 - }, 72 56 }, 73 57 }), 74 58 ); ··· 261 245 false, 262 246 ), 263 247 }; 264 - 265 - // Legacy storage items from v3 used for migration 266 - storage.defineItem("local:themeSettings", { 267 - version: 2, 268 - migrations: { 269 - 2: (oldData) => { 270 - globalSettings.set({ 271 - themes: oldData.themeToggle, 272 - themeFlavour: oldData.flavour, 273 - themeAccent: oldData.accent, 274 - }); 275 - }, 276 - }, 277 - }); 278 - 279 - storage.defineItem("local:pluginSettings", { 280 - version: 2, 281 - migrations: { 282 - 2: (oldData) => { 283 - globalSettings.set({ plugins: oldData.toggle }); 284 - plugins.subheader.toggle.set({ toggle: oldData.plugins.subheader.toggle }); 285 - plugins.scrollSegments.toggle.set({ toggle: oldData.plugins.scrollSegments.toggle }); 286 - plugins.scrollPeriod.toggle.set({ toggle: oldData.plugins.scrollPeriod.toggle }); 287 - plugins.modernIcons.toggle.set({ toggle: oldData.plugins.modernIcons.toggle }); 288 - plugins.tabTitle.toggle.set({ toggle: oldData.plugins.tabTitle.toggle }); 289 - plugins.homepageSwitcher.toggle.set({ toggle: oldData.plugins.homepageSwitcher.toggle }); 290 - }, 291 - }, 292 - }); 293 - 294 - storage.defineItem("local:snippetSettings", { 295 - version: 2, 296 - migrations: { 297 - 2: (oldData) => { 298 - globalSettings.set({ snippets: oldData.toggle, userSnippets: oldData.user }); 299 - snippets.hidePfp.toggle.set({ toggle: oldData.snippets.hidePfp.toggle }); 300 - snippets.censor.toggle.set({ toggle: oldData.snippets.censor.toggle }); 301 - }, 302 - }, 303 - });