From 53f18ca6ee866a71038a87c3bf431d476ebdef2c Mon Sep 17 00:00:00 2001 From: Victor_Jay Date: Tue, 2 Jun 2026 16:10:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20CSP=20=E7=AD=96=E7=95=A5=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=20unsafe-inline=EF=BC=8C=E6=94=B9=E7=94=A8=20nonce=20?= =?UTF-8?q?=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SecurityHeaders 中间件生成随机 nonce,注入 context - BuildPageData/BuildAdminPageData 将 CSPNonce 传递给模板 - 所有 19 个模板文件 - + + diff --git a/templates/MetaLab-2026/html/auth/register.html b/templates/MetaLab-2026/html/auth/register.html index e1c1350..525082a 100644 --- a/templates/MetaLab-2026/html/auth/register.html +++ b/templates/MetaLab-2026/html/auth/register.html @@ -38,7 +38,7 @@ 非共享设备推荐 - + {{else}} @@ -89,7 +89,7 @@ - - + + diff --git a/templates/MetaLab-2026/html/home/index.html b/templates/MetaLab-2026/html/home/index.html index 4bf3a6d..c04a0fb 100644 --- a/templates/MetaLab-2026/html/home/index.html +++ b/templates/MetaLab-2026/html/home/index.html @@ -64,7 +64,7 @@ {{end}} @@ -78,7 +78,7 @@ - {{template "layout/footer.html" .}} diff --git a/templates/MetaLab-2026/html/studio/write.html b/templates/MetaLab-2026/html/studio/write.html index 4f61d1f..5476148 100644 --- a/templates/MetaLab-2026/html/studio/write.html +++ b/templates/MetaLab-2026/html/studio/write.html @@ -95,8 +95,8 @@ {{template "layout/footer.html" .}} - - - + + + diff --git a/templates/MetaLab-2026/static/js/common.js b/templates/MetaLab-2026/static/js/common.js index 3dbc8dc..8283790 100644 --- a/templates/MetaLab-2026/static/js/common.js +++ b/templates/MetaLab-2026/static/js/common.js @@ -258,7 +258,8 @@ // ---- Logout ---- var logoutBtn = document.getElementById('logoutBtn'); if (logoutBtn) { - logoutBtn.addEventListener('click', function () { + logoutBtn.addEventListener('click', function (e) { + e.preventDefault(); var xhr = new XMLHttpRequest(); xhr.open('POST', '/api/auth/logout', true); xhr.onreadystatechange = function () { diff --git a/templates/admin/html/audit/index.html b/templates/admin/html/audit/index.html index e4a2cb1..88ad90b 100644 --- a/templates/admin/html/audit/index.html +++ b/templates/admin/html/audit/index.html @@ -92,12 +92,12 @@

请填写拒绝理由:

- + diff --git a/templates/admin/html/layout/footer.html b/templates/admin/html/layout/footer.html index 0888180..02684c5 100644 --- a/templates/admin/html/layout/footer.html +++ b/templates/admin/html/layout/footer.html @@ -1,9 +1,9 @@ - - + + {{if .ExtraJS}} - + {{end}} diff --git a/templates/admin/html/posts/index.html b/templates/admin/html/posts/index.html index 55b237f..45b131f 100644 --- a/templates/admin/html/posts/index.html +++ b/templates/admin/html/posts/index.html @@ -82,5 +82,5 @@ {{end}} - + {{template "admin/layout/footer.html" .}} diff --git a/templates/admin/html/users/index.html b/templates/admin/html/users/index.html index 738c28c..414155f 100644 --- a/templates/admin/html/users/index.html +++ b/templates/admin/html/users/index.html @@ -44,7 +44,7 @@
-