Merge pull request #217 from WebTools-NG/#213-AutoUpdate-Notification-Ignore

#213 auto update notification ignore
This commit is contained in:
Tommy Mikkelsen 2021-01-16 23:04:13 +01:00 committed by GitHub
commit 6e96bbf73e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 149 additions and 54 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.12
**Note**: This version is an Alpha version, that is not made public
* [#213 AutoUpdate Notification Ignore](https://github.com/WebTools-NG/WebTools-NG/issues/213)
## V0.1.11
**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.11",
"version": "0.1.12",
"description": "WebTools Next Generation 4 Plex",
"author": "dane22 & CPSO",
"license": "MPL-2.0",

View file

@ -119,7 +119,8 @@
"Update" : {
"Title": "Update detected",
"Body": "{0} was released on Github on: {1}.",
"Body2": "Click here for more info"
"Body2": "Click here for more info",
"Skip": "Don't show notification for this version anymore"
}
},
"Modules": {
@ -257,9 +258,12 @@
"RestartNeeded": "When changing this setting, a restart is needed",
"FactoryReset": "Factory Reset",
"FactoryResetWarning": "Factory Reset will reset this app towards how it was when first installed",
"BetaTester": "Subscribe to Beta updates"
"BetaTester": "Subscribe to Beta updates",
"TTBetaTester": "When selected, you'll be notified when a new beta version is available",
"Update": "Subscribe to updates (If false, beta updates will also be disabled)",
"TTUpdate": "When selected, you'll be notified when a new update is available",
"True": "True",
"False": "False"
}
}
}

View file

@ -12,30 +12,33 @@
<h3>
{{ $t("Modules.About.TranslationBetaTestersTitle") }} <br>
<small>{{ $t("Modules.About.TranslationBetaTestersText") }}</small>
</h3>
</h3>
<div>
<ul class="list-inline">
<li class="list-inline-item" v-for="(po, index) in poTranslators" :key="po.name">{{ po.name }}<span v-if="index != (poTranslators.length - 1)">,</span></li>
<li class="list-inline-item" v-for="(po, index) in poeTranslators" :key="po.name">{{ po.name }}<span v-if="index != (poeTranslators.length - 1)">,</span></li>
</ul>
</div>
<br>
<br>
<h6>{{ $t("Modules.About.PlexPoCredits") }}</h6>
</div>
</b-container>
</template>
<script>
export default {
name: 'about',
methods: {
},
const log = require('electron-log');
console.log = log.log;
export default {
data() {
return {
poeTranslators: []
}
},
async created() {
await this.$store.dispatch('fetchPOEContrib');
this.poeTranslators = await this.$store.getters.getContrib;
},
computed: {
poTranslators(){
return this.$store.getters.getContrib
}
mounted() {
log.info("About Created");
}
}

View file

@ -31,10 +31,20 @@
<b-input-group id="BetaTesterGrp" :prepend="$t('Modules.GlobalSettings.BetaTester')" class="mt-3">
<b-tooltip target="BetaTesterGrp" triggers="hover">
{{ $t('Modules.GlobalSettings.RestartNeeded') }}
{{ $t('Modules.GlobalSettings.TTBetaTester') }}
</b-tooltip>
<b-form-select id="LogLevel" name="LogLevel" type="text" class="form-control" v-model="BetaTester" :disabled=false :maxlength=2 v-on:change="setBeta" :options="BetaLevels"></b-form-select>
<b-form-select id="BetaTester" name="BetaTester" type="text" class="form-control" v-model="BetaTester" :disabled=false :maxlength=2 v-on:change="setBeta" :options="BetaLevels"></b-form-select>
</b-input-group>
<b-input-group id="Update" :prepend="$t('Modules.GlobalSettings.Update')" class="mt-3">
<b-tooltip target="Update" triggers="hover">
{{ $t('Modules.GlobalSettings.TTUpdate') }}
</b-tooltip>
<b-form-select id="Update" name="Update" type="text" class="form-control" v-model="Update" :disabled=false :maxlength=2 v-on:change="setUpdate" :options="UpdateLevels">
{{ this.getUpdate() }}
</b-form-select>
</b-input-group>
</div>
</b-container>
</template>
@ -54,7 +64,8 @@
LogLevel: wtconfig.get('Log.fileLevel'),
LogLevelConsole: wtconfig.get('Log.consoleLevel'),
LogLevelSize: this.getLogFileSize(),
BetaTester: wtconfig.get('Update.Beta', false)
BetaTester: this.getBeta(),
Update: this.getUpdate()
}
},
methods: {
@ -64,6 +75,28 @@
require('electron').remote.app.relaunch();
require('electron').remote.app.quit();
},
getUpdate: function(){
console.log('Ged GetUpdate')
if (wtconfig.get('Update.Update', true)){
console.log('Ged Update True')
return i18n.t('Modules.GlobalSettings.True')
}
else{
console.log('Ged Update False')
return i18n.t('Modules.GlobalSettings.False')
}
},
getBeta: function(){
console.log('Ged GetBeta')
if (wtconfig.get('Update.Beta', false)){
console.log('Ged Beta True')
return i18n.t('Modules.GlobalSettings.True')
}
else{
console.log('Ged Beta False')
return i18n.t('Modules.GlobalSettings.False')
}
},
setTimeOut: function(){
wtconfig.set('PMS.TimeOut', this.TimeOut)
},
@ -73,7 +106,11 @@
},
setBeta: function(value){
log.info(`Beta level set to ${value}`);
wtconfig.set('Update.Beta', value == 'true');
wtconfig.set('Update.Beta', value == i18n.t('Modules.GlobalSettings.True'));
},
setUpdate: function(value){
log.info(`Update set to ${value}`);
wtconfig.set('Update.Update', value == i18n.t('Modules.GlobalSettings.True'));
},
setLogLevelConsole: function(value){
log.info(`Log Console level set to ${value}`);
@ -135,7 +172,6 @@
wtconfig.set('Log.maxSize', size);
}
},
computed: {
logLevels: function() {
@ -147,7 +183,11 @@
return options;
},
BetaLevels: function() {
const options = ['true', 'false'];
const options = [i18n.t('Modules.GlobalSettings.True'), i18n.t('Modules.GlobalSettings.False')];
return options;
},
UpdateLevels: function() {
const options = [i18n.t('Modules.GlobalSettings.True'), i18n.t('Modules.GlobalSettings.False')];
return options;
},
}

