Skip to content

Commit 4c7525c

Browse files
authored
Feat(webui): show plugin author on cards & pinned item (#5802) (#6875)
* feat: 为卡片视图增加作者信息 * feat:置顶列表面板新增作者名称与插件名称
1 parent cc28bc4 commit 4c7525c

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

dashboard/src/components/extension/PinnedPluginItem.vue

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ const emit = defineEmits([
3939
const handlePinnedImgError = (e) => {
4040
e.target.src = defaultPluginIcon;
4141
};
42+
43+
const authorDisplay = computed(() => {
44+
const p = props.plugin || {};
45+
if (typeof p.author === 'string' && p.author.trim()) return p.author;
46+
if (Array.isArray(p.authors) && p.authors.length) return p.authors.join(', ');
47+
if (typeof p.author_name === 'string' && p.author_name.trim()) return p.author_name;
48+
if (typeof p.owner === 'string' && p.owner.trim()) return p.owner;
49+
if (p.author && typeof p.author === 'object' && p.author.name) return p.author.name;
50+
return '';
51+
});
4252
</script>
4353

4454
<template>
@@ -70,6 +80,22 @@ const handlePinnedImgError = (e) => {
7080
</template>
7181

7282
<v-card>
83+
<v-card-title class="d-flex" style="gap:8px; padding:12px; align-items:center;">
84+
<div style="display:flex; align-items:center; gap:8px; min-width:0;">
85+
<v-avatar size="40" class="pinned-avatar" style="width:40px; height:40px;">
86+
<img
87+
:src="(typeof plugin.logo === 'string' && plugin.logo.trim()) ? plugin.logo : defaultPluginIcon"
88+
:alt="plugin.name"
89+
@error="handlePinnedImgError"
90+
/>
91+
</v-avatar>
92+
<div style="min-width:0; overflow:hidden;">
93+
<div style="font-weight:600; font-size:0.95rem; white-space:nowrap; text-overflow:ellipsis; overflow:hidden;">{{ plugin.display_name || plugin.name }}</div>
94+
<div style="font-size:0.8rem; color:var(--v-theme-on-surface); opacity:0.8; white-space:nowrap; text-overflow:ellipsis; overflow:hidden;">{{ authorDisplay || (plugin.author || '') }}</div>
95+
</div>
96+
</div>
97+
</v-card-title>
98+
<v-divider></v-divider>
7399
<v-card-text class="d-flex" style="gap:8px; padding:12px;">
74100
<v-tooltip location="top" :text="tm('buttons.viewDocs')">
75101
<template #activator="{ props: a }">

dashboard/src/components/shared/ExtensionCard.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ const astrbotVersionRequirement = computed(() => {
6868
: "";
6969
});
7070
71+
// 作者显示(兼容多种字段名)
72+
const authorDisplay = computed(() => {
73+
const ext = props.extension || {};
74+
if (typeof ext.author === 'string' && ext.author.trim()) return ext.author;
75+
if (Array.isArray(ext.authors) && ext.authors.length) return ext.authors.join(', ');
76+
if (typeof ext.author_name === 'string' && ext.author_name.trim()) return ext.author_name;
77+
if (typeof ext.owner === 'string' && ext.owner.trim()) return ext.owner;
78+
if (ext.author && typeof ext.author === 'object' && ext.author.name) return ext.author.name;
79+
return '';
80+
});
81+
7182
const logoLoadFailed = ref(false);
7283
7384
const logoSrc = computed(() => {
@@ -345,6 +356,10 @@ const viewChangelog = () => {
345356
{{ tag === "danger" ? tm("tags.danger") : tag }}
346357
</v-chip>
347358
<PluginPlatformChip :platforms="supportPlatforms" />
359+
<v-chip v-if="authorDisplay" color="info" label size="small">
360+
<v-icon icon="mdi-account" start></v-icon>
361+
{{ authorDisplay }}
362+
</v-chip>
348363
<v-chip
349364
v-if="astrbotVersionRequirement"
350365
color="secondary"

0 commit comments

Comments
 (0)