Merge branch 'develop' into fix-13565
This commit is contained in:
commit
29ac5e3c0f
|
@ -13,6 +13,8 @@
|
||||||
- Fix: 一部のページ内リンクが正しく動作しない問題を修正
|
- Fix: 一部のページ内リンクが正しく動作しない問題を修正
|
||||||
- Fix: 周年の実績が閏年を考慮しない問題を修正
|
- Fix: 周年の実績が閏年を考慮しない問題を修正
|
||||||
- Fix: ローカルURLのプレビューポップアップが左上に表示される
|
- Fix: ローカルURLのプレビューポップアップが左上に表示される
|
||||||
|
- Fix: WebGL2をサポートしないブラウザで「季節に応じた画面の演出」が有効になっているとき、Misskeyが起動できなくなる問題を修正
|
||||||
|
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/459)
|
||||||
|
|
||||||
### Server
|
### Server
|
||||||
- Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに
|
- Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに
|
||||||
|
|
|
@ -75,27 +75,31 @@ export async function mainBoot() {
|
||||||
mainRouter.push('/search');
|
mainRouter.push('/search');
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
try {
|
||||||
if (defaultStore.state.enableSeasonalScreenEffect) {
|
if (defaultStore.state.enableSeasonalScreenEffect) {
|
||||||
const month = new Date().getMonth() + 1;
|
const month = new Date().getMonth() + 1;
|
||||||
if (defaultStore.state.hemisphere === 'S') {
|
if (defaultStore.state.hemisphere === 'S') {
|
||||||
// ▼南半球
|
// ▼南半球
|
||||||
if (month === 7 || month === 8) {
|
if (month === 7 || month === 8) {
|
||||||
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
||||||
new SnowfallEffect({}).render();
|
new SnowfallEffect({}).render();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// ▼北半球
|
// ▼北半球
|
||||||
if (month === 12 || month === 1) {
|
if (month === 12 || month === 1) {
|
||||||
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
||||||
new SnowfallEffect({}).render();
|
new SnowfallEffect({}).render();
|
||||||
} else if (month === 3 || month === 4) {
|
} else if (month === 3 || month === 4) {
|
||||||
const SakuraEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
const SakuraEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
|
||||||
new SakuraEffect({
|
new SakuraEffect({
|
||||||
sakura: true,
|
sakura: true,
|
||||||
}).render();
|
}).render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// console.error(error);
|
||||||
|
console.error('Failed to initialise the seasonal screen effect canvas context:', error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($i) {
|
if ($i) {
|
||||||
|
|
|
@ -155,7 +155,9 @@ export class SnowfallEffect {
|
||||||
max: 0.125,
|
max: 0.125,
|
||||||
easing: 0.0005,
|
easing: 0.0005,
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* @throws {Error} - Thrown when it fails to get WebGL context for the canvas
|
||||||
|
*/
|
||||||
constructor(options: {
|
constructor(options: {
|
||||||
sakura?: boolean;
|
sakura?: boolean;
|
||||||
}) {
|
}) {
|
||||||
|
|
|
@ -8,7 +8,12 @@ import { markRaw } from 'vue';
|
||||||
import { $i } from '@/account.js';
|
import { $i } from '@/account.js';
|
||||||
import { wsOrigin } from '@/config.js';
|
import { wsOrigin } from '@/config.js';
|
||||||
|
|
||||||
|
// heart beat interval in ms
|
||||||
|
const HEART_BEAT_INTERVAL = 1000 * 60;
|
||||||
|
|
||||||
let stream: Misskey.Stream | null = null;
|
let stream: Misskey.Stream | null = null;
|
||||||
|
let timeoutHeartBeat: ReturnType<typeof setTimeout> | null = null;
|
||||||
|
let lastHeartbeatCall = 0;
|
||||||
|
|
||||||
export function useStream(): Misskey.Stream {
|
export function useStream(): Misskey.Stream {
|
||||||
if (stream) return stream;
|
if (stream) return stream;
|
||||||
|
@ -17,7 +22,18 @@ export function useStream(): Misskey.Stream {
|
||||||
token: $i.token,
|
token: $i.token,
|
||||||
} : null));
|
} : null));
|
||||||
|
|
||||||
window.setTimeout(heartbeat, 1000 * 60);
|
if (timeoutHeartBeat) window.clearTimeout(timeoutHeartBeat);
|
||||||
|
timeoutHeartBeat = window.setTimeout(heartbeat, HEART_BEAT_INTERVAL);
|
||||||
|
|
||||||
|
// send heartbeat right now when last send time is over HEART_BEAT_INTERVAL
|
||||||
|
document.addEventListener('visibilitychange', () => {
|
||||||
|
if (
|
||||||
|
!stream
|
||||||
|
|| document.visibilityState !== 'visible'
|
||||||
|
|| Date.now() - lastHeartbeatCall < HEART_BEAT_INTERVAL
|
||||||
|
) return;
|
||||||
|
heartbeat();
|
||||||
|
});
|
||||||
|
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
@ -26,5 +42,7 @@ function heartbeat(): void {
|
||||||
if (stream != null && document.visibilityState === 'visible') {
|
if (stream != null && document.visibilityState === 'visible') {
|
||||||
stream.heartbeat();
|
stream.heartbeat();
|
||||||
}
|
}
|
||||||
window.setTimeout(heartbeat, 1000 * 60);
|
lastHeartbeatCall = Date.now();
|
||||||
|
if (timeoutHeartBeat) window.clearTimeout(timeoutHeartBeat);
|
||||||
|
timeoutHeartBeat = window.setTimeout(heartbeat, HEART_BEAT_INTERVAL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue