mirror of
https://github.com/aleksilassila/reiverr.git
synced 2026-04-17 21:53:12 +02:00
feat: version check using releases instead of tags
This commit is contained in:
@@ -44,8 +44,10 @@
|
||||
|
||||
async function fetchLatestVersion() {
|
||||
return axios
|
||||
.get('https://api.github.com/repos/aleksilassila/reiverr/tags')
|
||||
.then((res) => res.data?.find((v: { name: string }) => v.name.startsWith('v2'))?.name);
|
||||
.get('https://api.github.com/repos/aleksilassila/reiverr/releases')
|
||||
.then(
|
||||
(res) => res.data?.find((v: { tag_name: string }) => v.tag_name.startsWith('v2'))?.tag_name
|
||||
);
|
||||
}
|
||||
|
||||
function handleError(event: any) {
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { Cross2 } from 'radix-icons-svelte';
|
||||
import IconButton from './FloatingIconButton.svelte';
|
||||
import axios from 'axios';
|
||||
import Button from './Button.svelte';
|
||||
import { skippedVersion } from '../stores/localstorage.store';
|
||||
|
||||
let visible = true;
|
||||
|
||||
async function fetchLatestVersion() {
|
||||
return axios
|
||||
.get('https://api.github.com/repos/aleksilassila/reiverr/tags')
|
||||
.then((res) => res.data?.[0]?.name);
|
||||
}
|
||||
</script>
|
||||
|
||||
{#await fetchLatestVersion() then latestVersion}
|
||||
{#if latestVersion !== `v${REIVERR_VERSION}` && latestVersion !== $skippedVersion && visible}
|
||||
<div
|
||||
class="fixed inset-x-0 bottom-0 p-3 flex items-center justify-center z-20 bg-stone-800 text-sm"
|
||||
>
|
||||
<a href="https://github.com/aleksilassila/reiverr">{latestVersion} is now available!</a>
|
||||
<div class="absolute right-4 inset-y-0 flex items-center gap-2">
|
||||
<Button type="tertiary" size="xs" on:click={() => skippedVersion.set(latestVersion)}>
|
||||
Skip this version
|
||||
</Button>
|
||||
<IconButton on:click={() => (visible = false)}>
|
||||
<Cross2 size={20} />
|
||||
</IconButton>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/await}
|
||||
Reference in New Issue
Block a user