diff --git a/src/App.vue b/src/App.vue index 06e204ed..50560ba5 100644 --- a/src/App.vue +++ b/src/App.vue @@ -173,23 +173,6 @@ export default { redirection, ], - data() { - return { - links: [ - { - title: 'Github', - href: 'https://github.com/samcm/SyncLounge', - target: '_blank', - }, - { - title: 'Discord', - target: '_blank', - href: 'https://discord.gg/fKQB3yt', - }, - ], - }; - }, - computed: { ...mapGetters([ 'GET_UP_NEXT_POST_PLAY_DATA', @@ -199,6 +182,8 @@ export default { 'GET_SNACKBAR_OPEN', 'GET_BACKGROUND', 'GET_NAVIGATE_TO_PLAYER', + 'GET_REPOSITORY_URL', + 'GET_DISCORD_URL', ]), ...mapGetters('plex', [ @@ -225,6 +210,21 @@ export default { ...mapState(['isRightSidebarOpen']), + links() { + return [ + { + title: 'Github', + href: this.GET_REPOSITORY_URL, + target: '_blank', + }, + { + title: 'Discord', + target: '_blank', + href: this.GET_DISCORD_URL, + }, + ]; + }, + showNowPlaying() { return this.GET_ACTIVE_SERVER_ID && this.$route.name === 'browse'; }, diff --git a/src/components/sidebars/leftsidebar.vue b/src/components/sidebars/leftsidebar.vue index 0d7a1485..7981d228 100644 --- a/src/components/sidebars/leftsidebar.vue +++ b/src/components/sidebars/leftsidebar.vue @@ -74,7 +74,7 @@ About @@ -84,12 +84,12 @@ - SyncLounge v{{ version }} + SyncLounge v{{ GET_VERSION }} @@ -104,7 +104,7 @@ @@ -144,7 +144,7 @@ class="text-center pa-2" style="opacity: 0.7; font-size: 12px;" > -
Build #{{ hash }}
+
Build #{{ GET_GIT_HASH }}
Last updated {{ updatedAt }}
@@ -161,7 +161,7 @@ - + @@ -191,7 +191,7 @@ import { formatDistanceToNow } from 'date-fns'; export default { components: { - ptsettings: () => import('@/components/settings.vue'), + settings: () => import('@/components/settings.vue'), plexsettings: () => import('@/components/plex/plexsettings.vue'), donate: () => import('@/components/donate.vue'), }, @@ -206,14 +206,19 @@ export default { computed: { ...mapState(['isLeftSidebarOpen']), + ...mapGetters([ + 'GET_REPOSITORY_URL', + 'GET_VERSION', + 'GET_GIT_HASH', + 'GET_DISCORD_URL', + 'GET_RELEASE_URL', + 'GET_COMMIT_URL', + ]), + ...mapGetters('plex', [ 'GET_PLEX_USER', ]), - hash() { - return process.env.VUE_APP_GIT_HASH; - }, - date() { return new Date(parseInt(process.env.VUE_APP_GIT_DATE, 10) * 1000); }, @@ -221,14 +226,11 @@ export default { updatedAt() { return `${formatDistanceToNow(this.date)} ago`; }, - - version() { - return process.env.VUE_APP_VERSION; - }, }, methods: { ...mapActions(['SET_LEFT_SIDEBAR_OPEN']), + getTimeFromMs(ms) { const hours = ms / (1000 * 60 * 60); const absoluteHours = Math.floor(hours); diff --git a/src/store/getters.js b/src/store/getters.js index 0fec41e1..5b650631 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,4 +1,12 @@ export default { + GET_VERSION: (state) => state.version, + GET_GIT_HASH: (state) => state.gitHash, + GET_REPOSITORY_URL: (state) => state.repositoryUrl, + GET_DISCORD_URL: (state) => state.discordUrl, + GET_RELEASE_URL: (state, getters) => `${getters.GET_REPOSITORY_URL}/releases/tag/v${ + getters.GET_VERSION}`, + GET_COMMIT_URL: (state, getters) => `${getters.GET_REPOSITORY_URL}/commit/${ + getters.GET_GIT_HASH}`, GET_BACKGROUND: (state) => state.background, GET_UP_NEXT_POST_PLAY_DATA: (state) => state.upNextPostPlayData, GET_CONFIG: (state) => state.configuration, diff --git a/src/store/modules/plex/getters.js b/src/store/modules/plex/getters.js index a64abfea..9c9bd03a 100644 --- a/src/store/modules/plex/getters.js +++ b/src/store/modules/plex/getters.js @@ -31,7 +31,7 @@ export default { GET_PLEX_INITIAL_AUTH_PARAMS: (state, getters, rootState, rootGetters) => ({ 'X-Plex-Product': getters.GET_PLEX_PRODUCT_HEADER, - 'X-Plex-Version': process.env.VUE_APP_VERSION, + 'X-Plex-Version': rootGetters.GET_VERSION, 'X-Plex-Client-Identifier': getters.GET_CLIENT_IDENTIFIER, 'X-Plex-Platform': getters.GET_PLEX_PLATFORM_HEADER, 'X-Plex-Platform-Version': rootGetters.GET_BROWSER.version, @@ -54,7 +54,7 @@ export default { GET_PLEX_AUTH_URL: (state, getters, rootState, rootGetters) => (code) => { const urlParams = { 'context[device][product]': getters.GET_PLEX_PRODUCT_HEADER, - 'context[device][version]': process.env.VUE_APP_VERSION, + 'context[device][version]': rootGetters.GET_VERSION, 'context[device][platform]': getters.GET_PLEX_PLATFORM_HEADER, 'context[device][platformVersion]': rootGetters.GET_BROWSER.version, 'context[device][device]': getters.GET_PLEX_DEVICE_DEVICE_HEADER, diff --git a/src/store/state.js b/src/store/state.js index 16c6836c..697f5941 100644 --- a/src/store/state.js +++ b/src/store/state.js @@ -1,6 +1,11 @@ import { detect } from 'detect-browser'; const state = () => ({ + version: process.env.VUE_APP_VERSION, + gitHash: process.env.VUE_APP_GIT_HASH, + repositoryUrl: 'https://github.com/ttshivers/synclounge', + discordUrl: 'https://discord.gg/fKQB3yt', + background: null, configuration: null, diff --git a/src/views/signin.vue b/src/views/signin.vue index 016e07c5..a26c2be3 100644 --- a/src/views/signin.vue +++ b/src/views/signin.vue @@ -32,7 +32,7 @@ SyncLounge yourself have a look here for details. @@ -73,6 +73,7 @@ export default { computed: { ...mapGetters([ 'GET_CONFIG', + 'GET_REPOSITORY_URL', ]), ...mapGetters('plex', [