Skip to content

Commit 9423812

Browse files
committed
FIX: Fix images in Comick and cache
1 parent 8a01f29 commit 9423812

File tree

9 files changed

+65
-50
lines changed

9 files changed

+65
-50
lines changed

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/cards/FavoriteCard.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
preferableLanguage,
2020
useMpv,
2121
coversLoaded,
22+
openFavoriteChapter,
2223
} from "@/store";
2324
import { FavoriteDB, MarkFavoriteDB, ReadedDB } from "@/repositories";
2425
import {
@@ -158,7 +159,7 @@
158159
isContext && "!scale-[1.15] !border-1 !border-white opacity-100",
159160
)}
160161
onclick={() => {
161-
if (favoriteLoad.nextChapter === null) {
162+
if (favoriteLoad.nextChapter === null || !$openFavoriteChapter) {
162163
isOpen = true;
163164
} else {
164165
gotoNext();

src/components/modals/PatchNotes.svelte

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,11 @@
1616
<Dialog.Content class="max-w-[40rem]">
1717
<div class="flex gap-6 w-full select-none">
1818
<div class="flex items-center">
19-
<Image class="w-[88rem] object-contain" src="/employed-woojack.png" />
19+
<Image class="w-[28rem] object-contain" src="/employed-woojack.png" />
2020
</div>
2121
<div class="flex flex-col h-full justify-center gap-6 py-6">
2222
<div class="flex flex-col justify-center gap-2">
23-
<Label class="font-[minecraftia, sans] text-2xl">
24-
Fresh start! Comick is pretty good. Thanks for the developers and
25-
thank you all for giving feedback and a lot of stars. Almost
26-
receiving a achievement for 128 stars :)
27-
</Label>
23+
<Label class="font-[minecraftia, sans] text-2xl">Small update</Label>
2824
<Label class="text-md">
2925
As ever, feel free to join my server, just click in the top menu:
3026
About > Discord :)</Label
@@ -33,31 +29,19 @@
3329
</div>
3430
<div class="flex flex-col gap-2">
3531
<Label class="text-lg">New features</Label>
36-
<Label class="list-disc list-item">Add Comick as manga source</Label>
3732
<Label class="list-disc list-item"
38-
>Improve chapters modal and add things like Scan selector & filter
39-
repeated</Label
40-
>
41-
<Label class="list-disc list-item"
42-
>Add visual feedback in favorites to let you know there's something
43-
wrong with your source</Label
44-
>
45-
<Label class="list-disc list-item"
46-
>Right clicking on any input pastes the text in your copy area</Label
33+
>Number of languages in chapters modal select</Label
4734
>
35+
4836
<!--
4937
<Label class="list-disc list-item cursor-pointer" onclick={() => {}}
5038
>Feedback menu, you can send feedback directly from the app to
5139
Discord. Click here or at the top menu: About > Give feedback</Label
5240
>
5341
-->
5442
<Label class="text-lg">Fixed bugs</Label>
55-
<Label class="list-disc list-item"
56-
>Ugly color when hovering in selector tab in settings</Label
57-
>
58-
<Label class="list-disc list-item"
59-
>macOS MAYBE is working. I did something.</Label
60-
>
43+
<Label class="list-disc list-item">Comick images loading wrong</Label>
44+
<Label class="list-disc list-item">Cache not working properly</Label>
6145
</div>
6246
</div>
6347
</div>

src/components/modals/ReadFavorite.svelte

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
type DirEntry,
1111
} from "@tauri-apps/plugin-fs";
1212
import Icon from "@iconify/svelte";
13-
import { ScrollingValue } from "svelte-ux";
13+
import { Badge as BadgeCount, ScrollingValue } from "svelte-ux";
1414
import {
1515
Dialog,
1616
ScrollArea,
@@ -726,8 +726,8 @@
726726
"data-[state=open]:!zoom-in-100 data-[state=closed]:!zoom-out-100 data-[state=open]:slide-in-from-right-full data-[state=closed]:slide-out-to-right-full data-[state=open]:duration-500 data-[state=close]:duration-500",
727727
"h-[100vh] max-w-[100vw] py-4 px-6 duration-400",
728728
$sidebarBehavior === "expand"
729-
? "w-[calc(100vw-10rem)] ml-[4.2rem]"
730-
: "w-[calc(100vw-5rem)] ml-[2rem]",
729+
? "w-[calc(100vw-11rem)] ml-[3.2rem] !mr-[2rem]"
730+
: "w-[calc(100vw-6rem)] ml-[1rem] !mr-[2rem]",
731731
$customTitlebar && "h-[calc(100vh-3.5rem)] mt-[1.2rem]",
732732
isMobile && "flex flex-col items-center h-[90vh]",
733733
)}
@@ -780,7 +780,7 @@
780780
draggable={false}
781781
src={favorite.cover}
782782
alt={favorite.name}
783-
class="w-full h-full object-contain"
783+
class="w-full h-full object-contain select-none"
784784
/>
785785
</div>
786786
<div
@@ -789,25 +789,32 @@
789789
isMobile && "justify-end p-2 h-full",
790790
)}
791791
>
792-
<Language
793-
class="min-w-full max-w-full w-full mt-1"
794-
bind:selectedLanguage={localSelectedLanguage}
795-
{languageOptions}
796-
onChange={async () => {
797-
isFetching = true;
798-
const result = await $downloadManager.getChapters(
799-
favorite,
800-
localSelectedLanguage.id,
801-
);
802-
await refreshReadeds(favorite);
803-
await new Promise((resolve) => setTimeout(resolve, 10));
804-
// displayedChapters = result;
805-
globalChapters.set(result);
806-
isFetching = false;
807-
}}
808-
wheelControls
809-
disabled={!isMulti || isFetching || languageOptions.length < 2}
810-
/>
792+
<div class="w-full relative">
793+
<Language
794+
class="min-w-full max-w-full w-full mt-1"
795+
bind:selectedLanguage={localSelectedLanguage}
796+
{languageOptions}
797+
onChange={async () => {
798+
isFetching = true;
799+
const result = await $downloadManager.getChapters(
800+
favorite,
801+
localSelectedLanguage.id,
802+
);
803+
await refreshReadeds(favorite);
804+
await new Promise((resolve) => setTimeout(resolve, 10));
805+
// displayedChapters = result;
806+
globalChapters.set(result);
807+
isFetching = false;
808+
}}
809+
wheelControls
810+
disabled={!isMulti || isFetching || languageOptions.length < 2}
811+
/>
812+
<div
813+
class="absolute top-0 size-5 text-sm font-semibold bg-primary/70 text-background flex justify-center items-center rounded-full"
814+
>
815+
{languageOptions.length}
816+
</div>
817+
</div>
811818
<Button
812819
class="w-full"
813820
variant="outline"

