diff --git a/README.md b/README.md index 0ce41caf..06024d6c 100644 --- a/README.md +++ b/README.md @@ -100,8 +100,7 @@ If you like to always have the latest and greatest, please sync to the `nightly- ## Contributing -Open up a PR or create an issue to discuss. -Reach out on Discord if you need help getting started! +Open up a PR or create an issue to discuss. Reach out on Discord if you need help getting started! [FAQ](../../wiki/FAQ) diff --git a/src/components/Settings/VueTorrent/General.vue b/src/components/Settings/VueTorrent/General.vue index d48a7118..5fd7413f 100644 --- a/src/components/Settings/VueTorrent/General.vue +++ b/src/components/Settings/VueTorrent/General.vue @@ -5,12 +5,15 @@ import { useAppStore, useHistoryStore, useVueTorrentStore } from '@/stores' import { computed, onBeforeMount, ref } from 'vue' import { useI18n } from 'vue-i18n' import { toast } from 'vue3-toastify' +import { Github } from '@/services/Github' const { t } = useI18n() const appStore = useAppStore() const historyStore = useHistoryStore() const vueTorrentStore = useVueTorrentStore() +const github = new Github() + const titleOptionsList = [ { title: t('constants.titleOptions.default'), value: TitleOptions.DEFAULT }, { title: t('constants.titleOptions.global_speed'), value: TitleOptions.GLOBAL_SPEED }, @@ -68,6 +71,15 @@ const registerMagnetHandler = () => { toast.success(t('toast.magnet_handler.registered')) } +const checkNewVersion = async () => { + if (vueTorrentVersion.value === 'DEV') return + + const latest = await github.getVersion() + if ('vueTorrentVersion.value' === latest) return + + toast.info(t('toast.new_version')) +} + onBeforeMount(() => { appStore.fetchQbitVersion() }) @@ -149,50 +161,35 @@ onBeforeMount(() => { - - - - - - - - - - - - - - - + + + + + + + - +

{{ t('settings.vuetorrent.general.currentVersion') }} undefined - {{ vueTorrentVersion }} - {{ vueTorrentVersion }} + {{ vueTorrentVersion }} + {{ vueTorrentVersion }}

- +

{{ t('settings.vuetorrent.general.qbittorrentVersion') }} {{ appStore.version }}

- - - - - - + + {{ t('settings.vuetorrent.general.check_new') }}
diff --git a/src/services/Github.ts b/src/services/Github.ts new file mode 100644 index 00000000..0f10bfbe --- /dev/null +++ b/src/services/Github.ts @@ -0,0 +1,18 @@ +import { AxiosInstance } from 'axios' +import axios from 'axios' + +export class Github { + private axios: AxiosInstance + + constructor() { + this.axios = axios.create() + } + + /** + * Fetches the latest version of VueTorrent + */ + async getVersion(): Promise { + const { data } = await this.axios.get('https://api.github.com/repos/vuetorrent/vuetorrent/releases/latest') + return data.tag_name + } +}