fix: add forced update apology for broken auto-updater
Some checks are pending
Check / check (push) Waiting to run

This commit is contained in:
ThaUnknown 2025-06-26 01:10:35 +02:00
parent ead30618f8
commit 9a7ea1f888
No known key found for this signature in database
6 changed files with 44 additions and 16 deletions

View file

@ -1,6 +1,6 @@
{
"name": "ui",
"version": "6.4.0",
"version": "6.4.1",
"license": "BUSL-1.1",
"private": true,
"packageManager": "pnpm@9.14.4",

View file

@ -83,7 +83,7 @@
<div class='overflow-y-auto pt-3 -mx-14 px-14 pointer-events-none -mb-3 pb-3' use:dragScroll>
<div class='grid grid-cols-1 sm:grid-cols-[repeat(auto-fit,minmax(500px,1fr))] place-items-center gap-x-4 gap-y-7 justify-center align-middle pointer-events-auto'>
{#each getPage(currentPage, episodeList) as { episode, image, title, summary, airingAt, airdate, filler, length } (episode)}
{@const watched = _progress >= episode}
{@const watched = _progress >= episode && !completed}
{@const target = _progress + 1 === episode}
<div class={!target ? 'px-3 w-full' : 'contents'}>
<div use:click={() => play(episode)}

View file

@ -11,7 +11,7 @@
toastOptions={{
classes: {
toast: 'group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg',
description: 'group-[.toast]:text-muted-foreground',
description: 'group-[.toast]:text-muted-foreground whitespace-pre-line',
actionButton: 'group-[.toast]:bg-primary group-[.toast]:text-primary-foreground',
cancelButton: 'group-[.toast]:bg-muted group-[.toast]:text-muted-foreground'
}

View file

@ -127,7 +127,7 @@
<ClockFading class='w-4 h-4 text-orange-500' />
<span class='text-sm font-medium text-muted-foreground'>Remaining</span>
</div>
<div class='text-2xl font-bold'>{eta(torrent.time.remaining)}</div>
<div class='text-2xl font-bold'>{eta(torrent.time.remaining / 1000)}</div>
</div>
<div class='space-y-2'>
<div class='flex items-center gap-2'>

View file

@ -3,10 +3,19 @@ import { compare, diff } from 'semver'
import native from './native'
import { version } from '$app/environment'
import { highEntropyValues } from '$lib/utils'
export const isBrokenVeryBadly = native.version().then(async nativeVersion => {
const entr = await highEntropyValues
if (entr && entr.platform !== 'Windows') return false
return compare(nativeVersion, '6.4.4') === -1 && compare(nativeVersion, '6.4.0') !== -1
})
async function compareVersions (): Promise<'ui' | 'client' | undefined> {
const nativeVersion = await native.version()
const releaseType = diff(version, nativeVersion)
// TODO: REMOVE MEEE!!!
if (await isBrokenVeryBadly) return 'client'
if (!releaseType) return
if (releaseType === 'patch') return

View file

@ -1,13 +1,26 @@
<script lang='ts'>
import { toast } from 'svelte-sonner'
import InstallWaitButton from './InstallWaitButton.svelte'
import { Button } from '$lib/components/ui/button'
import { Menubar } from '$lib/components/ui/menubar'
import { Separator } from '$lib/components/ui/separator'
import native from '$lib/modules/native'
import { outdatedComponent, uiUpdate } from '$lib/modules/update'
import { outdatedComponent, uiUpdate, isBrokenVeryBadly } from '$lib/modules/update'
navigator.serviceWorker.getRegistration().then(registration => registration?.update())
// TODO: REMOVE MEEE!!!
isBrokenVeryBadly.then(brokey => {
if (!brokey) return
setTimeout(() => {
toast.error('We broke the app\'s auto-update functionality :(', {
description: 'Please re-install to update the app.\n\nThis problem has now been fixed and won\'t EVER occur in future versions.\n\nWe apologize for the inconvenience and appreciate your understanding. :(',
duration: Infinity
})
}, 500)
})
</script>
<div class='w-full h-full flex flex-col grow items-center justify-center gap-9'>
@ -17,18 +30,24 @@
<div class='text-6xl text-center font-bold'>Update Required</div>
<Separator class='my-6 w-40' />
<div class='text-xl text-wrap max-w-full text-center mb-6'>A mandatory update is available for the {#await outdatedComponent then name}{name}{/await}.<br />Please update to continue.</div>
{#await outdatedComponent then name}
{#if name === 'client'}
{#await native.updateReady()}
<InstallWaitButton />
{:then _}
<Button class='text-md font-bold' size='lg' on:click={native.updateAndRestart}>Update</Button>
{/await}
{#await isBrokenVeryBadly then brokey}
{#if brokey}
<Button class='text-md font-bold' size='lg' on:click={() => native.openURL('https://hayase.watch/download')}>Open Website</Button>
{:else}
{#await uiUpdate}
<InstallWaitButton />
{:then _}
<Button class='text-md font-bold' size='lg' on:click={() => location.reload()}>Install</Button>
{#await outdatedComponent then name}
{#if name === 'client'}
{#await native.updateReady()}
<InstallWaitButton />
{:then _}
<Button class='text-md font-bold' size='lg' on:click={native.updateAndRestart}>Update</Button>
{/await}
{:else}
{#await uiUpdate}
<InstallWaitButton />
{:then _}
<Button class='text-md font-bold' size='lg' on:click={() => location.reload()}>Install</Button>
{/await}
{/if}
{/await}
{/if}
{/await}