src/components/modals/Settings.svelte

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
readerClock,
6161
filterReader,
6262
downloadPath,
63+
openFavoriteChapter,
6364
} from "@/store";
6465
import { onMount } from "svelte";
6566
import { Language, Theme, Select } from "@/components";
@@ -198,7 +199,9 @@
198199
<Button
199200
class={cn(
200201
"z-[2] h-6 w-16 rounded-lg duration-500 bg-transparent",
201-
currentTab === "player" ? "text-primary hover:bg-primary/20" : "!text-background hover:!text-background/70 hover:bg-secondary/30",
202+
currentTab === "player"
203+
? "text-primary hover:bg-primary/20"
204+
: "!text-background hover:!text-background/70 hover:bg-secondary/30",
202205
)}
203206
size="sm"
204207
variant="secondary"
@@ -357,6 +360,18 @@
357360
languageOptions={LANGUAGE_OPTIONS}
358361
/>
359362
</div>
363+
<Label>Favorite</Label>
364+
<div class="flex items-center">
365+
<Switch
366+
id="open-favorite-chapter"
367+
bind:checked={$openFavoriteChapter}
368+
class="flex-shrink-0 mr-2"
369+
onCheckedChange={saveSettings}
370+
/>
371+
<Label class="cursor-pointer" for="open-favorite-chapter">
372+
Click on favorite card opens the next chapter
373+
</Label>
374+
</div>
360375
<Label>Download path</Label>
361376
<div class="inline-flex">
362377
<Input

src/downloaders/manga/_comick.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ export class ComickDl implements MangaDl {
107107
throw new Error(`Error fetching images for chapter with id: ${chapterID}`)
108108
}
109109
const resJson = await response.json()
110-
return resJson.map((img: { b2key: string }) => { return `${this.baseImage}/${img.b2key.replace(".png", "-m.png")}` })
110+
console.log(resJson)
111+
return resJson.map((img: { b2key: string, optimized: number | null }) => {
112+
console.log(img.optimized === null)
113+
const id = img.optimized === null ? img.b2key.replace(".png", "-m.png") : img.b2key.replace(".jpg", "-m.jpg")
114+
return `${this.baseImage}/${id}`
115+
})
111116
}
112117
}

src/functions/_settings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import {
4444
filterReader,
4545
downloadPath,
4646
isChaptersUniqueNumber,
47+
openFavoriteChapter,
4748
} from "@/store";
4849
import { goto } from "$app/navigation";
4950
import type { Language } from "@/types";
@@ -119,6 +120,7 @@ const SETTINGS_SCHEMA: Record<string, SettingConfig> = {
119120
download_path: { store: downloadPath, default: "Mangas/" },
120121
discord_integration: { store: discordIntegration, default: false },
121122
sidebar_behavior: { store: sidebarBehavior, default: "collapse" },
123+
open_favorite_chapter: { store: openFavoriteChapter, default: false },
122124
custom_titlebar: { store: customTitlebar, default: true },
123125
show_count_icon: { store: showCountIcon, default: true },
124126
show_count_icon_tray: { store: showCountIconTray, default: false },

src/routes/(root)/reader/[favoriteId]/[chapterIndex]/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@
598598
totalPage = images.length;
599599
setChapterActivity(favorite.name);
600600
if (get(keepReading)) {
601-
if (cache) {
601+
if (cache && cache?.chapter?.chapter_id === chapter.chapter_id) {
602602
currentlyCount = cache.currentPage;
603603
currentlyImage = images[currentlyCount - 1];
604604
} else if (totalPage > 1) {

src/store/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export const openFeedback = writable<boolean>(false);
5353
export const openAdd = writable<boolean>(false);
5454
export const openTag = writable<boolean>(false);
5555
export const customTitlebar = writable<boolean>(true);
56+
export const openFavoriteChapter = writable<boolean>(false)
5657
export const isRefreshing = writable<boolean>(false);
5758
export const isChaptersUniqueNumber = writable<boolean>(false);
5859
export const isChaptersDescending = writable<boolean>(true);

0 commit comments

Comments
 (0)