From 9ed86e5f5394dbf07c2a60894156843224d8615a Mon Sep 17 00:00:00 2001 From: kwicxy Date: Fri, 30 May 2025 09:37:21 +0800 Subject: [PATCH] feat: Name trim of extension list to improve readability --- dashboard/src/views/ExtensionMarketplace.vue | 52 ++++++++++++++------ 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/dashboard/src/views/ExtensionMarketplace.vue b/dashboard/src/views/ExtensionMarketplace.vue index 466fe3cc5..516fc35ea 100644 --- a/dashboard/src/views/ExtensionMarketplace.vue +++ b/dashboard/src/views/ExtensionMarketplace.vue @@ -24,7 +24,7 @@ import 'highlight.js/styles/github.css';

✨ 插件市场

mdi-help - + 如无法显示,请单击此按钮跳转至插件市场,复制想安装插件对应的 repo链接然后点击右下角 + 号安装,或打开链接下载压缩包安装。
@@ -38,13 +38,12 @@ import 'highlight.js/styles/github.css'; {{ isListView ? 'mdi-view-grid' : 'mdi-view-list' }}
- + - @@ -68,6 +67,13 @@ import 'highlight.js/styles/github.css';

📦 全部插件

+ @@ -78,9 +84,8 @@ import 'highlight.js/styles/github.css'; alt="logo"> {{ - item.name }} - {{ item.name }} - + showPluginFullName ? item.name : item.trimmedName }} + {{ showPluginFullName ? item.name : item.trimmedName }}
@@ -107,18 +112,18 @@ import 'highlight.js/styles/github.css'; @@ -261,6 +266,7 @@ export default { loading_: false, upload_file: null, pluginMarketData: [], + showPluginFullName: false, loadingDialog: { show: false, title: "加载中...", @@ -315,6 +321,7 @@ export default { this.loading_ = true this.commonStore.getPluginCollections().then((data) => { this.pluginMarketData = data; + this.trimExtensionName(); this.checkAlreadyInstalled(); this.checkUpdate(); this.loading_ = false @@ -363,11 +370,24 @@ export default { getExtensions() { axios.get('/api/plugin/get').then((res) => { this.extension_data = res.data; + this.trimExtensionName(); this.checkAlreadyInstalled(); this.checkUpdate() }); }, - + trimExtensionName() { + console.log(this.pluginMarketData); + this.pluginMarketData.forEach(plugin => { + if (plugin.name) { + let name = plugin.name.trim().toLowerCase(); + if (name.startsWith("astrbot_plugin_")) { + plugin.trimmedName = name.substring(15); + } else if (name.startsWith("astrbot_") || name.startsWith("astrbot-")) { + plugin.trimmedName = name.substring(8); + } else plugin.trimmedName = plugin.name; + } + }); + }, checkUpdate() { // 创建在线插件的map const onlinePluginsMap = new Map();