diff options
| author | Leah <kevinlukej@gmail.com> | 2024-03-04 18:47:47 +0000 |
|---|---|---|
| committer | Amelia Yukii <amelia.yukii@shourai.de> | 2024-03-04 18:47:47 +0000 |
| commit | eba0c2cc61512db22109e2f15604eb65f5b7d2f2 (patch) | |
| tree | 97c40e3e90f68d0a3613adb7e1660921a34b758a /packages/frontend/src/boot | |
| parent | merge: put back the readme (!447) (diff) | |
| download | sharkey-eba0c2cc61512db22109e2f15604eb65f5b7d2f2.tar.gz sharkey-eba0c2cc61512db22109e2f15604eb65f5b7d2f2.tar.bz2 sharkey-eba0c2cc61512db22109e2f15604eb65f5b7d2f2.zip | |
Fixed startup crash with seasonal effects
Diffstat (limited to 'packages/frontend/src/boot')
| -rw-r--r-- | packages/frontend/src/boot/main-boot.ts | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/packages/frontend/src/boot/main-boot.ts b/packages/frontend/src/boot/main-boot.ts index fbb4baebdc..34612fee73 100644 --- a/packages/frontend/src/boot/main-boot.ts +++ b/packages/frontend/src/boot/main-boot.ts @@ -73,27 +73,31 @@ export async function mainBoot() { mainRouter.push('/search'); }, }; - - if (defaultStore.state.enableSeasonalScreenEffect) { - const month = new Date().getMonth() + 1; - if (defaultStore.state.hemisphere === 'S') { - // ▼南半球 - if (month === 7 || month === 8) { - const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect; - new SnowfallEffect({}).render(); - } - } else { - // ▼北半球 - if (month === 12 || month === 1) { - const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect; - new SnowfallEffect({}).render(); - } else if (month === 3 || month === 4) { - const SakuraEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect; - new SakuraEffect({ - sakura: true, - }).render(); + try { + if (defaultStore.state.enableSeasonalScreenEffect) { + const month = new Date().getMonth() + 1; + if (defaultStore.state.hemisphere === 'S') { + // ▼南半球 + if (month === 7 || month === 8) { + const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect; + new SnowfallEffect({}).render(); + } + } else { + // ▼北半球 + if (month === 12 || month === 1) { + const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect; + new SnowfallEffect({}).render(); + } else if (month === 3 || month === 4) { + const SakuraEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect; + new SakuraEffect({ + sakura: true, + }).render(); + } } - } + } + } catch (error) { + // console.error(error); + console.error('Failed to initialise the seasonal screen effect canvas context:', error); } if ($i) { |