Commit 05e19b07cd

05e19b07cd6bea670db505abb0b3dd0f02412f27

parent: cf4778c276

Unsigned

Duck <57977673+woducku@users.noreply.github.com> · 2026-07-13 17:12 UTC

sora

Layout: unified · split

docs/.vitepress/theme/components/extrepo/ExtensionRepos.vue +14 −3
@@ -1,6 +1,6 @@
11<script setup lang="ts">
22import { computed, ref } from 'vue'
3import { data as repoData } from '../../../../ext/extensionRepos.data'
3import { data } from '../../../../ext/extensionRepos.data'
44import { langLabel, stripHtml } from './helpers'
55import { mangayomiCopyValue } from './install'
66import RepoRow from './RepoRow.vue'
@@ -8,11 +8,22 @@ import SettingsMenu from './SettingsMenu.vue'
88import SiteGrid from './SiteGrid.vue'
99import type { MatchedSite, RatingFilter, Repo } from './types'
1010
11const repoData = data.sites
12const soraGroups = data.soraGroups
13
1114const props = defineProps<{
1215 repos: Repo[]
1316 scheme: string
1417}>()
1518
19const resolvedRepos = computed<Repo[]>(() => {
20 return props.repos.map(repo => {
21 const groups = soraGroups[repo.indexUrl]
22 if (!groups?.length) return repo
23 return { ...repo, variants: groups.map(g => ({ label: g.label, mangaUrl: g.indexUrl, labelUrl: g.repoUrl })) }
24 })
25})
26
1627const query = ref('')
1728const langFilter = ref('')
1829const ratingFilter = ref<RatingFilter>('all')
@@ -21,7 +32,7 @@ const showBroken = ref(false)
2132
2233const allSites = computed<MatchedSite[]>(() => {
2334 const sites: MatchedSite[] = []
24 for (const repo of props.repos) {
35 for (const repo of resolvedRepos.value) {
2536 if (repo.variants?.length) {
2637 // search fix for variations of setup. (mangayomi and kotatsu)
2738 const sameRepoName = repo.repoName ? stripHtml(repo.name) : undefined
@@ -108,7 +119,7 @@ const filteredSites = computed(() => {
108119 />
109120
110121 <div v-else>
111 <RepoRow v-for="repo in repos" :key="repo.indexUrl" :repo="repo" :scheme="scheme" :show-broken="showBroken" />
122 <RepoRow v-for="repo in resolvedRepos" :key="repo.indexUrl" :repo="repo" :scheme="scheme" :show-broken="showBroken" />
112123 </div>
113124 </div>
114125</template>
docs/.vitepress/theme/components/extrepo/LazyIcon.vue +12 −2
@@ -9,6 +9,7 @@ const props = defineProps<{
99
1010const rootRef = ref<HTMLElement>()
1111const loaded = ref(false)
12const failed = ref(false)
1213let observer: IntersectionObserver | undefined
1314
1415onMounted(() => {
@@ -20,10 +21,14 @@ onMounted(() => {
2021 observer?.disconnect()
2122 scheduleIconLoad(() => new Promise<void>((resolve) => {
2223 const img = new Image()
23 img.onload = img.onerror = () => {
24 img.onload = () => {
2425 loaded.value = true
2526 resolve()
2627 }
28 img.onerror = () => {
29 failed.value = true
30 resolve()
31 }
2732 img.src = props.src!
2833 }))
2934 }, { rootMargin: '200px' })
@@ -35,5 +40,10 @@ onBeforeUnmount(() => observer?.disconnect())
3540
3641<template>
3742 <img v-if="loaded" ref="rootRef" :src="src" :alt="alt" />
38 <span v-else ref="rootRef" class="ext-site-icon-fallback" :class="{ 'i-lucide:globe': !src, 'ext-site-icon-loading': src }" />
43 <span
44 v-else
45 ref="rootRef"
46 class="ext-site-icon-fallback"
47 :class="{ 'i-lucide:globe': !src || failed, 'ext-site-icon-loading': src && !failed }"
48 />
3949</template>
docs/.vitepress/theme/components/extrepo/RepoRow.vue +20 −2
@@ -1,11 +1,13 @@
11<script setup lang="ts">
22import { computed, ref } from 'vue'
3import { data as repoData } from '../../../../ext/extensionRepos.data'
3import { data } from '../../../../ext/extensionRepos.data'
44import { stripHtml } from './helpers'
55import { copyValue, installHref, isBrowseOnly, mangayomiCopyValue, mangayomiHref, mangayomiLiveContainerHref } from './install'
66import SiteGrid from './SiteGrid.vue'
77import type { Repo, RepoVariant } from './types'
88
9const repoData = data.sites
10
911const props = defineProps<{
1012 repo: Repo
1113 scheme: string
@@ -115,6 +117,12 @@ function variantSites(variant: RepoVariant) {
115117 <span v-else class="i-lucide:copy" />
116118 </button>
117119 </template>
120 <template v-else-if="installUrl">
121 <a class="ext-btn ext-btn-install" :href="installUrl">
122 <span class="i-lucide:download" />
123 <span class="ext-btn-install-label">Install</span>
124 </a>
125 </template>
118126 <button
119127 v-if="!repo.variants"
120128 class="ext-btn ext-btn-toggle"
@@ -133,7 +141,8 @@ function variantSites(variant: RepoVariant) {
133141 <div v-if="subVariants.length" class="ext-repo-variants">
134142 <div v-for="variant in subVariants" :key="variant.label" class="ext-repo-variant">
135143 <div class="ext-repo-variant-row">
136 <span class="ext-repo-variant-label">{{ variant.label }}</span>
144 <a v-if="variant.labelUrl" class="ext-repo-variant-label" :href="variant.labelUrl" target="_blank" rel="noopener noreferrer">{{ variant.label }}</a>
145 <span v-else class="ext-repo-variant-label">{{ variant.label }}</span>
137146 <div class="ext-repo-actions">
138147 <template v-if="showActions">
139148 <a class="ext-btn ext-btn-install" :href="mangayomiHref(repo, variant)">
@@ -327,6 +336,15 @@ function variantSites(variant: RepoVariant) {
327336 color: var(--vp-c-text-2);
328337}
329338
339a.ext-repo-variant-label {
340 text-decoration: none;
341}
342
343a.ext-repo-variant-label:hover {
344 color: var(--vp-c-brand-1);
345 text-decoration: underline;
346}
347
330348@media (max-width: 767px) {
331349 .ext-btn-install {
332350 padding: 5px 8px;
docs/.vitepress/theme/components/extrepo/SiteCell.vue +52 −16
@@ -9,25 +9,37 @@ defineProps<{
99</script>
1010
1111<template>
12 <component
13 :is="site.url ? 'a' : 'div'"
14 class="ext-site-cell"
15 :class="{ 'ext-site-cell-static': !site.url }"
16 :href="site.url || undefined"
17 :target="site.url ? '_blank' : undefined"
18 :rel="site.url ? 'noopener noreferrer' : undefined"
19 >
20 <div class="ext-site-row">
21 <LazyIcon class="ext-site-icon" :src="site.icon" :alt="site.name" />
22 <span class="ext-site-name-text" :title="site.name">{{ site.name }}</span>
23 <span v-if="site.rating !== 'safe'" class="ext-site-nsfw" :class="ratingIcon(site.rating)" :title="ratingTitle(site.rating)" />
24 <span class="ext-site-lang" :class="langFlagClass(site.lang)" :title="site.lang" />
25 </div>
26 <span v-if="site.repoName" class="ext-site-repo">{{ site.repoName }}</span>
27 </component>
12 <div class="ext-site-cell-wrap">
13 <component
14 :is="site.url ? 'a' : 'div'"
15 class="ext-site-cell"
16 :class="{ 'ext-site-cell-static': !site.url }"
17 :href="site.url || undefined"
18 :target="site.url ? '_blank' : undefined"
19 :rel="site.url ? 'noopener noreferrer' : undefined"
20 >
21 <div class="ext-site-row">
22 <LazyIcon class="ext-site-icon" :src="site.icon" :alt="site.name" />
23 <span class="ext-site-name-text" :title="site.name">{{ site.name }}</span>
24 <span v-if="site.rating !== 'safe'" class="ext-site-nsfw" :class="ratingIcon(site.rating)" :title="ratingTitle(site.rating)" />
25 <span class="ext-site-lang" :class="langFlagClass(site.lang)" :title="site.lang" />
26 </div>
27 <span v-if="site.repoName" class="ext-site-repo">{{ site.repoName }}</span>
28 </component>
29 <a v-if="site.installUrl" class="ext-site-install-btn" :href="site.installUrl" :title="`Install ${site.name}`">
30 <span class="i-lucide:download" />
31 </a>
32 </div>
2833</template>
2934
3035<style scoped>
36.ext-site-cell-wrap {
37 display: flex;
38 align-items: stretch;
39 gap: 4px;
40 min-width: 0;
41}
42
3143.ext-site-repo {
3244 display: block;
3345 padding-left: 24px;
@@ -41,6 +53,7 @@ defineProps<{
4153}
4254
4355.ext-site-cell {
56 flex: 1;
4457 display: flex;
4558 flex-direction: column;
4659 gap: 0;
@@ -111,4 +124,27 @@ defineProps<{
111124 flex-shrink: 0;
112125 font-size: 12px;
113126}
127
128.ext-site-install-btn {
129 flex-shrink: 0;
130 display: flex;
131 align-items: center;
132 justify-content: center;
133 width: 32px;
134 border-radius: 8px;
135 border: 1px solid var(--vp-button-brand-border);
136 background-color: var(--vp-button-brand-bg);
137 color: var(--vp-button-brand-text) !important;
138 text-decoration: none !important;
139 transition: filter 0.2s, border-color 0.2s;
140}
141
142.ext-site-install-btn:hover {
143 filter: brightness(1.08);
144 border-color: var(--vp-button-brand-hover-border);
145}
146
147.ext-site-install-btn span {
148 font-size: 15px;
149}
114150</style>
docs/.vitepress/theme/components/extrepo/install.ts +4 −3
@@ -11,23 +11,24 @@ const INSTALL_URL_BUILDERS: Record<string, (repo: Repo) => string> = {
1111 cloudstreamrepo: repo => `cloudstreamrepo://${repo.indexUrl.replace(/^https?:\/\//, '')}`,
1212 hayase: repo => `hayase://extensions/install?url=${repo.indexUrl}`,
1313 legado: repo => `legado://import/bookSource?src=${repo.indexUrl}`,
14 lnreader: repo => `lnreader://repo/add?url=${repo.indexUrl}`
14 lnreader: repo => `lnreader://repo/add?url=${repo.indexUrl}`,
15 sora: repo => `sora://default_page?url=${new URL(repo.indexUrl).origin}/library/?embed=true`
1516}
1617
1718// Apps with no deep-link install scheme;
1819const MANUAL_ONLY_SCHEMES = new Set(['manual'])
1920
2021// Schemes with no install or copy action
21const BROWSE_ONLY_SCHEMES = new Set(['kotatsu'])
22const BROWSE_ONLY_SCHEMES = new Set(['kotatsu', 'sora'])
2223
2324export function isBrowseOnly(scheme: string): boolean {
2425 return BROWSE_ONLY_SCHEMES.has(scheme)
2526}
2627
2728export function installHref(scheme: string, repo: Repo): string | null {
28 if (MANUAL_ONLY_SCHEMES.has(scheme) || BROWSE_ONLY_SCHEMES.has(scheme)) return null
2929 const build = INSTALL_URL_BUILDERS[scheme]
3030 if (build) return build(repo)
31 if (MANUAL_ONLY_SCHEMES.has(scheme) || BROWSE_ONLY_SCHEMES.has(scheme)) return null
3132 return `${scheme}://add-repo?url=${repo.indexUrl}`
3233}
3334
docs/.vitepress/theme/components/extrepo/types.ts +2 −1
@@ -6,6 +6,7 @@ export interface RepoVariant {
66 mangaUrl?: string
77 animeUrl?: string
88 novelUrl?: string
9 labelUrl?: string
910}
1011
1112export interface Repo {
@@ -23,9 +24,9 @@ export interface RepoSite {
2324 icon: string
2425 url: string
2526 rating: Rating
26 // Only for kotatsu
2727 contentType?: string
2828 isBroken?: boolean
29 installUrl?: string
2930}
3031
3132export interface MatchedSite extends RepoSite {
docs/ext/extensionRepos.data.ts +145 −6
@@ -14,6 +14,7 @@ export interface RepoSite {
1414 rating: Rating
1515 contentType?: string
1616 isBroken?: boolean
17 installUrl?: string
1718}
1819
1920export interface RepoData {
@@ -124,6 +125,22 @@ interface KotatsuIndex {
124125 sites: KotatsuSite[]
125126}
126127
128interface SoraModule {
129 sourceName: string
130 iconUrl?: string
131 language?: string
132 baseUrl?: string
133 manifestUrl: string
134 type?: string
135 status?: string
136}
137
138export interface SoraGroup {
139 label: string
140 repoUrl?: string
141 indexUrl: string
142}
143
127144const EXT_DIR = dirname(fileURLToPath(import.meta.url))
128145const DOCS_DIR = join(EXT_DIR, '..')
129146const CACHE_DIR = join(EXT_DIR, '../.vitepress/cache/extension-repos')
@@ -206,7 +223,22 @@ const LANG_ALIASES: Record<string, string> = {
206223 العربية: 'ar',
207224 chinese: 'zh',
208225 japanese: 'ja',
209 korean: 'ko'
226 korean: 'ko',
227 french: 'fr',
228 german: 'de',
229 greek: 'el',
230 indonesian: 'id',
231 italian: 'it',
232 spanish: 'es',
233 turkish: 'tr',
234 polish: 'pl',
235 russian: 'ru',
236 portuguese: 'pt',
237 arabic: 'ar',
238 tamil: 'ta',
239 ukrainian: 'uk',
240 vietnamese: 'vi',
241 thai: 'th'
210242}
211243
212244const LANG_SUBSTRING_ALIASES: [RegExp, string][] = [
@@ -402,6 +434,99 @@ function toRepoDataKotatsu(index: KotatsuIndex): RepoSite[] {
402434 return sites
403435}
404436
437function isSoraIndex(json: unknown): json is SoraModule[] {
438 if (!Array.isArray(json) || json.length === 0) return false
439 const first = json[0] as Record<string, unknown>
440 return typeof first.manifestUrl === 'string' && typeof first.sourceName === 'string'
441}
442
443function normalizeSoraLang(language: string | undefined): string {
444 const stripped = (language ?? '').replace(/\s*\([^)]*\)\s*$/, '').trim()
445 if (stripped.toLowerCase().startsWith('multi')) return 'all'
446 return normalizeLang(stripped)
447}
448
449function normalizeSoraType(type: string): string {
450 return type.toLowerCase().split('/').sort().join('_')
451}
452
453function toRepoDataSora(modules: SoraModule[]): RepoSite[] {
454 const seen = new Set<string>()
455 const sites: RepoSite[] = []
456
457 for (const mod of modules) {
458 const lang = normalizeSoraLang(mod.language)
459 const key = `${mod.sourceName}::${lang}::${mod.manifestUrl}`
460 if (seen.has(key)) continue
461 seen.add(key)
462 sites.push({
463 name: mod.sourceName,
464 lang,
465 icon: mod.iconUrl ?? '',
466 url: mod.baseUrl ?? '',
467 rating: 'safe',
468 contentType: mod.type ? normalizeSoraType(mod.type) : undefined,
469 isBroken: mod.status === 'down' || undefined,
470 installUrl: `sora://module?url=${mod.manifestUrl}`
471 })
472 }
473
474 return sites
475}
476
477function groupSoraModules(indexUrl: string, modules: SoraModule[]): { groups: SoraGroup[]; sitesByGroup: Record<string, RepoData> } {
478 const byAuthor = new Map<string, Map<string, SoraModule[]>>()
479 for (const mod of modules) {
480 const { key, display } = soraAuthorKey(mod.manifestUrl)
481 let displays = byAuthor.get(key)
482 if (!displays) {
483 displays = new Map()
484 byAuthor.set(key, displays)
485 }
486 const list = displays.get(display)
487 if (list) list.push(mod)
488 else displays.set(display, [mod])
489 }
490
491 const groups: SoraGroup[] = []
492 const sitesByGroup: Record<string, RepoData> = {}
493 for (const key of byAuthor.keys()) {
494 const displays = [...byAuthor.get(key)!.entries()]
495 const [display] = SORA_CANONICAL_DISPLAYS.has(key) ? [key] : displays.sort((a, b) => b[1].length - a[1].length)[0]
496 const allMods = displays.flatMap(([, mods]) => mods)
497 const label = display.split('/')[1] ?? display
498 const groupIndexUrl = `${indexUrl}#${key}`
499 const sites = toRepoDataSora(allMods)
500 sites.sort((a, b) => a.name.localeCompare(b.name))
501 groups.push({ label, repoUrl: soraRepoUrl(display), indexUrl: groupIndexUrl })
502 sitesByGroup[groupIndexUrl] = { sites }
503 }
504 groups.sort((a, b) => a.label.localeCompare(b.label))
505 return { groups, sitesByGroup }
506}
507
508function soraAuthorKey(manifestUrl: string): { key: string; display: string } {
509 try {
510 const u = new URL(manifestUrl)
511 const [user, repo] = u.pathname.split('/').filter(Boolean)
512 const display = user && repo ? `${u.host}/${user}/${repo}` : u.host
513 const key = display.toLowerCase()
514 return { key: SORA_AUTHOR_ALIASES[key] ?? key, display }
515 } catch {
516 return { key: manifestUrl.toLowerCase(), display: manifestUrl }
517 }
518}
519
520const SORA_AUTHOR_ALIASES: Record<string, string> = {
521 'git.luna-app.eu/emp0ry/sources': 'git.luna-app.eu/anonymous/sources'
522}
523
524const SORA_CANONICAL_DISPLAYS = new Set(Object.values(SORA_AUTHOR_ALIASES))
525
526function soraRepoUrl(display: string): string {
527 return `https://${display.replace(/^raw\.githubusercontent\.com\//, 'github.com/')}`
528}
529
405530function toRepoDataLNReader(plugins: LNReaderPlugin[]): RepoSite[] {
406531 const seen = new Set<string>()
407532 const sites: RepoSite[] = []
@@ -428,6 +553,8 @@ async function toRepoData(indexUrl: string, json: unknown): Promise<RepoData> {
428553 sites = toRepoDataHayase(json as HayaseExtension[])
429554 } else if (first && 'iconUrl' in first && 'site' in first) {
430555 sites = toRepoDataLNReader(json as LNReaderPlugin[])
556 } else if (isSoraIndex(json)) {
557 sites = toRepoDataSora(json)
431558 } else if (first && 'sources' in first) {
432559 sites = toRepoDataMihon(iconBase, json as MihonExtension[])
433560 } else if (first && 'pkg' in first && 'apk' in first) {
@@ -450,16 +577,28 @@ async function toRepoData(indexUrl: string, json: unknown): Promise<RepoData> {
450577 return { sites }
451578}
452579
453export declare const data: Record<string, RepoData>
580export interface ExtensionRepoData {
581 sites: Record<string, RepoData>
582 soraGroups: Record<string, SoraGroup[]>
583}
584
585export declare const data: ExtensionRepoData
454586
455587export default {
456588 watch: ['../**/*.md'],
457 async load(): Promise<Record<string, RepoData>> {
589 async load(): Promise<ExtensionRepoData> {
458590 const urls = collectIndexUrls()
459 const result: Record<string, RepoData> = {}
591 const sites: Record<string, RepoData> = {}
592 const soraGroups: Record<string, SoraGroup[]> = {}
460593 await Promise.all(urls.map(async url => {
461 result[url] = await toRepoData(url, await fetchIndex(url))
594 const json = await fetchIndex(url)
595 sites[url] = await toRepoData(url, json)
596 if (isSoraIndex(json)) {
597 const grouped = groupSoraModules(url, json)
598 soraGroups[url] = grouped.groups
599 Object.assign(sites, grouped.sitesByGroup)
600 }
462601 }))
463 return result
602 return { sites, soraGroups }
464603 }
465604}
docs/ext/ios.md +7 −4
@@ -125,10 +125,13 @@ You can install v0.8 extensions in the v0.9 Paperback client, but you can't inst
125125
126126## Sora
127127
128| Name | Region |
129| - | - |
130| [Module Library](https://library.cufiy.net/library/) | :global: |
131| [Ibra](https://git.luna-app.eu/ibro/services) | :global: |
128::: extrepo {scheme=sora}
129
130== Cufiy's Library
131- url: https://library.cufiy.net/
132- raw: https://library.cufiy.net/api/modules.min.json
133
134:::
132135
133136## Suwatte
134137