Skip to content

Commit

Permalink
🚑 [67174449] Fixes version checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Lissy93 committed Aug 19, 2021
1 parent 522bbca commit a8cf946
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/components/Configuration/AppVersion.vue
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down Expand Up @@ -31,6 +31,7 @@

<script>
import axios from 'axios';
import ErrorHandler from '@/utils/ErrorHandler';
export default {
name: 'AppInfoModal',
Expand Down Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit a8cf946

Please sign in to comment.