mirror of
https://github.com/moku-project/Moku.git
synced 2026-06-13 09:19:56 -05:00
Fix: TitleBar Issue (WIP) & Allow Sources in Content Settings
This commit is contained in:
+1
-1
@@ -339,7 +339,7 @@
|
|||||||
<SplashScreen mode="idle" showCards={store.settings.splashCards ?? true}
|
<SplashScreen mode="idle" showCards={store.settings.splashCards ?? true}
|
||||||
onDismiss={() => { idle = false; resetIdle(); }} />
|
onDismiss={() => { idle = false; resetIdle(); }} />
|
||||||
{/if}
|
{/if}
|
||||||
{#if !store.activeChapter && !store.isFullscreen}<TitleBar />{/if}
|
{#if !store.activeChapter}<TitleBar />{/if}
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{#if store.activeChapter}<Reader />{:else}<Layout />{/if}
|
{#if store.activeChapter}<Reader />{:else}<Layout />{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
import { platform } from "@tauri-apps/plugin-os";
|
import { platform } from "@tauri-apps/plugin-os";
|
||||||
|
|
||||||
const win = getCurrentWindow();
|
const win = getCurrentWindow();
|
||||||
const isMac = platform() === "macos";
|
const os = platform();
|
||||||
|
const isMac = os === "macos";
|
||||||
|
const isWindows = os === "windows";
|
||||||
|
|
||||||
let isFullscreen = $state(false);
|
let isFullscreen = $state(false);
|
||||||
|
|
||||||
@@ -42,9 +44,42 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
{:else if isWindows}
|
||||||
|
<!-- On Windows, fullscreen hides the native titlebar — show a hoverable overlay so the user isn't locked in -->
|
||||||
|
<div class="fullscreen-controls">
|
||||||
|
<button onclick={() => win.setFullscreen(false)} title="Exit Fullscreen" aria-label="Exit Fullscreen">
|
||||||
|
<svg width="10" height="10" viewBox="0 0 10 10">
|
||||||
|
<polyline points="1,4 1,1 4,1" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<polyline points="6,1 9,1 9,4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<polyline points="9,6 9,9 6,9" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
<polyline points="4,9 1,9 1,6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<button class="close" onclick={() => win.close()} title="Close" aria-label="Close">
|
||||||
|
<svg width="10" height="10" viewBox="0 0 10 10">
|
||||||
|
<line x1="1" y1="1" x2="9" y2="9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
|
||||||
|
<line x1="9" y1="1" x2="1" y2="9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.fullscreen-controls {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 9999;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 2px;
|
||||||
|
padding: 4px;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.2s ease;
|
||||||
|
-webkit-app-region: no-drag;
|
||||||
|
}
|
||||||
|
.fullscreen-controls:hover { opacity: 1; }
|
||||||
|
|
||||||
.bar {
|
.bar {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import { gql, thumbUrl } from "../../lib/client";
|
import { gql, thumbUrl } from "../../lib/client";
|
||||||
import { GET_SOURCES, FETCH_SOURCE_MANGA, UPDATE_MANGA, GET_CATEGORIES, CREATE_CATEGORY, UPDATE_MANGA_CATEGORIES } from "../../lib/queries";
|
import { GET_SOURCES, FETCH_SOURCE_MANGA, UPDATE_MANGA, GET_CATEGORIES, CREATE_CATEGORY, UPDATE_MANGA_CATEGORIES } from "../../lib/queries";
|
||||||
import { cache, CACHE_KEYS } from "../../lib/cache";
|
import { cache, CACHE_KEYS } from "../../lib/cache";
|
||||||
import { dedupeSources, dedupeMangaByTitle, dedupeMangaById, shouldHideNsfw } from "../../lib/util";
|
import { dedupeSources, dedupeMangaByTitle, dedupeMangaById, shouldHideNsfw, shouldHideSource } from "../../lib/util";
|
||||||
import { store, setPreviewManga, clearDiscoverCache } from "../../store/state.svelte";
|
import { store, setPreviewManga, clearDiscoverCache } from "../../store/state.svelte";
|
||||||
import type { Manga, Source, Category } from "../../lib/types";
|
import type { Manga, Source, Category } from "../../lib/types";
|
||||||
import ContextMenu from "../shared/ContextMenu.svelte";
|
import ContextMenu from "../shared/ContextMenu.svelte";
|
||||||
@@ -69,7 +69,8 @@
|
|||||||
|
|
||||||
function rotatedSources(): Source[] {
|
function rotatedSources(): Source[] {
|
||||||
const lang = store.settings.preferredExtensionLang || "en";
|
const lang = store.settings.preferredExtensionLang || "en";
|
||||||
const srcs = dedupeSources(allSources.filter(s => s.id !== "0"), lang);
|
const eligible = allSources.filter(s => s.id !== "0" && !shouldHideSource(s, store.settings));
|
||||||
|
const srcs = dedupeSources(eligible, lang);
|
||||||
if (!srcs.length) return [];
|
if (!srcs.length) return [];
|
||||||
const off = store.discoverSrcOffset % srcs.length;
|
const off = store.discoverSrcOffset % srcs.length;
|
||||||
return [...srcs.slice(off), ...srcs.slice(0, off)];
|
return [...srcs.slice(off), ...srcs.slice(0, off)];
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { gql, thumbUrl } from "../../lib/client";
|
import { gql, thumbUrl } from "../../lib/client";
|
||||||
import { GET_SOURCES, FETCH_SOURCE_MANGA } from "../../lib/queries";
|
import { GET_SOURCES, FETCH_SOURCE_MANGA } from "../../lib/queries";
|
||||||
import { cache, CACHE_KEYS, getPageSet } from "../../lib/cache";
|
import { cache, CACHE_KEYS, getPageSet } from "../../lib/cache";
|
||||||
import { dedupeSources, dedupeMangaById, dedupeMangaByTitle, shouldHideNsfw } from "../../lib/util";
|
import { dedupeSources, dedupeMangaById, dedupeMangaByTitle, shouldHideNsfw, shouldHideSource } from "../../lib/util";
|
||||||
import { store, setSearchPrefill, setPreviewManga } from "../../store/state.svelte";
|
import { store, setSearchPrefill, setPreviewManga } from "../../store/state.svelte";
|
||||||
import type { Manga, Source } from "../../lib/types";
|
import type { Manga, Source } from "../../lib/types";
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@
|
|||||||
if (kw_selectedLangs.size > 0)
|
if (kw_selectedLangs.size > 0)
|
||||||
filtered = filtered.filter((s) => kw_selectedLangs.has(s.lang));
|
filtered = filtered.filter((s) => kw_selectedLangs.has(s.lang));
|
||||||
if (!store.settings.showNsfw)
|
if (!store.settings.showNsfw)
|
||||||
filtered = filtered.filter((s) => !s.isNsfw);
|
filtered = filtered.filter((s) => !shouldHideSource(s, store.settings));
|
||||||
return filtered;
|
return filtered;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,13 +385,13 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
const src_visibleSources = $derived.by(() => {
|
const src_visibleSources = $derived.by(() => {
|
||||||
const nsfw = (s: Source) => !store.settings.showNsfw && s.isNsfw;
|
const hide = (s: Source) => shouldHideSource(s, store.settings);
|
||||||
if (src_selectedLang !== "all") {
|
if (src_selectedLang !== "all") {
|
||||||
return allSources.filter((s) => s.lang === src_selectedLang && !nsfw(s));
|
return allSources.filter((s) => s.lang === src_selectedLang && !hide(s));
|
||||||
}
|
}
|
||||||
const map = new Map<string, Source>();
|
const map = new Map<string, Source>();
|
||||||
for (const s of allSources) {
|
for (const s of allSources) {
|
||||||
if (nsfw(s)) continue;
|
if (hide(s)) continue;
|
||||||
const key = s.name;
|
const key = s.name;
|
||||||
const existing = map.get(key);
|
const existing = map.get(key);
|
||||||
if (!existing) { map.set(key, s); continue; }
|
if (!existing) { map.set(key, s); continue; }
|
||||||
|
|||||||
@@ -81,6 +81,29 @@ export function shouldHideNsfw(
|
|||||||
return isNsfwManga(manga, settings.nsfwFilteredTags);
|
return isNsfwManga(manga, settings.nsfwFilteredTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gate for Source objects — parallel to shouldHideNsfw for manga.
|
||||||
|
*
|
||||||
|
* Priority:
|
||||||
|
* 1. Blocked list → always hidden, even when showNsfw is on.
|
||||||
|
* 2. Allowed list → always shown, even if isNsfw is true.
|
||||||
|
* 3. Fallback → hide when showNsfw is off and source.isNsfw is true.
|
||||||
|
*
|
||||||
|
* Usage: sources.filter(s => !shouldHideSource(s, settings))
|
||||||
|
*/
|
||||||
|
export function shouldHideSource(
|
||||||
|
source: { id: string; isNsfw: boolean },
|
||||||
|
settings: {
|
||||||
|
showNsfw: boolean;
|
||||||
|
nsfwAllowedSourceIds: string[];
|
||||||
|
nsfwBlockedSourceIds: string[];
|
||||||
|
},
|
||||||
|
): boolean {
|
||||||
|
if (settings.nsfwBlockedSourceIds.includes(source.id)) return true;
|
||||||
|
if (settings.nsfwAllowedSourceIds.includes(source.id)) return false;
|
||||||
|
return !settings.showNsfw && source.isNsfw;
|
||||||
|
}
|
||||||
|
|
||||||
// ── Source deduplication ──────────────────────────────────────────────────────
|
// ── Source deduplication ──────────────────────────────────────────────────────
|
||||||
|
|
||||||
export function dedupeSources(sources: Source[], preferredLang: string): Source[] {
|
export function dedupeSources(sources: Source[], preferredLang: string): Source[] {
|
||||||
|
|||||||
Reference in New Issue
Block a user