182 lines
8.0 KiB
HTML
182 lines
8.0 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh-CN">
|
||
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>站点配置 - 管理后台</title>
|
||
<link rel="stylesheet" href="/static/css/ui-components.css?v=3">
|
||
<link rel="stylesheet" href="/static/css/admin.css">
|
||
</head>
|
||
|
||
<body class="admin-layout">
|
||
<header class="admin-header">
|
||
<div class="header-container">
|
||
<a href="/admin/dashboard" class="brand">
|
||
<span style="font-size: 1.5rem;">⚡</span> JieXi Admin
|
||
</a>
|
||
<nav class="nav-links">
|
||
<a href="/admin/dashboard" class="nav-item">仪表板</a>
|
||
<a href="/admin/users" class="nav-item">用户管理</a>
|
||
<a href="/admin/apis" class="nav-item">接口管理</a>
|
||
<a href="/admin/redeem-codes" class="nav-item">兑换码</a>
|
||
<a href="/admin/config" class="nav-item active">系统配置</a>
|
||
<a href="/admin/logs" class="nav-item">日志审计</a>
|
||
</nav>
|
||
<div class="user-actions">
|
||
<a href="/admin/profile" class="ui-btn ui-btn-secondary ui-btn-sm">账号设置</a>
|
||
<button class="ui-btn ui-btn-secondary ui-btn-sm" onclick="logout()">退出登录</button>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
|
||
<main class="main-container">
|
||
<div class="page-header">
|
||
<h1 class="page-title">系统配置</h1>
|
||
<div class="actions">
|
||
<a href="/admin/smtp" class="ui-btn ui-btn-secondary">SMTP设置</a>
|
||
<a href="/admin/health-checks" class="ui-btn ui-btn-secondary">健康检查</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-card" style="max-width: 800px;">
|
||
<form id="configForm">
|
||
<div class="form-group">
|
||
<label>网站标题</label>
|
||
<input type="text" id="site_title" class="ui-input" placeholder="短视频解析平台">
|
||
<small class="text-muted text-sm">显示在浏览器标签</small>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label>主页大标题</label>
|
||
<input type="text" id="home_title" class="ui-input" placeholder="JieXi Pro">
|
||
<small class="text-muted text-sm">显示在首页的主标题</small>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label>主页副标题</label>
|
||
<input type="text" id="home_subtitle" class="ui-input" placeholder="新一代全能短视频去水印解析工具">
|
||
<small class="text-muted text-sm">显示在首页主标题下方</small>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label>网站Logo URL</label>
|
||
<input type="url" id="site_logo" class="ui-input" placeholder="https://example.com/logo.png">
|
||
<small class="text-muted text-sm">留空则不显示Logo</small>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label>网站图标 (Favicon) URL</label>
|
||
<input type="url" id="site_favicon" class="ui-input" placeholder="https://example.com/favicon.ico">
|
||
<small class="text-muted text-sm">浏览器标签页显示的小图标,留空则使用Logo</small>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label>网站公告</label>
|
||
<textarea id="site_notice" class="ui-input" style="min-height: 100px;"
|
||
placeholder="欢迎使用短视频解析平台"></textarea>
|
||
<small class="text-muted text-sm">显示在首页顶部(留空则不显示)</small>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label>网站底部信息</label>
|
||
<textarea id="site_footer" class="ui-input" style="min-height: 80px;"
|
||
placeholder="© 2024 短视频解析平台. All rights reserved."></textarea>
|
||
<small class="text-muted text-sm">显示在页面底部</small>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label>最大并发解析数</label>
|
||
<input type="number" id="max_concurrent" class="ui-input" min="1" max="20" value="3">
|
||
<small class="text-muted text-sm">同时处理的最大解析任务数(1-20)</small>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label>游客每日解析次数</label>
|
||
<input type="number" id="guest_daily_limit" class="ui-input" min="0" max="100" value="5">
|
||
<small class="text-muted text-sm">未登录用户每天可解析的次数</small>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label>普通用户每日解析次数</label>
|
||
<input type="number" id="user_daily_limit" class="ui-input" min="0" max="500" value="10">
|
||
<small class="text-muted text-sm">已注册用户每天可解析的次数</small>
|
||
</div>
|
||
|
||
<div class="mt-4 flex justify-between">
|
||
<div></div>
|
||
<button type="submit" class="ui-btn ui-btn-primary">保存配置</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</main>
|
||
|
||
<script src="/static/js/ui-components.js"></script>
|
||
<script>
|
||
async function loadConfig() {
|
||
try {
|
||
const response = await fetch('/admin/api/config');
|
||
const result = await response.json();
|
||
|
||
if (result.success) {
|
||
const data = result.data;
|
||
Object.keys(data).forEach(key => {
|
||
const element = document.getElementById(key);
|
||
if (element) {
|
||
element.value = data[key] || '';
|
||
}
|
||
});
|
||
}
|
||
} catch (error) {
|
||
UI.notify('加载失败: ' + error.message, 'error');
|
||
}
|
||
}
|
||
|
||
document.getElementById('configForm').addEventListener('submit', async (e) => {
|
||
e.preventDefault();
|
||
|
||
const data = {
|
||
site_title: document.getElementById('site_title').value,
|
||
home_title: document.getElementById('home_title').value,
|
||
home_subtitle: document.getElementById('home_subtitle').value,
|
||
site_logo: document.getElementById('site_logo').value,
|
||
site_favicon: document.getElementById('site_favicon').value,
|
||
site_notice: document.getElementById('site_notice').value,
|
||
site_footer: document.getElementById('site_footer').value,
|
||
max_concurrent: document.getElementById('max_concurrent').value,
|
||
guest_daily_limit: document.getElementById('guest_daily_limit').value,
|
||
user_daily_limit: document.getElementById('user_daily_limit').value
|
||
};
|
||
|
||
try {
|
||
const response = await fetch('/admin/api/config', {
|
||
method: 'PUT',
|
||
headers: { 'Content-Type': 'application/json' },
|
||
body: JSON.stringify(data)
|
||
});
|
||
const result = await response.json();
|
||
|
||
if (result.success) {
|
||
UI.notify('配置保存成功', 'success');
|
||
} else {
|
||
UI.notify('保存失败: ' + result.message, 'error');
|
||
}
|
||
} catch (error) {
|
||
UI.notify('保存失败: ' + error.message, 'error');
|
||
}
|
||
});
|
||
|
||
async function logout() {
|
||
try {
|
||
await fetch('/admin/logout', { method: 'POST' });
|
||
window.location.href = '/admin/login';
|
||
} catch (error) {
|
||
UI.notify('退出失败', 'error');
|
||
}
|
||
}
|
||
|
||
loadConfig();
|
||
</script>
|
||
</body>
|
||
|
||
</html> |