mirror of
https://github.com/ThaUnknown/miru.git
synced 2026-04-20 05:02:04 +00:00
feat: default extensions on PC
feat: forced updates
This commit is contained in:
parent
9d98c00dd6
commit
0128ce7efe
7 changed files with 40 additions and 13 deletions
|
|
@ -1,5 +1,4 @@
|
|||
<script lang='ts'>
|
||||
import { page } from '$app/stores'
|
||||
import { activityState, idleState, isPlaying, lockedState } from '$lib/modules/idle'
|
||||
import { settings } from '$lib/modules/settings'
|
||||
import { sleep } from '$lib/utils'
|
||||
|
|
|
|||
|
|
@ -2,3 +2,4 @@
|
|||
|
||||
export const CHANGELOG_URL = 'https://api.github.com/repos/ThaUnknown/miru/releases'
|
||||
export const WEB_URL = 'https://miru.watch'
|
||||
export const DEFAULT_EXTENSIONS = 'gh:hayase-app/extensions'
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import { derived, readable } from 'svelte/store'
|
||||
import { readable } from 'svelte/store'
|
||||
import { writable } from 'simple-store-svelte'
|
||||
|
||||
import { page } from '$app/stores'
|
||||
|
||||
export const activityState = readable<'active' | 'inactive'>(document.hasFocus() ? 'active' : 'inactive', set => {
|
||||
set(document.hasFocus() ? 'active' : 'inactive')
|
||||
const ctrl = new AbortController()
|
||||
|
|
@ -21,9 +19,7 @@ export const activityState = readable<'active' | 'inactive'>(document.hasFocus()
|
|||
|
||||
// @ts-expect-error non-standard API
|
||||
const idleDetector = new IdleDetector()
|
||||
idleDetector.start({
|
||||
threshold: 60_000
|
||||
})
|
||||
idleDetector.start({ threshold: 60_000 })
|
||||
|
||||
export const idleState = readable<'active' | 'idle'>(idleDetector.userState, set => {
|
||||
set(idleDetector.userState)
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
<script lang='ts'>
|
||||
import { toast } from 'svelte-sonner'
|
||||
|
||||
import Footer, { type Checks } from '../Footer.svelte'
|
||||
import Progress from '../Progress.svelte'
|
||||
|
||||
import type { ExtensionConfig } from 'hayase-extensions'
|
||||
|
||||
import { Extensions } from '$lib/components/ui/extensions'
|
||||
import { saved, options } from '$lib/modules/extensions'
|
||||
import { saved, options, storage } from '$lib/modules/extensions'
|
||||
import SettingCard from '$lib/components/SettingCard.svelte'
|
||||
import { SingleCombo } from '$lib/components/ui/combobox'
|
||||
import { lookupPreferences, settings } from '$lib/modules/settings'
|
||||
import { dragScroll } from '$lib/modules/navigate'
|
||||
import { lookupPreferences, settings, SUPPORTS } from '$lib/modules/settings'
|
||||
import { DEFAULT_EXTENSIONS } from '$lib'
|
||||
|
||||
function checkExtensions (svd: Record<string, ExtensionConfig>, opts: Record<string, {
|
||||
options: Record<string, string | number | boolean | undefined>
|
||||
|
|
@ -32,11 +34,22 @@
|
|||
title: 'Extensions Required',
|
||||
pending: 'Waiting for at least one extension to be installed...'
|
||||
}]
|
||||
|
||||
async function importDefault () {
|
||||
try {
|
||||
await storage.import(DEFAULT_EXTENSIONS)
|
||||
} catch (err) {
|
||||
const error = err as Error
|
||||
toast.error(error.cause as string, { description: error.message })
|
||||
}
|
||||
}
|
||||
|
||||
if (!SUPPORTS.isAndroid && !Object.keys($saved).length) importDefault()
|
||||
</script>
|
||||
|
||||
<Progress step={2} />
|
||||
|
||||
<div class='space-y-3 lg:max-w-4xl h-full overflow-y-auto w-full py-8' use:dragScroll>
|
||||
<div class='space-y-3 lg:max-w-4xl h-full overflow-y-auto w-full py-8'>
|
||||
<SettingCard title='Lookup Preference' description='What to prioritize when looking for and sorting results. Quality will focus on the best quality available which often means big file sizes, Size will focus on the smallest file size available, and Availability will pick results with the most peers regardless of size and quality.'>
|
||||
<SingleCombo bind:value={$settings.lookupPreference} items={lookupPreferences} class='w-32 shrink-0 border-input border' />
|
||||
</SettingCard>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
<script lang='ts'>
|
||||
import { Menubar } from '$lib/components/ui/menubar'
|
||||
import { Separator } from '$lib/components/ui/separator'
|
||||
import { Button } from '$lib/components/ui/button'
|
||||
import native from '$lib/modules/native'
|
||||
import { outdatedComponent } from '$lib/modules/update'
|
||||
</script>
|
||||
|
||||
<div class='w-full h-full flex flex-col grow items-center justify-center gap-9'>
|
||||
<Menubar />
|
||||
<div class='overflow-x-hidden overflow-y-scroll relative flex justify-center items-center text-white px-15 w-full font-light'>
|
||||
<div class='max-w-full min-w-96 justify-center items-center flex-col flex'>
|
||||
<div class='text-6xl text-center'>Update Required</div>
|
||||
<Separator class='my-6 w-40' />
|
||||
<div class='text-xl text-wrap max-w-full text-center'>A mandatory update is available for the {outdatedComponent}.<br />Please update to continue.</div>
|
||||
<Button class='mt-6 text-md font-bold' size='lg' on:click={native.restart}>Update</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -3,8 +3,7 @@ import { clientsClaim, skipWaiting } from 'workbox-core'
|
|||
|
||||
import { build, files, prerendered, version } from '$service-worker'
|
||||
|
||||
const precache = [...build, ...files, ...prerendered, '/'].map(url => ({ url, revision: version }))
|
||||
precacheAndRoute(precache)
|
||||
precacheAndRoute([...build, ...files.filter(e => !['/Ameku.webm', '/video.mkv'].includes(e)), ...prerendered, '/'].map(url => ({ url, revision: version })))
|
||||
cleanupOutdatedCaches()
|
||||
clientsClaim()
|
||||
skipWaiting()
|
||||
|
|
|
|||
BIN
static/Roboto.ttf
Normal file
BIN
static/Roboto.ttf
Normal file
Binary file not shown.
Loading…
Reference in a new issue