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",
|
2021-03-29 21:55:43 +02:00
|
|
|
mounted() {
|
2021-06-29 11:55:53 +02:00
|
|
|
// 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;
|
|
|
|
|
}
|
2021-03-29 21:55:43 +02:00
|
|
|
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;
|
|
|
|
|
},
|
2021-02-17 10:43:42 +01:00
|
|
|
title() {
|
2021-05-20 12:33:59 +02:00
|
|
|
var title = this.$t(config.appName);
|
2021-02-17 10:43:42 +01:00
|
|
|
if (this.$matrix.notificationCount > 0) {
|
|
|
|
|
title += " [" + this.$matrix.notificationCount + "]";
|
|
|
|
|
}
|
|
|
|
|
if (this.$route.meta.title) {
|
|
|
|
|
title += " - " + this.$route.meta.title;
|
2021-01-29 21:41:43 +01:00
|
|
|
}
|
2021-02-17 10:43:42 +01:00
|
|
|
if (this.$route.meta.includeRoom) {
|
2021-01-29 21:41:43 +01:00
|
|
|
if (this.$matrix.currentRoom) {
|
2021-03-29 21:55:43 +02:00
|
|
|
title +=
|
|
|
|
|
" - " +
|
|
|
|
|
(this.$matrix.currentRoom.summary.info.title ||
|
|
|
|
|
this.$matrix.currentRoom.roomId);
|
2021-01-29 21:41:43 +01:00
|
|
|
} else if (this.$matrix.currentRoomId) {
|
2021-03-29 21:55:43 +02:00
|
|
|
title += " - " + this.$matrix.currentRoomId;
|
2021-01-29 21:41:43 +01:00
|
|
|
}
|
|
|
|
|
}
|
2021-02-17 10:43:42 +01:00
|
|
|
return title;
|
2021-03-29 21:55:43 +02:00
|
|
|
},
|
2021-02-17 10:43:42 +01:00
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
title(title) {
|
2021-01-29 21:41:43 +01:00
|
|
|
document.title = title;
|
|
|
|
|
},
|
2020-11-09 10:26:56 +01:00
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
.copyright {
|
|
|
|
|
font-size: 10px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|