mirror of
https://github.com/aleksilassila/reiverr.git
synced 2026-04-22 08:45:13 +02:00
feat: Add skip this version button, use youtube-nocookie.com, add changelog button
This commit is contained in:
@@ -1,28 +1,40 @@
|
||||
<script lang="ts">
|
||||
import { skippedVersion } from '$lib/localstorage';
|
||||
import axios from 'axios';
|
||||
import IconButton from './IconButton.svelte';
|
||||
import { Cross2 } from 'radix-icons-svelte';
|
||||
import { log } from '$lib/utils';
|
||||
import { version } from '$app/environment';
|
||||
import { createLocalStorageStore } from '$lib/localstorage';
|
||||
import { Cross2 } from 'radix-icons-svelte';
|
||||
import IconButton from './IconButton.svelte';
|
||||
import axios from 'axios';
|
||||
import Button from './Button.svelte';
|
||||
|
||||
let visible = true;
|
||||
|
||||
function fetchLatestVersion() {
|
||||
const skippedVersion = createLocalStorageStore<string>('skipped-version');
|
||||
|
||||
async function fetchLatestVersion() {
|
||||
return axios
|
||||
.get('https://api.github.com/repos/aleksilassila/reiverr/tags')
|
||||
.then((res) => res.data?.[0]?.name)
|
||||
.then(log);
|
||||
.get('https://api.github.com/repos/aleksilassila/reiverr/tags', {
|
||||
headers: {
|
||||
'Cache-Control': 'max-age=3600'
|
||||
}
|
||||
})
|
||||
.then((res) => res.data?.[0]?.name);
|
||||
}
|
||||
</script>
|
||||
|
||||
{#await fetchLatestVersion() then latestVersion}
|
||||
{#if latestVersion !== `v${version}` && latestVersion !== $skippedVersion && visible}
|
||||
<div class="fixed inset-x-0 bottom-0 p-2 flex items-center justify-center z-20 bg-stone-800">
|
||||
<a href="https://github.com/aleksilassila/reiverr">New version is available!</a>
|
||||
<IconButton on:click={() => (visible = false)} class="absolute right-8 inset-y-0">
|
||||
<Cross2 size={20} />
|
||||
</IconButton>
|
||||
<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