Commit 05e19b07cd
Unsigned
Layout: unified · split
docs/.vitepress/theme/components/extrepo/ExtensionRepos.vue +14 −3
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | <script setup lang="ts"> |
| 2 | 2 | import { computed, ref } from 'vue' |
| 3 | import { data as repoData } from '../../../../ext/extensionRepos.data' | |
| 3 | import { data } from '../../../../ext/extensionRepos.data' | |
| 4 | 4 | import { langLabel, stripHtml } from './helpers' |
| 5 | 5 | import { mangayomiCopyValue } from './install' |
| 6 | 6 | import RepoRow from './RepoRow.vue' |
| @@ -8,11 +8,22 @@ import SettingsMenu from './SettingsMenu.vue' | ||
| 8 | 8 | import SiteGrid from './SiteGrid.vue' |
| 9 | 9 | import type { MatchedSite, RatingFilter, Repo } from './types' |
| 10 | 10 | |
| 11 | const repoData = data.sites | |
| 12 | const soraGroups = data.soraGroups | |
| 13 | ||
| 11 | 14 | const props = defineProps<{ |
| 12 | 15 | repos: Repo[] |
| 13 | 16 | scheme: string |
| 14 | 17 | }>() |
| 15 | 18 | |
| 19 | const 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 | ||
| 16 | 27 | const query = ref('') |
| 17 | 28 | const langFilter = ref('') |
| 18 | 29 | const ratingFilter = ref<RatingFilter>('all') |
| @@ -21,7 +32,7 @@ const showBroken = ref(false) | ||
| 21 | 32 | |
| 22 | 33 | const allSites = computed<MatchedSite[]>(() => { |
| 23 | 34 | const sites: MatchedSite[] = [] |
| 24 | for (const repo of props.repos) { | |
| 35 | for (const repo of resolvedRepos.value) { | |
| 25 | 36 | if (repo.variants?.length) { |
| 26 | 37 | // search fix for variations of setup. (mangayomi and kotatsu) |
| 27 | 38 | const sameRepoName = repo.repoName ? stripHtml(repo.name) : undefined |
| @@ -108,7 +119,7 @@ const filteredSites = computed(() => { | ||
| 108 | 119 | /> |
| 109 | 120 | |
| 110 | 121 | <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" /> | |
| 112 | 123 | </div> |
| 113 | 124 | </div> |
| 114 | 125 | </template> |
docs/.vitepress/theme/components/extrepo/LazyIcon.vue +12 −2
| @@ -9,6 +9,7 @@ const props = defineProps<{ | ||
| 9 | 9 | |
| 10 | 10 | const rootRef = ref<HTMLElement>() |
| 11 | 11 | const loaded = ref(false) |
| 12 | const failed = ref(false) | |
| 12 | 13 | let observer: IntersectionObserver | undefined |
| 13 | 14 | |
| 14 | 15 | onMounted(() => { |
| @@ -20,10 +21,14 @@ onMounted(() => { | ||
| 20 | 21 | observer?.disconnect() |
| 21 | 22 | scheduleIconLoad(() => new Promise<void>((resolve) => { |
| 22 | 23 | const img = new Image() |
| 23 | img.onload = img.onerror = () => { | |
| 24 | img.onload = () => { | |
| 24 | 25 | loaded.value = true |
| 25 | 26 | resolve() |
| 26 | 27 | } |
| 28 | img.onerror = () => { | |
| 29 | failed.value = true | |
| 30 | resolve() | |
| 31 | } | |
| 27 | 32 | img.src = props.src! |
| 28 | 33 | })) |
| 29 | 34 | }, { rootMargin: '200px' }) |
| @@ -35,5 +40,10 @@ onBeforeUnmount(() => observer?.disconnect()) | ||
| 35 | 40 | |
| 36 | 41 | <template> |
| 37 | 42 | <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 | /> | |
| 39 | 49 | </template> |
docs/.vitepress/theme/components/extrepo/RepoRow.vue +20 −2
| @@ -1,11 +1,13 @@ | ||
| 1 | 1 | <script setup lang="ts"> |
| 2 | 2 | import { computed, ref } from 'vue' |
| 3 | import { data as repoData } from '../../../../ext/extensionRepos.data' | |
| 3 | import { data } from '../../../../ext/extensionRepos.data' | |
| 4 | 4 | import { stripHtml } from './helpers' |
| 5 | 5 | import { copyValue, installHref, isBrowseOnly, mangayomiCopyValue, mangayomiHref, mangayomiLiveContainerHref } from './install' |
| 6 | 6 | import SiteGrid from './SiteGrid.vue' |
| 7 | 7 | import type { Repo, RepoVariant } from './types' |
| 8 | 8 | |
| 9 | const repoData = data.sites | |
| 10 | ||
| 9 | 11 | const props = defineProps<{ |
| 10 | 12 | repo: Repo |
| 11 | 13 | scheme: string |
| @@ -115,6 +117,12 @@ function variantSites(variant: RepoVariant) { | ||
| 115 | 117 | <span v-else class="i-lucide:copy" /> |
| 116 | 118 | </button> |
| 117 | 119 | </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> | |
| 118 | 126 | <button |
| 119 | 127 | v-if="!repo.variants" |
| 120 | 128 | class="ext-btn ext-btn-toggle" |
| @@ -133,7 +141,8 @@ function variantSites(variant: RepoVariant) { | ||
| 133 | 141 | <div v-if="subVariants.length" class="ext-repo-variants"> |
| 134 | 142 | <div v-for="variant in subVariants" :key="variant.label" class="ext-repo-variant"> |
| 135 | 143 | <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> | |
| 137 | 146 | <div class="ext-repo-actions"> |
| 138 | 147 | <template v-if="showActions"> |
| 139 | 148 | <a class="ext-btn ext-btn-install" :href="mangayomiHref(repo, variant)"> |
| @@ -327,6 +336,15 @@ function variantSites(variant: RepoVariant) { | ||
| 327 | 336 | color: var(--vp-c-text-2); |
| 328 | 337 | } |
| 329 | 338 | |
| 339 | a.ext-repo-variant-label { | |
| 340 | text-decoration: none; | |
| 341 | } | |
| 342 | ||
| 343 | a.ext-repo-variant-label:hover { | |
| 344 | color: var(--vp-c-brand-1); | |
| 345 | text-decoration: underline; | |
| 346 | } | |
| 347 | ||
| 330 | 348 | @media (max-width: 767px) { |
| 331 | 349 | .ext-btn-install { |
| 332 | 350 | padding: 5px 8px; |
docs/.vitepress/theme/components/extrepo/SiteCell.vue +52 −16
| @@ -9,25 +9,37 @@ defineProps<{ | ||
| 9 | 9 | </script> |
| 10 | 10 | |
| 11 | 11 | <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> | |
| 28 | 33 | </template> |
| 29 | 34 | |
| 30 | 35 | <style scoped> |
| 36 | .ext-site-cell-wrap { | |
| 37 | display: flex; | |
| 38 | align-items: stretch; | |
| 39 | gap: 4px; | |
| 40 | min-width: 0; | |
| 41 | } | |
| 42 | ||
| 31 | 43 | .ext-site-repo { |
| 32 | 44 | display: block; |
| 33 | 45 | padding-left: 24px; |
| @@ -41,6 +53,7 @@ defineProps<{ | ||
| 41 | 53 | } |
| 42 | 54 | |
| 43 | 55 | .ext-site-cell { |
| 56 | flex: 1; | |
| 44 | 57 | display: flex; |
| 45 | 58 | flex-direction: column; |
| 46 | 59 | gap: 0; |
| @@ -111,4 +124,27 @@ defineProps<{ | ||
| 111 | 124 | flex-shrink: 0; |
| 112 | 125 | font-size: 12px; |
| 113 | 126 | } |
| 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 | } | |
| 114 | 150 | </style> |
docs/.vitepress/theme/components/extrepo/install.ts +4 −3
| @@ -11,23 +11,24 @@ const INSTALL_URL_BUILDERS: Record<string, (repo: Repo) => string> = { | ||
| 11 | 11 | cloudstreamrepo: repo => `cloudstreamrepo://${repo.indexUrl.replace(/^https?:\/\//, '')}`, |
| 12 | 12 | hayase: repo => `hayase://extensions/install?url=${repo.indexUrl}`, |
| 13 | 13 | 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` | |
| 15 | 16 | } |
| 16 | 17 | |
| 17 | 18 | // Apps with no deep-link install scheme; |
| 18 | 19 | const MANUAL_ONLY_SCHEMES = new Set(['manual']) |
| 19 | 20 | |
| 20 | 21 | // Schemes with no install or copy action |
| 21 | const BROWSE_ONLY_SCHEMES = new Set(['kotatsu']) | |
| 22 | const BROWSE_ONLY_SCHEMES = new Set(['kotatsu', 'sora']) | |
| 22 | 23 | |
| 23 | 24 | export function isBrowseOnly(scheme: string): boolean { |
| 24 | 25 | return BROWSE_ONLY_SCHEMES.has(scheme) |
| 25 | 26 | } |
| 26 | 27 | |
| 27 | 28 | export function installHref(scheme: string, repo: Repo): string | null { |
| 28 | if (MANUAL_ONLY_SCHEMES.has(scheme) || BROWSE_ONLY_SCHEMES.has(scheme)) return null | |
| 29 | 29 | const build = INSTALL_URL_BUILDERS[scheme] |
| 30 | 30 | if (build) return build(repo) |
| 31 | if (MANUAL_ONLY_SCHEMES.has(scheme) || BROWSE_ONLY_SCHEMES.has(scheme)) return null | |
| 31 | 32 | return `${scheme}://add-repo?url=${repo.indexUrl}` |
| 32 | 33 | } |
| 33 | 34 | |
docs/.vitepress/theme/components/extrepo/types.ts +2 −1
| @@ -6,6 +6,7 @@ export interface RepoVariant { | ||
| 6 | 6 | mangaUrl?: string |
| 7 | 7 | animeUrl?: string |
| 8 | 8 | novelUrl?: string |
| 9 | labelUrl?: string | |
| 9 | 10 | } |
| 10 | 11 | |
| 11 | 12 | export interface Repo { |
| @@ -23,9 +24,9 @@ export interface RepoSite { | ||
| 23 | 24 | icon: string |
| 24 | 25 | url: string |
| 25 | 26 | rating: Rating |
| 26 | // Only for kotatsu | |
| 27 | 27 | contentType?: string |
| 28 | 28 | isBroken?: boolean |
| 29 | installUrl?: string | |
| 29 | 30 | } |
| 30 | 31 | |
| 31 | 32 | export interface MatchedSite extends RepoSite { |
docs/ext/extensionRepos.data.ts +145 −6
| @@ -14,6 +14,7 @@ export interface RepoSite { | ||
| 14 | 14 | rating: Rating |
| 15 | 15 | contentType?: string |
| 16 | 16 | isBroken?: boolean |
| 17 | installUrl?: string | |
| 17 | 18 | } |
| 18 | 19 | |
| 19 | 20 | export interface RepoData { |
| @@ -124,6 +125,22 @@ interface KotatsuIndex { | ||
| 124 | 125 | sites: KotatsuSite[] |
| 125 | 126 | } |
| 126 | 127 | |
| 128 | interface SoraModule { | |
| 129 | sourceName: string | |
| 130 | iconUrl?: string | |
| 131 | language?: string | |
| 132 | baseUrl?: string | |
| 133 | manifestUrl: string | |
| 134 | type?: string | |
| 135 | status?: string | |
| 136 | } | |
| 137 | ||
| 138 | export interface SoraGroup { | |
| 139 | label: string | |
| 140 | repoUrl?: string | |
| 141 | indexUrl: string | |
| 142 | } | |
| 143 | ||
| 127 | 144 | const EXT_DIR = dirname(fileURLToPath(import.meta.url)) |
| 128 | 145 | const DOCS_DIR = join(EXT_DIR, '..') |
| 129 | 146 | const CACHE_DIR = join(EXT_DIR, '../.vitepress/cache/extension-repos') |
| @@ -206,7 +223,22 @@ const LANG_ALIASES: Record<string, string> = { | ||
| 206 | 223 | العربية: 'ar', |
| 207 | 224 | chinese: 'zh', |
| 208 | 225 | 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' | |
| 210 | 242 | } |
| 211 | 243 | |
| 212 | 244 | const LANG_SUBSTRING_ALIASES: [RegExp, string][] = [ |
| @@ -402,6 +434,99 @@ function toRepoDataKotatsu(index: KotatsuIndex): RepoSite[] { | ||
| 402 | 434 | return sites |
| 403 | 435 | } |
| 404 | 436 | |
| 437 | function 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 | ||
| 443 | function 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 | ||
| 449 | function normalizeSoraType(type: string): string { | |
| 450 | return type.toLowerCase().split('/').sort().join('_') | |
| 451 | } | |
| 452 | ||
| 453 | function 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 | ||
| 477 | function 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 | ||
| 508 | function 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 | ||
| 520 | const SORA_AUTHOR_ALIASES: Record<string, string> = { | |
| 521 | 'git.luna-app.eu/emp0ry/sources': 'git.luna-app.eu/anonymous/sources' | |
| 522 | } | |
| 523 | ||
| 524 | const SORA_CANONICAL_DISPLAYS = new Set(Object.values(SORA_AUTHOR_ALIASES)) | |
| 525 | ||
| 526 | function soraRepoUrl(display: string): string { | |
| 527 | return `https://${display.replace(/^raw\.githubusercontent\.com\//, 'github.com/')}` | |
| 528 | } | |
| 529 | ||
| 405 | 530 | function toRepoDataLNReader(plugins: LNReaderPlugin[]): RepoSite[] { |
| 406 | 531 | const seen = new Set<string>() |
| 407 | 532 | const sites: RepoSite[] = [] |
| @@ -428,6 +553,8 @@ async function toRepoData(indexUrl: string, json: unknown): Promise<RepoData> { | ||
| 428 | 553 | sites = toRepoDataHayase(json as HayaseExtension[]) |
| 429 | 554 | } else if (first && 'iconUrl' in first && 'site' in first) { |
| 430 | 555 | sites = toRepoDataLNReader(json as LNReaderPlugin[]) |
| 556 | } else if (isSoraIndex(json)) { | |
| 557 | sites = toRepoDataSora(json) | |
| 431 | 558 | } else if (first && 'sources' in first) { |
| 432 | 559 | sites = toRepoDataMihon(iconBase, json as MihonExtension[]) |
| 433 | 560 | } else if (first && 'pkg' in first && 'apk' in first) { |
| @@ -450,16 +577,28 @@ async function toRepoData(indexUrl: string, json: unknown): Promise<RepoData> { | ||
| 450 | 577 | return { sites } |
| 451 | 578 | } |
| 452 | 579 | |
| 453 | export declare const data: Record<string, RepoData> | |
| 580 | export interface ExtensionRepoData { | |
| 581 | sites: Record<string, RepoData> | |
| 582 | soraGroups: Record<string, SoraGroup[]> | |
| 583 | } | |
| 584 | ||
| 585 | export declare const data: ExtensionRepoData | |
| 454 | 586 | |
| 455 | 587 | export default { |
| 456 | 588 | watch: ['../**/*.md'], |
| 457 | async load(): Promise<Record<string, RepoData>> { | |
| 589 | async load(): Promise<ExtensionRepoData> { | |
| 458 | 590 | const urls = collectIndexUrls() |
| 459 | const result: Record<string, RepoData> = {} | |
| 591 | const sites: Record<string, RepoData> = {} | |
| 592 | const soraGroups: Record<string, SoraGroup[]> = {} | |
| 460 | 593 | 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 | } | |
| 462 | 601 | })) |
| 463 | return result | |
| 602 | return { sites, soraGroups } | |
| 464 | 603 | } |
| 465 | 604 | } |
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 | ||
| 125 | 125 | |
| 126 | 126 | ## Sora |
| 127 | 127 | |
| 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 | ::: | |
| 132 | 135 | |
| 133 | 136 | ## Suwatte |
| 134 | 137 | |