Fix default server fallback

This commit is contained in:
N-Pex 2023-02-20 16:51:05 +01:00 committed by n8fr8
parent f298f3c168
commit a1cb050ead
2 changed files with 4 additions and 3 deletions

View file

@ -26,7 +26,8 @@ Vue.config.productionTip = false
Vue.use(VueResize); Vue.use(VueResize);
Vue.use(VEmojiPicker); Vue.use(VEmojiPicker);
Vue.use(matrix, { store: store, i18n: i18n }); Vue.use(matrix, { store: store, i18n: i18n });
Vue.use(config); // Use this before cleaninsights below, it depends on config! // eslint-disable-next-line
Vue.use(config, globalThis.window.location.origin); // Use this before cleaninsights below, it depends on config!
Vue.use(analytics); Vue.use(analytics);
Vue.use(VueClipboard); Vue.use(VueClipboard);

View file

@ -1,5 +1,5 @@
export default { export default {
install(Vue) { install(Vue, defaultServerFromLocation) {
var config = Vue.observable(require('@/assets/config.json')); var config = Vue.observable(require('@/assets/config.json'));
const getRuntimeConfig = async () => { const getRuntimeConfig = async () => {
const runtimeConfig = await fetch('./config.json'); const runtimeConfig = await fetch('./config.json');
@ -14,7 +14,7 @@ export default {
} }
// If default server is not set, default to current server address // If default server is not set, default to current server address
if (!json.defaultServer) { if (!json.defaultServer) {
Vue.set(config, "defaultServer", window.location.origin); Vue.set(config, "defaultServer", defaultServerFromLocation);
} }
}); });
Vue.prototype.$config = config; Vue.prototype.$config = config;