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: [] };
+8 -1
View File
@@ -775,6 +775,13 @@
</div>
</div>
</div>
<div class="section">
<p class="section-title">Integrations</p>
<label class="toggle-row">
<div class="toggle-info"><span class="toggle-label">Discord Rich Presence</span><span class="toggle-desc">Show what you're reading in your Discord status</span></div>
<button role="switch" aria-checked={store.settings.discordRpc} aria-label="Discord Rich Presence" class="toggle" class:on={store.settings.discordRpc} onclick={() => updateSettings({ discordRpc: !store.settings.discordRpc })}><span class="toggle-thumb"></span></button>
</label>
</div>
</div>
@@ -1778,7 +1785,7 @@
<p class="section-title">Links</p>
<div class="about-block">
<a href="https://github.com/Youwes09/Moku" target="_blank" class="about-line" style="color:var(--accent-fg);text-decoration:none">GitHub </a>
<a href="https://discord.gg/cfncTbJ2" target="_blank" class="about-line" style="color:var(--accent-fg);text-decoration:none;margin-top:var(--sp-1)">Discord </a>
<a href="https://discord.gg/Jq3pwuNqPp" target="_blank" class="about-line" style="color:var(--accent-fg);text-decoration:none;margin-top:var(--sp-1)">Discord </a>
</div>
</div>