summaryrefslogtreecommitdiff
path: root/src/client/cold-storage.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2020-11-25 21:31:34 +0900
committerGitHub <noreply@github.com>2020-11-25 21:31:34 +0900
commit014440850014ee86d766bb07467c2970b17a1fc6 (patch)
treeffb652fe1db3365d430ed72ec2c62aaacfbe21fb /src/client/cold-storage.ts
parentフォントレンダリングを調整 (diff)
downloadmisskey-014440850014ee86d766bb07467c2970b17a1fc6.tar.gz
misskey-014440850014ee86d766bb07467c2970b17a1fc6.tar.bz2
misskey-014440850014ee86d766bb07467c2970b17a1fc6.zip
nanka iroiro (#6853)
* wip * Update maps.ts * wip * wip * wip * wip * Update base.vue * wip * wip * wip * wip * Update link.vue * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update privacy.vue * wip * wip * wip * wip * Update range.vue * wip * wip * wip * wip * Update profile.vue * wip * Update a.vue * Update index.vue * wip * Update sidebar.vue * wip * wip * Update account-info.vue * Update a.vue * wip * wip * Update sounds.vue * wip * wip * wip * wip * wip * wip * wip * wip * Update account-info.vue * Update account-info.vue * wip * wip * wip * Update d-persimmon.json5 * wip
Diffstat (limited to 'src/client/cold-storage.ts')
-rw-r--r--src/client/cold-storage.ts34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/client/cold-storage.ts b/src/client/cold-storage.ts
new file mode 100644
index 0000000000..1bee2313fa
--- /dev/null
+++ b/src/client/cold-storage.ts
@@ -0,0 +1,34 @@
+// 常にメモリにロードしておく必要がないような設定情報を保管するストレージ
+
+const PREFIX = 'miux:';
+
+export const defaultDeviceSettings = {
+ sound_masterVolume: 0.3,
+ sound_note: { type: 'syuilo/down', volume: 1 },
+ sound_noteMy: { type: 'syuilo/up', volume: 1 },
+ sound_notification: { type: 'syuilo/pope2', volume: 1 },
+ sound_chat: { type: 'syuilo/pope1', volume: 1 },
+ sound_chatBg: { type: 'syuilo/waon', volume: 1 },
+ sound_antenna: { type: 'syuilo/triple', volume: 1 },
+ sound_channel: { type: 'syuilo/square-pico', volume: 1 },
+ sound_reversiPutBlack: { type: 'syuilo/kick', volume: 0.3 },
+ sound_reversiPutWhite: { type: 'syuilo/snare', volume: 0.3 },
+};
+
+export const device = {
+ get<T extends keyof typeof defaultDeviceSettings>(key: T): typeof defaultDeviceSettings[T] {
+ // TODO: indexedDBにする
+ // ただしその際はnullチェックではなくキー存在チェックにしないとダメ
+ // (indexedDBはnullを保存できるため、ユーザーが意図してnullを格納した可能性がある)
+ const value = localStorage.getItem(PREFIX + key);
+ if (value == null) {
+ return defaultDeviceSettings[key];
+ } else {
+ return JSON.parse(value);
+ }
+ },
+
+ set(key: keyof typeof defaultDeviceSettings, value: any): any {
+ localStorage.setItem(PREFIX + key, JSON.stringify(value));
+ },
+};