248 lines
11 KiB
HTML
248 lines
11 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: #0d1117; color: #c9d1d9; font-family: 'Inter', sans-serif; min-height: 100vh; }
|
|
.layout { display: flex; min-height: 100vh; }
|
|
.sidebar {
|
|
width: 200px; flex-shrink: 0; background: #0b1220; border-right: 1px solid rgba(240,246,252,0.08);
|
|
padding: 20px 12px; display: flex; flex-direction: column; gap: 20px;
|
|
}
|
|
.sidebar-logo { font-family: 'Inter', sans-serif; font-size: 16px; font-weight: 700;
|
|
color: #fff; text-decoration: none; padding: 0 10px; }
|
|
.sidebar-menu { display: grid; gap: 6px; }
|
|
.sidebar-link {
|
|
padding: 10px 12px; border-radius: 10px; color: #8b949e; text-decoration: none;
|
|
font-size: 13px; font-weight: 500;
|
|
}
|
|
.sidebar-link:hover { background: rgba(56,139,253,0.14); color: #fff; }
|
|
.sidebar-link.active {
|
|
background: rgba(56,139,253,0.14); color: #fff;
|
|
}
|
|
.content-shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
|
|
.topbar {
|
|
background: transparent; border-bottom: none; padding: 0 24px;
|
|
display: flex; align-items: center; gap: 12px; min-height: 44px;
|
|
}
|
|
.topbar-spacer { flex: 1; }
|
|
.nav-user { font-size: 14px; color: #8b949e; }
|
|
.lang-bar { display: flex; gap: 2px; background: rgba(240,246,252,0.06); border-radius: 8px; padding: 2px; }
|
|
.lang-btn { padding: 4px 10px; border: none; background: none; color: #8b949e;
|
|
font-size: 12px; cursor: pointer; border-radius: 6px; }
|
|
.lang-btn.active { background: rgba(240,246,252,0.1); color: #fff; }
|
|
.btn-sign-out {
|
|
padding: 6px 14px; border-radius: 10px; border: 1px solid rgba(240,246,252,0.12);
|
|
background: #161b22; color: #c9d1d9; font-size: 13px; text-decoration: none; cursor: pointer;
|
|
}
|
|
.btn-sign-out:hover { border-color: rgba(56,139,253,0.45); color: #fff; }
|
|
.main { padding: 16px 16px 24px; flex: 1; }
|
|
.card { background: #111827; border: 1px solid rgba(240,246,252,0.08); border-radius: 18px;
|
|
padding: 20px; width: 100%; }
|
|
.card-title-row {
|
|
display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
|
|
margin-bottom: 18px;
|
|
}
|
|
.card-title { font-size: 22px; font-weight: 700; margin: 0; color: #fff; }
|
|
.card-title-count {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
min-height: 24px;
|
|
padding: 0 8px;
|
|
border: 1px solid rgba(240,246,252,0.08);
|
|
border-radius: 999px;
|
|
background: #0d1117;
|
|
color: #8b949e;
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
line-height: 1;
|
|
font-family: 'JetBrains Mono', monospace;
|
|
}
|
|
.empty { color: #8b949e; font-size: 14px; padding: 20px 0; }
|
|
table { width: 100%; border-collapse: collapse; }
|
|
th, td { text-align: left; vertical-align: top; padding: 14px 12px; border-top: 1px solid rgba(240,246,252,0.08); }
|
|
th { color: #8b949e; font-size: 12px; font-weight: 600; }
|
|
td { font-size: 13px; color: #c9d1d9; }
|
|
.mono { font-family: 'JetBrains Mono', monospace; }
|
|
.col-detail { min-width: 260px; max-width: 460px; }
|
|
.detail-scroll {
|
|
height: calc(1.5em * 3 + 20px);
|
|
min-height: calc(1.5em * 3 + 20px);
|
|
overflow: auto;
|
|
resize: vertical;
|
|
white-space: pre-wrap;
|
|
word-break: break-word;
|
|
padding: 10px;
|
|
background: #0d1117;
|
|
border: 1px solid rgba(240,246,252,0.08);
|
|
border-radius: 10px;
|
|
font-size: 12px;
|
|
font-family: 'JetBrains Mono', monospace;
|
|
margin: 0;
|
|
}
|
|
@media (max-width: 900px) {
|
|
.layout { flex-direction: column; }
|
|
.sidebar {
|
|
width: 100%; border-right: none; border-bottom: 1px solid rgba(240,246,252,0.08);
|
|
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 rgba(240,246,252,0.08); padding: 12px 0; }
|
|
td { border-top: none; padding: 6px 0; }
|
|
td::before {
|
|
display: block; color: #8b949e; font-size: 11px;
|
|
margin-bottom: 4px; text-transform: uppercase;
|
|
content: attr(data-label);
|
|
}
|
|
.detail { max-width: none; }
|
|
}
|
|
.pagination {
|
|
display: flex; align-items: center; gap: 12px; margin-top: 18px;
|
|
justify-content: center; padding: 12px 0;
|
|
}
|
|
.page-btn {
|
|
padding: 8px 12px; border-radius: 10px; border: 1px solid rgba(240,246,252,0.12);
|
|
background: #161b22; color: #c9d1d9; text-decoration: none;
|
|
font-size: 13px; cursor: pointer;
|
|
}
|
|
.page-btn:hover { border-color: rgba(56,139,253,0.45); color: #fff; }
|
|
.page-btn-disabled {
|
|
padding: 8px 12px; border-radius: 10px; border: 1px solid rgba(240,246,252,0.12);
|
|
background: #161b22; color: #6e7681; font-size: 13px;
|
|
opacity: 0.5; cursor: not-allowed;
|
|
}
|
|
.page-info {
|
|
color: #8b949e; font-size: 13px; font-family: 'JetBrains Mono', monospace;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="layout">
|
|
<aside class="sidebar">
|
|
<a href="/dashboard" class="sidebar-logo">secrets</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="/trash" class="sidebar-link" data-i18n="navTrash">回收站</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-row">
|
|
<div class="card-title" data-i18n="auditTitle">我的审计</div>
|
|
<span class="card-title-count">{{ total_count }}</span>
|
|
</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="详情">{% if !entry.detail.is_empty() %}<pre class="detail-scroll">{{ entry.detail }}</pre>{% endif %}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
|
|
{% if total_count > 0 %}
|
|
<div class="pagination">
|
|
{% if current_page > 1 %}
|
|
<a href="?page={{ current_page - 1 }}" class="page-btn" data-i18n="prevPage">上一页</a>
|
|
{% else %}
|
|
<span class="page-btn page-btn-disabled" data-i18n="prevPage">上一页</span>
|
|
{% endif %}
|
|
<span class="page-info">{{ current_page }} / {{ total_pages }}</span>
|
|
{% if current_page < total_pages %}
|
|
<a href="?page={{ current_page + 1 }}" class="page-btn" data-i18n="nextPage">下一页</a>
|
|
{% else %}
|
|
<span class="page-btn page-btn-disabled" data-i18n="nextPage">下一页</span>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
{% endif %}
|
|
</section>
|
|
</main>
|
|
</div>
|
|
</div>
|
|
<script src="/static/i18n.js?v={{ version }}"></script>
|
|
<script>
|
|
(function () {
|
|
I18N_PAGE = {
|
|
'zh-CN': { pageTitle: 'Secrets — 审计', auditTitle: '我的审计', emptyAudit: '暂无审计记录。', colTime: '时间', colAction: '动作', colTarget: '目标', colDetail: '详情', prevPage: '上一页', nextPage: '下一页' },
|
|
'zh-TW': { pageTitle: 'Secrets — 審計', auditTitle: '我的審計', emptyAudit: '暫無審計記錄。', colTime: '時間', colAction: '動作', colTarget: '目標', colDetail: '詳情', prevPage: '上一頁', nextPage: '下一頁' },
|
|
en: { pageTitle: 'Secrets — Audit', auditTitle: 'My audit', emptyAudit: 'No audit records.', colTime: 'Time', colAction: 'Action', colTarget: 'Target', colDetail: 'Detail', prevPage: 'Previous', nextPage: 'Next' }
|
|
};
|
|
|
|
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>
|