diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index c5325d2fa..04d43d91d 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -640,8 +640,8 @@ common/views/components/emoji-picker.vue: flags: "旗" common/views/components/settings/client-mode.vue: - title: "クライアント" - select-app-type: "利用するクライアントのモード" + title: "モード" + intro: "デスクトップ版とモバイル版のどちらを使うかを指定できます。" choices: auto: "自動で選択" desktop: "デスクトップ版に固定" diff --git a/src/client/app/boot.js b/src/client/app/boot.js index 56eb59e21..87a12e5cf 100644 --- a/src/client/app/boot.js +++ b/src/client/app/boot.js @@ -35,12 +35,12 @@ const url = new URL(location.href); //#region Detect app name - var appType = null; + window.appType = null; - if (`${url.pathname}/`.startsWith('/docs/')) appType = 'docs'; - if (`${url.pathname}/`.startsWith('/dev/')) appType = 'dev'; - if (`${url.pathname}/`.startsWith('/auth/')) appType = 'auth'; - if (`${url.pathname}/`.startsWith('/admin/')) appType = 'admin'; + if (`${url.pathname}/`.startsWith('/docs/')) window.appType = 'docs'; + if (`${url.pathname}/`.startsWith('/dev/')) window.appType = 'dev'; + if (`${url.pathname}/`.startsWith('/auth/')) window.appType = 'auth'; + if (`${url.pathname}/`.startsWith('/admin/')) window.appType = 'admin'; //#endregion // Script version @@ -84,7 +84,9 @@ // Detect the user agent const ua = navigator.userAgent.toLowerCase(); - const isMobile = /mobile|iphone|ipad|android/.test(ua) || window.innerWidth < 576; + const isMobile = settings.device.appTypeForce === 'mobile' || + (settings.device.appTypeForce !== 'desktop' + && (/mobile|iphone|ipad|android/.test(ua) || window.innerWidth < 576)); // Get the
element const head = document.getElementsByTagName('head')[0]; @@ -103,15 +105,15 @@ } // Switch desktop or mobile version - if (appType == null) { - appType = isMobile ? 'mobile' : 'desktop'; + if (window.appType == null) { + window.appType = isMobile ? 'mobile' : 'desktop'; } // Load an app script // 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/${appType}.${ver}.js`); + script.setAttribute('src', `/assets/${window.appType}.${ver}.js`); script.setAttribute('async', 'true'); script.setAttribute('defer', 'true'); head.appendChild(script); diff --git a/src/client/app/common/views/components/settings/app-type.vue b/src/client/app/common/views/components/settings/app-type.vue index 533fd5151..61a23866e 100644 --- a/src/client/app/common/views/components/settings/app-type.vue +++ b/src/client/app/common/views/components/settings/app-type.vue @@ -1,9 +1,10 @@{{ $t('intro') }}
+