fix: remove broken badly screen

This commit is contained in:
ThaUnknown 2025-07-19 18:58:35 +02:00
parent f28784583f
commit f6297e8be3
No known key found for this signature in database
3 changed files with 14 additions and 41 deletions

View file

@ -1,6 +1,6 @@
{
"name": "ui",
"version": "6.4.61",
"version": "6.4.62",
"license": "BUSL-1.1",
"private": true,
"packageManager": "pnpm@9.15.5",

View file

@ -3,19 +3,10 @@ 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,26 +1,13 @@
<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, isBrokenVeryBadly } from '$lib/modules/update'
import { outdatedComponent, uiUpdate } 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'>
@ -30,24 +17,19 @@
<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 isBrokenVeryBadly then brokey}
{#if brokey}
<Button class='text-md font-bold' size='lg' on:click={() => native.openURL('https://hayase.watch/download')}>Open Website</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 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 uiUpdate}
<InstallWaitButton />
{:then _}
<Button class='text-md font-bold' size='lg' on:click={() => location.reload()}>Install</Button>
{/await}
{/if}
{/await}