fix(frontend): ストレージが消去される事がある問題を軽減 (#16704)

* fix(frontend): ストレージが消去される事がある問題を軽減

* add comment

* add catch to continue request permissions

* Update Changelog

* update changelog

* fix

通知権限の許可取得はボタン押下時に移動

* fix

* wip

* Update main-boot.ts

* wip

---------

Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
This commit is contained in:
かっこかり 2025-12-20 21:22:31 +09:00 committed by GitHub
parent f739cb6270
commit 4c31eb409c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 63 additions and 1 deletions

View File

@ -17,6 +17,7 @@ v2025.12.0で行われた「configの`trustProxy`のデフォルト値を`false`
### Client ### Client
- Enhance: デッキのUI説明を追加 - Enhance: デッキのUI説明を追加
- Enhance: 設定がブラウザによって消去されないようにするオプションを追加
- Fix: バージョン表記のないPlayが正しく動作しない問題を修正 - Fix: バージョン表記のないPlayが正しく動作しない問題を修正
バージョン表記のないものは v0.x 系として実行されます。v1.x 系で動作させたい場合は必ずバージョン表記を含めてください。 バージョン表記のないものは v0.x 系として実行されます。v1.x 系で動作させたい場合は必ずバージョン表記を含めてください。
- Fix: デッキUIでメニュー位置を下にしているとプロファイル削除ボタンが表示されないのを修正 - Fix: デッキUIでメニュー位置を下にしているとプロファイル削除ボタンが表示されないのを修正

View File

@ -1557,6 +1557,9 @@ _settings:
showPageTabBarBottom: "ページのタブバーを下部に表示" showPageTabBarBottom: "ページのタブバーを下部に表示"
emojiPaletteBanner: "絵文字ピッカーに固定表示するプリセットをパレットとして登録したり、ピッカーの表示方法をカスタマイズしたりできます。" emojiPaletteBanner: "絵文字ピッカーに固定表示するプリセットをパレットとして登録したり、ピッカーの表示方法をカスタマイズしたりできます。"
enableAnimatedImages: "アニメーション画像を有効にする" enableAnimatedImages: "アニメーション画像を有効にする"
settingsPersistence_title: "設定の永続化"
settingsPersistence_description1: "設定の永続化を有効にすると、設定情報が失われるのを防止できます。"
settingsPersistence_description2: "環境によっては有効化できない場合があります。"
_chat: _chat:
showSenderName: "送信者の名前を表示" showSenderName: "送信者の名前を表示"

View File

@ -11,6 +11,11 @@ SPDX-License-Identifier: AGPL-3.0-only
<div v-if="!narrow || currentPage?.route.name == null" class="nav"> <div v-if="!narrow || currentPage?.route.name == null" class="nav">
<div class="_gaps_s"> <div class="_gaps_s">
<MkInfo v-if="emailNotConfigured" warn class="info">{{ i18n.ts.emailNotConfiguredWarning }} <MkA to="/settings/email" class="_link">{{ i18n.ts.configure }}</MkA></MkInfo> <MkInfo v-if="emailNotConfigured" warn class="info">{{ i18n.ts.emailNotConfiguredWarning }} <MkA to="/settings/email" class="_link">{{ i18n.ts.configure }}</MkA></MkInfo>
<MkInfo v-if="!storagePersisted && store.r.showStoragePersistenceSuggestion.value" class="info">
<div>{{ i18n.ts._settings.settingsPersistence_description1 }}</div>
<div>{{ i18n.ts._settings.settingsPersistence_description2 }}</div>
<div><button class="_textButton" @click="enableStoragePersistence">{{ i18n.ts.enable }}</button> | <button class="_textButton" @click="skipStoragePersistence">{{ i18n.ts.skip }}</button></div>
</MkInfo>
<MkInfo v-if="!store.r.enablePreferencesAutoCloudBackup.value && store.r.showPreferencesAutoCloudBackupSuggestion.value" class="info"> <MkInfo v-if="!store.r.enablePreferencesAutoCloudBackup.value && store.r.showPreferencesAutoCloudBackupSuggestion.value" class="info">
<div>{{ i18n.ts._preferencesBackup.autoPreferencesBackupIsNotEnabledForThisDevice }}</div> <div>{{ i18n.ts._preferencesBackup.autoPreferencesBackupIsNotEnabledForThisDevice }}</div>
<div><button class="_textButton" @click="enableAutoBackup">{{ i18n.ts.enable }}</button> | <button class="_textButton" @click="skipAutoBackup">{{ i18n.ts.skip }}</button></div> <div><button class="_textButton" @click="enableAutoBackup">{{ i18n.ts.enable }}</button> | <button class="_textButton" @click="skipAutoBackup">{{ i18n.ts.skip }}</button></div>
@ -46,6 +51,7 @@ import { enableAutoBackup, getPreferencesProfileMenu } from '@/preferences/utili
import { store } from '@/store.js'; import { store } from '@/store.js';
import { signout } from '@/signout.js'; import { signout } from '@/signout.js';
import { genSearchIndexes } from '@/utility/inapp-search.js'; import { genSearchIndexes } from '@/utility/inapp-search.js';
import { enableStoragePersistence, storagePersisted, skipStoragePersistence } from '@/utility/storage.js';
const searchIndex = await import('search-index:settings').then(({ searchIndexes }) => genSearchIndexes(searchIndexes)); const searchIndex = await import('search-index:settings').then(({ searchIndexes }) => genSearchIndexes(searchIndexes));

View File

@ -142,6 +142,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<hr> <hr>
</template> </template>
<MkButton v-if="!storagePersisted" @click="enableStoragePersistence">{{ i18n.ts._settings.settingsPersistence_title }}</MkButton>
<MkButton @click="forceCloudBackup">{{ i18n.ts._preferencesBackup.forceBackup }}</MkButton> <MkButton @click="forceCloudBackup">{{ i18n.ts._preferencesBackup.forceBackup }}</MkButton>
<FormSlot> <FormSlot>
@ -163,7 +165,7 @@ import MkKeyValue from '@/components/MkKeyValue.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import FormSlot from '@/components/form/slot.vue'; import FormSlot from '@/components/form/slot.vue';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { misskeyApi } from '@/utility/misskey-api.js'; import { enableStoragePersistence, storagePersisted, skipStoragePersistence } from '@/utility/storage.js';
import { ensureSignin } from '@/i.js'; import { ensureSignin } from '@/i.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { definePage } from '@/page.js'; import { definePage } from '@/page.js';

View File

@ -118,6 +118,10 @@ export const store = markRaw(new Pizzax('base', {
where: 'device', where: 'device',
default: true, default: true,
}, },
showStoragePersistenceSuggestion: {
where: 'device',
default: true,
},
//#region TODO: そのうち消す (preferに移行済み) //#region TODO: そのうち消す (preferに移行済み)
defaultWithReplies: { defaultWithReplies: {

View File

@ -0,0 +1,34 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { computed, ref, shallowRef, watch, defineAsyncComponent } from 'vue';
import * as os from '@/os.js';
import { store } from '@/store.js';
import { i18n } from '@/i18n.js';
export const storagePersisted = ref(await navigator.storage.persisted());
export async function enableStoragePersistence() {
try {
const persisted = await navigator.storage.persist();
if (persisted) {
storagePersisted.value = true;
} else {
os.alert({
type: 'error',
text: i18n.ts.somethingHappened,
});
}
} catch (err) {
os.alert({
type: 'error',
text: i18n.ts.somethingHappened,
});
}
}
export function skipStoragePersistence() {
store.set('showStoragePersistenceSuggestion', false);
}

View File

@ -6193,6 +6193,18 @@ export interface Locale extends ILocale {
* *
*/ */
"enableAnimatedImages": string; "enableAnimatedImages": string;
/**
*
*/
"settingsPersistence_title": string;
/**
*
*/
"settingsPersistence_description1": string;
/**
*
*/
"settingsPersistence_description2": string;
"_chat": { "_chat": {
/** /**
* *