Improved handling of "site-down" errors at init

Now uninstall devtron on production
Removed unnecessary comments in store/index.js
Now working on adapting to Vuetifyjs 0.12
This commit is contained in:
Kylart 2017-06-02 19:31:07 +02:00
parent 478cca91fe
commit 829a52ff78
5 changed files with 52 additions and 9 deletions

View File

@ -33,7 +33,7 @@ This software allows one to:
list of torrent magnets to paste in a torrent client on a distant server.
* Get information from any anime (those come from myanimelist.net) __COMMING SOON__.
* Get anime-related news from MyAnimeList.net.
* Get seasonal releases information (from [www.livechart.me](www.livechart.me)).
* Get seasonal releases information (from [www.livechart.me](https://www.livechart.me)).
* Manage your anime files (watch and delete on click)
* Manage watch lists.
* More features are to come.

View File

@ -33,7 +33,7 @@ if (config.dev) {
}
// Listen the server
server.listen(12345)
server.listen()
const _NUXT_URL_ = `http://localhost:${server.address().port}`
console.log(`KawAnime is at ${_NUXT_URL_}`)
@ -63,7 +63,7 @@ dialog.showErrorBox = (title, content) => {
console.log(`${title}\n${content}`)
}
process.on('uncaughtException', function (err) {
process.on('uncaughtException', (err) => {
console.error('Uncaught exception occurred in main process.\n' + err)
})
@ -121,6 +121,8 @@ app.on('ready', () => {
// Dev tools
if (config.dev) {
require('devtron').install()
} else {
require('devtron').uninstall()
}
newWin()

View File

@ -119,6 +119,13 @@
<v-list-tile-title>Add to &laquo;Seen&raquo;</v-list-tile-title>
</v-list-tile>
</v-list-item>
<v-list-item>
<v-list-tile @click.native="showChoices(item.title)">
<v-list-tile-title>
Add to
</v-list-tile-title>
</v-list-tile>
</v-list-item>
</v-list>
</v-menu>
</v-col>
@ -149,6 +156,21 @@
</v-card>
</v-dialog>
</div>
<v-dialog v-model="choiceDialog" width="650">
<v-card>
<v-card-row>
<v-card-title>Add {{ choiceTitle }} to</v-card-title>
</v-card-row>
<v-card-row>
<v-card-text>
To do
</v-card-text>
</v-card-row>
<v-card-row actions>
<v-btn class="green--text darken-1" flat="flat" @click.native="choiceDialog = false">Add</v-btn>
</v-card-row>
</v-card>
</v-dialog>
</v-container>
</v-container>
</template>
@ -159,6 +181,9 @@
export default {
data () {
return {
choiceDialog: false,
choiceTitle: '',
choices: [],
modalTitle: '',
modalText: '',
modal: false,
@ -258,6 +283,10 @@
listName: listName,
entry: entry
})
},
showChoices (name) {
this.choiceTitle = name
this.choiceDialog = true
}
}
}

View File

@ -113,8 +113,6 @@ const store = new Vuex.Store({
},
setReleases: function (state, data) {
state.releases = data
// Update time whenever KawAnime receives new releases.
state.releasesUpdateTime = (new Date()).toLocaleTimeString()
log(`Releases updated.`)
@ -231,6 +229,8 @@ const store = new Vuex.Store({
dispatch('releasesInit').catch(err => { void (err) })
}, 45 * 1000)
} else if (status === 204) {
log('nyaa.si does not respond... Switching to nyaa.pantsu.cat.')
commit('setReleaseParams', {
fansub: state.config.fansub,
quality: state.config.quality,
@ -251,6 +251,8 @@ const store = new Vuex.Store({
dispatch('releasesInit').catch(err => { void (err) })
}, 45 * 1000)
} else if (status === 204) {
log('nyaa.pantsu.cat does not respond... Switching to HorribleSubs.')
commit('setReleaseParams', {
fansub: state.config.fansub,
quality: state.config.quality,
@ -263,13 +265,17 @@ const store = new Vuex.Store({
commit('setReleases', data)
if (state.autoRefreshReleases === true) dispatch('autoRefreshReleases')
} else if (status === 202 || status === 204) {
} else if (status === 202) {
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 () {
log(`Retrying to get latest releases.`)
dispatch('releasesInit').catch(err => { void (err) })
}, 45 * 1000)
} else if (status === 204) {
log('HorribleSubs does not respond. Retrying with nyaa.si.')
dispatch('releasesInit')
}
}
}

View File

@ -47,8 +47,8 @@ module.exports = { // adapted from: https://git.io/vodU0
done()
})
},
'Getting downloader page': function (browser) {
browser
'Getting downloader page and downloading some anime': function (client) {
client
.url(`${uri}/downloader`)
.waitForElementVisible('body')
.assert.title('KawAnime')
@ -68,7 +68,13 @@ module.exports = { // adapted from: https://git.io/vodU0
.assert.visible('#download-btn')
.click('#download-btn')
.waitForElementVisible('div.modal-text')
.pause(3000)
.end()
},
'Getting season page': function (client) {
client
.url(`${uri}/seasons`)
.waitForElementVisible('body')
.assert.title('KawAnime')
.end()
},
after: function () {