This commit is contained in:
UKDTOM 2021-01-12 23:01:49 +01:00
parent 8302660cbc
commit 0c88e38f40
4 changed files with 126 additions and 19 deletions

View file

@ -1,5 +1,11 @@
# ![Logo](https://github.com/WebTools-NG/WebTools-NG/blob/master/src/assets/WebTools-48x48.png) WebTools-ng Change log
## V0.1.10
**Note**: This version is an Alpha version, that is not made public
* [#207 Autoudate trigger happy](https://github.com/WebTools-NG/WebTools-NG/issues/207)
## V0.1.9
**Note**: This version is an Alpha version, that is not made public

View file

@ -1,7 +1,7 @@
{
"name": "webtools-ng",
"productName": "WebTools-NG",
"version": "0.1.9",
"version": "0.1.10",
"description": "WebTools Next Generation 4 Plex",
"author": "dane22 & CPSO",
"license": "MPL-2.0",

View file

@ -394,15 +394,59 @@ const dialog = new class Dialog {
const github = new class GitHub {
constructor() {
this.releaseUrl = 'https://api.github.com/repos/WebTools-NG/WebTools-NG/releases';
//this.releaseUrl = 'https://api.github.com/repos/ukdtom/testrel/releases';
}
// Get the releases from GitHub
async Releases(){
log.debug('Checking for Github updates')
const fetch = require('node-fetch');
const response = await fetch(this.releaseUrl);
const releases = await response.json();
return releases;
}
const releases = await response.json();
const rels = {};
rels['beta'] = false;
rels['rel'] = false;
rels['betadate'] = false;
rels['reldate'] = false;
rels['betadateFull'] = false;
rels['reldateFull'] = false;
for(var i = 0; i < releases.length; i++)
{
if (rels['beta'] && rels['rel'])
{
break;
}
if (!rels['beta'] && releases[i].prerelease){
log.verbose(`Found beta version ${releases[i].tag_name}`)
rels['betaver'] = releases[i].tag_name;
rels['beta'] = true;
rels['betaname'] = releases[i].name;
rels['betaurl'] = releases[i].html_url;
rels['betadate'] = releases[i].published_at.substring(0, 10);
rels['betadateFull'] = releases[i].published_at;
}
else if (!rels['rel'] && !releases[i].prerelease){
log.verbose(`Found release version ${releases[i].tag_name}`)
rels['relver'] = releases[i].tag_name;
rels['rel'] = true;
rels['relname'] = releases[i].name;
rels['relurl'] = releases[i].html_url;
rels['relurl'] = releases[i].html_url;
rels['reldate'] = releases[i].published_at.substring(0, 10);
rels['reldateFull'] = releases[i].published_at;
}
}
// If not present, set to zerro
if (!rels['reldateFull']){
rels['reldateFull'] = 0;
}
// If not present, set to zerro
if (!rels['betadateFull']){
rels['betadateFull'] = 0;
}
return rels;
}
}

View file

@ -54,22 +54,79 @@ export default {
},
// Is an update present?
async UpdatePresent(){
// Get release page from GitHub
const releases = await github.Releases();
for(var i = 0; i < releases.length; i++)
// Get release page from GitHub
const releases = await github.Releases();
log.verbose('Github releases', JSON.stringify(releases))
if (wtconfig.get('Update.Beta'))
{
// Check for current release on GitHub
if ( Boolean(wtconfig.get('Update.Beta')) == releases[i].prerelease){
if ('v' + wtutils.AppVersion != releases[i].tag_name){
log.info('Update detected');
this.body = this.$t('Common.Update.Body', [releases[i].name, releases[i].published_at.substring(0, 10)]),
this.name = releases[i].name;
this.url = releases[i].html_url
this.$refs['showUpdate'].show()
}
break;
}
// Need to check both beta and rel versions
// Find newest one
if (Date.parse(releases['betadateFull']) > Date.parse(releases['reldateFull'])){
this.body = this.$t('Common.Update.Body', [releases['betaname'], releases['betadate']]),
this.name = releases['betaname'];
this.url = releases['betaurl'];
this.ver = releases['betaver'];
}
else
{
this.body = this.$t('Common.Update.Body', [releases['relname'], releases['reldate']]),
this.name = releases['relname'];
this.url = releases['relurl'];
this.ver = releases['relver'];
}
}
else
{
this.body = this.$t('Common.Update.Body', [releases['relname'], releases['reldate']]),
this.name = releases['relname'];
this.url = releases['relurl'];
this.ver = releases['relver'];
}
if (wtutils.AppVersion != this.ver && this.ver)
{
// Show an update is present
log.debug(`Update present: Github-Version: ${this.ver} Current-Version: ${wtutils.AppVersion}`)
this.$refs['showUpdate'].show();
}
/*
if (( Boolean(wtconfig.get('Update.Beta')) == releases['beta']))
{
log.verbose('Need to check for beta updates', releases['betaver'], wtutils.AppVersion)
if (releases['betaver'] != wtutils.AppVersion)
{
console.log('ged beta update avail')
log.info('Beta Update detected');
this.body = this.$t('Common.Update.Body', [releases['betaname'], releases['betadate']]),
this.name = releases['betaname'];
this.url = releases['betaurl'];
this.$refs['showUpdate'].show();
}
}
else
{
console.log('ged rel', releases['relver'] )
log.verbose('Need to check for rel updates', releases['relver'], wtutils.AppVersion)
if (releases['relver'] === null)
{
console.log('Ged3344 rel is null')
}
if ((releases['relver'] != wtutils.AppVersion) ?? (releases['relver'] !== null))
{
log.info('Release Update detected');
this.body = this.$t('Common.Update.Body', [releases['relname'], releases['reldate']]),
this.name = releases['relname'];
this.url = releases['relurl'];
this.$refs['showUpdate'].show();
}
}
*/
},
async checkLangUpdates() {
// Start by getting the currently selected language