localeとthemeのキャッシュクリア実装

This commit is contained in:
syuilo 2020-12-30 10:15:16 +09:00
parent a8ddb134a1
commit f573eb215e
3 changed files with 10 additions and 5 deletions

View file

@ -672,6 +672,7 @@ wide: "広い"
narrow: "狭い" narrow: "狭い"
reloadToApplySetting: "設定はページリロード後に反映されます。今すぐリロードしますか?" reloadToApplySetting: "設定はページリロード後に反映されます。今すぐリロードしますか?"
showTitlebar: "タイトルバーを表示する" showTitlebar: "タイトルバーを表示する"
clearCache: "キャッシュをクリア"
_aboutMisskey: _aboutMisskey:
about: "Misskeyはsyuiloによって2014年から開発されている、オープンソースのソフトウェアです。" about: "Misskeyはsyuiloによって2014年から開発されている、オープンソースのソフトウェアです。"

View file

@ -91,10 +91,6 @@ if (_DEV_) {
// タッチデバイスでCSSの:hoverを機能させる // タッチデバイスでCSSの:hoverを機能させる
document.addEventListener('touchend', () => {}, { passive: true }); document.addEventListener('touchend', () => {}, { passive: true });
if (localStorage.theme == null) {
applyTheme(require('@/themes/l-light.json5'));
}
//#region SEE: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/ //#region SEE: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
// TODO: いつの日にか消したい // TODO: いつの日にか消したい
const vh = window.innerHeight * 0.01; const vh = window.innerHeight * 0.01;
@ -204,7 +200,7 @@ watch(defaultStore.reactiveState.darkMode, (darkMode) => {
const themes = builtinThemes.concat(ColdDeviceStorage.get('themes')); const themes = builtinThemes.concat(ColdDeviceStorage.get('themes'));
applyTheme(themes.find(x => x.id === (darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme')))); applyTheme(themes.find(x => x.id === (darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme'))));
}); });
}); }, { immediate: localStorage.theme == null });
//#region Sync dark mode //#region Sync dark mode
if (ColdDeviceStorage.get('syncDeviceDarkMode')) { if (ColdDeviceStorage.get('syncDeviceDarkMode')) {

View file

@ -27,6 +27,9 @@
<FormLink :active="page === 'api'" replace to="/settings/api"><template #icon><Fa :icon="faKey"/></template>API</FormLink> <FormLink :active="page === 'api'" replace to="/settings/api"><template #icon><Fa :icon="faKey"/></template>API</FormLink>
<FormLink :active="page === 'other'" replace to="/settings/other"><template #icon><Fa :icon="faEllipsisH"/></template>{{ $ts.other }}</FormLink> <FormLink :active="page === 'other'" replace to="/settings/other"><template #icon><Fa :icon="faEllipsisH"/></template>{{ $ts.other }}</FormLink>
</FormGroup> </FormGroup>
<FormGroup>
<FormButton @click="clear">{{ $ts.clearCache }}</FormButton>
</FormGroup>
<FormGroup> <FormGroup>
<FormButton @click="logout" danger>{{ $ts.logout }}</FormButton> <FormButton @click="logout" danger>{{ $ts.logout }}</FormButton>
</FormGroup> </FormGroup>
@ -126,6 +129,11 @@ export default defineComponent({
logout: () => { logout: () => {
signout(); signout();
}, },
clear: () => {
localStorage.removeItem('locale');
localStorage.removeItem('theme');
location.reload();
},
faPalette, faPlug, faUser, faListUl, faLock, faLaugh, faCommentSlash, faMusic, faBell, faCogs, faEllipsisH, faBan, faShareAlt, faLockOpen, faKey, faBoxes, faEnvelope, faPalette, faPlug, faUser, faListUl, faLock, faLaugh, faCommentSlash, faMusic, faBell, faCogs, faEllipsisH, faBan, faShareAlt, faLockOpen, faKey, faBoxes, faEnvelope,
}; };
}, },