Commit fa0699037e
Unsigned
Layout: unified · split
docs/.vitepress/configs/markdown/langFlags.ts +3
| @@ -7,6 +7,7 @@ | |||
| 7 | export const LANG_FLAG_ICONS: Record<string, string> = { | 7 | export const LANG_FLAG_ICONS: Record<string, string> = { |
| 8 | all: 'globe-showing-asia-australia', | 8 | all: 'globe-showing-asia-australia', |
| 9 | en: 'flag-united-kingdom', | 9 | en: 'flag-united-kingdom', |
| 10 | us: 'flag-for-flag-united-states', | ||
| 10 | ja: 'flag-japan', | 11 | ja: 'flag-japan', |
| 11 | zh: 'flag-china', | 12 | zh: 'flag-china', |
| 12 | 'zh-hans': 'flag-china', | 13 | 'zh-hans': 'flag-china', |
| @@ -25,9 +26,11 @@ export const LANG_FLAG_ICONS: Record<string, string> = { | |||
| 25 | ar: 'flag-saudi-arabia', | 26 | ar: 'flag-saudi-arabia', |
| 26 | vi: 'flag-vietnam', | 27 | vi: 'flag-vietnam', |
| 27 | id: 'flag-indonesia', | 28 | id: 'flag-indonesia', |
| 29 | in: 'flag-indonesia', | ||
| 28 | jv: 'flag-indonesia', | 30 | jv: 'flag-indonesia', |
| 29 | ms: 'flag-malaysia', | 31 | ms: 'flag-malaysia', |
| 30 | tr: 'flag-turkiye', | 32 | tr: 'flag-turkiye', |
| 33 | tu: 'flag-turkiye', | ||
| 31 | pl: 'flag-poland', | 34 | pl: 'flag-poland', |
| 32 | nl: 'flag-netherlands', | 35 | nl: 'flag-netherlands', |
| 33 | cs: 'flag-czechia', | 36 | cs: 'flag-czechia', |
docs/.vitepress/theme/components/extrepo/ContentTypeFilter.vue +13 −6
| @@ -5,11 +5,18 @@ import { contentTypeLabel } from './helpers' | |||
| 5 | import MenuHelp from '../settings/MenuHelp.vue' | 5 | import MenuHelp from '../settings/MenuHelp.vue' |
| 6 | import MenuTitle from '../settings/MenuTitle.vue' | 6 | import MenuTitle from '../settings/MenuTitle.vue' |
| 7 | 7 | ||
| 8 | const props = defineProps<{ | 8 | const props = withDefaults(defineProps<{ |
| 9 | // Excluded type values; empty means nothing is excluded, so everything is shown. | 9 | // Excluded type values; empty means nothing is excluded, so everything is shown. |
| 10 | modelValue: Set<string> | 10 | modelValue: Set<string> |
| 11 | availableTypes: string[] | 11 | availableTypes: string[] |
| 12 | }>() | 12 | title?: string |
| 13 | icon?: string | ||
| 14 | helpText?: string | ||
| 15 | }>(), { | ||
| 16 | title: 'Content Type', | ||
| 17 | icon: 'i-lucide:tags', | ||
| 18 | helpText: 'Shows or hides specific content types. Unchecking a type hides matching entries from the list.' | ||
| 19 | }) | ||
| 13 | 20 | ||
| 14 | const emit = defineEmits<{ | 21 | const emit = defineEmits<{ |
| 15 | 'update:modelValue': [value: Set<string>] | 22 | 'update:modelValue': [value: Set<string>] |
| @@ -48,18 +55,18 @@ onUnmounted(() => document.removeEventListener('click', onDocClick, true)) | |||
| 48 | <template> | 55 | <template> |
| 49 | <div ref="rootRef" class="ext-ctype-select" :class="{ 'ext-ctype-select--open': open }"> | 56 | <div ref="rootRef" class="ext-ctype-select" :class="{ 'ext-ctype-select--open': open }"> |
| 50 | <div ref="menuTitleElementRef" relative flex items-center mb-2> | 57 | <div ref="menuTitleElementRef" relative flex items-center mb-2> |
| 51 | <MenuTitle title="Content Type" aria-label="Content Type" flex="1" pr-4> | 58 | <MenuTitle :title="title" :aria-label="title" flex="1" pr-4> |
| 52 | <template #icon> | 59 | <template #icon> |
| 53 | <span i-lucide:tags mr-1 aria-hidden="true" /> | 60 | <span :class="icon" mr-1 aria-hidden="true" /> |
| 54 | </template> | 61 | </template> |
| 55 | </MenuTitle> | 62 | </MenuTitle> |
| 56 | <MenuHelp | 63 | <MenuHelp |
| 57 | v-model:is-popped-up="isMenuHelpPoppedUp" | 64 | v-model:is-popped-up="isMenuHelpPoppedUp" |
| 58 | :menu-title-element-ref="menuTitleElementRef" | 65 | :menu-title-element-ref="menuTitleElementRef" |
| 59 | > | 66 | > |
| 60 | <h4 text-md mb-1 font-semibold>Content Type</h4> | 67 | <h4 text-md mb-1 font-semibold>{{ title }}</h4> |
| 61 | <p text="sm" mb-2 max-w-100> | 68 | <p text="sm" mb-2 max-w-100> |
| 62 | Shows or hides specific content types. Unchecking a type hides matching entries from the list. | 69 | {{ helpText }} |
| 63 | </p> | 70 | </p> |
| 64 | </MenuHelp> | 71 | </MenuHelp> |
| 65 | </div> | 72 | </div> |
docs/.vitepress/theme/components/extrepo/ExtensionRepos.vue +27 −7
| @@ -31,12 +31,7 @@ const resolvedRepos = computed<Repo[]>(() => { | |||
| 31 | const name = author.repoUrl | 31 | const name = author.repoUrl |
| 32 | ? `<a href="${author.repoUrl}" target="_blank" rel="noopener noreferrer">${escapeHtml(author.label)}</a>` | 32 | ? `<a href="${author.repoUrl}" target="_blank" rel="noopener noreferrer">${escapeHtml(author.label)}</a>` |
| 33 | : escapeHtml(author.label) | 33 | : escapeHtml(author.label) |
| 34 | result.push({ | 34 | result.push({ name, indexUrl: author.indexUrl, repoName: author.label }) |
| 35 | name, | ||
| 36 | indexUrl: `${repo.indexUrl}#${author.label}`, | ||
| 37 | repoName: author.label, | ||
| 38 | variants: author.types.map(t => ({ label: t.label, mangaUrl: t.indexUrl })) | ||
| 39 | }) | ||
| 40 | } | 35 | } |
| 41 | } | 36 | } |
| 42 | return result | 37 | return result |
| @@ -46,6 +41,8 @@ const query = ref('') | |||
| 46 | const langFilter = ref('') | 41 | const langFilter = ref('') |
| 47 | const ratingFilter = ref<RatingFilter>('all') | 42 | const ratingFilter = ref<RatingFilter>('all') |
| 48 | const excludedContentTypes = ref<Set<string>>(new Set()) | 43 | const excludedContentTypes = ref<Set<string>>(new Set()) |
| 44 | const excludedStreamTypes = ref<Set<string>>(new Set()) | ||
| 45 | const excludedQualities = ref<Set<string>>(new Set()) | ||
| 49 | const showBroken = ref(false) | 46 | const showBroken = ref(false) |
| 50 | 47 | ||
| 51 | const allSites = computed<MatchedSite[]>(() => { | 48 | const allSites = computed<MatchedSite[]>(() => { |
| @@ -79,6 +76,20 @@ const availableContentTypes = computed(() => { | |||
| 79 | }) | 76 | }) |
| 80 | const hasContentTypes = computed(() => availableContentTypes.value.length > 0) | 77 | const hasContentTypes = computed(() => availableContentTypes.value.length > 0) |
| 81 | 78 | ||
| 79 | const availableStreamTypes = computed(() => { | ||
| 80 | const types = new Set<string>() | ||
| 81 | for (const site of allSites.value) if (site.streamType) types.add(site.streamType) | ||
| 82 | return [...types].sort() | ||
| 83 | }) | ||
| 84 | const hasStreamTypes = computed(() => availableStreamTypes.value.length > 0) | ||
| 85 | |||
| 86 | const availableQualities = computed(() => { | ||
| 87 | const types = new Set<string>() | ||
| 88 | for (const site of allSites.value) if (site.quality) types.add(site.quality) | ||
| 89 | return [...types].sort() | ||
| 90 | }) | ||
| 91 | const hasQualities = computed(() => availableQualities.value.length > 0) | ||
| 92 | |||
| 82 | const hasRatings = computed(() => allSites.value.some(site => site.rating !== 'safe')) | 93 | const hasRatings = computed(() => allSites.value.some(site => site.rating !== 'safe')) |
| 83 | const hasSuggestive = computed(() => allSites.value.some(site => site.rating === 'suggestive')) | 94 | const hasSuggestive = computed(() => allSites.value.some(site => site.rating === 'suggestive')) |
| 84 | const hasMultiLanguage = computed(() => allSites.value.some(site => site.lang.toLowerCase() === 'all')) | 95 | const hasMultiLanguage = computed(() => allSites.value.some(site => site.lang.toLowerCase() === 'all')) |
| @@ -91,7 +102,8 @@ const availableLangs = computed(() => { | |||
| 91 | }) | 102 | }) |
| 92 | 103 | ||
| 93 | const isFiltering = computed(() => { | 104 | const isFiltering = computed(() => { |
| 94 | return query.value.trim() !== '' || langFilter.value !== '' || ratingFilter.value !== 'all' || excludedContentTypes.value.size > 0 | 105 | return query.value.trim() !== '' || langFilter.value !== '' || ratingFilter.value !== 'all' |
| 106 | || excludedContentTypes.value.size > 0 || excludedStreamTypes.value.size > 0 || excludedQualities.value.size > 0 | ||
| 95 | }) | 107 | }) |
| 96 | 108 | ||
| 97 | const filteredSites = computed(() => { | 109 | const filteredSites = computed(() => { |
| @@ -102,6 +114,8 @@ const filteredSites = computed(() => { | |||
| 102 | if (langFilter.value && site.lang !== langFilter.value) return false | 114 | if (langFilter.value && site.lang !== langFilter.value) return false |
| 103 | if (ratingFilter.value !== 'all' && site.rating !== ratingFilter.value) return false | 115 | if (ratingFilter.value !== 'all' && site.rating !== ratingFilter.value) return false |
| 104 | if (site.contentType && excludedContentTypes.value.has(site.contentType)) return false | 116 | if (site.contentType && excludedContentTypes.value.has(site.contentType)) return false |
| 117 | if (site.streamType && excludedStreamTypes.value.has(site.streamType)) return false | ||
| 118 | if (site.quality && excludedQualities.value.has(site.quality)) return false | ||
| 105 | return true | 119 | return true |
| 106 | }) | 120 | }) |
| 107 | }) | 121 | }) |
| @@ -118,6 +132,8 @@ const filteredSites = computed(() => { | |||
| 118 | v-model:lang-filter="langFilter" | 132 | v-model:lang-filter="langFilter" |
| 119 | v-model:rating-filter="ratingFilter" | 133 | v-model:rating-filter="ratingFilter" |
| 120 | v-model:content-type-filter="excludedContentTypes" | 134 | v-model:content-type-filter="excludedContentTypes" |
| 135 | v-model:stream-type-filter="excludedStreamTypes" | ||
| 136 | v-model:quality-filter="excludedQualities" | ||
| 121 | v-model:show-broken="showBroken" | 137 | v-model:show-broken="showBroken" |
| 122 | :available-langs="availableLangs" | 138 | :available-langs="availableLangs" |
| 123 | :has-multi-language="hasMultiLanguage" | 139 | :has-multi-language="hasMultiLanguage" |
| @@ -125,6 +141,10 @@ const filteredSites = computed(() => { | |||
| 125 | :has-suggestive="hasSuggestive" | 141 | :has-suggestive="hasSuggestive" |
| 126 | :available-content-types="availableContentTypes" | 142 | :available-content-types="availableContentTypes" |
| 127 | :has-content-types="hasContentTypes" | 143 | :has-content-types="hasContentTypes" |
| 144 | :available-stream-types="availableStreamTypes" | ||
| 145 | :has-stream-types="hasStreamTypes" | ||
| 146 | :available-qualities="availableQualities" | ||
| 147 | :has-qualities="hasQualities" | ||
| 128 | :has-broken="hasBroken" | 148 | :has-broken="hasBroken" |
| 129 | /> | 149 | /> |
| 130 | </div> | 150 | </div> |
docs/.vitepress/theme/components/extrepo/RepoRow.vue +5 −1
| @@ -2,7 +2,7 @@ | |||
| 2 | import { computed, ref } from 'vue' | 2 | import { computed, ref } from 'vue' |
| 3 | import { data } from '../../../../ext/extensionRepos.data' | 3 | import { data } from '../../../../ext/extensionRepos.data' |
| 4 | import { stripHtml } from './helpers' | 4 | import { stripHtml } from './helpers' |
| 5 | import { copyValue, hasCopyButton, installHref, isBrowseOnly, mangayomiCopyValue, mangayomiHref, mangayomiLiveContainerHref } from './install' | 5 | import { copyValue, hasBrowseOnlyCopyButton, hasCopyButton, installHref, isBrowseOnly, mangayomiCopyValue, mangayomiHref, mangayomiLiveContainerHref } from './install' |
| 6 | import SiteGrid from './SiteGrid.vue' | 6 | import SiteGrid from './SiteGrid.vue' |
| 7 | import type { Repo, RepoVariant } from './types' | 7 | import type { Repo, RepoVariant } from './types' |
| 8 | import { useTooltip } from './useTooltip' | 8 | import { useTooltip } from './useTooltip' |
| @@ -123,6 +123,10 @@ function variantSites(variant: RepoVariant) { | |||
| 123 | <span v-else class="i-lucide:copy" /> | 123 | <span v-else class="i-lucide:copy" /> |
| 124 | </button> | 124 | </button> |
| 125 | </template> | 125 | </template> |
| 126 | <button v-else-if="hasBrowseOnlyCopyButton(scheme)" class="ext-btn ext-btn-copy" type="button" @click="copyUrl"> | ||
| 127 | <span v-if="copied" class="i-lucide:check" /> | ||
| 128 | <span v-else class="i-lucide:copy" /> | ||
| 129 | </button> | ||
| 126 | <button | 130 | <button |
| 127 | v-if="!repo.variants" | 131 | v-if="!repo.variants" |
| 128 | class="ext-btn ext-btn-toggle" | 132 | class="ext-btn ext-btn-toggle" |
docs/.vitepress/theme/components/extrepo/SettingsMenu.vue +27 −1
| @@ -16,6 +16,12 @@ defineProps<{ | |||
| 16 | contentTypeFilter: Set<string> | 16 | contentTypeFilter: Set<string> |
| 17 | availableContentTypes: string[] | 17 | availableContentTypes: string[] |
| 18 | hasContentTypes: boolean | 18 | hasContentTypes: boolean |
| 19 | streamTypeFilter: Set<string> | ||
| 20 | availableStreamTypes: string[] | ||
| 21 | hasStreamTypes: boolean | ||
| 22 | qualityFilter: Set<string> | ||
| 23 | availableQualities: string[] | ||
| 24 | hasQualities: boolean | ||
| 19 | showBroken: boolean | 25 | showBroken: boolean |
| 20 | hasBroken: boolean | 26 | hasBroken: boolean |
| 21 | }>() | 27 | }>() |
| @@ -24,6 +30,8 @@ defineEmits<{ | |||
| 24 | 'update:langFilter': [value: string] | 30 | 'update:langFilter': [value: string] |
| 25 | 'update:ratingFilter': [value: RatingFilterValue] | 31 | 'update:ratingFilter': [value: RatingFilterValue] |
| 26 | 'update:contentTypeFilter': [value: Set<string>] | 32 | 'update:contentTypeFilter': [value: Set<string>] |
| 33 | 'update:streamTypeFilter': [value: Set<string>] | ||
| 34 | 'update:qualityFilter': [value: Set<string>] | ||
| 27 | 'update:showBroken': [value: boolean] | 35 | 'update:showBroken': [value: boolean] |
| 28 | }>() | 36 | }>() |
| 29 | 37 | ||
| @@ -98,7 +106,7 @@ onUnmounted(() => { | |||
| 98 | v-show="open" | 106 | v-show="open" |
| 99 | ref="menuRef" | 107 | ref="menuRef" |
| 100 | class="ext-settings-menu VPMenu" | 108 | class="ext-settings-menu VPMenu" |
| 101 | :class="{ 'ext-settings-menu--wide': hasSuggestive || hasContentTypes }" | 109 | :class="{ 'ext-settings-menu--wide': hasSuggestive || hasContentTypes || hasStreamTypes || hasQualities }" |
| 102 | :style="menuStyle" | 110 | :style="menuStyle" |
| 103 | > | 111 | > |
| 104 | <LangSelect | 112 | <LangSelect |
| @@ -119,6 +127,24 @@ onUnmounted(() => { | |||
| 119 | :available-types="availableContentTypes" | 127 | :available-types="availableContentTypes" |
| 120 | @update:model-value="$emit('update:contentTypeFilter', $event)" | 128 | @update:model-value="$emit('update:contentTypeFilter', $event)" |
| 121 | /> | 129 | /> |
| 130 | <ContentTypeFilter | ||
| 131 | v-if="hasStreamTypes" | ||
| 132 | :model-value="streamTypeFilter" | ||
| 133 | :available-types="availableStreamTypes" | ||
| 134 | title="Stream Type" | ||
| 135 | icon="i-lucide:cast" | ||
| 136 | help-text="Shows or hides specific stream types. Unchecking a type hides matching entries from the list." | ||
| 137 | @update:model-value="$emit('update:streamTypeFilter', $event)" | ||
| 138 | /> | ||
| 139 | <ContentTypeFilter | ||
| 140 | v-if="hasQualities" | ||
| 141 | :model-value="qualityFilter" | ||
| 142 | :available-types="availableQualities" | ||
| 143 | title="Quality" | ||
| 144 | icon="i-lucide:monitor" | ||
| 145 | help-text="Shows or hides specific quality levels. Unchecking a quality hides matching entries from the list." | ||
| 146 | @update:model-value="$emit('update:qualityFilter', $event)" | ||
| 147 | /> | ||
| 122 | <BrokenFilter | 148 | <BrokenFilter |
| 123 | v-if="hasBroken" | 149 | v-if="hasBroken" |
| 124 | :model-value="showBroken" | 150 | :model-value="showBroken" |
docs/.vitepress/theme/components/extrepo/install.ts +6
| @@ -37,6 +37,8 @@ const BROWSE_ONLY_SCHEMES = new Set(['kotatsu', 'sora']) | |||
| 37 | 37 | ||
| 38 | const NO_COPY_SCHEMES = new Set(['suwatte']) | 38 | const NO_COPY_SCHEMES = new Set(['suwatte']) |
| 39 | 39 | ||
| 40 | const COPYABLE_BROWSE_ONLY_SCHEMES = new Set(['sora']) | ||
| 41 | |||
| 40 | export function isBrowseOnly(scheme: string): boolean { | 42 | export function isBrowseOnly(scheme: string): boolean { |
| 41 | return BROWSE_ONLY_SCHEMES.has(scheme) | 43 | return BROWSE_ONLY_SCHEMES.has(scheme) |
| 42 | } | 44 | } |
| @@ -45,6 +47,10 @@ export function hasCopyButton(scheme: string): boolean { | |||
| 45 | return !NO_COPY_SCHEMES.has(scheme) | 47 | return !NO_COPY_SCHEMES.has(scheme) |
| 46 | } | 48 | } |
| 47 | 49 | ||
| 50 | export function hasBrowseOnlyCopyButton(scheme: string): boolean { | ||
| 51 | return COPYABLE_BROWSE_ONLY_SCHEMES.has(scheme) | ||
| 52 | } | ||
| 53 | |||
| 48 | export function installHref(scheme: string, repo: Repo, opts?: InstallOpts): string | null { | 54 | export function installHref(scheme: string, repo: Repo, opts?: InstallOpts): string | null { |
| 49 | const build = INSTALL_URL_BUILDERS[scheme] | 55 | const build = INSTALL_URL_BUILDERS[scheme] |
| 50 | if (build) return build(repo, opts) | 56 | if (build) return build(repo, opts) |
docs/.vitepress/theme/components/extrepo/types.ts +2
| @@ -24,6 +24,8 @@ export interface RepoSite { | |||
| 24 | url: string | 24 | url: string |
| 25 | rating: Rating | 25 | rating: Rating |
| 26 | contentType?: string | 26 | contentType?: string |
| 27 | streamType?: string | ||
| 28 | quality?: string | ||
| 27 | isBroken?: boolean | 29 | isBroken?: boolean |
| 28 | installUrl?: string | 30 | installUrl?: string |
| 29 | } | 31 | } |
docs/ext/extensionRepos.data.ts +78 −72
| @@ -13,6 +13,8 @@ export interface RepoSite { | |||
| 13 | url: string | 13 | url: string |
| 14 | rating: Rating | 14 | rating: Rating |
| 15 | contentType?: string | 15 | contentType?: string |
| 16 | streamType?: string | ||
| 17 | quality?: string | ||
| 16 | isBroken?: boolean | 18 | isBroken?: boolean |
| 17 | installUrl?: string | 19 | installUrl?: string |
| 18 | } | 20 | } |
| @@ -141,34 +143,38 @@ interface KotatsuIndex { | |||
| 141 | sites: KotatsuSite[] | 143 | sites: KotatsuSite[] |
| 142 | } | 144 | } |
| 143 | 145 | ||
| 144 | interface SoraLibraryModule { | 146 | interface SoraRepoIndexEntry { |
| 147 | slug: string | ||
| 148 | name: string | ||
| 149 | source: string | ||
| 150 | path?: string | ||
| 151 | totalSources?: number | ||
| 152 | error?: string | ||
| 153 | } | ||
| 154 | |||
| 155 | interface SoraRepoIndex { | ||
| 156 | repos: SoraRepoIndexEntry[] | ||
| 157 | } | ||
| 158 | |||
| 159 | interface SoraModule { | ||
| 145 | sourceName: string | 160 | sourceName: string |
| 146 | iconUrl?: string | 161 | iconUrl?: string |
| 147 | iconURL?: string | 162 | iconURL?: string |
| 148 | language?: string | 163 | language?: string |
| 149 | languageClean?: string | ||
| 150 | baseUrl?: string | 164 | baseUrl?: string |
| 151 | scriptUrl?: string | 165 | scriptUrl?: string |
| 152 | scriptURL?: string | 166 | scriptURL?: string |
| 153 | manifestUrl?: string | 167 | wotaku_sourceName?: string |
| 154 | jsonUrl?: string | 168 | wotaku_language?: string[] |
| 155 | } | 169 | wotaku_type?: string[] |
| 156 | 170 | wotaku_streamType?: string[] | |
| 157 | interface SoraLibraryAuthor { | 171 | wotaku_quality?: string[] |
| 158 | author: string | ||
| 159 | repo: string | ||
| 160 | types: Record<string, SoraLibraryModule[]> | ||
| 161 | } | ||
| 162 | |||
| 163 | export interface SoraTypeGroup { | ||
| 164 | label: string | ||
| 165 | indexUrl: string | ||
| 166 | } | 172 | } |
| 167 | 173 | ||
| 168 | export interface SoraAuthorRepo { | 174 | export interface SoraAuthorRepo { |
| 169 | label: string | 175 | label: string |
| 170 | repoUrl?: string | 176 | repoUrl?: string |
| 171 | types: SoraTypeGroup[] | 177 | indexUrl: string |
| 172 | } | 178 | } |
| 173 | 179 | ||
| 174 | const EXT_DIR = dirname(fileURLToPath(import.meta.url)) | 180 | const EXT_DIR = dirname(fileURLToPath(import.meta.url)) |
| @@ -275,7 +281,8 @@ const LANG_ALIASES: Record<string, string> = { | |||
| 275 | } | 281 | } |
| 276 | 282 | ||
| 277 | const LANG_SUBSTRING_ALIASES: [RegExp, string][] = [ | 283 | const LANG_SUBSTRING_ALIASES: [RegExp, string][] = [ |
| 278 | [/中文|汉语|漢語/, 'zh'], | 284 | [/日语原版/, 'ja'], |
| 285 | [/中文|汉语|漢語|轻小说/, 'zh'], | ||
| 279 | [/日本語/, 'ja'], | 286 | [/日本語/, 'ja'], |
| 280 | [/한국어|조선말/, 'ko'] | 287 | [/한국어|조선말/, 'ko'] |
| 281 | ] | 288 | ] |
| @@ -496,10 +503,8 @@ function toRepoDataKotatsu(index: KotatsuIndex): RepoSite[] { | |||
| 496 | return sites | 503 | return sites |
| 497 | } | 504 | } |
| 498 | 505 | ||
| 499 | function isSoraLibrary(json: unknown): json is SoraLibraryAuthor[] { | 506 | function isSoraRepoIndex(json: unknown): json is SoraRepoIndex { |
| 500 | if (!Array.isArray(json) || json.length === 0) return false | 507 | return !!json && typeof json === 'object' && Array.isArray((json as SoraRepoIndex).repos) |
| 501 | const first = json[0] as Record<string, unknown> | ||
| 502 | return typeof first.author === 'string' && typeof first.repo === 'string' && typeof first.types === 'object' | ||
| 503 | } | 508 | } |
| 504 | 509 | ||
| 505 | function normalizeSoraLang(language: string | undefined): string { | 510 | function normalizeSoraLang(language: string | undefined): string { |
| @@ -508,64 +513,65 @@ function normalizeSoraLang(language: string | undefined): string { | |||
| 508 | return normalizeLang(stripped) | 513 | return normalizeLang(stripped) |
| 509 | } | 514 | } |
| 510 | 515 | ||
| 511 | const SORA_TYPE_ORDER = ['anime', 'manga', 'novels', 'other'] | 516 | function toRepoDataSoraModules(modules: SoraModule[]): RepoSite[] { |
| 512 | const SORA_TYPE_LABELS: Record<string, string> = { | ||
| 513 | anime: 'Anime', | ||
| 514 | manga: 'Manga', | ||
| 515 | novels: 'Novels', | ||
| 516 | other: 'Other' | ||
| 517 | } | ||
| 518 | |||
| 519 | function soraModuleInstallUrl(mod: SoraLibraryModule): string | undefined { | ||
| 520 | const explicit = mod.manifestUrl ?? mod.jsonUrl | ||
| 521 | if (explicit) return explicit | ||
| 522 | const script = mod.scriptUrl ?? mod.scriptURL | ||
| 523 | return script?.replace(/\.js$/i, '.json') | ||
| 524 | } | ||
| 525 | |||
| 526 | function toRepoDataSoraModules(modules: SoraLibraryModule[]): RepoSite[] { | ||
| 527 | const seen = new Set<string>() | 517 | const seen = new Set<string>() |
| 528 | const sites: RepoSite[] = [] | 518 | const sites: RepoSite[] = [] |
| 529 | 519 | ||
| 530 | for (const mod of modules) { | 520 | for (const mod of modules) { |
| 531 | const lang = normalizeSoraLang(mod.languageClean ?? mod.language) | 521 | const name = mod.wotaku_sourceName ?? mod.sourceName |
| 532 | const installUrl = soraModuleInstallUrl(mod) | 522 | const langs = mod.wotaku_language?.length ? mod.wotaku_language : [mod.language] |
| 533 | const key = `${mod.sourceName}::${lang}::${installUrl ?? ''}` | 523 | const scriptUrl = mod.scriptUrl ?? mod.scriptURL |
| 534 | if (seen.has(key)) continue | 524 | const installUrl = scriptUrl?.replace(/\.js$/i, '.json') |
| 535 | seen.add(key) | 525 | for (const rawLang of langs) { |
| 536 | sites.push({ | 526 | const lang = normalizeSoraLang(rawLang) |
| 537 | name: mod.sourceName, | 527 | const key = `${name}::${lang}::${installUrl ?? ''}` |
| 538 | lang, | 528 | if (seen.has(key)) continue |
| 539 | icon: mod.iconUrl ?? mod.iconURL ?? '', | 529 | seen.add(key) |
| 540 | url: mod.baseUrl ?? '', | 530 | sites.push({ |
| 541 | rating: 'safe', | 531 | name, |
| 542 | installUrl: installUrl ? `sora://module?url=${installUrl}` : undefined | 532 | lang, |
| 543 | }) | 533 | icon: mod.iconUrl ?? mod.iconURL ?? '', |
| 534 | url: mod.baseUrl ?? '', | ||
| 535 | rating: 'safe', | ||
| 536 | contentType: mod.wotaku_type?.[0], | ||
| 537 | streamType: mod.wotaku_streamType?.[0], | ||
| 538 | quality: mod.wotaku_quality?.[0], | ||
| 539 | installUrl: installUrl ? `sora://module?url=${installUrl}` : undefined | ||
| 540 | }) | ||
| 541 | } | ||
| 544 | } | 542 | } |
| 545 | 543 | ||
| 546 | sites.sort((a, b) => a.name.localeCompare(b.name)) | 544 | sites.sort((a, b) => a.name.localeCompare(b.name)) |
| 547 | return sites | 545 | return sites |
| 548 | } | 546 | } |
| 549 | 547 | ||
| 550 | function groupSoraLibrary(indexUrl: string, authors: SoraLibraryAuthor[]): { authorRepos: SoraAuthorRepo[]; sitesByType: Record<string, RepoData> } { | 548 | async function loadSoraRepoIndex(indexUrl: string, index: SoraRepoIndex): Promise<{ sites: RepoSite[]; authorRepos: SoraAuthorRepo[]; sitesByAuthor: Record<string, RepoData> }> { |
| 549 | const seen = new Set<string>() | ||
| 550 | const sites: RepoSite[] = [] | ||
| 551 | const authorRepos: SoraAuthorRepo[] = [] | 551 | const authorRepos: SoraAuthorRepo[] = [] |
| 552 | const sitesByType: Record<string, RepoData> = {} | 552 | const sitesByAuthor: Record<string, RepoData> = {} |
| 553 | 553 | ||
| 554 | for (const entry of authors) { | 554 | const entries = index.repos.filter(repo => repo.path && !repo.error) |
| 555 | const types: SoraTypeGroup[] = [] | 555 | const fileUrls = entries.map(repo => new URL(repo.path!, indexUrl).toString()) |
| 556 | for (const typeKey of SORA_TYPE_ORDER) { | 556 | const moduleLists = await Promise.all(fileUrls.map(url => fetchIndex(url))) |
| 557 | const modules = entry.types[typeKey] | 557 | |
| 558 | if (!modules?.length) continue | 558 | entries.forEach((repo, i) => { |
| 559 | const typeIndexUrl = new URL(`${entry.author}/${typeKey}.json`, indexUrl).toString() | 559 | const modules = moduleLists[i] |
| 560 | sitesByType[typeIndexUrl] = { sites: toRepoDataSoraModules(modules) } | 560 | const authorSites = Array.isArray(modules) ? toRepoDataSoraModules(modules as SoraModule[]) : [] |
| 561 | types.push({ label: SORA_TYPE_LABELS[typeKey] ?? typeKey, indexUrl: typeIndexUrl }) | 561 | const fileUrl = fileUrls[i] |
| 562 | sitesByAuthor[fileUrl] = { sites: authorSites } | ||
| 563 | authorRepos.push({ label: repo.name, repoUrl: repo.source?.replace(/\.git$/, ''), indexUrl: fileUrl }) | ||
| 564 | for (const site of authorSites) { | ||
| 565 | const key = `${site.name}::${site.lang}::${site.installUrl ?? ''}` | ||
| 566 | if (seen.has(key)) continue | ||
| 567 | seen.add(key) | ||
| 568 | sites.push(site) | ||
| 562 | } | 569 | } |
| 563 | if (!types.length) continue | 570 | }) |
| 564 | authorRepos.push({ label: entry.author, repoUrl: entry.repo.replace(/\.git$/, ''), types }) | ||
| 565 | } | ||
| 566 | 571 | ||
| 567 | authorRepos.sort((a, b) => a.label.localeCompare(b.label)) | 572 | authorRepos.sort((a, b) => a.label.localeCompare(b.label)) |
| 568 | return { authorRepos, sitesByType } | 573 | sites.sort((a, b) => a.name.localeCompare(b.name)) |
| 574 | return { sites, authorRepos, sitesByAuthor } | ||
| 569 | } | 575 | } |
| 570 | 576 | ||
| 571 | function toRepoDataLNReader(plugins: LNReaderPlugin[]): RepoSite[] { | 577 | function toRepoDataLNReader(plugins: LNReaderPlugin[]): RepoSite[] { |
| @@ -596,8 +602,6 @@ async function toRepoData(indexUrl: string, json: unknown): Promise<RepoData> { | |||
| 596 | sites = toRepoDataHayase(json as HayaseExtension[]) | 602 | sites = toRepoDataHayase(json as HayaseExtension[]) |
| 597 | } else if (first && 'iconUrl' in first && 'site' in first) { | 603 | } else if (first && 'iconUrl' in first && 'site' in first) { |
| 598 | sites = toRepoDataLNReader(json as LNReaderPlugin[]) | 604 | sites = toRepoDataLNReader(json as LNReaderPlugin[]) |
| 599 | } else if (isSoraLibrary(json)) { | ||
| 600 | sites = toRepoDataSoraModules(json.flatMap(entry => Object.values(entry.types).flat())) | ||
| 601 | } else if (first && 'sources' in first) { | 605 | } else if (first && 'sources' in first) { |
| 602 | sites = toRepoDataMihon(iconBase, json as MihonExtension[]) | 606 | sites = toRepoDataMihon(iconBase, json as MihonExtension[]) |
| 603 | } else if (first && 'pkg' in first && 'apk' in first) { | 607 | } else if (first && 'pkg' in first && 'apk' in first) { |
| @@ -640,12 +644,14 @@ export default { | |||
| 640 | const soraAuthors: Record<string, SoraAuthorRepo[]> = {} | 644 | const soraAuthors: Record<string, SoraAuthorRepo[]> = {} |
| 641 | await Promise.all(urls.map(async url => { | 645 | await Promise.all(urls.map(async url => { |
| 642 | const json = await fetchIndex(url) | 646 | const json = await fetchIndex(url) |
| 643 | sites[url] = await toRepoData(url, json) | 647 | if (isSoraRepoIndex(json)) { |
| 644 | if (isSoraLibrary(json)) { | 648 | const result = await loadSoraRepoIndex(url, json) |
| 645 | const grouped = groupSoraLibrary(url, json) | 649 | sites[url] = { sites: result.sites } |
| 646 | soraAuthors[url] = grouped.authorRepos | 650 | soraAuthors[url] = result.authorRepos |
| 647 | Object.assign(sites, grouped.sitesByType) | 651 | Object.assign(sites, result.sitesByAuthor) |
| 652 | return | ||
| 648 | } | 653 | } |
| 654 | sites[url] = await toRepoData(url, json) | ||
| 649 | })) | 655 | })) |
| 650 | return { sites, soraAuthors } | 656 | return { sites, soraAuthors } |
| 651 | } | 657 | } |
docs/ext/ios.md +5 −5
| @@ -128,7 +128,7 @@ You can install v0.8 extensions in the v0.9 Paperback client, but you can't inst | |||
| 128 | ::: extrepo {scheme=sora} | 128 | ::: extrepo {scheme=sora} |
| 129 | 129 | ||
| 130 | == Sources | 130 | == Sources |
| 131 | - raw: https://shebyyy.github.io/sources-dart/anymex/all.json | 131 | - raw: https://kotatsu-83g.pages.dev/sora/index.json |
| 132 | 132 | ||
| 133 | ::: | 133 | ::: |
| 134 | 134 | ||
| @@ -138,20 +138,20 @@ You can install v0.8 extensions in the v0.9 Paperback client, but you can't inst | |||
| 138 | 138 | ||
| 139 | == Mantton | 139 | == Mantton |
| 140 | - url: https://aegir.mantton.com/ | 140 | - url: https://aegir.mantton.com/ |
| 141 | - raw: https://kotatsu-83g.pages.dev/aegir.json | 141 | - raw: https://kotatsu-83g.pages.dev/suwatte/aegir.json |
| 142 | 142 | ||
| 143 | == Jishnu | 143 | == Jishnu |
| 144 | - url: https://jishnusen.github.io/SuwatteSources/ | 144 | - url: https://jishnusen.github.io/SuwatteSources/ |
| 145 | - src: https://github.com/jishnusen/SuwatteSources | 145 | - src: https://github.com/jishnusen/SuwatteSources |
| 146 | - raw: https://kotatsu-83g.pages.dev/jishnu.json | 146 | - raw: https://kotatsu-83g.pages.dev/suwatte/jishnu.json |
| 147 | 147 | ||
| 148 | == Seb | 148 | == Seb |
| 149 | - url: https://sebzzzzzzzzzzzzzzzz.github.io/sources/ | 149 | - url: https://sebzzzzzzzzzzzzzzzz.github.io/sources/ |
| 150 | - raw: https://kotatsu-83g.pages.dev/seb.json | 150 | - raw: https://kotatsu-83g.pages.dev/suwatte/seb.json |
| 151 | 151 | ||
| 152 | == Community | 152 | == Community |
| 153 | - url: https://community.suwatte.app/ | 153 | - url: https://community.suwatte.app/ |
| 154 | - raw: https://kotatsu-83g.pages.dev/suwatte-community.json | 154 | - raw: https://kotatsu-83g.pages.dev/suwatte/suwatte-community.json |
| 155 | 155 | ||
| 156 | ::: | 156 | ::: |
| 157 | 157 | ||
docs/ext/misc.md +9 −9
| @@ -109,27 +109,27 @@ og: | |||
| 109 | ::: extrepo {scheme=kotatsu} | 109 | ::: extrepo {scheme=kotatsu} |
| 110 | 110 | ||
| 111 | == Sheby's builds | 111 | == Sheby's builds |
| 112 | - url: https://github.com/Shebyyy/kotatsu-multi-parsers | 112 | - url: https://github.com/Shebyyy/kotatsu/kotatsu-multi-parsers |
| 113 | -- Kotatsu-Redo | 113 | -- Kotatsu-Redo |
| 114 | - raw: https://kotatsu-83g.pages.dev/kotatsu-parsers-redo.json | 114 | - raw: https://kotatsu-83g.pages.dev/kotatsu/kotatsu-parsers-redo.json |
| 115 | -- YakaTeam | 115 | -- YakaTeam |
| 116 | - raw: https://kotatsu-83g.pages.dev/yakateam-kotatsu-parsers.json | 116 | - raw: https://kotatsu-83g.pages.dev/yakateam-kotatsu-parsers.json |
| 117 | -- TamerAli-0 | 117 | -- TamerAli-0 |
| 118 | - raw: https://kotatsu-83g.pages.dev/tamerali-kotatsu-parsers.json | 118 | - raw: https://kotatsu-83g.pages.dev/kotatsu/tamerali-kotatsu-parsers.json |
| 119 | -- Kaisoku | 119 | -- Kaisoku |
| 120 | - raw: https://kotatsu-83g.pages.dev/kaisoku-parsers.json | 120 | - raw: https://kotatsu-83g.pages.dev/kotatsu/kaisoku-parsers.json |
| 121 | -- hany18h | 121 | -- hany18h |
| 122 | - raw: https://kotatsu-83g.pages.dev/hany18h-kotatsu-parsers.json | 122 | - raw: https://kotatsu-83g.pages.dev/kotatsu/hany18h-kotatsu-parsers.json |
| 123 | -- Kototoro | 123 | -- Kototoro |
| 124 | - raw: https://kotatsu-83g.pages.dev/kototoro-parsers.json | 124 | - raw: https://kotatsu-83g.pages.dev/kotatsu/kototoro-parsers.json |
| 125 | 125 | ||
| 126 | == UMA | 126 | == UMA |
| 127 | - url: https://github.com/InvalidDavid/UMA | 127 | - url: https://github.com/InvalidDavid/UMA |
| 128 | - raw: https://kotatsu-83g.pages.dev/uma.json | 128 | - raw: https://kotatsu-83g.pages.dev/kotatsu/uma.json |
| 129 | 129 | ||
| 130 | == Draken | 130 | == Draken |
| 131 | - url: https://github.com/dragonx943/manga-repo | 131 | - url: https://github.com/dragonx943/kotatsu/manga-repo |
| 132 | - raw: https://kotatsu-83g.pages.dev/manga-repo.json | 132 | - raw: https://kotatsu-83g.pages.dev/kotatsu/manga-repo.json |
| 133 | 133 | ||
| 134 | ::: | 134 | ::: |
| 135 | 135 | ||