From f8b979f60dc2e7797d8b04e91b79c95f411a81a2 Mon Sep 17 00:00:00 2001 From: Zach Bruggeman Date: Thu, 7 Dec 2017 19:52:30 -0800 Subject: [PATCH] Minor changes * Prompt when session expires * Design updates * Delete old code * Update changelog --- src/App.vue | 11 ++++++++++- src/lib/websocket.js | 20 -------------------- src/pages/Changelog.vue | 24 +++++++++++++++++++++--- src/pages/Login.vue | 23 +++++++++++++++++------ src/pages/Media.vue | 9 ++++----- src/store/index.js | 22 ++++++++++++++-------- 6 files changed, 66 insertions(+), 43 deletions(-) delete mode 100644 src/lib/websocket.js diff --git a/src/App.vue b/src/App.vue index 1f7773a..67e9de3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -118,8 +118,17 @@ export default { }, async created () { try { - await this.$store.dispatch('startSession') + + if ( + this.$route.name !== 'login' && + Object.keys(this.$store.state.auth).length > 0 && + (!this.$store.state.auth.token || !this.$store.state.auth.expires || new Date() > new Date(this.$store.state.auth.expires)) + ) { + await this.$store.dispatch('logout', true) + this.$router.replace(`/login?next=${encodeURIComponent(this.$route.fullPath)}`) + } + this.loaded = true } catch (err) { this.error = true diff --git a/src/lib/websocket.js b/src/lib/websocket.js deleted file mode 100644 index d901db4..0000000 --- a/src/lib/websocket.js +++ /dev/null @@ -1,20 +0,0 @@ -import io from 'socket.io-client' -import { UMI_SERVER } from './api' - -const WS = { - connected: false, - init () { - this.socket = io.connect(UMI_SERVER) - this.socket.on('connect', () => { - this.connected = true - }) - }, - install (Vue) { - this.init() - Object.defineProperty(Vue.prototype, '$socket', { - get () { return WS.socket } - }) - } -} - -export default WS diff --git a/src/pages/Changelog.vue b/src/pages/Changelog.vue index fe98535..38dc94e 100644 --- a/src/pages/Changelog.vue +++ b/src/pages/Changelog.vue @@ -2,6 +2,24 @@

Changelog

+

2017-12-07: Minor updates

+
+
    +
  • + Umi will now prompt you if you need to sign in again due to your session expiring. A session might expire if you change your password, or if you don't use Umi for a little while. +
      +
    • This fixes a bug where your queue and history data wouldn't load properly.
    • +
    +
  • +
  • + Minor design updates. +
  • +
  • + Happy holidays! +
  • +
+
+

2017-11-30: Rooms rewrite & more

    @@ -23,13 +41,13 @@ Install and refresh
- As a brief explanation of why this would happen: To make Umi even faster, the website caches a copy of all its code, so it doesn't even need to contact the Umi servers to run. Since the website doesn't contact the server when you first open it, the website has to check for updates after it's loaded. This is when you'd get the update notification. + As a brief explanation of why this would happen: To make Umi even faster, the website stores a copy of all its code on your device, so it doesn't need to contact the Umi servers to load. Since the website doesn't contact the server when you first open it, the website has to check for updates after it has loaded. This is when you'd get the update notification.
- I set the old system up to continually check for updates, including while you're using the player. Part of this was because of the rooms system, as it was very fickle with people leaving, so I didn't want to make it so auto updated while in a room. Now that rooms are a lot more stable, Umi will just check for updates when you first open the site, and automatically refresh if there's an update. You'll get a notification that links you here for details on the updates. + I setup the old system to continually check for updates, including while you were using the player. Part of this was because of the old rooms system, as it was very fickle with people leaving, so I didn't want to make it so auto-update while you in a room. Now that rooms are a lot more stable, Umi will just check for updates when you first open the site, and automatically refresh if there's an update. You'll get a notification that links you here for details on the update.
  • What's next: - I'm generally pretty happy with how Umi has progressed so far, and I hope you're enjoying using it. I do still have some ideas for the future, though! Here are some, in no particular planned order of adding them: + I'm generally pretty happy with how Umi has progressed so far, and I hope you're enjoying using it. I do still have some ideas for the future though! Here are some, in no particular order of adding them: