Commit 3042c9c660

3042c9c66047a89af23027833a56ab7807ac2795

parent: a11db1db8e

Unsigned

Duck <57977673+woducku@users.noreply.github.com> · 2026-07-12 11:18 UTC

broken

Layout: unified · split

docs/.vitepress/theme/components/extrepo/BrokenFilter.vue added +35
@@ -0,0 +1,35 @@
1<script setup lang="ts">
2import { NuInputHorizontalRadioGroup } from '@nolebase/ui'
3import { computed } from 'vue'
4import MenuTitle from './MenuTitle.vue'
5
6const props = defineProps<{
7 modelValue: boolean
8}>()
9
10const emit = defineEmits<{
11 'update:modelValue': [value: boolean]
12}>()
13
14const options = [
15 { value: 'on', title: 'On', ariaLabel: 'On', text: 'ON', name: 'ShowBroken' },
16 { value: 'off', title: 'Off', ariaLabel: 'Off', text: 'OFF', name: 'ShowBroken' }
17]
18
19const showBroken = computed({
20 get: () => props.modelValue ? 'on' : 'off',
21 set: (value: string) => emit('update:modelValue', value === 'on')
22})
23</script>
24
25<template>
26 <div class="ext-broken" role="radiogroup">
27 <MenuTitle icon="i-lucide:unlink" title="Show broken urls" />
28 <NuInputHorizontalRadioGroup
29 v-model="showBroken"
30 bg="$vp-nolebase-enhanced-readabilities-menu-background-color"
31 text="sm $vp-nolebase-enhanced-readabilities-menu-text-color"
32 :options="options"
33 />
34 </div>
35</template>
docs/.vitepress/theme/components/extrepo/ExtensionRepos.vue +6 −1
@@ -17,6 +17,7 @@ const query = ref('')
17const langFilter = ref('') 17const langFilter = ref('')
18const ratingFilter = ref<RatingFilter>('all') 18const ratingFilter = ref<RatingFilter>('all')
19const excludedContentTypes = ref<Set<string>>(new Set()) 19const excludedContentTypes = ref<Set<string>>(new Set())
20const showBroken = ref(false)
20 21
21const allSites = computed<MatchedSite[]>(() => { 22const allSites = computed<MatchedSite[]>(() => {
22 const sites: MatchedSite[] = [] 23 const sites: MatchedSite[] = []
@@ -52,6 +53,7 @@ const hasContentTypes = computed(() => availableContentTypes.value.length > 0)
52const hasRatings = computed(() => allSites.value.some(site => site.rating !== 'safe')) 53const hasRatings = computed(() => allSites.value.some(site => site.rating !== 'safe'))
53const hasSuggestive = computed(() => allSites.value.some(site => site.rating === 'suggestive')) 54const hasSuggestive = computed(() => allSites.value.some(site => site.rating === 'suggestive'))
54const hasMultiLanguage = computed(() => allSites.value.some(site => site.lang.toLowerCase() === 'all')) 55const hasMultiLanguage = computed(() => allSites.value.some(site => site.lang.toLowerCase() === 'all'))
56const hasBroken = computed(() => allSites.value.some(site => site.isBroken))
55 57
56const availableLangs = computed(() => { 58const availableLangs = computed(() => {
57 const codes = new Set(allSites.value.map(site => site.lang)) 59 const codes = new Set(allSites.value.map(site => site.lang))
@@ -66,6 +68,7 @@ const isFiltering = computed(() => {
66const filteredSites = computed(() => { 68const filteredSites = computed(() => {
67 const q = query.value.trim().toLowerCase() 69 const q = query.value.trim().toLowerCase()
68 return allSites.value.filter(site => { 70 return allSites.value.filter(site => {
71 if (site.isBroken && !showBroken.value) return false
69 if (q && !site.name.toLowerCase().includes(q) && !site.url.toLowerCase().includes(q)) return false 72 if (q && !site.name.toLowerCase().includes(q) && !site.url.toLowerCase().includes(q)) return false
70 if (langFilter.value && site.lang !== langFilter.value) return false 73 if (langFilter.value && site.lang !== langFilter.value) return false
71 if (ratingFilter.value !== 'all' && site.rating !== ratingFilter.value) return false 74 if (ratingFilter.value !== 'all' && site.rating !== ratingFilter.value) return false
@@ -86,12 +89,14 @@ const filteredSites = computed(() => {
86 v-model:lang-filter="langFilter" 89 v-model:lang-filter="langFilter"
87 v-model:rating-filter="ratingFilter" 90 v-model:rating-filter="ratingFilter"
88 v-model:content-type-filter="excludedContentTypes" 91 v-model:content-type-filter="excludedContentTypes"
92 v-model:show-broken="showBroken"
89 :available-langs="availableLangs" 93 :available-langs="availableLangs"
90 :has-multi-language="hasMultiLanguage" 94 :has-multi-language="hasMultiLanguage"
91 :has-ratings="hasRatings" 95 :has-ratings="hasRatings"
92 :has-suggestive="hasSuggestive" 96 :has-suggestive="hasSuggestive"
93 :available-content-types="availableContentTypes" 97 :available-content-types="availableContentTypes"
94 :has-content-types="hasContentTypes" 98 :has-content-types="hasContentTypes"
99 :has-broken="hasBroken"
95 /> 100 />
96 </div> 101 </div>
97 102
@@ -103,7 +108,7 @@ const filteredSites = computed(() => {
103 /> 108 />
104 109
105 <div v-else> 110 <div v-else>
106 <RepoRow v-for="repo in repos" :key="repo.indexUrl" :repo="repo" :scheme="scheme" /> 111 <RepoRow v-for="repo in repos" :key="repo.indexUrl" :repo="repo" :scheme="scheme" :show-broken="showBroken" />
107 </div> 112 </div>
108 </div> 113 </div>
109</template> 114</template>
docs/.vitepress/theme/components/extrepo/RepoRow.vue +7 −2
@@ -9,6 +9,7 @@ import type { Repo, RepoVariant } from './types'
9const props = defineProps<{ 9const props = defineProps<{
10 repo: Repo 10 repo: Repo
11 scheme: string 11 scheme: string
12 showBroken?: boolean
12}>() 13}>()
13 14
14const NOT_EXPANDABLE = new Set(['MegaRepo', 'Shotetsu Compatability']) 15const NOT_EXPANDABLE = new Set(['MegaRepo', 'Shotetsu Compatability'])
@@ -18,7 +19,10 @@ const copied = ref(false)
18const copiedLabel = ref<string | null>(null) 19const copiedLabel = ref<string | null>(null)
19const openVariants = ref<Set<string>>(new Set()) 20const openVariants = ref<Set<string>>(new Set())
20 21
21const sites = computed(() => repoData[props.repo.indexUrl]?.sites ?? []) 22const sites = computed(() => {
23 const all = repoData[props.repo.indexUrl]?.sites ?? []
24 return props.showBroken ? all : all.filter(site => !site.isBroken)
25})
22const isExpandable = computed(() => !NOT_EXPANDABLE.has(stripHtml(props.repo.name))) 26const isExpandable = computed(() => !NOT_EXPANDABLE.has(stripHtml(props.repo.name)))
23const installUrl = computed(() => installHref(props.scheme, props.repo)) 27const installUrl = computed(() => installHref(props.scheme, props.repo))
24// Browse-only schemes (e.g. Kotatsu forks) have no app to deep-link into, so install, 28// Browse-only schemes (e.g. Kotatsu forks) have no app to deep-link into, so install,
@@ -56,7 +60,8 @@ function toggleVariant(label: string) {
56 60
57function variantSites(variant: RepoVariant) { 61function variantSites(variant: RepoVariant) {
58 const url = mangayomiCopyValue(variant) 62 const url = mangayomiCopyValue(variant)
59 return url ? repoData[url]?.sites ?? [] : [] 63 const all = url ? repoData[url]?.sites ?? [] : []
64 return props.showBroken ? all : all.filter(site => !site.isBroken)
60} 65}
61</script> 66</script>
62 67
docs/.vitepress/theme/components/extrepo/SettingsMenu.vue +9
@@ -1,5 +1,6 @@
1<script setup lang="ts"> 1<script setup lang="ts">
2import { nextTick, onMounted, onUnmounted, ref } from 'vue' 2import { nextTick, onMounted, onUnmounted, ref } from 'vue'
3import BrokenFilter from './BrokenFilter.vue'
3import ContentTypeFilter from './ContentTypeFilter.vue' 4import ContentTypeFilter from './ContentTypeFilter.vue'
4import LangSelect from './LangSelect.vue' 5import LangSelect from './LangSelect.vue'
5import RatingFilter from './RatingFilter.vue' 6import RatingFilter from './RatingFilter.vue'
@@ -15,12 +16,15 @@ defineProps<{
15 contentTypeFilter: Set<string> 16 contentTypeFilter: Set<string>
16 availableContentTypes: string[] 17 availableContentTypes: string[]
17 hasContentTypes: boolean 18 hasContentTypes: boolean
19 showBroken: boolean
20 hasBroken: boolean
18}>() 21}>()
19 22
20defineEmits<{ 23defineEmits<{
21 'update:langFilter': [value: string] 24 'update:langFilter': [value: string]
22 'update:ratingFilter': [value: RatingFilterValue] 25 'update:ratingFilter': [value: RatingFilterValue]
23 'update:contentTypeFilter': [value: Set<string>] 26 'update:contentTypeFilter': [value: Set<string>]
27 'update:showBroken': [value: boolean]
24}>() 28}>()
25 29
26const rootRef = ref<HTMLElement>() 30const rootRef = ref<HTMLElement>()
@@ -115,6 +119,11 @@ onUnmounted(() => {
115 :available-types="availableContentTypes" 119 :available-types="availableContentTypes"
116 @update:model-value="$emit('update:contentTypeFilter', $event)" 120 @update:model-value="$emit('update:contentTypeFilter', $event)"
117 /> 121 />
122 <BrokenFilter
123 v-if="hasBroken"
124 :model-value="showBroken"
125 @update:model-value="$emit('update:showBroken', $event)"
126 />
118 </div> 127 </div>
119 </Teleport> 128 </Teleport>
120 </div> 129 </div>
docs/.vitepress/theme/components/extrepo/types.ts +1
@@ -25,6 +25,7 @@ export interface RepoSite {
25 rating: Rating 25 rating: Rating
26 // Only for kotatsu 26 // Only for kotatsu
27 contentType?: string 27 contentType?: string
28 isBroken?: boolean
28} 29}
29 30
30export interface MatchedSite extends RepoSite { 31export interface MatchedSite extends RepoSite {
docs/ext/extensionRepos.data.ts +2 −3
@@ -13,6 +13,7 @@ export interface RepoSite {
13 url: string 13 url: string
14 rating: Rating 14 rating: Rating
15 contentType?: string 15 contentType?: string
16 isBroken?: boolean
16} 17}
17 18
18export interface RepoData { 19export interface RepoData {
@@ -390,14 +391,12 @@ function toRepoDataKotatsu(index: KotatsuIndex): RepoSite[] {
390 const sites: RepoSite[] = [] 391 const sites: RepoSite[] = []
391 392
392 for (const site of index.sites) { 393 for (const site of index.sites) {
393 // Broken parsers aren't "available" sites -- skip rather than surface a dead link.
394 if (site.isBroken) continue
395 const lang = normalizeLang(site.lang) 394 const lang = normalizeLang(site.lang)
396 const key = `${site.name}::${lang}::${site.url}` 395 const key = `${site.name}::${lang}::${site.url}`
397 if (seen.has(key)) continue 396 if (seen.has(key)) continue
398 seen.add(key) 397 seen.add(key)
399 const rating: Rating = site.contentType.includes('HENTAI') ? 'nsfw' : 'safe' 398 const rating: Rating = site.contentType.includes('HENTAI') ? 'nsfw' : 'safe'
400 sites.push({ name: site.name, lang, icon: site.icon, url: site.url, rating, contentType: site.contentType }) 399 sites.push({ name: site.name, lang, icon: site.icon, url: site.url, rating, contentType: site.contentType, isBroken: site.isBroken || undefined })
401 } 400 }
402 401
403 return sites 402 return sites