feat: 添加预发布版本提醒和检测功能

This commit is contained in:
Soulter
2025-08-19 01:15:56 +08:00
parent 90cb5a1951
commit 6975525b70
3 changed files with 54 additions and 2 deletions
@@ -25,6 +25,12 @@
"dev": "🧐 Development (master branch)"
},
"updateToLatest": "Update to Latest Version",
"preRelease": "Pre-release",
"preReleaseWarning": {
"title": "Pre-release Version Notice",
"description": "Versions marked as pre-release may contain unknown issues or bugs and are not recommended for production use. If you encounter any problems, please visit ",
"issueLink": "GitHub Issues"
},
"tip": "💡 TIP: Switching to an older version or a specific version will not re-download the dashboard files, which may cause some data display errors. You can find the corresponding dashboard files dist.zip at",
"tipLink": "here",
"tipContinue": ", extract and replace the data/dist folder. Of course, the frontend source code is in the dashboard directory, you can also build it yourself using npm install and npm build.",
@@ -25,6 +25,12 @@
"dev": "🧐 开发版(master 分支)"
},
"updateToLatest": "更新到最新版本",
"preRelease": "预发布",
"preReleaseWarning": {
"title": "预发布版本提醒",
"description": "标有预发布标签的版本可能存在未知问题或 Bug,不建议在生产环境使用。如发现问题,请提交至 ",
"issueLink": "GitHub Issues"
},
"tip": "💡 TIP: 跳到旧版本或者切换到某个版本不会重新下载管理面板文件,这可能会造成部分数据显示错误。您可在",
"tipLink": "此处",
"tipContinue": "找到对应的面板文件 dist.zip,解压后替换 data/dist 文件夹即可。当然,前端源代码在 dashboard 目录下,你也可以自己使用 npm install 和 npm build 构建。",
@@ -76,6 +76,13 @@ const open = (link: string) => {
window.open(link, '_blank');
};
// 检测是否为预发布版本
const isPreRelease = (version: string) => {
const preReleaseKeywords = ['alpha', 'beta', 'rc', 'pre', 'preview', 'dev'];
const lowerVersion = version.toLowerCase();
return preReleaseKeywords.some(keyword => lowerVersion.includes(keyword));
};
// 账户修改
function accountEdit() {
accountEditStatus.value.loading = true;
@@ -305,7 +312,7 @@ commonStore.getStartTime();
</v-btn>
<!-- 更新对话框 -->
<v-dialog v-model="updateStatusDialog" :width="$vuetify.display.smAndDown ? '100%' : '1000'" :fullscreen="$vuetify.display.xs">
<v-dialog v-model="updateStatusDialog" :width="$vuetify.display.smAndDown ? '100%' : '1200'" :fullscreen="$vuetify.display.xs">
<template v-slot:activator="{ props }">
<v-btn size="small" @click="checkUpdate(); getReleases(); getDevCommits();" class="action-btn"
color="var(--v-theme-surface)" variant="flat" rounded="sm" v-bind="props">
@@ -357,11 +364,44 @@ commonStore.getStartTime();
href="https://containrrr.dev/watchtower/usage-overview/">{{ t('core.header.updateDialog.dockerTipLink') }}</a> {{ t('core.header.updateDialog.dockerTipContinue') }}</small>
</div>
<v-alert
v-if="releases.some(item => isPreRelease(item.tag_name))"
type="warning"
variant="tonal"
border="start"
>
<template v-slot:prepend>
<v-icon>mdi-alert-circle-outline</v-icon>
</template>
<div class="text-body-2">
<strong>{{ t('core.header.updateDialog.preReleaseWarning.title') }}</strong>
<br>
{{ t('core.header.updateDialog.preReleaseWarning.description') }}
<a href="https://github.com/Soulter/AstrBot/issues" target="_blank" class="text-decoration-none">
{{ t('core.header.updateDialog.preReleaseWarning.issueLink') }}
</a>
</div>
</v-alert>
<v-data-table :headers="releasesHeader" :items="releases" item-key="name">
<template v-slot:item.tag_name="{ item }: { item: { tag_name: string } }">
<div class="d-flex align-center">
<span>{{ item.tag_name }}</span>
<v-chip
v-if="isPreRelease(item.tag_name)"
size="x-small"
color="warning"
variant="tonal"
class="ml-2"
>
{{ t('core.header.updateDialog.preRelease') }}
</v-chip>
</div>
</template>
<template v-slot:item.body="{ item }: { item: { body: string } }">
<v-tooltip :text="item.body">
<template v-slot:activator="{ props }">
<v-btn v-bind="props" rounded="xl" variant="tonal" color="primary" size="small">{{ t('core.header.updateDialog.table.view') }}</v-btn>
<v-btn v-bind="props" rounded="xl" variant="tonal" color="primary" size="x-small">{{ t('core.header.updateDialog.table.view') }}</v-btn>
</template>
</v-tooltip>
</template>