mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Merge pull request #2874 from timongh/fix_online_registry_url
fix: 修复在现安装时分支选择无效(Issue #2849)
This commit is contained in:
commit
16c2c57baa
@ -46,6 +46,7 @@
|
|||||||
:key="item.name"
|
:key="item.name"
|
||||||
ref="items"
|
ref="items"
|
||||||
:item="item"
|
:item="item"
|
||||||
|
:branch="selectedBranch"
|
||||||
@refresh="checkInstalled"
|
@refresh="checkInstalled"
|
||||||
/>
|
/>
|
||||||
<!-- <RegistryItem
|
<!-- <RegistryItem
|
||||||
|
|||||||
@ -48,14 +48,17 @@
|
|||||||
import { getDescriptionHTML } from '@/components/description'
|
import { getDescriptionHTML } from '@/components/description'
|
||||||
import { cdnRoots } from '@/core/cdn-types'
|
import { cdnRoots } from '@/core/cdn-types'
|
||||||
import { installFeature } from '@/core/install-feature'
|
import { installFeature } from '@/core/install-feature'
|
||||||
import { meta } from '@/core/meta'
|
|
||||||
import { visibleInside } from '@/core/observer'
|
import { visibleInside } from '@/core/observer'
|
||||||
import { getGeneralSettings, settings } from '@/core/settings'
|
import { getGeneralSettings, settings } from '@/core/settings'
|
||||||
import { logError } from '@/core/utils/log'
|
import { logError } from '@/core/utils/log'
|
||||||
import { VIcon, VButton, MiniToast } from '@/ui'
|
import { VIcon, VButton, MiniToast } from '@/ui'
|
||||||
import { DocSourceItem } from 'registry/lib/docs'
|
import { DocSourceItem } from 'registry/lib/docs'
|
||||||
|
|
||||||
const getFeatureUrl = (item: DocSourceItem) => `${cdnRoots[getGeneralSettings().cdnRoot](meta.compilationInfo.branch, item.owner)}${item.fullAbsolutePath}`
|
const getFeatureUrl = (item: DocSourceItem, branch: string) => {
|
||||||
|
const cdnRootFn = cdnRoots[getGeneralSettings().cdnRoot]
|
||||||
|
const cdnRoot = cdnRootFn(branch, item.owner)
|
||||||
|
return `${cdnRoot}${item.fullAbsolutePath}`
|
||||||
|
}
|
||||||
const isFeatureInstalled = (item: DocSourceItem) => {
|
const isFeatureInstalled = (item: DocSourceItem) => {
|
||||||
const storageKey = `user${lodash.startCase(item.type)}s`
|
const storageKey = `user${lodash.startCase(item.type)}s`
|
||||||
return item.name in settings[storageKey]
|
return item.name in settings[storageKey]
|
||||||
@ -83,7 +86,7 @@ const typeMappings = {
|
|||||||
pack: {
|
pack: {
|
||||||
icon: 'mdi-package-variant-closed',
|
icon: 'mdi-package-variant-closed',
|
||||||
badge: '合集包',
|
badge: '合集包',
|
||||||
getUrl: (pack: PackItem) => pack.items.map(getFeatureUrl).join('\n'),
|
getUrl: (pack: PackItem, branch: string) => pack.items.map(it => getFeatureUrl(it, branch)).join('\n'),
|
||||||
isInstalled: (pack: PackItem) => pack.items.every(isFeatureInstalled),
|
isInstalled: (pack: PackItem) => pack.items.every(isFeatureInstalled),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -94,11 +97,20 @@ export default Vue.extend({
|
|||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
branch: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
const {
|
||||||
|
icon, badge, getUrl, isInstalled,
|
||||||
|
} = typeMappings[this.item.type]
|
||||||
return {
|
return {
|
||||||
typeMappings,
|
icon,
|
||||||
...typeMappings[this.item.type],
|
badge,
|
||||||
|
getUrl: (item: PackItem) => getUrl(item, this.branch),
|
||||||
|
isInstalled,
|
||||||
description: getDescriptionHTML(this.item),
|
description: getDescriptionHTML(this.item),
|
||||||
installing: false,
|
installing: false,
|
||||||
installed: false,
|
installed: false,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user