Commit 5a7e37c78e
Unsigned
Layout: unified · split
docs/.vitepress/theme/components/extrepo/ExtensionRepos.vue +1
| @@ -130,6 +130,7 @@ const filteredSites = computed(() => { | ||
| 130 | 130 | v-if="isFiltering" |
| 131 | 131 | class="ext-search-results" |
| 132 | 132 | :sites="filteredSites" |
| 133 | :scheme="scheme" | |
| 133 | 134 | empty-text="No sites match your filters." |
| 134 | 135 | /> |
| 135 | 136 | |
docs/.vitepress/theme/components/extrepo/RepoRow.vue +8 −5
| @@ -2,7 +2,7 @@ | ||
| 2 | 2 | import { computed, ref } from 'vue' |
| 3 | 3 | import { data } from '../../../../ext/extensionRepos.data' |
| 4 | 4 | import { stripHtml } from './helpers' |
| 5 | import { copyValue, installHref, isBrowseOnly, mangayomiCopyValue, mangayomiHref, mangayomiLiveContainerHref } from './install' | |
| 5 | import { copyValue, hasCopyButton, installHref, isBrowseOnly, mangayomiCopyValue, mangayomiHref, mangayomiLiveContainerHref } from './install' | |
| 6 | 6 | import SiteGrid from './SiteGrid.vue' |
| 7 | 7 | import type { Repo, RepoVariant } from './types' |
| 8 | 8 | |
| @@ -26,7 +26,10 @@ const sites = computed(() => { | ||
| 26 | 26 | return props.showBroken ? all : all.filter(site => !site.isBroken) |
| 27 | 27 | }) |
| 28 | 28 | const isExpandable = computed(() => !NOT_EXPANDABLE.has(stripHtml(props.repo.name))) |
| 29 | const installUrl = computed(() => installHref(props.scheme, props.repo)) | |
| 29 | const installUrl = computed(() => installHref(props.scheme, props.repo, { | |
| 30 | suwatteV6: repoData[props.repo.indexUrl]?.suwatteV6, | |
| 31 | suwatteListUrl: repoData[props.repo.indexUrl]?.suwatteListUrl | |
| 32 | })) | |
| 30 | 33 | // Browse-only schemes (e.g. Kotatsu forks) have no app to deep-link into, so install, |
| 31 | 34 | // copy, and livecontainer actions are hidden everywhere in this component. |
| 32 | 35 | const showActions = computed(() => !isBrowseOnly(props.scheme)) |
| @@ -112,7 +115,7 @@ function variantSites(variant: RepoVariant) { | ||
| 112 | 115 | <span class="i-lucide:download" /> |
| 113 | 116 | <span class="ext-btn-install-label">Install</span> |
| 114 | 117 | </a> |
| 115 | <button class="ext-btn ext-btn-copy" type="button" @click="copyUrl"> | |
| 118 | <button v-if="hasCopyButton(scheme)" class="ext-btn ext-btn-copy" type="button" @click="copyUrl"> | |
| 116 | 119 | <span v-if="copied" class="i-lucide:check" /> |
| 117 | 120 | <span v-else class="i-lucide:copy" /> |
| 118 | 121 | </button> |
| @@ -176,11 +179,11 @@ function variantSites(variant: RepoVariant) { | ||
| 176 | 179 | </div> |
| 177 | 180 | </div> |
| 178 | 181 | |
| 179 | <SiteGrid v-if="openVariants.has(variant.label)" :sites="variantSites(variant)" empty-text="No site data available." /> | |
| 182 | <SiteGrid v-if="openVariants.has(variant.label)" :sites="variantSites(variant)" :scheme="scheme" empty-text="No site data available." /> | |
| 180 | 183 | </div> |
| 181 | 184 | </div> |
| 182 | 185 | |
| 183 | <SiteGrid v-if="!repo.variants && isExpandable && open" :sites="sites" empty-text="No site data available." /> | |
| 186 | <SiteGrid v-if="!repo.variants && isExpandable && open" :sites="sites" :scheme="scheme" empty-text="No site data available." /> | |
| 184 | 187 | </div> |
| 185 | 188 | </template> |
| 186 | 189 | |
docs/.vitepress/theme/components/extrepo/SiteCell.vue +5 −2
| @@ -1,17 +1,20 @@ | ||
| 1 | 1 | <script setup lang="ts"> |
| 2 | 2 | import { ref } from 'vue' |
| 3 | 3 | import { langFlagClass, ratingIcon, ratingTitle } from './helpers' |
| 4 | import { hasCopyButton } from './install' | |
| 4 | 5 | import LazyIcon from './LazyIcon.vue' |
| 5 | 6 | import type { RepoSite } from './types' |
| 6 | 7 | |
| 7 | 8 | const props = defineProps<{ |
| 8 | 9 | site: RepoSite & { repoName?: string } |
| 10 | scheme?: string | |
| 9 | 11 | }>() |
| 10 | 12 | |
| 11 | 13 | const copied = ref(false) |
| 12 | 14 | |
| 13 | 15 | async function copyInstallUrl() { |
| 14 | const value = props.site.installUrl?.replace(/^sora:\/\/module\?url=/, '') | |
| 16 | const soraMatch = props.site.installUrl?.match(/^sora:\/\/module\?url=(.+)$/) | |
| 17 | const value = soraMatch ? soraMatch[1] : props.site.installUrl | |
| 15 | 18 | if (!value) return |
| 16 | 19 | await navigator.clipboard.writeText(value) |
| 17 | 20 | copied.value = true |
| @@ -40,7 +43,7 @@ async function copyInstallUrl() { | ||
| 40 | 43 | <a v-if="site.installUrl" class="ext-site-install-btn" :href="site.installUrl" :title="`Install ${site.name}`"> |
| 41 | 44 | <span class="i-lucide:download" /> |
| 42 | 45 | </a> |
| 43 | <button v-if="site.installUrl" class="ext-site-copy-btn" type="button" :title="`Copy ${site.name} url`" @click="copyInstallUrl"> | |
| 46 | <button v-if="site.installUrl && hasCopyButton(scheme ?? '')" class="ext-site-copy-btn" type="button" :title="`Copy ${site.name} url`" @click="copyInstallUrl"> | |
| 44 | 47 | <span v-if="copied" class="i-lucide:check" /> |
| 45 | 48 | <span v-else class="i-lucide:copy" /> |
| 46 | 49 | </button> |
docs/.vitepress/theme/components/extrepo/SiteGrid.vue +3 −2
| @@ -7,6 +7,7 @@ import type { RepoSite } from './types' | ||
| 7 | 7 | const props = defineProps<{ |
| 8 | 8 | sites: (RepoSite & { repoName?: string })[] |
| 9 | 9 | emptyText: string |
| 10 | scheme?: string | |
| 10 | 11 | }>() |
| 11 | 12 | |
| 12 | 13 | interface SiteGroup { |
| @@ -44,7 +45,7 @@ function toggleGroup(key: string) { | ||
| 44 | 45 | {{ emptyText }} |
| 45 | 46 | </div> |
| 46 | 47 | <template v-for="group in groups" :key="group.key"> |
| 47 | <SiteCell v-if="group.sites.length === 1" :site="group.sites[0]" /> | |
| 48 | <SiteCell v-if="group.sites.length === 1" :site="group.sites[0]" :scheme="scheme" /> | |
| 48 | 49 | <template v-else> |
| 49 | 50 | <SiteGroupCell |
| 50 | 51 | :sites="group.sites" |
| @@ -52,7 +53,7 @@ function toggleGroup(key: string) { | ||
| 52 | 53 | @toggle="toggleGroup(group.key)" |
| 53 | 54 | /> |
| 54 | 55 | <template v-if="openGroups.has(group.key)"> |
| 55 | <SiteCell v-for="site in group.sites" :key="`${group.key}-${site.lang}`" :site="site" /> | |
| 56 | <SiteCell v-for="site in group.sites" :key="`${group.key}-${site.lang}`" :site="site" :scheme="scheme" /> | |
| 56 | 57 | </template> |
| 57 | 58 | </template> |
| 58 | 59 | </template> |
docs/.vitepress/theme/components/extrepo/install.ts +27 −4
| @@ -5,9 +5,24 @@ export function paperbackBase(indexUrl: string): string { | ||
| 5 | 5 | return indexUrl.replace(/\/versioning\.json$/, '') |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | const INSTALL_URL_BUILDERS: Record<string, (repo: Repo) => string> = { | |
| 8 | export function suwatteBase(indexUrl: string): string { | |
| 9 | return indexUrl.replace(/\/sources\.json$/, '') | |
| 10 | } | |
| 11 | ||
| 12 | interface InstallOpts { | |
| 13 | suwatteV6?: boolean | |
| 14 | suwatteListUrl?: string | |
| 15 | } | |
| 16 | ||
| 17 | const INSTALL_URL_BUILDERS: Record<string, (repo: Repo, opts?: InstallOpts) => string> = { | |
| 9 | 18 | aidoku: repo => `aidoku://addSourceList?url=${repo.indexUrl}`, |
| 10 | 19 | paperback: repo => `paperback://addRepo?displayName=${encodeURIComponent(stripHtml(repo.name))}&url=${paperbackBase(repo.indexUrl)}`, |
| 20 | suwatte: (repo, opts) => { | |
| 21 | const listUrl = opts?.suwatteListUrl ?? suwatteBase(repo.indexUrl) | |
| 22 | return opts?.suwatteV6 | |
| 23 | ? `suwatte://list?url=${listUrl}` | |
| 24 | : `suwatte://AddSourceList?list=${encodeURIComponent(listUrl)}` | |
| 25 | }, | |
| 11 | 26 | cloudstreamrepo: repo => `cloudstreamrepo://${repo.indexUrl.replace(/^https?:\/\//, '')}`, |
| 12 | 27 | hayase: repo => `hayase://extensions/install?url=${repo.indexUrl}`, |
| 13 | 28 | legado: repo => `legado://import/bookSource?src=${repo.indexUrl}`, |
| @@ -20,19 +35,27 @@ const MANUAL_ONLY_SCHEMES = new Set(['manual']) | ||
| 20 | 35 | // Schemes with no install or copy action |
| 21 | 36 | const BROWSE_ONLY_SCHEMES = new Set(['kotatsu', 'sora']) |
| 22 | 37 | |
| 38 | const NO_COPY_SCHEMES = new Set(['suwatte']) | |
| 39 | ||
| 23 | 40 | export function isBrowseOnly(scheme: string): boolean { |
| 24 | 41 | return BROWSE_ONLY_SCHEMES.has(scheme) |
| 25 | 42 | } |
| 26 | 43 | |
| 27 | export function installHref(scheme: string, repo: Repo): string | null { | |
| 44 | export function hasCopyButton(scheme: string): boolean { | |
| 45 | return !NO_COPY_SCHEMES.has(scheme) | |
| 46 | } | |
| 47 | ||
| 48 | export function installHref(scheme: string, repo: Repo, opts?: InstallOpts): string | null { | |
| 28 | 49 | const build = INSTALL_URL_BUILDERS[scheme] |
| 29 | if (build) return build(repo) | |
| 50 | if (build) return build(repo, opts) | |
| 30 | 51 | if (MANUAL_ONLY_SCHEMES.has(scheme) || BROWSE_ONLY_SCHEMES.has(scheme)) return null |
| 31 | 52 | return `${scheme}://add-repo?url=${repo.indexUrl}` |
| 32 | 53 | } |
| 33 | 54 | |
| 34 | 55 | export function copyValue(scheme: string, indexUrl: string): string { |
| 35 | return scheme === 'paperback' ? paperbackBase(indexUrl) : indexUrl | |
| 56 | if (scheme === 'paperback') return paperbackBase(indexUrl) | |
| 57 | if (scheme === 'suwatte') return suwatteBase(indexUrl) | |
| 58 | return indexUrl | |
| 36 | 59 | } |
| 37 | 60 | |
| 38 | 61 | export function mangayomiHref(repo: Repo, variant: RepoVariant): string { |
docs/ext/extensionRepos.data.ts +53 −1
| @@ -19,6 +19,8 @@ export interface RepoSite { | ||
| 19 | 19 | |
| 20 | 20 | export interface RepoData { |
| 21 | 21 | sites: RepoSite[] |
| 22 | suwatteV6?: boolean | |
| 23 | suwatteListUrl?: string | |
| 22 | 24 | } |
| 23 | 25 | |
| 24 | 26 | interface MihonSource { |
| @@ -111,6 +113,20 @@ interface IReaderSource { | ||
| 111 | 113 | nsfw?: boolean |
| 112 | 114 | } |
| 113 | 115 | |
| 116 | interface SuwatteCatalogSource { | |
| 117 | name: string | |
| 118 | website?: string | |
| 119 | languages?: string[] | |
| 120 | thumbnail?: string | |
| 121 | path?: string | |
| 122 | } | |
| 123 | ||
| 124 | interface SuwatteCatalogIndex { | |
| 125 | listUrl?: string | |
| 126 | catalogVersion?: number | |
| 127 | sources: SuwatteCatalogSource[] | |
| 128 | } | |
| 129 | ||
| 114 | 130 | // For kotatsu |
| 115 | 131 | interface KotatsuSite { |
| 116 | 132 | name: string |
| @@ -435,6 +451,35 @@ function toRepoDataIReader(sources: IReaderSource[]): RepoSite[] { | ||
| 435 | 451 | return sites |
| 436 | 452 | } |
| 437 | 453 | |
| 454 | function toRepoDataSuwatte(iconBase: string, index: SuwatteCatalogIndex): { sites: RepoSite[]; listUrl: string } { | |
| 455 | const seen = new Set<string>() | |
| 456 | const sites: RepoSite[] = [] | |
| 457 | ||
| 458 | const listUrl = index.listUrl ?? iconBase | |
| 459 | const isV6 = index.catalogVersion === undefined | |
| 460 | ||
| 461 | for (const source of index.sources ?? []) { | |
| 462 | const langs = source.languages?.length ? source.languages : ['all'] | |
| 463 | const icon = source.thumbnail | |
| 464 | ? (/^https?:\/\//i.test(source.thumbnail) ? source.thumbnail : `${iconBase}/assets/${source.thumbnail}`) | |
| 465 | : '' | |
| 466 | const installUrl = source.path | |
| 467 | ? (isV6 | |
| 468 | ? `suwatte://runner?url=${listUrl}&runner=${source.path}` | |
| 469 | : `suwatte://AddSourceFromList?list=${listUrl}&source=${source.path}`) | |
| 470 | : undefined | |
| 471 | for (const rawLang of langs) { | |
| 472 | const lang = normalizeLang(rawLang) | |
| 473 | const key = `${source.name}::${lang}` | |
| 474 | if (seen.has(key)) continue | |
| 475 | seen.add(key) | |
| 476 | sites.push({ name: source.name, lang, icon, url: source.website ?? '', rating: 'safe', installUrl }) | |
| 477 | } | |
| 478 | } | |
| 479 | ||
| 480 | return { sites, listUrl } | |
| 481 | } | |
| 482 | ||
| 438 | 483 | function toRepoDataKotatsu(index: KotatsuIndex): RepoSite[] { |
| 439 | 484 | const seen = new Set<string>() |
| 440 | 485 | const sites: RepoSite[] = [] |
| @@ -541,6 +586,8 @@ function toRepoDataLNReader(plugins: LNReaderPlugin[]): RepoSite[] { | ||
| 541 | 586 | async function toRepoData(indexUrl: string, json: unknown): Promise<RepoData> { |
| 542 | 587 | const iconBase = indexUrl.slice(0, indexUrl.lastIndexOf('/')) |
| 543 | 588 | let sites: RepoSite[] |
| 589 | let suwatteV6: boolean | undefined | |
| 590 | let suwatteListUrl: string | undefined | |
| 544 | 591 | if (Array.isArray(json)) { |
| 545 | 592 | const first = json[0] as Record<string, unknown> | undefined |
| 546 | 593 | if (first && 'bookSourceUrl' in first) { |
| @@ -564,13 +611,18 @@ async function toRepoData(indexUrl: string, json: unknown): Promise<RepoData> { | ||
| 564 | 611 | sites = await toRepoDataCloudstream(json as CloudstreamRepo) |
| 565 | 612 | } else if ((json as AidokuIndex).sources?.length && 'iconURL' in (json as AidokuIndex).sources[0]) { |
| 566 | 613 | sites = toRepoDataAidoku(iconBase, json as AidokuIndex) |
| 614 | } else if ((json as SuwatteCatalogIndex).sources?.length && 'thumbnail' in (json as SuwatteCatalogIndex).sources[0]) { | |
| 615 | const result = toRepoDataSuwatte(iconBase, json as SuwatteCatalogIndex) | |
| 616 | sites = result.sites | |
| 617 | suwatteListUrl = result.listUrl | |
| 618 | suwatteV6 = (json as SuwatteCatalogIndex).catalogVersion === undefined | |
| 567 | 619 | } else if (Array.isArray((json as KotatsuIndex).sites)) { |
| 568 | 620 | sites = toRepoDataKotatsu(json as KotatsuIndex) |
| 569 | 621 | } else { |
| 570 | 622 | sites = toRepoDataPaperback(iconBase, json as PaperbackIndex) |
| 571 | 623 | } |
| 572 | 624 | sites.sort((a, b) => a.name.localeCompare(b.name)) |
| 573 | return { sites } | |
| 625 | return { sites, suwatteV6, suwatteListUrl } | |
| 574 | 626 | } |
| 575 | 627 | |
| 576 | 628 | export interface ExtensionRepoData { |
docs/ext/ios.md +28 −14
| @@ -134,19 +134,33 @@ You can install v0.8 extensions in the v0.9 Paperback client, but you can't inst | ||
| 134 | 134 | |
| 135 | 135 | ## Suwatte |
| 136 | 136 | |
| 137 | ::: tabs | |
| 138 | ||
| 139 | == v6 | |
| 140 | | Name | Region | Auto | | |
| 141 | | - | - | - | | |
| 142 | | [Mantton](https://aegir.mantton.com/) | :len: | [Install](suwatte://list?url=https://aegir.mantton.com) | | |
| 143 | | [Jishnu](https://jishnusen.github.io/SuwatteSources/) [:src:](https://github.com/jishnusen/SuwatteSources) | :global: | [Install](suwatte://list?url=https://jishnusen.github.io/SuwatteSources) | | |
| 144 | | [Seb](https://sebzzzzzzzzzzzzzzzz.github.io/sources/) | :global: | [Install](suwatte://list?url=https://sebzzzzzzzzzzzzzzzz.github.io/sources) | | |
| 145 | | [Community](https://community.suwatte.app/) | :global: | [Install](suwatte://list?url=https://community.suwatte.app) | | |
| 146 | ||
| 147 | == v7 | |
| 148 | | Name | Region | Auto | | |
| 149 | | - | - | - | | |
| 150 | | [Bergelmir](https://bergelmir.mantton.com/) | :global: | [Install](suwatte://list?url=https://bergelmir.mantton.com/) | | |
| 137 | ::: extrepo {scheme=suwatte} | |
| 138 | ||
| 139 | == Mantton | |
| 140 | - url: https://aegir.mantton.com/ | |
| 141 | - raw: https://kotatsu-83g.pages.dev/aegir.json | |
| 142 | ||
| 143 | == Jishnu | |
| 144 | - url: https://jishnusen.github.io/SuwatteSources/ | |
| 145 | - src: https://github.com/jishnusen/SuwatteSources | |
| 146 | - raw: https://kotatsu-83g.pages.dev/jishnu.json | |
| 147 | ||
| 148 | == Seb | |
| 149 | - url: https://sebzzzzzzzzzzzzzzzz.github.io/sources/ | |
| 150 | - raw: https://kotatsu-83g.pages.dev/seb.json | |
| 151 | ||
| 152 | == Community | |
| 153 | - url: https://community.suwatte.app/ | |
| 154 | - raw: https://kotatsu-83g.pages.dev/suwatte-community.json | |
| 155 | ||
| 156 | ::: | |
| 157 | ||
| 158 | ## Suwatte (v7) | |
| 159 | ||
| 160 | ::: extrepo {scheme=suwatte} | |
| 161 | ||
| 162 | == Bergelmir | |
| 163 | - url: https://bergelmir.mantton.com/ | |
| 164 | - raw: https://bergelmir.mantton.com/sources.json | |
| 151 | 165 | |
| 152 | 166 | ::: |
| \ No newline at end of file | ||