Start on Vue 3 changes
This commit is contained in:
parent
dcc4784bfd
commit
c913a40e18
35 changed files with 3570 additions and 1913 deletions
|
|
@ -1,9 +1,9 @@
|
|||
import * as defaultConfig from "@/assets/config.json";
|
||||
|
||||
export default {
|
||||
install(Vue, defaultServerFromLocation, onloaded) {
|
||||
var config = Vue.observable(defaultConfig.default);
|
||||
Vue.set(config, "loaded", false);
|
||||
install(app, defaultServerFromLocation, onloaded) {
|
||||
var config = defaultConfig.default;
|
||||
config["loaded"] = false;
|
||||
const getRuntimeConfig = () => {
|
||||
return fetch('./config.json?ms=' + Date.now()).then((res) => res.json()).catch(err => {
|
||||
console.error("Failed to get config:", err);
|
||||
|
|
@ -14,25 +14,25 @@ export default {
|
|||
config.promise = getRuntimeConfig().then((json) => {
|
||||
// Reactively use all the config values
|
||||
for (const key of Object.keys(json)) {
|
||||
Vue.set(config, key, json[key]);
|
||||
config[key] = json[key];
|
||||
}
|
||||
// If default server is not set, default to current server address
|
||||
if (!json.defaultBaseUrl) {
|
||||
if (json.defaultServer) {
|
||||
// TODO - Only to migrate old values (defaultServer was renamed defaultBaseUrl), can be removed later...
|
||||
Vue.set(config, "defaultBaseUrl", defaultServerFromLocation);
|
||||
config["defaultBaseUrl"] = defaultServerFromLocation;
|
||||
} else {
|
||||
Vue.set(config, "defaultBaseUrl", json.defaultServer);
|
||||
config["defaultBaseUrl"] = json.defaultServer;
|
||||
}
|
||||
}
|
||||
if (json.useFullyQualifiedDMLinks == undefined) {
|
||||
Vue.set(config, "useFullyQualifiedDMLinks", true); // Default to true
|
||||
config["useFullyQualifiedDMLinks"] = true; // Default to true
|
||||
}
|
||||
if (json.disableMediaSharing == undefined) {
|
||||
Vue.set(config, "disableMediaSharing", false);
|
||||
}
|
||||
if (!json.maxSizeAutoDownloads) {
|
||||
Vue.set(config, "maxSizeAutoDownloads", 10 * 1024 * 1024);
|
||||
config["maxSizeAutoDownloads"] = 10 * 1024 * 1024;
|
||||
}
|
||||
if (!json.roomTypes) {
|
||||
let roomTypes = ["group_chat", "channel"];
|
||||
|
|
@ -40,9 +40,9 @@ export default {
|
|||
if (fileDropEnabled) {
|
||||
roomTypes.push("file_drop");
|
||||
}
|
||||
Vue.set(config, "roomTypes", roomTypes);
|
||||
config["roomTypes"] = roomTypes;
|
||||
}
|
||||
Vue.set(config, "loaded", true);
|
||||
config["loaded"] = true;
|
||||
|
||||
document.title = config.appName || "";
|
||||
|
||||
|
|
@ -70,6 +70,7 @@ export default {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
Vue.prototype.$config = config;
|
||||
app.$config = config;
|
||||
app.config.globalProperties.$config = config;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue