Feature(custom): show last update time in plugin page

This commit is contained in:
Kuingsmile
2026-05-10 08:51:52 +08:00
parent 94f21b52f2
commit 01fd39cf07
7 changed files with 33 additions and 5 deletions

View File

@@ -692,6 +692,7 @@
"installed": "Installed",
"installing": "Installing...",
"installPluginsToGetStarted": "Please install plugins to get started",
"lastUpdated": "Last Updated",
"list": "Plugin List",
"loading": "Loading...",
"loadingPlugins": "Loading plugins...",

View File

@@ -692,6 +692,7 @@
"installed": "已安装",
"installing": "安装中",
"installPluginsToGetStarted": "请先安装插件以开始使用",
"lastUpdated": "最后更新",
"list": "插件列表",
"loading": "加载中...",
"loadingPlugins": "正在加载插件...",

View File

@@ -692,6 +692,7 @@
"installed": "已安裝",
"installing": "安裝中",
"installPluginsToGetStarted": "請先安裝插件以開始使用",
"lastUpdated": "最後更新",
"list": "插件列表",
"loading": "載入中...",
"loadingPlugins": "正在加載插件...",

View File

@@ -133,7 +133,7 @@
</div>
<!-- Plugin Header -->
<div class="mb-4 flex items-start gap-4">
<div class="mb-4 flex items-start gap-2">
<img
class="h-[48px] w-[48px] shrink-0 rounded-lg object-cover"
:src="item.logo"
@@ -153,9 +153,19 @@
>
</h3>
</div>
<p class="m-0 overflow-hidden text-sm text-ellipsis whitespace-nowrap text-secondary">
{{ item.author.replace(/<.*>/, '') }}
</p>
<div class="flex items-center gap-2">
<p class="m-0 overflow-hidden text-sm text-ellipsis whitespace-nowrap text-secondary">
{{ item.author.replace(/<.*>/, '') }}
</p>
<span
v-if="updateTimeMap[item.fullName]"
class="flex shrink-0 items-center gap-1 text-xs text-secondary/70"
:title="t('pages.plugin.lastUpdated')"
>
<CalendarIcon :size="11" />
{{ updateTimeMap[item.fullName] }}
</span>
</div>
</div>
</div>
@@ -337,7 +347,7 @@
>
<div
v-if="!item.gui"
class="absolute top-4 right-4 z-1 rounded-sm bg-accent/20 px-2 py-1 text-sm font-semibold text-secondary"
class="absolute top-4 right-4 z-1 rounded-sm bg-accent/20 px-1 py-0 text-sm font-semibold text-secondary"
>
CLI
</div>
@@ -345,6 +355,14 @@
<p class="m-0 overflow-hidden text-sm text-ellipsis whitespace-nowrap text-secondary">
{{ item.author }}
</p>
<p
v-if="item.date"
class="mt-1 flex shrink-0 items-center gap-1 text-xs text-secondary/70"
:title="t('pages.plugin.lastUpdated')"
>
<CalendarIcon :size="11" />
{{ item.date }}
</p>
</div>
</div>
<div class="mb-6 flex flex-1 items-start">
@@ -407,6 +425,7 @@ import { useStorage } from '@vueuse/core'
import { debounce, DebouncedFunc } from 'lodash-es'
import {
AlertCircleIcon,
CalendarIcon,
CheckIcon,
DownloadIcon,
ExternalLinkIcon,
@@ -448,6 +467,7 @@ const pluginNameList = ref<string[]>([])
const loading = ref(true)
const needReload = ref(false)
const latestVersionMap = reactive<Record<string, string>>({})
const updateTimeMap = reactive<Record<string, string>>({})
const $configForm = useTemplateRef('$configForm')
const strictSearch = useStorage('plugin-strict-search', true)
const showBrowseDialog = ref(false)
@@ -507,6 +527,7 @@ async function getLatestVersionOfPlugIn(pluginName: string) {
const res = await fetch(`https://registry.npmjs.com/${pluginName}`)
const data = await res.json()
latestVersionMap[pluginName] = data['dist-tags'].latest
updateTimeMap[pluginName] = (data.time?.modified || '').split('T')[0]
} catch (err) {
console.error(err)
}
@@ -718,6 +739,7 @@ function handleSearchResult(item: INPMSearchResultObject) {
}
return {
name,
date: pkg.date ? pkg.date.split('T')[0] : '',
fullName: pkg.name,
author: pkg.author?.name || pkg.publisher?.username || 'unknown',
description: pkg.description,

View File

@@ -203,6 +203,7 @@ interface IPluginMenuConfig {
interface INPMSearchResultObject {
package: {
date?: string
name: string
scope: string
version: string