mirror of https://github.com/Lissy93/dashy.git
🚑 [67174449] Fixes version checking
This commit is contained in:
parent
522bbca427
commit
a8cf946f76
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div class="app-version">
|
||||
<div class="app-version" v-if="isVersionValid()">
|
||||
<!-- Current Version -->
|
||||
<p>
|
||||
{{ $t('updates.app-version-note') }} {{ appVersion }}
|
||||
|
@ -31,6 +31,7 @@
|
|||
|
||||
<script>
|
||||
import axios from 'axios';
|
||||
import ErrorHandler from '@/utils/ErrorHandler';
|
||||
|
||||
export default {
|
||||
name: 'AppInfoModal',
|
||||
|
@ -76,6 +77,17 @@ export default {
|
|||
if (difference > 5) this.veryOutOfDate = true;
|
||||
return difference <= 0;
|
||||
},
|
||||
/* Checks that the input version is correctly parsed */
|
||||
isVersionValid() {
|
||||
const isValid = !Number.isNaN(parseInt(this.appVersion.replaceAll('.', ''), 10));
|
||||
if (!isValid) { // If invalid, then record an error
|
||||
ErrorHandler(
|
||||
'Unable to check for updates, because current version is unavailible.'
|
||||
+ ` ${this.appVersion} is not a valid version.`,
|
||||
);
|
||||
}
|
||||
return isValid;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
||||
|
||||
// Get current version
|
||||
process.env.VUE_APP_VERSION = require('./package.json');
|
||||
process.env.VUE_APP_VERSION = require('./package.json').version;
|
||||
|
||||
// Specify and export the main Vue app config
|
||||
module.exports = {
|
||||
|
|
Loading…
Reference in New Issue