diff --git a/nuxt.config.js b/nuxt.config.js index 2e0c680..2efff02 100755 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -19,7 +19,13 @@ module.exports = { 'assets/main.css' ], head: { + title: 'KawAnime', + meta: [ + {charset: 'utf-8'}, + {name: 'viewport', content: 'width=device-width, initial-scale=1'}, + ], link: [ + // { rel: 'icon', type: 'image/x-icon', href: 'favicon.ico' }, {rel: 'stylesheet', href: 'http://fonts.googleapis.com/css?family=Roboto'}, {rel: 'stylesheet', href: 'http://fonts.googleapis.com/icon?family=Material+Icons'} ] diff --git a/pages/index.vue b/pages/index.vue index 4fc913d..15572f5 100755 --- a/pages/index.vue +++ b/pages/index.vue @@ -74,15 +74,15 @@ - - + + Check synopsis - - + + Download all episodes @@ -173,6 +173,7 @@ }, watch: { releases: function () { + // Update time whenever KawAnime receives new releases. const newTime = (new Date()).toLocaleTimeString() this.$store.commit('setReleasesUpdateTime', newTime) } diff --git a/static/images/favicon.ico b/static/images/favicon.ico new file mode 100644 index 0000000..9e4cf6d Binary files /dev/null and b/static/images/favicon.ico differ diff --git a/store/index.js b/store/index.js index f73cba6..9fd7dfd 100644 --- a/store/index.js +++ b/store/index.js @@ -14,6 +14,7 @@ const log = (message) => { const store = new Vuex.Store({ state: { + autoRefreshReleases: true, releaseFansub: '', releaseQuality: '', releases: [], @@ -208,8 +209,11 @@ const store = new Vuex.Store({ const {data, status} = await axios.get(`getLatest.json?quality=${state.releaseQuality}`) - if (status === 200) commit('setReleases', data) - else if (status === 204) { + if (status === 200) { + commit('setReleases', data) + + if (state.autoRefreshReleases === true) dispatch('autoRefreshReleases') + } else if (status === 204) { log(`An error occurred while getting the latest releases. Retrying in 45 seconds.`) commit('setInfoSnackbar', 'Could not get the latest releases. Retrying in 45 seconds.') setTimeout(function () { @@ -263,6 +267,19 @@ const store = new Vuex.Store({ }, 45 * 1000) } }, + async autoRefreshReleases ({dispatch, commit, state}) { + // Refresh releases every 30 minutes + setTimeout(async () => { + log(`Refreshing Releases...`) + + const {data} = await axios.get(`getLatest.json?quality=${state.releaseQuality}`) + + if (data.length === 18) { + commit('setReleases', data) + dispatch('autoRefreshReleases') + } + }, 30 * 60 * 1000) + }, async refreshSeasons ({state, commit}) { log(`Refreshing Seasons...`)