fix(frontend): WebGL2コンテキストの初期化に失敗するとMisskeyが起動できなくなる問題を修正 (#13587)

* Fixed startup crash with seasonal effects

(cherry picked from commit eba0c2cc61512db22109e2f15604eb65f5b7d2f2)

* Update Changelog

* Update Changelog

---------

Co-authored-by: Leah <kevinlukej@gmail.com>
This commit is contained in:
かっこかり 2024-03-17 20:33:33 +09:00 committed by GitHub
parent dcfab918e9
commit b65203c9f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 21 deletions

View file

@ -13,6 +13,8 @@
- Fix: 一部のページ内リンクが正しく動作しない問題を修正
- Fix: 周年の実績が閏年を考慮しない問題を修正
- Fix: ローカルURLのプレビューポップアップが左上に表示される
- Fix: WebGL2をサポートしないブラウザで「季節に応じた画面の演出」が有効になっているとき、Misskeyが起動できなくなる問題を修正
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/459)
### Server
- Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに

View file

@ -75,27 +75,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();
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();
}
}
} 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) {

View file

@ -155,7 +155,9 @@ export class SnowfallEffect {
max: 0.125,
easing: 0.0005,
};
/**
* @throws {Error} - Thrown when it fails to get WebGL context for the canvas
*/
constructor(options: {
sakura?: boolean;
}) {