summaryrefslogtreecommitdiff
path: root/packages/frontend/src/boot/main-boot.ts
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2025-08-01 17:20:40 +0900
committerGitHub <noreply@github.com>2025-08-01 17:20:40 +0900
commite092008dc5768cb57b9eeb2ff70e5b831e0dfa24 (patch)
tree9d5c4e33ee26219acd57b66e8f6fc0394bbd022a /packages/frontend/src/boot/main-boot.ts
parentenhance(frontend): いくつかの翻訳を調整 (diff)
downloadmisskey-e092008dc5768cb57b9eeb2ff70e5b831e0dfa24.tar.gz
misskey-e092008dc5768cb57b9eeb2ff70e5b831e0dfa24.tar.bz2
misskey-e092008dc5768cb57b9eeb2ff70e5b831e0dfa24.zip
feat(frontend): セーフモード (#16245)
* feat(frontend): セーフモード * Update Changelog * Update Changelog * fix * fix * Update Changelog * Update Changelog * PWAのショートカット経由でもセーフモードで起動できるように * Update ClientServerService.ts --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to 'packages/frontend/src/boot/main-boot.ts')
-rw-r--r--packages/frontend/src/boot/main-boot.ts22
1 files changed, 21 insertions, 1 deletions
diff --git a/packages/frontend/src/boot/main-boot.ts b/packages/frontend/src/boot/main-boot.ts
index ae4e0445db..46e690a55f 100644
--- a/packages/frontend/src/boot/main-boot.ts
+++ b/packages/frontend/src/boot/main-boot.ts
@@ -28,8 +28,8 @@ import { addCustomEmoji, removeCustomEmojis, updateCustomEmojis } from '@/custom
import { prefer } from '@/preferences.js';
import { launchPlugins } from '@/plugin.js';
import { updateCurrentAccountPartial } from '@/accounts.js';
-import { signout } from '@/signout.js';
import { migrateOldSettings } from '@/pref-migrate.js';
+import { unisonReload } from '@/utility/unison-reload.js';
export async function mainBoot() {
const { isClientUpdated, lastVersion } = await common(async () => {
@@ -391,6 +391,8 @@ export async function mainBoot() {
}
// shortcut
+ let safemodeRequestCount = 0;
+ let safemodeRequestTimer: number | null = null;
const keymap = {
'p|n': () => {
if ($i == null) return;
@@ -402,6 +404,24 @@ export async function mainBoot() {
's': () => {
mainRouter.push('/search');
},
+ 'g': {
+ callback: () => {
+ // mを5回押すとセーフモードに入る
+ safemodeRequestCount++;
+ if (safemodeRequestCount >= 5) {
+ miLocalStorage.setItem('isSafeMode', 'true');
+ unisonReload();
+ } else {
+ if (safemodeRequestTimer != null) {
+ window.clearTimeout(safemodeRequestTimer);
+ }
+ safemodeRequestTimer = window.setTimeout(() => {
+ safemodeRequestCount = 0;
+ }, 300);
+ }
+ },
+ allowRepeat: true,
+ }
} as const satisfies Keymap;
window.document.addEventListener('keydown', makeHotkey(keymap), { passive: false });