fix(plugin): local source label and detection

This commit is contained in:
InfinityPacer
2026-04-19 02:54:09 +08:00
parent 48c12b765d
commit df66b3e917
5 changed files with 10 additions and 5 deletions

View File

@@ -118,7 +118,7 @@ const iconPath: Ref<string> = computed(() => {
function visitPluginPage() {
// 将raw.githubusercontent.com转换为项目地址
let repoUrl = props.plugin?.repo_url
if (repoUrl?.startsWith('local://')) {
if (props.plugin?.is_local || repoUrl?.startsWith('local://')) {
repoUrl = props.plugin?.author_url
}
if (repoUrl) {

View File

@@ -2601,6 +2601,7 @@ export default {
settings: 'Settings',
projectHome: 'Project Home',
updateHistory: 'Update History',
local: 'Local',
installToLocal: 'Install to Local',
totalDownloads: 'Total {count} downloads',
viewData: 'View Data',

View File

@@ -2571,6 +2571,7 @@ export default {
settings: '设置',
projectHome: '项目主页',
updateHistory: '更新说明',
local: '本地',
installToLocal: '安装到本地',
totalDownloads: '共 {count} 次下载',
viewData: '查看数据',

View File

@@ -2572,6 +2572,7 @@ export default {
settings: '設置',
projectHome: '項目主頁',
updateHistory: '更新說明',
local: '本地',
installToLocal: '安裝到本地',
totalDownloads: '共 {count} 次下載',
viewData: '查看數據',

View File

@@ -34,6 +34,9 @@ const activeTab = ref('installed')
// 获取插件标签页
const pluginTabs = computed(() => getPluginTabs(t))
// 本地插件来源显示名称
const localRepoLabel = computed(() => t('plugin.local'))
// 使用动态标签页
const { registerHeaderTab } = useDynamicHeaderTab()
@@ -610,10 +613,9 @@ async function saveFolderPluginOrder() {
// 初始化过滤选项
function initOptions(item: Plugin) {
const LOCAL_REPO_LABEL = '本地'
const optionValue = (options: Array<string>, value: string | undefined) => {
if (!value || options.includes(value)) return
if (value === LOCAL_REPO_LABEL) options.unshift(value)
if (value === localRepoLabel.value) options.unshift(value)
else options.push(value)
}
const optionMutipleValue = (options: Array<string>, value: string | undefined) => {
@@ -857,9 +859,9 @@ async function refreshMarket() {
// 处理掉github地址的前缀
function handleRepoUrl(item: Plugin | string | undefined) {
const url = typeof item === 'string' ? item : item?.repo_url
if (typeof item !== 'string' && item?.is_local) return '本地'
if (typeof item !== 'string' && item?.is_local) return localRepoLabel.value
if (!url) return ''
if (url.startsWith('local://')) return '本地'
if (url.startsWith('local://')) return localRepoLabel.value
return url.replace('https://github.com/', '').replace('https://raw.githubusercontent.com/', '')
}