Fix: Attempt to Improve UI-Login Cache (#63)

This commit is contained in:
Youwes09
2026-05-03 12:29:20 -05:00
parent 093b395cc1
commit 0d53e3f102
8 changed files with 58 additions and 42 deletions
+2 -8
View File
@@ -1,7 +1,6 @@
<script lang="ts">
import { onMount, untrack } from "svelte";
import { gql, thumbUrl } from "@api/client";
import { getBlobUrl } from "@core/cache/imageCache";
import { gql, resolveImageUrl } from "@api/client";
import { GET_CHAPTERS } from "@api/queries/chapters";
import { GET_LIBRARY } from "@api/queries/manga";
import { cache, CACHE_KEYS } from "@core/cache";
@@ -95,13 +94,8 @@
let heroThumb = $state("");
$effect(() => {
const path = heroThumbSrc;
const mode = store.settings.serverAuthMode ?? "NONE";
if (!path) { heroThumb = ""; return; }
const needsBlob = mode === "BASIC_AUTH" || mode === "UI_LOGIN";
if (!needsBlob) { heroThumb = thumbUrl(path); return; }
getBlobUrl(thumbUrl(path))
resolveImageUrl(path)
.then(url => { heroThumb = url; })
.catch(() => { heroThumb = ""; });
});
+13 -5
View File
@@ -224,11 +224,19 @@
{#if style === "longstrip"}
{#each stripToRender as chunk}
{#each chunk.urls as url, i}
{#await resolveUrl(url, chunk.urls.length - i)}
<img src="" alt="{chunk.chapterName} Page {i + 1}" data-local-page={i + 1} data-chapter={chunk.chapterId} data-total={chunk.urls.length} class="{imgCls}{store.settings.pageGap ? ' strip-gap' : ''}" loading={i < 5 ? "eager" : "lazy"} decoding="async" />
{:then src}
<img {src} alt="{chunk.chapterName} Page {i + 1}" data-local-page={i + 1} data-chapter={chunk.chapterId} data-total={chunk.urls.length} class="{imgCls}{store.settings.pageGap ? ' strip-gap' : ''}" loading={i < 5 ? "eager" : "lazy"} decoding="async" />
{/await}
{#if i < 8}
{#await resolveUrl(url, 8 - i)}
<img src="" alt="{chunk.chapterName} Page {i + 1}" data-local-page={i + 1} data-chapter={chunk.chapterId} data-total={chunk.urls.length} class="{imgCls}{store.settings.pageGap ? ' strip-gap' : ''}" loading="eager" decoding="async" />
{:then src}
<img {src} alt="{chunk.chapterName} Page {i + 1}" data-local-page={i + 1} data-chapter={chunk.chapterId} data-total={chunk.urls.length} class="{imgCls}{store.settings.pageGap ? ' strip-gap' : ''}" loading="eager" decoding="async" />
{/await}
{:else}
{#await resolveUrl(url, 0)}
<img src="" alt="{chunk.chapterName} Page {i + 1}" data-local-page={i + 1} data-chapter={chunk.chapterId} data-total={chunk.urls.length} class="{imgCls}{store.settings.pageGap ? ' strip-gap' : ''}" loading="lazy" decoding="async" />
{:then src}
<img {src} alt="{chunk.chapterName} Page {i + 1}" data-local-page={i + 1} data-chapter={chunk.chapterId} data-total={chunk.urls.length} class="{imgCls}{store.settings.pageGap ? ' strip-gap' : ''}" loading="lazy" decoding="async" />
{/await}
{/if}
{/each}
{/each}
<div style="height:1px;flex-shrink:0"></div>
+1 -1
View File
@@ -25,7 +25,7 @@
import ReaderPresetPanel from "./ReaderPresetPanel.svelte";
const win = getCurrentWindow();
const useBlob = $derived((store.settings.serverAuthMode ?? "NONE") === "BASIC_AUTH");
const useBlob = $derived((store.settings.serverAuthMode ?? "NONE") !== "NONE");
const effectiveReaderSettings = $derived.by(() => {
const mangaId = store.activeManga?.id;