VersionChecker.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <script setup>
  2. import systemService from '@/services/systemService'
  3. import { useAppSettingsStore } from '@/stores/appSettings'
  4. const appSettings = useAppSettingsStore()
  5. const isScanning = ref(false)
  6. const isUpToDate = ref(null)
  7. async function getLatestRelease() {
  8. isScanning.value = true;
  9. await systemService.getLastRelease()
  10. .then(response => {
  11. appSettings.latestRelease = response.data.newRelease
  12. isUpToDate.value = response.data.newRelease === false
  13. })
  14. isScanning.value = false;
  15. }
  16. </script>
  17. <template>
  18. <div class="columns is-mobile is-vcentered">
  19. <div class="column is-narrow">
  20. <button type="button" :class="isScanning ? 'is-loading' : ''" class="button is-link is-rounded is-small" @click="getLatestRelease">Check now</button>
  21. </div>
  22. <div class="column">
  23. <span v-if="appSettings.latestRelease" class="mt-2 has-text-warning">
  24. <span class="release-flag"></span>{{ appSettings.latestRelease }} is available <a class="is-size-7" href="https://github.com/Bubka/2FAuth/releases">View on Github</a>
  25. </span>
  26. <span v-if="isUpToDate" class="has-text-grey">
  27. {{ $t('commons.you_are_up_to_date') }}
  28. </span>
  29. </div>
  30. </div>
  31. </template>