summaryrefslogtreecommitdiff
path: root/src/client/app
diff options
context:
space:
mode:
authortamaina <tamaina@hotmail.co.jp>2019-04-19 11:07:54 +0900
committerSatsuki Yanagi <17376330+u1-liquid@users.noreply.github.com>2019-07-07 02:21:13 +0900
commit2afcdda0587b8f63b5bfd8c28348ede41b5f12ee (patch)
tree29a01ebacd4af5b7df2fe77a02d73e671b60ba1a /src/client/app
parentrevert (diff)
downloadsharkey-2afcdda0587b8f63b5bfd8c28348ede41b5f12ee.tar.gz
sharkey-2afcdda0587b8f63b5bfd8c28348ede41b5f12ee.tar.bz2
sharkey-2afcdda0587b8f63b5bfd8c28348ede41b5f12ee.zip
wip
Diffstat (limited to 'src/client/app')
-rw-r--r--src/client/app/boot.js16
-rw-r--r--src/client/app/common/views/components/settings/app-type.vue40
-rw-r--r--src/client/app/common/views/components/settings/settings.vue3
-rw-r--r--src/client/app/store.ts1
4 files changed, 52 insertions, 8 deletions
diff --git a/src/client/app/boot.js b/src/client/app/boot.js
index 01104bf715..56eb59e21e 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
- let app = null;
+ var appType = null;
- if (`${url.pathname}/`.startsWith('/docs/')) app = 'docs';
- if (`${url.pathname}/`.startsWith('/dev/')) app = 'dev';
- if (`${url.pathname}/`.startsWith('/auth/')) app = 'auth';
- if (`${url.pathname}/`.startsWith('/admin/')) app = 'admin';
+ 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';
//#endregion
// Script version
@@ -103,15 +103,15 @@
}
// Switch desktop or mobile version
- if (app == null) {
- app = isMobile ? 'mobile' : 'desktop';
+ if (appType == null) {
+ 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/${app}.${ver}.js`);
+ script.setAttribute('src', `/assets/${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
new file mode 100644
index 0000000000..533fd51517
--- /dev/null
+++ b/src/client/app/common/views/components/settings/app-type.vue
@@ -0,0 +1,40 @@
+<template>
+<ui-card>
+ <template #title><fa :icon="faMobile"/> {{ $t('title') }}</template>
+
+ <section class="fit-top">
+ <ui-select v-model="lang" :placeholder="$t('select-app-type')">
+ <option v-for="x in ['auto', 'desktop', 'mobile']" :value="x" :key="x">{{ $t(`choices.${x}`) }}</option>
+ </ui-select>
+ <ui-info>Current: <i>{{ $t(currentAppType) }}</i></ui-info>
+ <ui-info warn>{{ $t('info') }}</ui-info>
+ </section>
+</ui-card>
+</template>
+
+<script lang="ts">
+import Vue from 'vue';
+import i18n from '../../../../i18n';
+import { langs } from '../../../../config';
+import { faMobile } from '@fortawesome/free-solid-svg-icons'
+
+export default Vue.extend({
+ i18n: i18n('common/views/components/settings/client-mode.vue'),
+
+ data() {
+ return {
+ langs,
+ currentAppType: (window as any).appType,
+
+ faMobile
+ };
+ },
+
+ computed: {
+ appTypeForce: {
+ get() { return this.$store.state.device.appTypeForce; },
+ set(value) { this.$store.commit('device/set', { key: 'appTypeForce', value }); }
+ },
+ },
+});
+</script>
diff --git a/src/client/app/common/views/components/settings/settings.vue b/src/client/app/common/views/components/settings/settings.vue
index 1254eb5e5e..5f370c8be7 100644
--- a/src/client/app/common/views/components/settings/settings.vue
+++ b/src/client/app/common/views/components/settings/settings.vue
@@ -163,6 +163,7 @@
</ui-card>
<x-language/>
+ <x-app-type/>
</template>
<template v-if="page == null || page == 'notification'">
@@ -271,6 +272,7 @@ import XPassword from './password.vue';
import XProfile from './profile.vue';
import XApi from './api.vue';
import XLanguage from './language.vue';
+import XAppType from './app-type.vue';
import XNotification from './notification.vue';
import { url, version } from '../../../../config';
@@ -291,6 +293,7 @@ export default Vue.extend({
XProfile,
XApi,
XLanguage,
+ XAppType,
XNotification,
},
props: {
diff --git a/src/client/app/store.ts b/src/client/app/store.ts
index 852d2c393d..cca7a5c2ce 100644
--- a/src/client/app/store.ts
+++ b/src/client/app/store.ts
@@ -60,6 +60,7 @@ const defaultDeviceSettings = {
soundVolume: 0.5,
mediaVolume: 0.5,
lang: null,
+ appTypeForce: 'auto',
debug: false,
lightmode: false,
loadRawImages: false,