refactor: CSP nonce替代unsafe-inline, HSTS始终启用, router/api拆分, 管理后台+用户设置页拆分, DB健康降级, 时区配置, UID统一解析, CI接入
Some checks failed
CI / Lint + Build (push) Has been cancelled
Some checks failed
CI / Lint + Build (push) Has been cancelled
审计修复: - CSP: unsafe-inline移除, nonce替代; unsafe-eval保留供Vditor使用 - HSTS: 始终启用(不再依赖release模式) - Controller Exp: common.GetGinExp包装, 不再直接读context - UID解析: common.ParseUIDParam统一, follow/admin controller改用 重构: - router/api.go(198行)拆为7个域文件: auth/settings/posts/comments/reactions/social/studio - 管理后台站点设置: 单页拆为4个子页(brand/security/registration/content)+子菜单 - 前台用户设置页: 1201行拆为6个独立模板+6个独立JS文件 新增: - DB健康检测中间件(middleware/db_health.go): 5s ping+降级页面 - 时区配置: config.yaml server.timezone→time.Local初始化 - .gitea/workflows/ci.yml: strict模式CI流水线
This commit is contained in:
47
templates/admin/html/site-settings/security.html
Normal file
47
templates/admin/html/site-settings/security.html
Normal file
@ -0,0 +1,47 @@
|
||||
{{template "admin/layout/base.html" .}}
|
||||
<div class="page-header">
|
||||
<h1>站点设置</h1>
|
||||
<p class="page-desc">安全策略与维护模式</p>
|
||||
</div>
|
||||
|
||||
{{template "admin/site-settings/_menu.html" .}}
|
||||
|
||||
<!-- 安全设置 -->
|
||||
<div class="settings-section">
|
||||
<div class="section-title">安全设置</div>
|
||||
<div class="section-body">
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<span class="setting-label">密码强度</span>
|
||||
<span class="setting-desc">注册和修改密码时的最低强度要求</span>
|
||||
</div>
|
||||
<div class="setting-input-wrap">
|
||||
<select id="setting-password-strength" class="setting-select" data-key="password.strength">
|
||||
<option value="low">低 — 仅要求 8 位</option>
|
||||
<option value="medium" selected>中 — 字母+数字/符号(两类)</option>
|
||||
<option value="high">高 — 大小写+数字+符号(至少三类)+ 禁止连续字符</option>
|
||||
<option value="very_high">极高 — 四类全有 + 禁止连续字符</option>
|
||||
</select>
|
||||
<button class="btn btn-sm btn-primary btn-save-select" data-key="password.strength" data-input="setting-password-strength">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 维护设置 -->
|
||||
<div class="settings-section">
|
||||
<div class="section-title">维护设置</div>
|
||||
<div class="section-body">
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<span class="setting-label">启用维护模式</span>
|
||||
<span class="setting-desc">开启后仅站长可登录和访问,其他用户将看到维护提示</span>
|
||||
</div>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" id="maintenance-enabled" data-key="maintenance.enabled">
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "admin/layout/footer.html" .}}
|
||||
Reference in New Issue
Block a user