keanu-weblite/src/App.vue

77 lines
1.8 KiB
Vue
Raw Normal View History

2020-11-09 10:26:56 +01:00
<template>
<v-app>
<v-main>
<router-view />
</v-main>
</v-app>
</template>
<script>
2021-05-19 13:22:28 +02:00
import config from "./assets/config";
2020-11-09 10:26:56 +01:00
export default {
name: "App",
mounted() {
// Set RTL mode if flag given in config. TODO: this should be based on language, not a global setting.
//
if (config.rtl) {
this.$vuetify.rtl = true;
document.documentElement.setAttribute("dir", "rtl");
}
if (
window.location.protocol == "http" &&
!window.location.hostname.endsWith(".onion")
) {
2021-04-14 10:17:11 +02:00
// Redirect to HTTPS
window.location.href = window.location.href.replace("http:", "https:");
return;
}
if (this.currentUser) {
this.$matrix
.login(this.currentUser)
.then(() => {
console.log("Matrix client ready");
})
.catch((error) => {
console.log("Error creating client", error);
});
}
2020-11-09 10:26:56 +01:00
},
computed: {
currentUser() {
return this.$store.state.auth.user;
},
title() {
var title = this.$t(config.appName);
if (this.$matrix.notificationCount > 0) {
title += " [" + this.$matrix.notificationCount + "]";
}
if (this.$route.meta.title) {
title += " - " + this.$route.meta.title;
}
if (this.$route.meta.includeRoom) {
if (this.$matrix.currentRoom) {
title +=
" - " +
(this.$matrix.currentRoom.summary.info.title ||
this.$matrix.currentRoom.roomId);
} else if (this.$matrix.currentRoomId) {
title += " - " + this.$matrix.currentRoomId;
}
}
return title;
},
},
watch: {
title(title) {
document.title = title;
},
2020-11-09 10:26:56 +01:00
},
};
</script>
<style lang="scss">
.copyright {
font-size: 10px;
}
</style>