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(() => {
130 v-if="isFiltering" 130 v-if="isFiltering"
131 class="ext-search-results" 131 class="ext-search-results"
132 :sites="filteredSites" 132 :sites="filteredSites"
133 :scheme="scheme"
133 empty-text="No sites match your filters." 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 @@
2import { computed, ref } from 'vue' 2import { computed, ref } from 'vue'
3import { data } from '../../../../ext/extensionRepos.data' 3import { data } from '../../../../ext/extensionRepos.data'
4import { stripHtml } from './helpers' 4import { stripHtml } from './helpers'
5import { copyValue, installHref, isBrowseOnly, mangayomiCopyValue, mangayomiHref, mangayomiLiveContainerHref } from './install' 5import { copyValue, hasCopyButton, installHref, isBrowseOnly, mangayomiCopyValue, mangayomiHref, mangayomiLiveContainerHref } from './install'
6import SiteGrid from './SiteGrid.vue' 6import SiteGrid from './SiteGrid.vue'
7import type { Repo, RepoVariant } from './types' 7import type { Repo, RepoVariant } from './types'
8 8
@@ -26,7 +26,10 @@ const sites = computed(() => {
26 return props.showBroken ? all : all.filter(site => !site.isBroken) 26 return props.showBroken ? all : all.filter(site => !site.isBroken)
27}) 27})
28const isExpandable = computed(() => !NOT_EXPANDABLE.has(stripHtml(props.repo.name))) 28const 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}))
30// Browse-only schemes (e.g. Kotatsu forks) have no app to deep-link into, so install, 33// Browse-only schemes (e.g. Kotatsu forks) have no app to deep-link into, so install,
31// copy, and livecontainer actions are hidden everywhere in this component. 34// copy, and livecontainer actions are hidden everywhere in this component.
32const showActions = computed(() => !isBrowseOnly(props.scheme)) 35const showActions = computed(() => !isBrowseOnly(props.scheme))
@@ -112,7 +115,7 @@ function variantSites(variant: RepoVariant) {
112 <span class="i-lucide:download" /> 115 <span class="i-lucide:download" />
113 <span class="ext-btn-install-label">Install</span> 116 <span class="ext-btn-install-label">Install</span>
114 </a> 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 <span v-if="copied" class="i-lucide:check" /> 119 <span v-if="copied" class="i-lucide:check" />
117 <span v-else class="i-lucide:copy" /> 120 <span v-else class="i-lucide:copy" />
118 </button> 121 </button>
@@ -176,11 +179,11 @@ function variantSites(variant: RepoVariant) {
176 </div> 179 </div>
177 </div> 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 </div> 183 </div>
181 </div> 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 </div> 187 </div>
185</template> 188</template>
186 189
docs/.vitepress/theme/components/extrepo/SiteCell.vue +5 −2
@@ -1,17 +1,20 @@
1<script setup lang="ts"> 1<script setup lang="ts">
2import { ref } from 'vue' 2import { ref } from 'vue'
3import { langFlagClass, ratingIcon, ratingTitle } from './helpers' 3import { langFlagClass, ratingIcon, ratingTitle } from './helpers'
4import { hasCopyButton } from './install'
4import LazyIcon from './LazyIcon.vue' 5import LazyIcon from './LazyIcon.vue'
5import type { RepoSite } from './types' 6import type { RepoSite } from './types'
6 7
7const props = defineProps<{ 8const props = defineProps<{
8 site: RepoSite & { repoName?: string } 9 site: RepoSite & { repoName?: string }
10 scheme?: string
9}>() 11}>()
10 12
11const copied = ref(false) 13const copied = ref(false)
12 14
13async function copyInstallUrl() { 15async 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 if (!value) return 18 if (!value) return
16 await navigator.clipboard.writeText(value) 19 await navigator.clipboard.writeText(value)
17 copied.value = true 20 copied.value = true
@@ -40,7 +43,7 @@ async function copyInstallUrl() {
40 <a v-if="site.installUrl" class="ext-site-install-btn" :href="site.installUrl" :title="`Install ${site.name}`"> 43 <a v-if="site.installUrl" class="ext-site-install-btn" :href="site.installUrl" :title="`Install ${site.name}`">
41 <span class="i-lucide:download" /> 44 <span class="i-lucide:download" />
42 </a> 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 <span v-if="copied" class="i-lucide:check" /> 47 <span v-if="copied" class="i-lucide:check" />
45 <span v-else class="i-lucide:copy" /> 48 <span v-else class="i-lucide:copy" />
46 </button> 49 </button>
docs/.vitepress/theme/components/extrepo/SiteGrid.vue +3 −2
@@ -7,6 +7,7 @@ import type { RepoSite } from './types'
7const props = defineProps<{ 7const props = defineProps<{
8 sites: (RepoSite & { repoName?: string })[] 8 sites: (RepoSite & { repoName?: string })[]
9 emptyText: string 9 emptyText: string
10 scheme?: string
10}>() 11}>()
11 12
12interface SiteGroup { 13interface SiteGroup {
@@ -44,7 +45,7 @@ function toggleGroup(key: string) {
44 {{ emptyText }} 45 {{ emptyText }}
45 </div> 46 </div>
46 <template v-for="group in groups" :key="group.key"> 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 <template v-else> 49 <template v-else>
49 <SiteGroupCell 50 <SiteGroupCell
50 :sites="group.sites" 51 :sites="group.sites"
@@ -52,7 +53,7 @@ function toggleGroup(key: string) {
52 @toggle="toggleGroup(group.key)" 53 @toggle="toggleGroup(group.key)"
53 /> 54 />
54 <template v-if="openGroups.has(group.key)"> 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 </template> 57 </template>
57 </template> 58 </template>
58 </template> 59 </template>
docs/.vitepress/theme/components/extrepo/install.ts +27 −4
@@ -5,9 +5,24 @@ export function paperbackBase(indexUrl: string): string {
5 return indexUrl.replace(/\/versioning\.json$/, '') 5 return indexUrl.replace(/\/versioning\.json$/, '')
6} 6}
7 7
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> = {
9 aidoku: repo => `aidoku://addSourceList?url=${repo.indexUrl}`, 18 aidoku: repo => `aidoku://addSourceList?url=${repo.indexUrl}`,
10 paperback: repo => `paperback://addRepo?displayName=${encodeURIComponent(stripHtml(repo.name))}&url=${paperbackBase(repo.indexUrl)}`, 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 cloudstreamrepo: repo => `cloudstreamrepo://${repo.indexUrl.replace(/^https?:\/\//, '')}`, 26 cloudstreamrepo: repo => `cloudstreamrepo://${repo.indexUrl.replace(/^https?:\/\//, '')}`,
12 hayase: repo => `hayase://extensions/install?url=${repo.indexUrl}`, 27 hayase: repo => `hayase://extensions/install?url=${repo.indexUrl}`,
13 legado: repo => `legado://import/bookSource?src=${repo.indexUrl}`, 28 legado: repo => `legado://import/bookSource?src=${repo.indexUrl}`,
@@ -20,19 +35,27 @@ const MANUAL_ONLY_SCHEMES = new Set(['manual'])
20// Schemes with no install or copy action 35// Schemes with no install or copy action
21const BROWSE_ONLY_SCHEMES = new Set(['kotatsu', 'sora']) 36const BROWSE_ONLY_SCHEMES = new Set(['kotatsu', 'sora'])
22 37
38const NO_COPY_SCHEMES = new Set(['suwatte'])
39
23export function isBrowseOnly(scheme: string): boolean { 40export function isBrowseOnly(scheme: string): boolean {
24 return BROWSE_ONLY_SCHEMES.has(scheme) 41 return BROWSE_ONLY_SCHEMES.has(scheme)
25} 42}
26 43
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 {
28 const build = INSTALL_URL_BUILDERS[scheme] 49 const build = INSTALL_URL_BUILDERS[scheme]
29 if (build) return build(repo) 50 if (build) return build(repo, opts)
30 if (MANUAL_ONLY_SCHEMES.has(scheme) || BROWSE_ONLY_SCHEMES.has(scheme)) return null 51 if (MANUAL_ONLY_SCHEMES.has(scheme) || BROWSE_ONLY_SCHEMES.has(scheme)) return null
31 return `${scheme}://add-repo?url=${repo.indexUrl}` 52 return `${scheme}://add-repo?url=${repo.indexUrl}`
32} 53}
33 54
34export function copyValue(scheme: string, indexUrl: string): string { 55export 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
38export function mangayomiHref(repo: Repo, variant: RepoVariant): string { 61export function mangayomiHref(repo: Repo, variant: RepoVariant): string {
docs/ext/extensionRepos.data.ts +53 −1
@@ -19,6 +19,8 @@ export interface RepoSite {
19 19
20export interface RepoData { 20export interface RepoData {
21 sites: RepoSite[] 21 sites: RepoSite[]
22 suwatteV6?: boolean
23 suwatteListUrl?: string
22} 24}
23 25
24interface MihonSource { 26interface MihonSource {
@@ -111,6 +113,20 @@ interface IReaderSource {
111 nsfw?: boolean 113 nsfw?: boolean
112} 114}
113 115
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
114// For kotatsu 130// For kotatsu
115interface KotatsuSite { 131interface KotatsuSite {
116 name: string 132 name: string
@@ -435,6 +451,35 @@ function toRepoDataIReader(sources: IReaderSource[]): RepoSite[] {
435 return sites 451 return sites
436} 452}
437 453
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
438function toRepoDataKotatsu(index: KotatsuIndex): RepoSite[] { 483function toRepoDataKotatsu(index: KotatsuIndex): RepoSite[] {
439 const seen = new Set<string>() 484 const seen = new Set<string>()
440 const sites: RepoSite[] = [] 485 const sites: RepoSite[] = []
@@ -541,6 +586,8 @@ function toRepoDataLNReader(plugins: LNReaderPlugin[]): RepoSite[] {
541async function toRepoData(indexUrl: string, json: unknown): Promise<RepoData> { 586async function toRepoData(indexUrl: string, json: unknown): Promise<RepoData> {
542 const iconBase = indexUrl.slice(0, indexUrl.lastIndexOf('/')) 587 const iconBase = indexUrl.slice(0, indexUrl.lastIndexOf('/'))
543 let sites: RepoSite[] 588 let sites: RepoSite[]
589 let suwatteV6: boolean | undefined
590 let suwatteListUrl: string | undefined
544 if (Array.isArray(json)) { 591 if (Array.isArray(json)) {
545 const first = json[0] as Record<string, unknown> | undefined 592 const first = json[0] as Record<string, unknown> | undefined
546 if (first && 'bookSourceUrl' in first) { 593 if (first && 'bookSourceUrl' in first) {
@@ -564,13 +611,18 @@ async function toRepoData(indexUrl: string, json: unknown): Promise<RepoData> {
564 sites = await toRepoDataCloudstream(json as CloudstreamRepo) 611 sites = await toRepoDataCloudstream(json as CloudstreamRepo)
565 } else if ((json as AidokuIndex).sources?.length && 'iconURL' in (json as AidokuIndex).sources[0]) { 612 } else if ((json as AidokuIndex).sources?.length && 'iconURL' in (json as AidokuIndex).sources[0]) {
566 sites = toRepoDataAidoku(iconBase, json as AidokuIndex) 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 } else if (Array.isArray((json as KotatsuIndex).sites)) { 619 } else if (Array.isArray((json as KotatsuIndex).sites)) {
568 sites = toRepoDataKotatsu(json as KotatsuIndex) 620 sites = toRepoDataKotatsu(json as KotatsuIndex)
569 } else { 621 } else {
570 sites = toRepoDataPaperback(iconBase, json as PaperbackIndex) 622 sites = toRepoDataPaperback(iconBase, json as PaperbackIndex)
571 } 623 }
572 sites.sort((a, b) => a.name.localeCompare(b.name)) 624 sites.sort((a, b) => a.name.localeCompare(b.name))
573 return { sites } 625 return { sites, suwatteV6, suwatteListUrl }
574} 626}
575 627
576export interface ExtensionRepoData { 628export 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## Suwatte 135## Suwatte
136 136
137::: tabs 137::: extrepo {scheme=suwatte}
138 138
139== v6 139== Mantton
140| Name | Region | Auto | 140- url: https://aegir.mantton.com/
141| - | - | - | 141- raw: https://kotatsu-83g.pages.dev/aegir.json
142| [Mantton](https://aegir.mantton.com/) | :len: | [Install](suwatte://list?url=https://aegir.mantton.com) | 142
143| [Jishnu](https://jishnusen.github.io/SuwatteSources/) [:src:](https://github.com/jishnusen/SuwatteSources) | :global: | [Install](suwatte://list?url=https://jishnusen.github.io/SuwatteSources) | 143== Jishnu
144| [Seb](https://sebzzzzzzzzzzzzzzzz.github.io/sources/) | :global: | [Install](suwatte://list?url=https://sebzzzzzzzzzzzzzzzz.github.io/sources) | 144- url: https://jishnusen.github.io/SuwatteSources/
145| [Community](https://community.suwatte.app/) | :global: | [Install](suwatte://list?url=https://community.suwatte.app) | 145- src: https://github.com/jishnusen/SuwatteSources
146 146- raw: https://kotatsu-83g.pages.dev/jishnu.json
147== v7 147
148| Name | Region | Auto | 148== Seb
149| - | - | - | 149- url: https://sebzzzzzzzzzzzzzzzz.github.io/sources/
150| [Bergelmir](https://bergelmir.mantton.com/) | :global: | [Install](suwatte://list?url=https://bergelmir.mantton.com/) | 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:::\ No newline at end of file 166:::\ No newline at end of file