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
+1 -1
View File
@@ -118,7 +118,7 @@ const iconPath: Ref<string> = computed(() => {
function visitPluginPage() { function visitPluginPage() {
// 将raw.githubusercontent.com转换为项目地址 // 将raw.githubusercontent.com转换为项目地址
let repoUrl = props.plugin?.repo_url let repoUrl = props.plugin?.repo_url
if (repoUrl?.startsWith('local://')) { if (props.plugin?.is_local || repoUrl?.startsWith('local://')) {
repoUrl = props.plugin?.author_url repoUrl = props.plugin?.author_url
} }
if (repoUrl) { if (repoUrl) {
+1
View File
@@ -2601,6 +2601,7 @@ export default {
settings: 'Settings', settings: 'Settings',
projectHome: 'Project Home', projectHome: 'Project Home',
updateHistory: 'Update History', updateHistory: 'Update History',
local: 'Local',
installToLocal: 'Install to Local', installToLocal: 'Install to Local',
totalDownloads: 'Total {count} downloads', totalDownloads: 'Total {count} downloads',
viewData: 'View Data', viewData: 'View Data',
+1
View File
@@ -2571,6 +2571,7 @@ export default {
settings: '设置', settings: '设置',
projectHome: '项目主页', projectHome: '项目主页',
updateHistory: '更新说明', updateHistory: '更新说明',
local: '本地',
installToLocal: '安装到本地', installToLocal: '安装到本地',
totalDownloads: '共 {count} 次下载', totalDownloads: '共 {count} 次下载',
viewData: '查看数据', viewData: '查看数据',
+1
View File
@@ -2572,6 +2572,7 @@ export default {
settings: '設置', settings: '設置',
projectHome: '項目主頁', projectHome: '項目主頁',
updateHistory: '更新說明', updateHistory: '更新說明',
local: '本地',
installToLocal: '安裝到本地', installToLocal: '安裝到本地',
totalDownloads: '共 {count} 次下載', totalDownloads: '共 {count} 次下載',
viewData: '查看數據', viewData: '查看數據',
+6 -4
View File
@@ -34,6 +34,9 @@ const activeTab = ref('installed')
// 获取插件标签页 // 获取插件标签页
const pluginTabs = computed(() => getPluginTabs(t)) const pluginTabs = computed(() => getPluginTabs(t))
// 本地插件来源显示名称
const localRepoLabel = computed(() => t('plugin.local'))
// 使用动态标签页 // 使用动态标签页
const { registerHeaderTab } = useDynamicHeaderTab() const { registerHeaderTab } = useDynamicHeaderTab()
@@ -610,10 +613,9 @@ async function saveFolderPluginOrder() {
// 初始化过滤选项 // 初始化过滤选项
function initOptions(item: Plugin) { function initOptions(item: Plugin) {
const LOCAL_REPO_LABEL = '本地'
const optionValue = (options: Array<string>, value: string | undefined) => { const optionValue = (options: Array<string>, value: string | undefined) => {
if (!value || options.includes(value)) return 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) else options.push(value)
} }
const optionMutipleValue = (options: Array<string>, value: string | undefined) => { const optionMutipleValue = (options: Array<string>, value: string | undefined) => {
@@ -857,9 +859,9 @@ async function refreshMarket() {
// 处理掉github地址的前缀 // 处理掉github地址的前缀
function handleRepoUrl(item: Plugin | string | undefined) { function handleRepoUrl(item: Plugin | string | undefined) {
const url = typeof item === 'string' ? item : item?.repo_url 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) return ''
if (url.startsWith('local://')) return '本地' if (url.startsWith('local://')) return localRepoLabel.value
return url.replace('https://github.com/', '').replace('https://raw.githubusercontent.com/', '') return url.replace('https://github.com/', '').replace('https://raw.githubusercontent.com/', '')
} }