Skip to content

Commit

Permalink
Merge pull request #65 from Suwayomi/main
Browse files Browse the repository at this point in the history
fixes
  • Loading branch information
Robonau committed Nov 11, 2023
2 parents df5586a + 973d233 commit b28c278
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 13 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ Robonau's Svelte + skeleton tachidesk UI

## Web Server files

The Tachidesk-VUI-Web.zip file in the release is for hosting the ui though a webserver
It should also be possible to replace the contents of the webUI folder in the Tachidesk data directory, though this is not recommended
The Tachidesk-VUI-Web.zip file in the release is for hosting the ui though `server.webUIFlavor = "Custom"` config and replacing the contents of the webUI folder in the Tachidesk data directory

The files could also be used in a stand alone webserver though you would have to redirect `/api` trafic to tachidesk server

## Docker

Expand All @@ -20,10 +21,14 @@ It should also be possible to replace the contents of the webUI folder in the Ta
```yaml
version: '3.7'
services:
tachideskvui:
image: ghcr.io/suwayomi/tachidesk-vui:latest
vui3:
image: ghcr.io/suwayomi/tachidesk-vui
ports:
- '9013:8080'
environment:
- tachidesk=http://tachidesk:4567/
# will proxy the tachidesk server to the UI
# if you plan on proxying it externally then this is unnecessary
restart: unless-stopped
```
Expand Down
8 changes: 5 additions & 3 deletions src/lib/simpleStores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function GlobalMeta() {

Meta.subscribe((e) => {
store.update((n) => {
const Ncopy = structuredClone(n) as { [key: string]: unknown };
const Ncopy = structuredClone(trueDefaults) as { [key: string]: unknown };
(Object.keys(n) as (keyof globalMeta)[]).forEach((ee) => {
const tmp = e.data.metas?.nodes.find((k) => k.key.replace('VUI3_', '') === ee);
if (!tmp) return;
Expand Down Expand Up @@ -194,11 +194,11 @@ function MangaMetaUpdator(cache: ApolloCache<unknown>, key: string, value: strin

export function MangaMeta(id: number) {
const MMeta = getManga({ variables: { id } });
const store = writable(mangaMetaDefaults);
const store = writable(get(Meta).mangaMetaDefaults);

MMeta.subscribe((e) => {
store.update((n) => {
const Ncopy = structuredClone(n) as { [key: string]: unknown };
const Ncopy = structuredClone(get(Meta).mangaMetaDefaults) as { [key: string]: unknown };
(Object.keys(n) as (keyof mangaMeta)[]).forEach((ee) => {
const tmp = e.data.manga?.meta.find((k) => k.key.replace('VUI3_', '') === ee);
if (!tmp) return;
Expand All @@ -221,6 +221,8 @@ export function MangaMeta(id: number) {
//set if not the truedefault value
await setMangaMeta({
variables: { key, value, id }
//update after to keep in sync
// update: (a) => MangaMetaUpdator(a, key, value, id)
});
} else if (tmp !== undefined) {
//delete if not already undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
id: 'ChapterMenu',
width: 'w-[280px] md:w-[480px]',
meta: {
id: data.ChapterID
id: data.MangaID
}
});
}
Expand Down
27 changes: 22 additions & 5 deletions src/routes/(app)/manga/[MangaID]/chapter/[ChapterID]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import { Layout, MangaMeta, Mode } from '$lib/simpleStores';
export let data: PageData;
const mangaMeta = MangaMeta(data.ChapterID);
const mangaMeta = MangaMeta(data.MangaID);
let currentChapterID = data.ChapterID;
Expand Down Expand Up @@ -107,7 +107,10 @@
} else if (path.menu && pointInPoly([e.x, e.y], polyToPOLLY(path.menu))) {
drawerStore.open({
id: 'ChapterMenu',
width: 'w-[280px] md:w-[480px]'
width: 'w-[280px] md:w-[480px]',
meta: {
id: data.MangaID
}
});
}
}
Expand Down Expand Up @@ -283,11 +286,17 @@
{/if}
{#each chapter.pages as page, pageindex (page)}
<div
class=" w-auto h-auto
class="w-auto h-auto
{$mangaMeta.Margins && $mangaMeta.ReaderMode === Mode.Vertical && 'mb-4'}
{$mangaMeta.Margins && $mangaMeta.ReaderMode === Mode.single && 'mb-4'}
{$mangaMeta.Margins && $mangaMeta.ReaderMode === Mode.RTL && 'even:mr-2 odd:ml-2 mb-4'}
{$mangaMeta.Margins && $mangaMeta.ReaderMode === Mode.LTR && 'even:ml-2 odd:mr-2 mb-4'}"
{$mangaMeta.Margins && $mangaMeta.ReaderMode === Mode.LTR && 'even:ml-2 odd:mr-2 mb-4'}
{$mangaMeta.Scale && $mangaMeta.ReaderMode !== Mode.Vertical
? 'max-h-screen h-full'
: 'h-auto'} {$mangaMeta.Scale && $mangaMeta.ReaderMode === Mode.Vertical
? 'w-full'
: 'w-auto'}
{$mangaMeta.Scale && $mangaMeta.ReaderMode === Mode.single ? 'max-w-full' : ''}"
>
<IntersectionObserver
on:intersect={(e) => {
Expand All @@ -304,7 +313,15 @@
bottom={0}
top={$mangaMeta.Margins ? 16 : 0}
/>
<div id="c{index}p{pageindex}">
<div
id="c{index}p{pageindex}"
class="{$mangaMeta.Scale && $mangaMeta.ReaderMode !== Mode.Vertical
? 'max-h-screen h-full'
: 'h-auto'} {$mangaMeta.Scale && $mangaMeta.ReaderMode === Mode.Vertical
? 'w-full'
: 'w-auto'}
{$mangaMeta.Scale && $mangaMeta.ReaderMode === Mode.single ? 'max-w-full' : ''}"
>
<Image
src={page}
height={$mangaMeta.Scale && $mangaMeta.ReaderMode !== Mode.Vertical
Expand Down

0 comments on commit b28c278

Please sign in to comment.