diff --git a/locales/ja.yml b/locales/ja.yml
index 6f8b1eaf20..953556eedb 100644
--- a/locales/ja.yml
+++ b/locales/ja.yml
@@ -495,9 +495,6 @@ desktop/views/components/settings.vue:
advanced-settings: "高度な設定"
debug-mode: "デバッグモードを有効にする"
debug-mode-desc: "この設定はブラウザに記憶されます。"
- use-raw-script: "生のスクリプトを読み込む"
- use-raw-script-desc: "圧縮されていない「生の」スクリプトを使用します。サイズが大きいため、読み込みに時間がかかる場合があります。この設定はブラウザに記憶されます。"
- source-info: "Misskeyはソースマップも提供しています。"
experimental: "実験的機能を有効にする"
experimental-desc: "実験的機能を有効にするとMisskeyの動作が不安定になる可能性があります。この設定はブラウザに記憶されます。"
tools: "ツール"
diff --git a/package.json b/package.json
index 119d2dac53..14f7956f52 100644
--- a/package.json
+++ b/package.json
@@ -211,6 +211,7 @@
"vue-template-compiler": "2.5.16",
"vuedraggable": "2.16.0",
"vuex": "3.0.1",
+ "vuex-persistedstate": "^2.5.4",
"web-push": "3.3.1",
"webfinger.js": "2.6.6",
"webpack": "4.8.3",
diff --git a/src/client/app/boot.js b/src/client/app/boot.js
index 9338bc501e..e09a5d12e9 100644
--- a/src/client/app/boot.js
+++ b/src/client/app/boot.js
@@ -29,11 +29,21 @@
if (url.pathname == '/auth') app = 'auth';
//#endregion
- // Detect the user language
- // Note: The default language is Japanese
+ //#region Detect the user language
let lang = navigator.language.split('-')[0];
+
+ // The default language is English
if (!LANGS.includes(lang)) lang = 'en';
- if (localStorage.getItem('lang')) lang = localStorage.getItem('lang');
+
+ const vuex = localStorage.getItem('vuex');
+ if (vuex) {
+ const data = JSON.parse(vuex);
+ if (data.device.lang) lang = data.device.lang;
+ }
+
+ const storedLang = localStorage.getItem('lang');
+ if (storedLang) lang = storedLang;
+ //#endregion
// Detect the user agent
const ua = navigator.userAgent.toLowerCase();
@@ -68,13 +78,6 @@
// Script version
const ver = localStorage.getItem('v') || VERSION;
- // Whether in debug mode
- const isDebug = localStorage.getItem('debug') == 'true';
-
- // Whether use raw version script
- const raw = (localStorage.getItem('useRawScript') == 'true' && isDebug)
- || ENV != 'production';
-
// Get salt query
const salt = localStorage.getItem('salt')
? '?salt=' + localStorage.getItem('salt')
@@ -84,7 +87,7 @@
// Note: 'async' make it possible to load the script asyncly.
// 'defer' make it possible to run the script when the dom loaded.
const script = document.createElement('script');
- script.setAttribute('src', `/assets/${app}.${ver}.${lang}.${raw ? 'raw' : 'min'}.js${salt}`);
+ script.setAttribute('src', `/assets/${app}.${ver}.${lang}.js${salt}`);
script.setAttribute('async', 'true');
script.setAttribute('defer', 'true');
head.appendChild(script);
diff --git a/src/client/app/common/views/components/avatar.vue b/src/client/app/common/views/components/avatar.vue
index 8cc72fb518..6b407ccc80 100644
--- a/src/client/app/common/views/components/avatar.vue
+++ b/src/client/app/common/views/components/avatar.vue
@@ -22,7 +22,7 @@ export default Vue.extend({
},
computed: {
lightmode(): boolean {
- return localStorage.getItem('lightmode') == 'true';
+ return this.$store.state.device.lightmode;
},
style(): any {
return {
diff --git a/src/client/app/common/views/components/messaging-room.vue b/src/client/app/common/views/components/messaging-room.vue
index 330834233a..7832a331df 100644
--- a/src/client/app/common/views/components/messaging-room.vue
+++ b/src/client/app/common/views/components/messaging-room.vue
@@ -149,9 +149,9 @@ export default Vue.extend({
onMessage(message) {
// サウンドを再生する
- if ((this as any).os.isEnableSounds) {
+ if (this.$store.state.device.enableSounds) {
const sound = new Audio(`${url}/assets/message.mp3`);
- sound.volume = localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) / 100 : 0.5;
+ sound.volume = this.$store.state.device.soundVolume;
sound.play();
}
diff --git a/src/client/app/common/views/components/othello.game.vue b/src/client/app/common/views/components/othello.game.vue
index 8c646cce07..ea75558d10 100644
--- a/src/client/app/common/views/components/othello.game.vue
+++ b/src/client/app/common/views/components/othello.game.vue
@@ -162,9 +162,9 @@ export default Vue.extend({
this.o.put(this.myColor, pos);
// サウンドを再生する
- if ((this as any).os.isEnableSounds) {
+ if (this.$store.state.device.enableSounds) {
const sound = new Audio(`${url}/assets/othello-put-me.mp3`);
- sound.volume = localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) / 100 : 0.5;
+ sound.volume = this.$store.state.device.soundVolume;
sound.play();
}
@@ -186,9 +186,9 @@ export default Vue.extend({
this.$forceUpdate();
// サウンドを再生する
- if ((this as any).os.isEnableSounds && x.color != this.myColor) {
+ if (this.$store.state.device.enableSounds && x.color != this.myColor) {
const sound = new Audio(`${url}/assets/othello-put-you.mp3`);
- sound.volume = localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) / 100 : 0.5;
+ sound.volume = this.$store.state.device.soundVolume;
sound.play();
}
},
diff --git a/src/client/app/config.ts b/src/client/app/config.ts
index 522d7ff056..70c085de1c 100644
--- a/src/client/app/config.ts
+++ b/src/client/app/config.ts
@@ -8,6 +8,7 @@ declare const _STATS_URL_: string;
declare const _STATUS_URL_: string;
declare const _DEV_URL_: string;
declare const _LANG_: string;
+declare const _LANGS_: string;
declare const _RECAPTCHA_SITEKEY_: string;
declare const _SW_PUBLICKEY_: string;
declare const _THEME_COLOR_: string;
@@ -27,6 +28,7 @@ export const statsUrl = _STATS_URL_;
export const statusUrl = _STATUS_URL_;
export const devUrl = _DEV_URL_;
export const lang = _LANG_;
+export const langs = _LANGS_;
export const recaptchaSitekey = _RECAPTCHA_SITEKEY_;
export const swPublickey = _SW_PUBLICKEY_;
export const themeColor = _THEME_COLOR_;
diff --git a/src/client/app/desktop/views/components/home.vue b/src/client/app/desktop/views/components/home.vue
index 87dae5a806..d84c1e404f 100644
--- a/src/client/app/desktop/views/components/home.vue
+++ b/src/client/app/desktop/views/components/home.vue
@@ -102,7 +102,7 @@ export default Vue.extend({
computed: {
home(): any[] {
- return this.$store.state.settings.data.home;
+ return this.$store.state.settings.home;
},
left(): any[] {
return this.home.filter(w => w.place == 'left');
diff --git a/src/client/app/desktop/views/components/notes.vue b/src/client/app/desktop/views/components/notes.vue
index c041e5278c..55b0de3fbd 100644
--- a/src/client/app/desktop/views/components/notes.vue
+++ b/src/client/app/desktop/views/components/notes.vue
@@ -145,9 +145,9 @@ export default Vue.extend({
this.notes.unshift(note);
// サウンドを再生する
- if ((this as any).os.isEnableSounds && !silent) {
+ if (this.$store.state.device.enableSounds && !silent) {
const sound = new Audio(`${url}/assets/post.mp3`);
- sound.volume = localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) / 100 : 0.5;
+ sound.volume = this.$store.state.device.soundVolume;
sound.play();
}
diff --git a/src/client/app/desktop/views/components/settings.vue b/src/client/app/desktop/views/components/settings.vue
index 24af64a59c..3fe09b9acc 100644
--- a/src/client/app/desktop/views/components/settings.vue
+++ b/src/client/app/desktop/views/components/settings.vue
@@ -62,8 +62,10 @@
%fa:info-circle%%i18n:@source-info%
-