From f042e61154fdc2a47e29a1101841f9ce5441a470 Mon Sep 17 00:00:00 2001 From: Tenzin Passang Date: Fri, 12 Nov 2021 19:29:28 +0200 Subject: [PATCH] favicon matches room logo --- public/index.html | 2 +- src/App.vue | 17 +++++++++++++++++ src/router/index.js | 9 ++++++--- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/public/index.html b/public/index.html index 4123528..93f2580 100644 --- a/public/index.html +++ b/public/index.html @@ -4,7 +4,7 @@ - + <%= htmlWebpackPlugin.options.title %> diff --git a/src/App.vue b/src/App.vue index cb470ca..8802d96 100644 --- a/src/App.vue +++ b/src/App.vue @@ -127,6 +127,16 @@ export default { } return title; }, + + favicon() { + var favicon = undefined; + if (this.$route.meta.includeFavicon) { + if (this.$matrix.currentRoom) { + favicon = this.$matrix.currentRoom.avatar || 'favicon.ico'; + } + } + return favicon; + }, }, watch: { "$i18n.locale": { @@ -149,6 +159,13 @@ export default { }, immediate: true, }, + + favicon: { + handler(favicon) { + document.getElementById("favicon").setAttribute('href', favicon); + }, + immediate: true, + }, }, }; diff --git a/src/router/index.js b/src/router/index.js index b74dec0..4ec0a32 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -22,7 +22,8 @@ const routes = [ name: 'Chat', component: Chat, meta: { - includeRoom: true + includeRoom: true, + includeFavicon: true } }, { @@ -32,7 +33,8 @@ const routes = [ props: true, meta: { title: 'Info', - includeRoom: true + includeRoom: true, + includeFavicon: true } }, { @@ -40,7 +42,8 @@ const routes = [ name: 'Profile', component: Profile, meta: { - title: 'Profile' + title: 'Profile', + includeFavicon: true } }, {