diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2020-12-19 10:55:52 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-19 10:55:52 +0900 |
| commit | 43930e6a84d11fb00b9ae9ac153c2538e179d538 (patch) | |
| tree | c6f6d98976d9ea5d198d0c1249b7b2a8749353f3 /src/client/scripts | |
| parent | Bump vue-i18n from 9.0.0-beta.7 to 9.0.0-beta.14 (#6993) (diff) | |
| download | misskey-43930e6a84d11fb00b9ae9ac153c2538e179d538.tar.gz misskey-43930e6a84d11fb00b9ae9ac153c2538e179d538.tar.bz2 misskey-43930e6a84d11fb00b9ae9ac153c2538e179d538.zip | |
Storage improve (#6976)
* wip
* wip
* wip
* wip
* wip
* Update storage.ts
* wip
* wip
* wip
* wip
* Update storage.ts
* Update storage.ts
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Update storage.ts
* wip
* wip
* wip
* wip
* :pizza:
* wip
* wip
* wip
* wip
* wip
* wip
* Update deck-storage.ts
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Update store.ts
* wip
* wip
* wip
* wip
* Update init.ts
* wip
* wip
* Update pizzax.ts
* wip
* wip
* Update timeline.vue
* Update init.ts
* wip
* wip
* Update init.ts
Diffstat (limited to 'src/client/scripts')
| -rw-r--r-- | src/client/scripts/aiscript/api.ts | 8 | ||||
| -rw-r--r-- | src/client/scripts/get-user-menu.ts | 11 | ||||
| -rw-r--r-- | src/client/scripts/please-login.ts | 4 | ||||
| -rw-r--r-- | src/client/scripts/sound.ts | 6 |
4 files changed, 15 insertions, 14 deletions
diff --git a/src/client/scripts/aiscript/api.ts b/src/client/scripts/aiscript/api.ts index f5618bd14c..20c15d809e 100644 --- a/src/client/scripts/aiscript/api.ts +++ b/src/client/scripts/aiscript/api.ts @@ -1,13 +1,13 @@ import { utils, values } from '@syuilo/aiscript'; -import { store } from '@/store'; import * as os from '@/os'; +import { $i } from '@/account'; export function createAiScriptEnv(opts) { let apiRequests = 0; return { - USER_ID: store.getters.isSignedIn ? values.STR(store.state.i.id) : values.NULL, - USER_NAME: store.getters.isSignedIn ? values.STR(store.state.i.name) : values.NULL, - USER_USERNAME: store.getters.isSignedIn ? values.STR(store.state.i.username) : values.NULL, + USER_ID: $i ? values.STR($i.id) : values.NULL, + USER_NAME: $i ? values.STR($i.name) : values.NULL, + USER_USERNAME: $i ? values.STR($i.username) : values.NULL, 'Mk:dialog': values.FN_NATIVE(async ([title, text, type]) => { await os.dialog({ type: type ? type.value : 'info', diff --git a/src/client/scripts/get-user-menu.ts b/src/client/scripts/get-user-menu.ts index a97fed9919..bac944aa0b 100644 --- a/src/client/scripts/get-user-menu.ts +++ b/src/client/scripts/get-user-menu.ts @@ -5,11 +5,12 @@ import copyToClipboard from '@/scripts/copy-to-clipboard'; import { host } from '@/config'; import getAcct from '../../misc/acct/render'; import * as os from '@/os'; -import { store, userActions } from '@/store'; +import { userActions } from '@/store'; import { router } from '@/router'; +import { $i } from '@/account'; export function getUserMenu(user) { - const meId = store.getters.isSignedIn ? store.state.i.id : null; + const meId = $i ? $i.id : null; async function pushList() { const t = i18n.global.t('selectList'); // なぜか後で参照すると null になるので最初にメモリに確保しておく @@ -146,7 +147,7 @@ export function getUserMenu(user) { action: inviteGroup } : undefined] as any; - if (store.getters.isSignedIn && meId != user.id) { + if ($i && meId != user.id) { menu = menu.concat([null, { icon: user.isMuted ? faEye : faEyeSlash, text: user.isMuted ? i18n.global.t('unmute') : i18n.global.t('mute'), @@ -163,7 +164,7 @@ export function getUserMenu(user) { action: reportAbuse }]); - if (store.getters.isSignedIn && (store.state.i.isAdmin || store.state.i.isModerator)) { + if ($i && ($i.isAdmin || $i.isModerator)) { menu = menu.concat([null, { icon: faMicrophoneSlash, text: user.isSilenced ? i18n.global.t('unsilence') : i18n.global.t('silence'), @@ -176,7 +177,7 @@ export function getUserMenu(user) { } } - if (store.getters.isSignedIn && meId === user.id) { + if ($i && meId === user.id) { menu = menu.concat([null, { icon: faPencilAlt, text: i18n.global.t('editProfile'), diff --git a/src/client/scripts/please-login.ts b/src/client/scripts/please-login.ts index a221665295..1d27de2c7f 100644 --- a/src/client/scripts/please-login.ts +++ b/src/client/scripts/please-login.ts @@ -1,9 +1,9 @@ +import { $i } from '@/account'; import { i18n } from '@/i18n'; import { dialog } from '@/os'; -import { store } from '@/store'; export function pleaseLogin() { - if (store.getters.isSignedIn) return; + if ($i) return; dialog({ title: i18n.global.t('signinRequired'), diff --git a/src/client/scripts/sound.ts b/src/client/scripts/sound.ts index 13fd9a80f5..176d2b68bf 100644 --- a/src/client/scripts/sound.ts +++ b/src/client/scripts/sound.ts @@ -1,15 +1,15 @@ -import { device } from '@/cold-storage'; +import { ColdDeviceStorage } from '@/store'; const cache = new Map<string, HTMLAudioElement>(); export function play(type: string) { - const sound = device.get('sound_' + type as any); + const sound = ColdDeviceStorage.get('sound_' + type as any); if (sound.type == null) return; playFile(sound.type, sound.volume); } export function playFile(file: string, volume: number) { - const masterVolume = device.get('sound_masterVolume'); + const masterVolume = ColdDeviceStorage.get('sound_masterVolume'); if (masterVolume === 0) return; let audio: HTMLAudioElement; |