View file

@ -12,11 +12,20 @@
<dd>* {{ $t("Modules.ET.Description") }} </dd>
<dt>{{ $t("Modules.PMS.Name") }}</dt>
<dd>* {{ $t("Modules.PMS.Description") }} </dd>
<dt>{{ $t("Modules.PlexTV.Name") }}</dt>
<dd>* {{ $t("Modules.PlexTV.Description") }} </dd>
</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"
>
{{ $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>
@ -34,11 +43,26 @@ import { shell } from 'electron';
export default {
data() {
return {
updateTitle: this.$t('Common.Update.Title'),
//name: '',
updateTitle: this.$t('Common.Update.Title'),
body: '',
body2: this.$t('Common.Update.Body2'),
url: ''
url: '',
cbOptions: [{ text: i18n.t('Common.Update.Skip'), value: 'SkipUpdate' }],
cbSelected: '',
GitHubVersion: ''
}
},
watch: {
// Watch for when selected server address is updated
cbSelected: async function(){
if (Boolean(this.cbSelected) === true){
log.verbose(`Update will skip version: ${this.GitHubVersion}`)
wtconfig.set("Update.SkipVer", this.GitHubVersion)
}
else{
log.verbose(`No Update will be skiped`)
wtconfig.set("Update.SkipVer", '')
}
}
},
mounted() {
@ -46,49 +70,67 @@ export default {
this.checkLangUpdates();
this.UpdatePresent();
},
methods: {
methods: {
// Visit GitHub release page
visitRels(){
log.info(`User pressed update link, and was directed to: ${this.url}`);
shell.openExternal(this.url);
},
// Is an update present?
async UpdatePresent(){
// Get release page from GitHub
const releases = await github.Releases();
log.verbose('Github releases', JSON.stringify(releases))
if (wtconfig.get('Update.Beta'))
{
// 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'];
async UpdatePresent(){
if (wtconfig.get('Update.Update', true)){
log.verbose(`Check for updates enabled`)
// Get release page from GitHub
const releases = await github.Releases();
log.verbose('Github releases', JSON.stringify(releases));
if (wtconfig.get('Update.Beta', true))
{
// 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'];
this.beta = true;
}
else
{
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;
}
}
else
{
{
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', ''))
{
log.debug(`Update Deselected by user: Github-Version: ${this.ver} Current-Version: ${wtutils.AppVersion}`);
}
else
{
log.debug(`Update present: Github-Version: ${this.ver} Current-Version: ${wtutils.AppVersion}`);
console.log('Ged beta or not', this.beta)
this.GitHubVersion = this.ver;
this.$refs['showUpdate'].show();
}
}
}
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{
log.verbose(`Check for updates disabled`)
}
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();
}
},
async checkLangUpdates() {
// Start by getting the currently selected language