diff --git a/src/client/app/desktop/views/components/notes.vue b/src/client/app/desktop/views/components/notes.vue index efb9db70f..a1c1207a7 100644 --- a/src/client/app/desktop/views/components/notes.vue +++ b/src/client/app/desktop/views/components/notes.vue @@ -193,7 +193,7 @@ export default Vue.extend({ clearNotification() { this.unreadCount = 0; - document.title = config.name; + document.title = (this as any).os.instanceName; }, onVisibilitychange() { diff --git a/src/client/app/desktop/views/pages/home-customize.vue b/src/client/app/desktop/views/pages/home-customize.vue index 4318e8982..174fbf45e 100644 --- a/src/client/app/desktop/views/pages/home-customize.vue +++ b/src/client/app/desktop/views/pages/home-customize.vue @@ -4,11 +4,10 @@ <script lang="ts"> import Vue from 'vue'; -import * as config from '../../../config'; export default Vue.extend({ mounted() { - document.title = `${config.name} - %i18n:@title%`; + document.title = `${(this as any).os.instanceName} - %i18n:@title%`; } }); </script> diff --git a/src/client/app/desktop/views/pages/home.vue b/src/client/app/desktop/views/pages/home.vue index 3d3c24bfa..c7ff0904e 100644 --- a/src/client/app/desktop/views/pages/home.vue +++ b/src/client/app/desktop/views/pages/home.vue @@ -7,7 +7,6 @@ <script lang="ts"> import Vue from 'vue'; import Progress from '../../../common/scripts/loading'; -import * as config from '../../../config'; export default Vue.extend({ props: { @@ -17,7 +16,7 @@ export default Vue.extend({ } }, mounted() { - document.title = config.name; + document.title = (this as any).os.instanceName; Progress.start(); }, diff --git a/src/client/app/desktop/views/pages/share.vue b/src/client/app/desktop/views/pages/share.vue index 4a7bdb14c..4dd608069 100644 --- a/src/client/app/desktop/views/pages/share.vue +++ b/src/client/app/desktop/views/pages/share.vue @@ -12,12 +12,11 @@ <script lang="ts"> import Vue from 'vue'; -import * as config from '../../../config'; export default Vue.extend({ data() { return { - name: config.name, + name: (this as any).os.instanceName, posted: false, text: new URLSearchParams(location.search).get('text') }; diff --git a/src/client/app/desktop/views/pages/welcome.vue b/src/client/app/desktop/views/pages/welcome.vue index 585a23de2..ac2f921a2 100644 --- a/src/client/app/desktop/views/pages/welcome.vue +++ b/src/client/app/desktop/views/pages/welcome.vue @@ -5,7 +5,7 @@ <template v-if="$store.state.device.darkmode">%fa:moon%</template> <template v-else>%fa:R moon%</template> </button> - <div class="body" :style="{ backgroundImage: `url('${ welcomeBgUrl }')` }"> + <div class="body"> <div class="container"> <div class="info"> <span><b>{{ host }}</b></span> @@ -46,22 +46,26 @@ <script lang="ts"> import Vue from 'vue'; -import { host, name, description, copyright, welcomeBgUrl } from '../../../config'; +import { host, copyright } from '../../../config'; export default Vue.extend({ data() { return { stats: null, copyright, - welcomeBgUrl, host, - name, - description, + name: 'Misskey', + description: '', pointerInterval: null, tags: [] }; }, created() { + (this as any).os.getMeta().then(meta => { + this.name = meta.name; + this.description = meta.description; + }); + (this as any).api('stats').then(stats => { this.stats = stats; }); diff --git a/src/client/app/mios.ts b/src/client/app/mios.ts index 565c8bf1f..664848b5e 100644 --- a/src/client/app/mios.ts +++ b/src/client/app/mios.ts @@ -70,6 +70,10 @@ export default class MiOS extends EventEmitter { chachedAt: Date; }; + public get instanceName() { + return this.meta ? this.meta.data.name : 'Misskey'; + } + private isMetaFetching = false; public app: Vue; diff --git a/src/client/app/mobile/views/components/notes.vue b/src/client/app/mobile/views/components/notes.vue index cce81d1b7..714e521c0 100644 --- a/src/client/app/mobile/views/components/notes.vue +++ b/src/client/app/mobile/views/components/notes.vue @@ -38,7 +38,6 @@ <script lang="ts"> import Vue from 'vue'; import getNoteSummary from '../../../../../misc/get-note-summary'; -import * as config from '../../../config'; const displayLimit = 30; @@ -190,7 +189,7 @@ export default Vue.extend({ clearNotification() { this.unreadCount = 0; - document.title = config.name; + document.title = (this as any).os.instanceName; }, onVisibilitychange() { diff --git a/src/client/app/mobile/views/components/ui.header.vue b/src/client/app/mobile/views/components/ui.header.vue index b87c6f1eb..a616586c5 100644 --- a/src/client/app/mobile/views/components/ui.header.vue +++ b/src/client/app/mobile/views/components/ui.header.vue @@ -8,7 +8,7 @@ <button class="nav" @click="$parent.isDrawerOpening = true">%fa:bars%</button> <template v-if="hasUnreadNotification || hasUnreadMessagingMessage || hasGameInvitation">%fa:circle%</template> <h1> - <slot>config.name</slot> + <slot>{{ os.instanceName }}</slot> </h1> <slot name="func"></slot> </div> @@ -20,13 +20,11 @@ <script lang="ts"> import Vue from 'vue'; import * as anime from 'animejs'; -import * as config from '../../../config'; export default Vue.extend({ props: ['func'], data() { return { - config, hasGameInvitation: false, connection: null, connectionId: null diff --git a/src/client/app/mobile/views/pages/drive.vue b/src/client/app/mobile/views/pages/drive.vue index 72427a478..c7cbe0f72 100644 --- a/src/client/app/mobile/views/pages/drive.vue +++ b/src/client/app/mobile/views/pages/drive.vue @@ -25,7 +25,6 @@ <script lang="ts"> import Vue from 'vue'; import Progress from '../../../common/scripts/loading'; -import * as config from '../../../config'; export default Vue.extend({ data() { @@ -44,7 +43,7 @@ export default Vue.extend({ window.addEventListener('popstate', this.onPopState); }, mounted() { - document.title = `${config.name} Drive`; + document.title = `${(this as any).os.instanceName} Drive`; document.documentElement.style.background = '#fff'; }, beforeDestroy() { @@ -64,7 +63,7 @@ export default Vue.extend({ (this.$refs as any).browser.openContextMenu(); }, onMoveRoot(silent) { - const title = `${config.name} Drive`; + const title = `${(this as any).os.instanceName} Drive`; if (!silent) { // Rewrite URL @@ -77,7 +76,7 @@ export default Vue.extend({ this.folder = null; }, onOpenFolder(folder, silent) { - const title = `${folder.name} | ${config.name} Drive`; + const title = `${folder.name} | ${(this as any).os.instanceName} Drive`; if (!silent) { // Rewrite URL @@ -90,7 +89,7 @@ export default Vue.extend({ this.folder = folder; }, onOpenFile(file, silent) { - const title = `${file.name} | ${config.name} Drive`; + const title = `${file.name} | ${(this as any).os.instanceName} Drive`; if (!silent) { // Rewrite URL diff --git a/src/client/app/mobile/views/pages/favorites.vue b/src/client/app/mobile/views/pages/favorites.vue index 491890bb0..6b9aec6a0 100644 --- a/src/client/app/mobile/views/pages/favorites.vue +++ b/src/client/app/mobile/views/pages/favorites.vue @@ -14,7 +14,6 @@ <script lang="ts"> import Vue from 'vue'; import Progress from '../../../common/scripts/loading'; -import * as config from '../../../config'; export default Vue.extend({ data() { @@ -29,7 +28,7 @@ export default Vue.extend({ this.fetch(); }, mounted() { - document.title = `${config.name} | %i18n:@notifications%`; + document.title = `${(this as any).os.instanceName} | %i18n:@notifications%`; }, methods: { fetch() { diff --git a/src/client/app/mobile/views/pages/followers.vue b/src/client/app/mobile/views/pages/followers.vue index 5bba534ba..421c15085 100644 --- a/src/client/app/mobile/views/pages/followers.vue +++ b/src/client/app/mobile/views/pages/followers.vue @@ -21,7 +21,6 @@ import Vue from 'vue'; import Progress from '../../../common/scripts/loading'; import parseAcct from '../../../../../misc/acct/parse'; import getUserName from '../../../../../misc/get-user-name'; -import * as config from '../../../config'; export default Vue.extend({ data() { @@ -50,7 +49,7 @@ export default Vue.extend({ this.user = user; this.fetching = false; - document.title = '%i18n:@followers-of%'.replace('{}', this.name) + ' | ' + config.name; + document.title = '%i18n:@followers-of%'.replace('{}', this.name) + ' | ' + (this as any).os.instanceName; }); }, onLoaded() { diff --git a/src/client/app/mobile/views/pages/following.vue b/src/client/app/mobile/views/pages/following.vue index cdc009b76..ff201ff2b 100644 --- a/src/client/app/mobile/views/pages/following.vue +++ b/src/client/app/mobile/views/pages/following.vue @@ -20,7 +20,6 @@ import Vue from 'vue'; import Progress from '../../../common/scripts/loading'; import parseAcct from '../../../../../misc/acct/parse'; -import * as config from '../../../config'; export default Vue.extend({ data() { @@ -49,7 +48,7 @@ export default Vue.extend({ this.user = user; this.fetching = false; - document.title = '%i18n:@followers-of%'.replace('{}', this.name) + ' | ' + config.name; + document.title = '%i18n:@followers-of%'.replace('{}', this.name) + ' | ' + (this as any).os.instanceName; }); }, onLoaded() { diff --git a/src/client/app/mobile/views/pages/games/reversi.vue b/src/client/app/mobile/views/pages/games/reversi.vue index 448c9b8d7..d6849a1c1 100644 --- a/src/client/app/mobile/views/pages/games/reversi.vue +++ b/src/client/app/mobile/views/pages/games/reversi.vue @@ -7,11 +7,10 @@ <script lang="ts"> import Vue from 'vue'; -import * as config from '../../../../config'; export default Vue.extend({ mounted() { - document.title = `${config.name} %i18n:@reversi%`; + document.title = `${(this as any).os.instanceName} %i18n:@reversi%`; document.documentElement.style.background = '#fff'; }, methods: { diff --git a/src/client/app/mobile/views/pages/home.vue b/src/client/app/mobile/views/pages/home.vue index c1ed97ac1..706c9cd28 100644 --- a/src/client/app/mobile/views/pages/home.vue +++ b/src/client/app/mobile/views/pages/home.vue @@ -49,7 +49,6 @@ import Vue from 'vue'; import Progress from '../../../common/scripts/loading'; import XTl from './home.timeline.vue'; -import * as config from '../../../config'; export default Vue.extend({ components: { @@ -97,7 +96,7 @@ export default Vue.extend({ }, mounted() { - document.title = config.name; + document.title = (this as any).os.instanceName; Progress.start(); diff --git a/src/client/app/mobile/views/pages/messaging-room.vue b/src/client/app/mobile/views/pages/messaging-room.vue index e2016fc82..401397d85 100644 --- a/src/client/app/mobile/views/pages/messaging-room.vue +++ b/src/client/app/mobile/views/pages/messaging-room.vue @@ -11,7 +11,6 @@ <script lang="ts"> import Vue from 'vue'; import parseAcct from '../../../../../misc/acct/parse'; -import * as config from '../../../config'; export default Vue.extend({ data() { @@ -48,7 +47,7 @@ export default Vue.extend({ this.user = user; this.fetching = false; - document.title = `%i18n:@messaging%: ${Vue.filter('userName')(this.user)} | ${config.name}`; + document.title = `%i18n:@messaging%: ${Vue.filter('userName')(this.user)} | ${(this as any).os.instanceName}`; }); } } diff --git a/src/client/app/mobile/views/pages/messaging.vue b/src/client/app/mobile/views/pages/messaging.vue index 9f2beb860..388350528 100644 --- a/src/client/app/mobile/views/pages/messaging.vue +++ b/src/client/app/mobile/views/pages/messaging.vue @@ -8,11 +8,10 @@ <script lang="ts"> import Vue from 'vue'; import getAcct from '../../../../../misc/acct/render'; -import * as config from '../../../config'; export default Vue.extend({ mounted() { - document.title = `${config.name} %i18n:@messaging%`; + document.title = `${(this as any).os.instanceName} %i18n:@messaging%`; }, methods: { navigate(user) { diff --git a/src/client/app/mobile/views/pages/note.vue b/src/client/app/mobile/views/pages/note.vue index 8b1095c50..fee60b350 100644 --- a/src/client/app/mobile/views/pages/note.vue +++ b/src/client/app/mobile/views/pages/note.vue @@ -16,7 +16,6 @@ <script lang="ts"> import Vue from 'vue'; import Progress from '../../../common/scripts/loading'; -import * as config from '../../../config'; export default Vue.extend({ data() { @@ -32,7 +31,7 @@ export default Vue.extend({ this.fetch(); }, mounted() { - document.title = config.name; + document.title = (this as any).os.instanceName; }, methods: { fetch() { diff --git a/src/client/app/mobile/views/pages/search.vue b/src/client/app/mobile/views/pages/search.vue index 0b37a3c7b..6e8118ff9 100644 --- a/src/client/app/mobile/views/pages/search.vue +++ b/src/client/app/mobile/views/pages/search.vue @@ -12,7 +12,6 @@ <script lang="ts"> import Vue from 'vue'; import Progress from '../../../common/scripts/loading'; -import * as config from '../../../config'; const limit = 20; @@ -35,7 +34,7 @@ export default Vue.extend({ } }, mounted() { - document.title = `%i18n:@search%: ${this.q} | ${config.name}`; + document.title = `%i18n:@search%: ${this.q} | ${(this as any).os.instanceName}`; this.fetch(); }, diff --git a/src/client/app/mobile/views/pages/share.vue b/src/client/app/mobile/views/pages/share.vue index dcb55e670..588b0941e 100644 --- a/src/client/app/mobile/views/pages/share.vue +++ b/src/client/app/mobile/views/pages/share.vue @@ -12,12 +12,11 @@ <script lang="ts"> import Vue from 'vue'; -import * as config from '../../../config'; export default Vue.extend({ data() { return { - name: config.name, + name: (this as any).os.instanceName, posted: false, text: new URLSearchParams(location.search).get('text') }; diff --git a/src/client/app/mobile/views/pages/user.vue b/src/client/app/mobile/views/pages/user.vue index 11ca1caeb..5ecd0b695 100644 --- a/src/client/app/mobile/views/pages/user.vue +++ b/src/client/app/mobile/views/pages/user.vue @@ -67,7 +67,6 @@ import * as age from 's-age'; import parseAcct from '../../../../../misc/acct/parse'; import Progress from '../../../common/scripts/loading'; import XHome from './user/home.vue'; -import * as config from '../../../config'; export default Vue.extend({ components: { @@ -107,7 +106,7 @@ export default Vue.extend({ this.fetching = false; Progress.done(); - document.title = Vue.filter('userName')(this.user) + ' | ' + config.name; + document.title = Vue.filter('userName')(this.user) + ' | ' + (this as any).os.instanceName; }); } } diff --git a/src/client/app/mobile/views/pages/welcome.vue b/src/client/app/mobile/views/pages/welcome.vue index f8a7ff1c8..49227790f 100644 --- a/src/client/app/mobile/views/pages/welcome.vue +++ b/src/client/app/mobile/views/pages/welcome.vue @@ -30,7 +30,7 @@ <script lang="ts"> import Vue from 'vue'; -import { apiUrl, copyright, host, name, description } from '../../../config'; +import { apiUrl, copyright, host } from '../../../config'; export default Vue.extend({ data() { @@ -39,12 +39,17 @@ export default Vue.extend({ copyright, stats: null, host, - name, - description, + name: 'Misskey', + description: '', tags: [] }; }, created() { + (this as any).os.getMeta().then(meta => { + this.name = meta.name; + this.description = meta.description; + }); + (this as any).api('stats').then(stats => { this.stats = stats; }); diff --git a/src/client/app/mobile/views/pages/widgets.vue b/src/client/app/mobile/views/pages/widgets.vue index b90d710c6..a83103632 100644 --- a/src/client/app/mobile/views/pages/widgets.vue +++ b/src/client/app/mobile/views/pages/widgets.vue @@ -53,7 +53,6 @@ import Vue from 'vue'; import * as XDraggable from 'vuedraggable'; import * as uuid from 'uuid'; -import * as config from '../../../config'; export default Vue.extend({ components: { @@ -103,7 +102,7 @@ export default Vue.extend({ }, mounted() { - document.title = config.name; + document.title = (this as any).os.instanceName; }, methods: { diff --git a/src/server/api/endpoints/meta.ts b/src/server/api/endpoints/meta.ts index 505ff6006..2b39f26b8 100644 --- a/src/server/api/endpoints/meta.ts +++ b/src/server/api/endpoints/meta.ts @@ -33,7 +33,7 @@ export default () => new Promise(async (res, rej) => { }, broadcasts: meta.broadcasts, disableRegistration: meta.disableRegistration, - recaptchaSitekey: config.recaptcha.site_key, - swPublickey: config.sw.public_key + recaptchaSitekey: config.recaptcha ? config.recaptcha.site_key : null, + swPublickey: config.sw ? config.sw.public_key : null }); });