Feat: Discord RPC

This commit is contained in:
Youwes09
2026-03-29 15:38:39 -05:00
parent f6786def87
commit 0a11fe3982
12 changed files with 191 additions and 8 deletions
+14
View File
@@ -5,6 +5,7 @@
import { FETCH_CHAPTER_PAGES, MARK_CHAPTER_READ, ENQUEUE_DOWNLOAD, ENQUEUE_CHAPTERS_DOWNLOAD } from "../../lib/queries";
import { store, closeReader, openReader, addHistory, updateSettings, checkAndMarkCompleted, setSettingsOpen } from "../../store/state.svelte";
import { matchesKeybind, toggleFullscreen, DEFAULT_KEYBINDS } from "../../lib/keybinds";
import { setReading } from "../../lib/discord";
import type { FitMode } from "../../store/state.svelte";
// ─── Constants ────────────────────────────────────────────────────────────────
@@ -190,6 +191,19 @@
: store.activeChapter
);
// ─── Discord RPC ──────────────────────────────────────────────────────────────
// displayChapter already handles both single/double (store.activeChapter) and
// longstrip auto-next (visibleChapterId) — so reacting to it here means RPC
// updates on every chapter transition regardless of reading mode.
$effect(() => {
const chapter = displayChapter;
const manga = store.activeManga;
if (store.settings.discordRpc && chapter && manga) {
setReading(manga, chapter);
}
});
const adjacent = $derived.by(() => {
const ref = displayChapter ?? store.activeChapter;
if (!ref || !store.activeChapterList.length) return { prev: null, next: null, remaining: [] };