summaryrefslogtreecommitdiff
path: root/packages/frontend/src/boot
diff options
context:
space:
mode:
authorLeah <kevinlukej@gmail.com>2024-03-04 18:47:47 +0000
committerAmelia Yukii <amelia.yukii@shourai.de>2024-03-04 18:47:47 +0000
commiteba0c2cc61512db22109e2f15604eb65f5b7d2f2 (patch)
tree97c40e3e90f68d0a3613adb7e1660921a34b758a /packages/frontend/src/boot
parentmerge: put back the readme (!447) (diff)
downloadsharkey-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.ts44
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) {