Merge branch 'logo-and-accentcolor-runtime-config' into 'dev'
Allow logo and accentColor to be set in config/runtimeConfig See merge request keanuapp/keanuapp-weblite!177
This commit is contained in:
commit
ce780ea3b0
9 changed files with 71 additions and 27 deletions
|
|
@ -145,10 +145,10 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
favicon() {
|
favicon() {
|
||||||
var favicon = 'favicon.ico';
|
var favicon = this.$config.logo ? this.$config.logo : 'favicon.ico';
|
||||||
if (this.$route.meta.includeFavicon) {
|
if (this.$route.meta.includeFavicon) {
|
||||||
if (this.$matrix.currentRoom) {
|
if (this.$matrix.currentRoom) {
|
||||||
favicon = this.$matrix.currentRoom.avatar || 'favicon.ico';
|
favicon = this.$matrix.currentRoom.avatar || favicon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return favicon;
|
return favicon;
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@
|
||||||
"defaultServer": "https://neo.keanu.im",
|
"defaultServer": "https://neo.keanu.im",
|
||||||
"identityServer_unset": "",
|
"identityServer_unset": "",
|
||||||
"rtl": false,
|
"rtl": false,
|
||||||
|
"accentColor_unset": "",
|
||||||
|
"logo_unset": "",
|
||||||
"analytics": [
|
"analytics": [
|
||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<v-container fluid class="text-center mt-8">
|
<v-container fluid class="text-center mt-8">
|
||||||
<v-row align="center" justify="center">
|
<v-row align="center" justify="center">
|
||||||
<v-col class="text-center" cols="auto">
|
<v-col class="text-center" cols="auto">
|
||||||
<v-img contain src="@/assets/logo.svg" width="64" height="64" />
|
<v-img contain :src="logotype" width="64" height="64" />
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-container>
|
</v-container>
|
||||||
|
|
@ -42,12 +42,13 @@
|
||||||
<script>
|
<script>
|
||||||
import RoomList from "../components/RoomList";
|
import RoomList from "../components/RoomList";
|
||||||
import YouAre from "../components/YouAre.vue";
|
import YouAre from "../components/YouAre.vue";
|
||||||
|
import logoMixin from "../components/logoMixin";
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
RoomList,
|
RoomList,
|
||||||
YouAre,
|
YouAre,
|
||||||
},
|
},
|
||||||
|
mixins: [logoMixin],
|
||||||
computed: {
|
computed: {
|
||||||
loading() {
|
loading() {
|
||||||
return !this.$matrix.ready;
|
return !this.$matrix.ready;
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@
|
||||||
|
|
||||||
<div class="d-flex justify-center align-center mt-9">
|
<div class="d-flex justify-center align-center mt-9">
|
||||||
<div class="mr-2">
|
<div class="mr-2">
|
||||||
<img src="@/assets/logo.svg" width="32" height="32" contain class="d-inline" />
|
<img :src="logotype" width="32" height="32" contain class="d-inline" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<strong>{{ $t("project.name") }}</strong>
|
<strong>{{ $t("project.name") }}</strong>
|
||||||
|
|
@ -138,12 +138,12 @@ import util from "../plugins/utils";
|
||||||
import InteractiveAuth from './InteractiveAuth.vue';
|
import InteractiveAuth from './InteractiveAuth.vue';
|
||||||
import LanguageMixin from "./languageMixin";
|
import LanguageMixin from "./languageMixin";
|
||||||
import rememberMeMixin from "./rememberMeMixin";
|
import rememberMeMixin from "./rememberMeMixin";
|
||||||
|
import logoMixin from "./logoMixin";
|
||||||
import SelectLanguageDialog from "./SelectLanguageDialog.vue";
|
import SelectLanguageDialog from "./SelectLanguageDialog.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Join",
|
name: "Join",
|
||||||
mixins: [LanguageMixin, rememberMeMixin],
|
mixins: [LanguageMixin, rememberMeMixin, logoMixin],
|
||||||
components: {
|
components: {
|
||||||
SelectLanguageDialog,
|
SelectLanguageDialog,
|
||||||
InteractiveAuth
|
InteractiveAuth
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<v-row no-gutters>
|
<v-row no-gutters>
|
||||||
<v-col>
|
<v-col>
|
||||||
<v-img
|
<v-img
|
||||||
src="@/assets/logo.svg"
|
:src="logotype"
|
||||||
width="32"
|
width="32"
|
||||||
height="32"
|
height="32"
|
||||||
contain
|
contain
|
||||||
|
|
@ -106,10 +106,11 @@ import User from "../models/user";
|
||||||
import util from "../plugins/utils";
|
import util from "../plugins/utils";
|
||||||
import rememberMeMixin from "./rememberMeMixin";
|
import rememberMeMixin from "./rememberMeMixin";
|
||||||
import * as sdk from "matrix-js-sdk";
|
import * as sdk from "matrix-js-sdk";
|
||||||
|
import logoMixin from "./logoMixin";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Login",
|
name: "Login",
|
||||||
mixins:[rememberMeMixin],
|
mixins:[rememberMeMixin, logoMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
user: new User(this.$config.defaultServer, "", ""),
|
user: new User(this.$config.defaultServer, "", ""),
|
||||||
|
|
|
||||||
10
src/components/logoMixin.js
Normal file
10
src/components/logoMixin.js
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
export default {
|
||||||
|
computed: {
|
||||||
|
logotype() {
|
||||||
|
if (this.$config.logo) {
|
||||||
|
return this.$config.logo;
|
||||||
|
}
|
||||||
|
return require("@/assets/logo.svg");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
23
src/main.js
23
src/main.js
|
|
@ -1,6 +1,5 @@
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import vuetify from './plugins/vuetify';
|
|
||||||
import store from './store'
|
import store from './store'
|
||||||
import i18n from './plugins/lang';
|
import i18n from './plugins/lang';
|
||||||
import router from './router'
|
import router from './router'
|
||||||
|
|
@ -15,6 +14,7 @@ import VueResize from 'vue-resize';
|
||||||
import 'vue-resize/dist/vue-resize.css';
|
import 'vue-resize/dist/vue-resize.css';
|
||||||
import VueClipboard from 'vue-clipboard2'
|
import VueClipboard from 'vue-clipboard2'
|
||||||
import VueSanitize from "vue-sanitize";
|
import VueSanitize from "vue-sanitize";
|
||||||
|
import createVuetify from './plugins/vuetify';
|
||||||
|
|
||||||
var defaultOptions = VueSanitize.defaults;
|
var defaultOptions = VueSanitize.defaults;
|
||||||
defaultOptions.disallowedTagsMode = "recursiveEscape";
|
defaultOptions.disallowedTagsMode = "recursiveEscape";
|
||||||
|
|
@ -26,11 +26,18 @@ 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 });
|
||||||
// eslint-disable-next-line
|
|
||||||
Vue.use(config, globalThis.window.location.origin); // Use this before cleaninsights below, it depends on config!
|
const configLoadedPromise = new Promise((resolve, ignoredreject) => {
|
||||||
|
// eslint-disable-next-line
|
||||||
|
Vue.use(config, globalThis.window.location.origin, (config) => {
|
||||||
|
resolve(config);
|
||||||
|
}); // Use this before cleaninsights below, it depends on config!
|
||||||
|
});
|
||||||
Vue.use(analytics);
|
Vue.use(analytics);
|
||||||
Vue.use(VueClipboard);
|
Vue.use(VueClipboard);
|
||||||
|
|
||||||
|
const vuetify = createVuetify(config);
|
||||||
|
|
||||||
// Add bubble functionality to custom events.
|
// Add bubble functionality to custom events.
|
||||||
// From here: https://stackoverflow.com/questions/41993508/vuejs-bubbling-custom-events
|
// From here: https://stackoverflow.com/questions/41993508/vuejs-bubbling-custom-events
|
||||||
Vue.use((Vue) => {
|
Vue.use((Vue) => {
|
||||||
|
|
@ -161,7 +168,7 @@ Vue.directive('longTap', {
|
||||||
|
|
||||||
Vue.use(navigation, router);
|
Vue.use(navigation, router);
|
||||||
|
|
||||||
new Vue({
|
const vueInstance = new Vue({
|
||||||
vuetify,
|
vuetify,
|
||||||
store,
|
store,
|
||||||
i18n,
|
i18n,
|
||||||
|
|
@ -170,4 +177,10 @@ new Vue({
|
||||||
config,
|
config,
|
||||||
analytics,
|
analytics,
|
||||||
render: h => h(App)
|
render: h => h(App)
|
||||||
}).$mount('#app');
|
});
|
||||||
|
vueInstance.$vuetify.theme.themes.light.primary = vueInstance.$config.accentColor;
|
||||||
|
configLoadedPromise.then((config) => {
|
||||||
|
vueInstance.$vuetify.theme.themes.light.primary = config.accentColor;
|
||||||
|
vueInstance.$mount('#app');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,22 @@ function importAll(r) {
|
||||||
}
|
}
|
||||||
importAll(require.context('@/assets/icons/', true, /\.vue$/));
|
importAll(require.context('@/assets/icons/', true, /\.vue$/));
|
||||||
|
|
||||||
|
|
||||||
Vue.use(Vuetify);
|
Vue.use(Vuetify);
|
||||||
|
|
||||||
export default new Vuetify({
|
export default function(ignoredconfig) {
|
||||||
icons: {
|
return new Vuetify({
|
||||||
iconfont: 'md',
|
icons: {
|
||||||
values: icons,
|
iconfont: 'md',
|
||||||
},
|
values: icons,
|
||||||
});
|
},
|
||||||
|
options: {
|
||||||
|
customProperties: true
|
||||||
|
},
|
||||||
|
theme: {
|
||||||
|
options: {
|
||||||
|
customProperties: true,
|
||||||
|
},
|
||||||
|
dark: false,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
export default {
|
export default {
|
||||||
install(Vue, defaultServerFromLocation) {
|
install(Vue, defaultServerFromLocation, onloaded) {
|
||||||
var config = Vue.observable(require('@/assets/config.json'));
|
var config = Vue.observable(require('@/assets/config.json'));
|
||||||
const getRuntimeConfig = async () => {
|
const getRuntimeConfig = () => {
|
||||||
const runtimeConfig = await fetch('./config.json');
|
return fetch('./config.json').then((res) => res.json()).catch(err => {
|
||||||
return await runtimeConfig.json()
|
console.error("Failed to get config:", err);
|
||||||
|
return {};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
config.promise = getRuntimeConfig();
|
config.promise = getRuntimeConfig().then((json) => {
|
||||||
config.promise.then(function (json) {
|
|
||||||
// Reactively use all the config values
|
// Reactively use all the config values
|
||||||
for (const key of Object.keys(json)) {
|
for (const key of Object.keys(json)) {
|
||||||
Vue.set(config, key, json[key]);
|
Vue.set(config, key, json[key]);
|
||||||
|
|
@ -16,6 +17,12 @@ export default {
|
||||||
if (!json.defaultServer) {
|
if (!json.defaultServer) {
|
||||||
Vue.set(config, "defaultServer", defaultServerFromLocation);
|
Vue.set(config, "defaultServer", defaultServerFromLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tell callback we are done loading runtime config
|
||||||
|
if (onloaded) {
|
||||||
|
onloaded(config);
|
||||||
|
}
|
||||||
|
return config;
|
||||||
});
|
});
|
||||||
Vue.prototype.$config = config;
|
Vue.prototype.$config = config;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue