Bump version for the N:N entry_secrets data model and related MCP/Web changes. Remove superseded SQL migration artifacts; rely on auto-migrate. Add structured errors, taxonomy normalization, and web i18n helpers. Made-with: Cursor
183 lines
9.3 KiB
HTML
183 lines
9.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link rel="icon" href="/favicon.svg?v={{ version }}" type="image/svg+xml">
|
|
<title>Secrets — Audit</title>
|
|
<style>
|
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600&family=Inter:wght@400;500;600&display=swap');
|
|
:root {
|
|
--bg: #0d1117; --surface: #161b22; --surface2: #21262d;
|
|
--border: #30363d; --text: #e6edf3; --text-muted: #8b949e;
|
|
--accent: #58a6ff; --accent-hover: #79b8ff;
|
|
}
|
|
body { background: var(--bg); color: var(--text); font-family: 'Inter', sans-serif; min-height: 100vh; }
|
|
.layout { display: flex; min-height: 100vh; }
|
|
.sidebar {
|
|
width: 220px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
|
|
padding: 24px 16px; display: flex; flex-direction: column; gap: 20px;
|
|
}
|
|
.sidebar-logo { font-family: 'JetBrains Mono', monospace; font-size: 16px; font-weight: 600;
|
|
color: var(--text); text-decoration: none; padding: 0 10px; }
|
|
.sidebar-logo span { color: var(--accent); }
|
|
.sidebar-menu { display: flex; flex-direction: column; gap: 6px; }
|
|
.sidebar-link {
|
|
padding: 10px 12px; border-radius: 8px; color: var(--text-muted); text-decoration: none;
|
|
border: 1px solid transparent; font-size: 13px; font-weight: 500;
|
|
}
|
|
.sidebar-link:hover { background: var(--surface2); color: var(--text); }
|
|
.sidebar-link.active {
|
|
background: rgba(88,166,255,0.12); color: var(--text); border-color: rgba(88,166,255,0.35);
|
|
}
|
|
.content-shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
|
|
.topbar {
|
|
background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 24px;
|
|
display: flex; align-items: center; gap: 12px; min-height: 52px;
|
|
}
|
|
.topbar-spacer { flex: 1; }
|
|
.nav-user { font-size: 13px; color: var(--text-muted); }
|
|
.lang-bar { display: flex; gap: 2px; background: var(--surface2); border-radius: 6px; padding: 2px; }
|
|
.lang-btn { padding: 3px 9px; border: none; background: none; color: var(--text-muted);
|
|
font-size: 12px; cursor: pointer; border-radius: 4px; }
|
|
.lang-btn.active { background: var(--border); color: var(--text); }
|
|
.btn-sign-out {
|
|
padding: 5px 12px; border-radius: 6px; border: 1px solid var(--border);
|
|
background: none; color: var(--text); font-size: 12px; text-decoration: none; cursor: pointer;
|
|
}
|
|
.btn-sign-out:hover { background: var(--surface2); }
|
|
.main { padding: 32px 24px 40px; flex: 1; }
|
|
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
|
|
padding: 24px; width: 100%; max-width: 1180px; margin: 0 auto; }
|
|
.card-title { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
|
|
.card-subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }
|
|
.empty { color: var(--text-muted); font-size: 14px; padding: 20px 0; }
|
|
table { width: 100%; border-collapse: collapse; }
|
|
th, td { text-align: left; vertical-align: top; padding: 12px 10px; border-top: 1px solid var(--border); }
|
|
th { color: var(--text-muted); font-size: 12px; font-weight: 600; }
|
|
td { font-size: 13px; }
|
|
.mono { font-family: 'JetBrains Mono', monospace; }
|
|
.detail {
|
|
background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
|
|
padding: 10px; white-space: pre-wrap; word-break: break-word; font-size: 12px;
|
|
max-width: 460px;
|
|
}
|
|
@media (max-width: 900px) {
|
|
.layout { flex-direction: column; }
|
|
.sidebar {
|
|
width: 100%; border-right: none; border-bottom: 1px solid var(--border);
|
|
padding: 16px; gap: 14px;
|
|
}
|
|
.sidebar-menu { flex-direction: row; }
|
|
.sidebar-link { flex: 1; text-align: center; }
|
|
.main { padding: 20px 12px 28px; }
|
|
.card { padding: 16px; }
|
|
.topbar { padding: 12px 16px; flex-wrap: wrap; }
|
|
table, thead, tbody, th, td, tr { display: block; }
|
|
thead { display: none; }
|
|
tr { border-top: 1px solid var(--border); padding: 12px 0; }
|
|
td { border-top: none; padding: 6px 0; }
|
|
td::before {
|
|
display: block; color: var(--text-muted); font-size: 11px;
|
|
margin-bottom: 4px; text-transform: uppercase;
|
|
content: attr(data-label);
|
|
}
|
|
.detail { max-width: none; }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="layout">
|
|
<aside class="sidebar">
|
|
<a href="/dashboard" class="sidebar-logo"><span>secrets</span></a>
|
|
<nav class="sidebar-menu">
|
|
<a href="/dashboard" class="sidebar-link" data-i18n="navMcp">MCP</a>
|
|
<a href="/entries" class="sidebar-link" data-i18n="navEntries">条目</a>
|
|
<a href="/audit" class="sidebar-link active" data-i18n="navAudit">审计</a>
|
|
</nav>
|
|
</aside>
|
|
|
|
<div class="content-shell">
|
|
<div class="topbar">
|
|
<span class="topbar-spacer"></span>
|
|
<span class="nav-user">{{ user_name }}{% if !user_email.is_empty() %} · {{ user_email }}{% endif %}</span>
|
|
<div class="lang-bar">
|
|
<button class="lang-btn" onclick="setLang('zh-CN')">简</button>
|
|
<button class="lang-btn" onclick="setLang('zh-TW')">繁</button>
|
|
<button class="lang-btn" onclick="setLang('en')">EN</button>
|
|
</div>
|
|
<form action="/auth/logout" method="post" style="display:inline">
|
|
<button type="submit" class="btn-sign-out" data-i18n="signOut">退出</button>
|
|
</form>
|
|
</div>
|
|
|
|
<main class="main">
|
|
<section class="card">
|
|
<div class="card-title" data-i18n="auditTitle">我的审计</div>
|
|
<div class="card-subtitle" data-i18n="auditSubtitle">展示最近 100 条与当前用户相关的新审计记录。时间为浏览器本地时区。</div>
|
|
|
|
{% if entries.is_empty() %}
|
|
<div class="empty" data-i18n="emptyAudit">暂无审计记录。</div>
|
|
{% else %}
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th data-i18n="colTime">时间</th>
|
|
<th data-i18n="colAction">动作</th>
|
|
<th data-i18n="colTarget">目标</th>
|
|
<th data-i18n="colDetail">详情</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for entry in entries %}
|
|
<tr>
|
|
<td class="col-time mono" data-label="时间"><time class="audit-local-time" datetime="{{ entry.created_at_iso }}">{{ entry.created_at_iso }}</time></td>
|
|
<td class="col-action mono" data-label="动作">{{ entry.action }}</td>
|
|
<td class="col-target mono" data-label="目标">{{ entry.target }}</td>
|
|
<td class="col-detail" data-label="详情"><pre class="detail">{{ entry.detail }}</pre></td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% endif %}
|
|
</section>
|
|
</main>
|
|
</div>
|
|
</div>
|
|
<script src="/static/i18n.js"></script>
|
|
<script>
|
|
(function () {
|
|
I18N_PAGE = {
|
|
'zh-CN': { pageTitle: 'Secrets — 审计', auditTitle: '我的审计', auditSubtitle: '展示最近 100 条与当前用户相关的新审计记录。时间为浏览器本地时区。', emptyAudit: '暂无审计记录。', colTime: '时间', colAction: '动作', colTarget: '目标', colDetail: '详情' },
|
|
'zh-TW': { pageTitle: 'Secrets — 審計', auditTitle: '我的審計', auditSubtitle: '顯示最近 100 筆與目前使用者相關的新審計記錄。時間為瀏覽器本地時區。', emptyAudit: '暫無審計記錄。', colTime: '時間', colAction: '動作', colTarget: '目標', colDetail: '詳情' },
|
|
en: { pageTitle: 'Secrets — Audit', auditTitle: 'My audit', auditSubtitle: 'Shows the latest 100 audit records related to the current user. Time is in browser local timezone.', emptyAudit: 'No audit records.', colTime: 'Time', colAction: 'Action', colTarget: 'Target', colDetail: 'Detail' }
|
|
};
|
|
|
|
window.applyPageLang = function () {
|
|
document.querySelectorAll('tbody tr').forEach(function (tr) {
|
|
var time = tr.querySelector('.col-time');
|
|
var action = tr.querySelector('.col-action');
|
|
var target = tr.querySelector('.col-target');
|
|
var detail = tr.querySelector('.col-detail');
|
|
if (time) time.setAttribute('data-label', t('mobileLabelTime'));
|
|
if (action) action.setAttribute('data-label', t('mobileLabelAction'));
|
|
if (target) target.setAttribute('data-label', t('mobileLabelTarget'));
|
|
if (detail) detail.setAttribute('data-label', t('mobileLabelDetail'));
|
|
});
|
|
};
|
|
|
|
document.querySelectorAll('time.audit-local-time[datetime]').forEach(function (el) {
|
|
var raw = el.getAttribute('datetime');
|
|
var d = raw ? new Date(raw) : null;
|
|
if (d && !isNaN(d.getTime())) {
|
|
el.textContent = d.toLocaleString(undefined, { dateStyle: 'medium', timeStyle: 'medium' });
|
|
el.title = raw + ' (UTC)';
|
|
}
|
|
});
|
|
applyLang();
|
|
})();
|
|
</script>
|
|
</body>
|
|
</html>
|