Commit 5a7e37c78e

5a7e37c78ed279572018ccb486521d0155512d62

parent: bf834e9100

Unsigned

Duck <57977673+woducku@users.noreply.github.com> · 2026-07-14 07:20 UTC

Suwatte

Layout: unified · split

docs/.vitepress/theme/components/extrepo/ExtensionRepos.vue +1
@@ -130,6 +130,7 @@ const filteredSites = computed(() => {
130130 v-if="isFiltering"
131131 class="ext-search-results"
132132 :sites="filteredSites"
133 :scheme="scheme"
133134 empty-text="No sites match your filters."
134135 />
135136
docs/.vitepress/theme/components/extrepo/RepoRow.vue +8 −5
@@ -2,7 +2,7 @@
22import { computed, ref } from 'vue'
33import { data } from '../../../../ext/extensionRepos.data'
44import { stripHtml } from './helpers'
5import { copyValue, installHref, isBrowseOnly, mangayomiCopyValue, mangayomiHref, mangayomiLiveContainerHref } from './install'
5import { copyValue, hasCopyButton, installHref, isBrowseOnly, mangayomiCopyValue, mangayomiHref, mangayomiLiveContainerHref } from './install'
66import SiteGrid from './SiteGrid.vue'
77import type { Repo, RepoVariant } from './types'
88
@@ -26,7 +26,10 @@ const sites = computed(() => {
2626 return props.showBroken ? all : all.filter(site => !site.isBroken)
2727})
2828const isExpandable = computed(() => !NOT_EXPANDABLE.has(stripHtml(props.repo.name)))
29const installUrl = computed(() => installHref(props.scheme, props.repo))
29const installUrl = computed(() => installHref(props.scheme, props.repo, {
30 suwatteV6: repoData[props.repo.indexUrl]?.suwatteV6,
31 suwatteListUrl: repoData[props.repo.indexUrl]?.suwatteListUrl
32}))
3033// Browse-only schemes (e.g. Kotatsu forks) have no app to deep-link into, so install,
3134// copy, and livecontainer actions are hidden everywhere in this component.
3235const showActions = computed(() => !isBrowseOnly(props.scheme))
@@ -112,7 +115,7 @@ function variantSites(variant: RepoVariant) {
112115 <span class="i-lucide:download" />
113116 <span class="ext-btn-install-label">Install</span>
114117 </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">
116119 <span v-if="copied" class="i-lucide:check" />
117120 <span v-else class="i-lucide:copy" />
118121 </button>
@@ -176,11 +179,11 @@ function variantSites(variant: RepoVariant) {
176179 </div>
177180 </div>
178181
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." />
180183 </div>
181184 </div>
182185
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." />
184187 </div>
185188</template>
186189
docs/.vitepress/theme/components/extrepo/SiteCell.vue +5 −2
@@ -1,17 +1,20 @@
11<script setup lang="ts">
22import { ref } from 'vue'
33import { langFlagClass, ratingIcon, ratingTitle } from './helpers'
4import { hasCopyButton } from './install'
45import LazyIcon from './LazyIcon.vue'
56import type { RepoSite } from './types'
67
78const props = defineProps<{
89 site: RepoSite & { repoName?: string }
10 scheme?: string
911}>()
1012
1113const copied = ref(false)
1214
1315async 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
1518 if (!value) return
1619 await navigator.clipboard.writeText(value)
1720 copied.value = true
@@ -40,7 +43,7 @@ async function copyInstallUrl() {
4043 <a v-if="site.installUrl" class="ext-site-install-btn" :href="site.installUrl" :title="`Install ${site.name}`">
4144 <span class="i-lucide:download" />
4245 </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">
4447 <span v-if="copied" class="i-lucide:check" />
4548 <span v-else class="i-lucide:copy" />
4649 </button>
docs/.vitepress/theme/components/extrepo/SiteGrid.vue +3 −2
@@ -7,6 +7,7 @@ import type { RepoSite } from './types'
77const props = defineProps<{
88 sites: (RepoSite & { repoName?: string })[]
99 emptyText: string
10 scheme?: string
1011}>()
1112
1213interface SiteGroup {
@@ -44,7 +45,7 @@ function toggleGroup(key: string) {
4445 {{ emptyText }}
4546 </div>
4647 <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" />
4849 <template v-else>
4950 <SiteGroupCell
5051 :sites="group.sites"
@@ -52,7 +53,7 @@ function toggleGroup(key: string) {
5253 @toggle="toggleGroup(group.key)"
5354 />
5455 <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" />
5657 </template>
5758 </template>
5859 </template>
docs/.vitepress/theme/components/extrepo/install.ts +27 −4
@@ -5,9 +5,24 @@ export function paperbackBase(indexUrl: string): string {
55 return indexUrl.replace(/\/versioning\.json$/, '')
66}
77
8const INSTALL_URL_BUILDERS: Record<string, (repo: Repo) => string> = {
8export function suwatteBase(indexUrl: string): string {
9 return indexUrl.replace(/\/sources\.json$/, '')
10}
11
12interface InstallOpts {
13 suwatteV6?: boolean
14 suwatteListUrl?: string
15}
16
17const INSTALL_URL_BUILDERS: Record<string, (repo: Repo, opts?: InstallOpts) => string> = {
918 aidoku: repo => `aidoku://addSourceList?url=${repo.indexUrl}`,
1019 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 },
1126 cloudstreamrepo: repo => `cloudstreamrepo://${repo.indexUrl.replace(/^https?:\/\//, '')}`,
1227 hayase: repo => `hayase://extensions/install?url=${repo.indexUrl}`,
1328 legado: repo => `legado://import/bookSource?src=${repo.indexUrl}`,
@@ -20,19 +35,27 @@ const MANUAL_ONLY_SCHEMES = new Set(['manual'])
2035// Schemes with no install or copy action
2136const BROWSE_ONLY_SCHEMES = new Set(['kotatsu', 'sora'])
2237
38const NO_COPY_SCHEMES = new Set(['suwatte'])
39
2340export function isBrowseOnly(scheme: string): boolean {
2441 return BROWSE_ONLY_SCHEMES.has(scheme)
2542}
2643
27export function installHref(scheme: string, repo: Repo): string | null {
44export function hasCopyButton(scheme: string): boolean {
45 return !NO_COPY_SCHEMES.has(scheme)
46}
47
48export function installHref(scheme: string, repo: Repo, opts?: InstallOpts): string | null {
2849 const build = INSTALL_URL_BUILDERS[scheme]
29 if (build) return build(repo)
50 if (build) return build(repo, opts)
3051 if (MANUAL_ONLY_SCHEMES.has(scheme) || BROWSE_ONLY_SCHEMES.has(scheme)) return null
3152 return `${scheme}://add-repo?url=${repo.indexUrl}`
3253}
3354
3455export 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
3659}
3760
3861export function mangayomiHref(repo: Repo, variant: RepoVariant): string {
docs/ext/extensionRepos.data.ts +53 −1
@@ -19,6 +19,8 @@ export interface RepoSite {
1919
2020export interface RepoData {
2121 sites: RepoSite[]
22 suwatteV6?: boolean
23 suwatteListUrl?: string
2224}
2325
2426interface MihonSource {
@@ -111,6 +113,20 @@ interface IReaderSource {
111113 nsfw?: boolean
112114}
113115
116interface SuwatteCatalogSource {
117 name: string
118 website?: string
119 languages?: string[]
120 thumbnail?: string
121 path?: string
122}
123
124interface SuwatteCatalogIndex {
125 listUrl?: string
126 catalogVersion?: number
127 sources: SuwatteCatalogSource[]
128}
129
114130// For kotatsu
115131interface KotatsuSite {
116132 name: string
@@ -435,6 +451,35 @@ function toRepoDataIReader(sources: IReaderSource[]): RepoSite[] {
435451 return sites
436452}
437453
454function 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
438483function toRepoDataKotatsu(index: KotatsuIndex): RepoSite[] {
439484 const seen = new Set<string>()
440485 const sites: RepoSite[] = []
@@ -541,6 +586,8 @@ function toRepoDataLNReader(plugins: LNReaderPlugin[]): RepoSite[] {
541586async function toRepoData(indexUrl: string, json: unknown): Promise<RepoData> {
542587 const iconBase = indexUrl.slice(0, indexUrl.lastIndexOf('/'))
543588 let sites: RepoSite[]
589 let suwatteV6: boolean | undefined
590 let suwatteListUrl: string | undefined
544591 if (Array.isArray(json)) {
545592 const first = json[0] as Record<string, unknown> | undefined
546593 if (first && 'bookSourceUrl' in first) {
@@ -564,13 +611,18 @@ async function toRepoData(indexUrl: string, json: unknown): Promise<RepoData> {
564611 sites = await toRepoDataCloudstream(json as CloudstreamRepo)
565612 } else if ((json as AidokuIndex).sources?.length && 'iconURL' in (json as AidokuIndex).sources[0]) {
566613 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
567619 } else if (Array.isArray((json as KotatsuIndex).sites)) {
568620 sites = toRepoDataKotatsu(json as KotatsuIndex)
569621 } else {
570622 sites = toRepoDataPaperback(iconBase, json as PaperbackIndex)
571623 }
572624 sites.sort((a, b) => a.name.localeCompare(b.name))
573 return { sites }
625 return { sites, suwatteV6, suwatteListUrl }
574626}
575627
576628export 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
134134
135135## Suwatte
136136
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
151165
152166:::
\ No newline at end of file