feat: 故障推送 / 公需课自动重学 / 插件解耦,发版 v0.0.8
体检修复:启动日志不再打印 AUTH_TOKEN、密钥可清空、推送失败不占整段冷却、目录名与文案统一成 plugins/。
This commit is contained in:
@@ -14,6 +14,20 @@ interface PluginsResponse {
|
||||
plugins?: PluginInfo[]
|
||||
}
|
||||
|
||||
// 能力名(contract.CAPABILITIES 的键)→ 界面文案
|
||||
const CAPABILITY_LABELS: Record<string, string> = {
|
||||
login: '登录',
|
||||
session: '会话',
|
||||
renew: '续期',
|
||||
profile: '账号信息',
|
||||
courses: '课程列表',
|
||||
discover: '课程详情',
|
||||
study: '学习',
|
||||
quiz: '测验',
|
||||
capture: '抓包',
|
||||
push: '推送',
|
||||
}
|
||||
|
||||
export function PluginsDialog({
|
||||
open,
|
||||
onClose,
|
||||
@@ -68,12 +82,11 @@ export function PluginsDialog({
|
||||
open={open}
|
||||
onClose={onClose}
|
||||
title="插件管理"
|
||||
subtitle="pugins/<名字>/ 下的平台插件:启停立即生效,改完代码重载即可,不用重启服务"
|
||||
size="lg"
|
||||
footer={
|
||||
<>
|
||||
<span className="mr-auto text-[11px] text-slate-400">
|
||||
共 {plugins.length} 个 · 停用后该平台会从「添加账号」的平台下拉里消失
|
||||
共 {plugins.length} 个 · 停用后平台会从「添加账号」下拉里消失,推送渠道也会停止推送
|
||||
</span>
|
||||
<Button
|
||||
variant="soft"
|
||||
@@ -106,10 +119,47 @@ export function PluginsDialog({
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11.5px] text-slate-500">
|
||||
<span>平台 {plugin.label || '—'}</span>
|
||||
<span>id {plugin.id || '—'}</span>
|
||||
<span>能力 {plugin.capabilities.length ? plugin.capabilities.join(' / ') : '无'}</span>
|
||||
<div className="mt-2 space-y-1.5 rounded-lg border border-line/80 bg-white px-3 py-2">
|
||||
<div className="flex flex-wrap items-center gap-1.5">
|
||||
<span className="w-[52px] shrink-0 text-[11px] text-slate-400">适配网站</span>
|
||||
{plugin.sites?.length ? (
|
||||
plugin.sites.map((site) => (
|
||||
<span
|
||||
key={site}
|
||||
className="rounded-md border border-line bg-slate-50 px-1.5 py-0.5 font-mono text-[11px] text-slate-600"
|
||||
>
|
||||
{site}
|
||||
</span>
|
||||
))
|
||||
) : (
|
||||
<span className="text-[11px] text-slate-400">—</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-1.5">
|
||||
<span className="w-[52px] shrink-0 text-[11px] text-slate-400">能力</span>
|
||||
{plugin.capabilities.length ? (
|
||||
plugin.capabilities.map((cap) => (
|
||||
<span
|
||||
key={cap}
|
||||
className="rounded-md bg-brand-50 px-1.5 py-0.5 text-[11px] font-medium text-brand-700 ring-1 ring-inset ring-brand-100"
|
||||
>
|
||||
{CAPABILITY_LABELS[cap] || cap}
|
||||
</span>
|
||||
))
|
||||
) : (
|
||||
<span className="text-[11px] text-slate-400">无</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-x-3 gap-y-1 pl-[52px] text-[11px] text-slate-400">
|
||||
<span>
|
||||
平台 <span className="text-slate-600">{plugin.label || '—'}</span>
|
||||
</span>
|
||||
<span>
|
||||
id <span className="text-slate-600">{plugin.id || '—'}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-2.5 flex items-center gap-2">
|
||||
@@ -144,7 +194,7 @@ export function PluginsDialog({
|
||||
|
||||
{!plugins.length && !loading && (
|
||||
<p className="py-8 text-center text-[12.5px] text-slate-400">
|
||||
pugins/ 下还没有插件。建一个含 pugin.json + main.py 的目录丢进去,刷新即可看到。
|
||||
plugins/ 下还没有插件。建一个含 plugin.json + main.py 的目录丢进去,刷新即可看到。
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user