mirror of
https://github.com/WebTools-NG/WebTools-NG
synced 2025-02-16 19:38:26 +00:00
Fixed #305
This commit is contained in:
parent
5b2542ea66
commit
1396f45e56
5 changed files with 112 additions and 52 deletions
|
@ -1,5 +1,11 @@
|
|||
# ![Logo](https://github.com/WebTools-NG/WebTools-NG/blob/master/src/assets/WebTools-48x48.png) WebTools-ng Change log
|
||||
|
||||
## V0.3.0
|
||||
|
||||
**Note**: This version is an Beta version
|
||||
|
||||
* [#305 First launch after an upgrade should show changelog](https://github.com/WebTools-NG/WebTools-NG/issues/305)
|
||||
|
||||
## V0.2.02
|
||||
|
||||
**Note**: This version is an Alpha version, that is not made public
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "webtools-ng",
|
||||
"productName": "WebTools-NG",
|
||||
"version": "0.2.3",
|
||||
"version": "0.3.0",
|
||||
"description": "WebTools Next Generation 4 Plex",
|
||||
"author": "dane22 & CPSO",
|
||||
"license": "MPL-2.0",
|
||||
|
|
|
@ -125,7 +125,8 @@
|
|||
"ExportDir": "Select Export Directory",
|
||||
"Browse": "Browse",
|
||||
"ErrorNoOutDirMsg": "You need to define an output directory in the global settings page first",
|
||||
"ErrorNoOutDirTitle": "No output directory defined"
|
||||
"ErrorNoOutDirTitle": "No output directory defined",
|
||||
"ReleaseNoteTitle": "Release Note"
|
||||
},
|
||||
"Modules": {
|
||||
"PlexTV": {
|
||||
|
|
|
@ -443,9 +443,35 @@ 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';
|
||||
this.changeLogUrl = 'https://raw.githubusercontent.com/WebTools-NG/WebTools-NG/master/CHANGELOG.md'
|
||||
}
|
||||
|
||||
// Get the changelog from GitHub
|
||||
async ChangeLog(){
|
||||
log.debug('Fetching Github Release Note')
|
||||
|
||||
const axios = require('axios');
|
||||
//let html = '';
|
||||
var resp;
|
||||
await axios(this.changeLogUrl)
|
||||
.then(response => {
|
||||
this.data = response.data;
|
||||
resp = this.data.split("## ")[1];
|
||||
resp = resp.split('## ')[0];
|
||||
})
|
||||
.catch(console.error);
|
||||
// Remove link from lines
|
||||
const regex = /\([^)]*\)/ig;
|
||||
resp = resp.replaceAll(regex, '');
|
||||
// Remove * and []
|
||||
resp = resp.replaceAll('* [', '').replaceAll(']','');
|
||||
// Split into an array
|
||||
resp = resp.split("\n");
|
||||
// Remove empty items
|
||||
resp = resp.filter(item => item);
|
||||
return resp;
|
||||
}
|
||||
|
||||
// Get the releases from GitHub
|
||||
async Releases(){
|
||||
log.debug('Checking for Github updates')
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<template>
|
||||
<b-container fluid>
|
||||
<div class="col-lg-9 col-md-12 col-xs-12">
|
||||
<div class="col-lg-9 col-md-12 col-xs-12">
|
||||
<h2>
|
||||
{{ $t("Common.Home.Title") }} <br>
|
||||
<h5>{{ $t("Common.Home.About") }}</h5>
|
||||
</h2>
|
||||
</h2>
|
||||
<br>
|
||||
<h3>{{ $t("Common.Home.Modules") }}</h3>
|
||||
<dl>
|
||||
|
@ -14,24 +14,34 @@
|
|||
<dd>* {{ $t("Modules.PMS.Description") }} </dd>
|
||||
<dt>{{ $t("Modules.PlexTV.Name") }}</dt>
|
||||
<dd>* {{ $t("Modules.PlexTV.Description") }} </dd>
|
||||
</dl>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
<b-modal ref="showUpdate" hide-footer v-bind:title=this.updateTitle >
|
||||
<div class="d-block text-center">
|
||||
{{ this.body }}
|
||||
{{ this.body }}
|
||||
<b-form-checkbox
|
||||
id="SkipVerCB"
|
||||
v-model="cbSelected"
|
||||
name="SkipVerCB"
|
||||
name="SkipVerCB"
|
||||
>
|
||||
{{ $t("Common.Update.Skip") }}
|
||||
{{ $t("Common.Update.Skip") }}
|
||||
</b-form-checkbox>
|
||||
</div>
|
||||
<b-button class="mt-3" variant="outline-primary" block @click="visitRels">{{ this.body2 }}</b-button>
|
||||
</b-modal>
|
||||
|
||||
|
||||
<b-modal ref="showRelNote" scrollable hide-footer v-bind:title=this.relNoteTitle >
|
||||
<div class="d-block text-left">
|
||||
<ul id="v-for-object">
|
||||
<li v-for="value in relNoteArr" v-bind:key="value">
|
||||
{{ value }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</b-modal>
|
||||
|
||||
</b-container>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -43,19 +53,21 @@ import { shell } from 'electron';
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
updateTitle: this.$t('Common.Update.Title'),
|
||||
updateTitle: this.$t('Common.Update.Title'),
|
||||
relNoteTitle: this.$t('Common.ReleaseNoteTitle'),
|
||||
relNoteArr: [],
|
||||
body: '',
|
||||
body2: this.$t('Common.Update.Body2'),
|
||||
url: '',
|
||||
url: '',
|
||||
cbOptions: [{ text: i18n.t('Common.Update.Skip'), value: 'SkipUpdate' }],
|
||||
cbSelected: '',
|
||||
GitHubVersion: ''
|
||||
GitHubVersion: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// Watch for when selected server address is updated
|
||||
cbSelected: async function(){
|
||||
if (Boolean(this.cbSelected) === true){
|
||||
cbSelected: async function(){
|
||||
if (Boolean(this.cbSelected) === true){
|
||||
log.verbose(`Update will skip version: ${this.GitHubVersion}`)
|
||||
wtconfig.set("Update.SkipVer", this.GitHubVersion)
|
||||
}
|
||||
|
@ -66,54 +78,66 @@ export default {
|
|||
}
|
||||
},
|
||||
mounted() {
|
||||
log.info("Home Created");
|
||||
log.info("Home Created");
|
||||
this.ShowReleaseNote();
|
||||
this.checkLangUpdates();
|
||||
this.UpdatePresent();
|
||||
this.CheckExportDir();
|
||||
this.CheckExportDir();
|
||||
},
|
||||
methods: {
|
||||
methods: {
|
||||
// Visit GitHub release page
|
||||
visitRels(){
|
||||
log.info(`User pressed update link, and was directed to: ${this.url}`);
|
||||
shell.openExternal(this.url);
|
||||
shell.openExternal(this.url);
|
||||
},
|
||||
// Do we need to show release notes?
|
||||
async ShowReleaseNote(){
|
||||
if (wtutils.AppVersion != wtconfig.get('General.ShowRel', "0"))
|
||||
{
|
||||
log.verbose(`Show Rel Notes`);
|
||||
this.relNoteArr = await github.ChangeLog();
|
||||
this.$refs['showRelNote'].show();
|
||||
wtconfig.set('General.ShowRel',wtutils.AppVersion);
|
||||
}
|
||||
|
||||
},
|
||||
// Is an update present?
|
||||
async UpdatePresent(){
|
||||
if (wtconfig.get('Update.Update', true)){
|
||||
log.verbose(`Check for updates enabled`)
|
||||
// Get release page from GitHub
|
||||
log.verbose(`Check for updates enabled`)
|
||||
// Get release page from GitHub
|
||||
const releases = await github.Releases();
|
||||
log.verbose('Github releases', JSON.stringify(releases));
|
||||
log.verbose('Github releases', JSON.stringify(releases));
|
||||
if (wtconfig.get('Update.Beta', true))
|
||||
{
|
||||
// Need to check both beta and rel versions
|
||||
// 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'];
|
||||
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'];
|
||||
this.beta = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.body = this.$t('Common.Update.Body', [releases['relname'], releases['reldate']]),
|
||||
this.name = releases['relname'];
|
||||
{
|
||||
this.body = this.$t('Common.Update.Body', [releases['relname'], releases['reldate']]),
|
||||
this.name = releases['relname'];
|
||||
this.url = releases['relurl'];
|
||||
this.ver = releases['relver'];
|
||||
this.beta = false;
|
||||
this.beta = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.body = this.$t('Common.Update.Body', [releases['relname'], releases['reldate']]),
|
||||
this.name = releases['relname'];
|
||||
{
|
||||
this.body = this.$t('Common.Update.Body', [releases['relname'], releases['reldate']]),
|
||||
this.name = releases['relname'];
|
||||
this.url = releases['relurl'];
|
||||
this.ver = releases['relver'];
|
||||
this.beta = false;
|
||||
}
|
||||
if (wtutils.AppVersion != this.ver && this.ver)
|
||||
{
|
||||
{
|
||||
// Show an update is present
|
||||
if (this.ver == wtconfig.get('Update.SkipVer', ''))
|
||||
{
|
||||
|
@ -121,55 +145,55 @@ export default {
|
|||
}
|
||||
else
|
||||
{
|
||||
log.debug(`Update present: Github-Version: ${this.ver} Current-Version: ${wtutils.AppVersion}`);
|
||||
this.GitHubVersion = this.ver;
|
||||
log.debug(`Update present: Github-Version: ${this.ver} Current-Version: ${wtutils.AppVersion}`);
|
||||
this.GitHubVersion = this.ver;
|
||||
this.$refs['showUpdate'].show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
log.verbose(`Check for updates disabled`)
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
async checkLangUpdates() {
|
||||
// Start by getting the currently selected language
|
||||
const selLang = wtconfig.get('General.language');
|
||||
const selLangUpdated = wtconfig.get(`Languages.${selLang}`, 'N/A')
|
||||
var onlineLangs = await this.$store.getters.getLanguages
|
||||
var onlineLangs = await this.$store.getters.getLanguages
|
||||
for (var i=0; i<onlineLangs.length; i++) {
|
||||
if (onlineLangs[i]['code'] == selLang)
|
||||
{
|
||||
if ( onlineLangs[i]['updated'] != selLangUpdated)
|
||||
{
|
||||
const bodyStr = i18n.t("Common.Home.LangUpdateMsg", [onlineLangs[i]['name']]) + '. ' + i18n.t("Common.Home.LangUpdateMsg2", [i18n.t("Common.Language.btnForce")]);
|
||||
this.$bvToast.toast(bodyStr, {
|
||||
{
|
||||
const bodyStr = i18n.t("Common.Home.LangUpdateMsg", [onlineLangs[i]['name']]) + '. ' + i18n.t("Common.Home.LangUpdateMsg2", [i18n.t("Common.Language.btnForce")]);
|
||||
this.$bvToast.toast(bodyStr, {
|
||||
title: this.$t("Common.Home.LangUpdateTitle"),
|
||||
autoHideDelay: 400000,
|
||||
autoHideDelay: 400000,
|
||||
solid: true,
|
||||
variant: 'primary',
|
||||
toaster: 'b-toaster-bottom-right'
|
||||
toaster: 'b-toaster-bottom-right'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
selLang, wtutils, selLangUpdated
|
||||
},
|
||||
async CheckExportDir() {
|
||||
async CheckExportDir() {
|
||||
if ( wtutils.ExportDirPresent )
|
||||
{
|
||||
log.info('ExportDir OK');
|
||||
}
|
||||
else
|
||||
{
|
||||
log.error('ExportDir missing');
|
||||
const bodyStr = i18n.t("Common.ErrorNoOutDirMsg");
|
||||
this.$bvToast.toast(bodyStr, {
|
||||
log.error('ExportDir missing');
|
||||
const bodyStr = i18n.t("Common.ErrorNoOutDirMsg");
|
||||
this.$bvToast.toast(bodyStr, {
|
||||
title: this.$t("Common.ErrorNoOutDirTitle"),
|
||||
autoHideDelay: 400000,
|
||||
autoHideDelay: 400000,
|
||||
solid: true,
|
||||
variant: 'primary',
|
||||
toaster: 'b-toaster-bottom-right'
|
||||
toaster: 'b-toaster-bottom-right'
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -183,5 +207,8 @@ export default {
|
|||
dd {
|
||||
padding-left: 10px;
|
||||
}
|
||||
ul{
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
Loading…
Add table
Reference in a new issue