docs: annotate all shared frontend modules in Chinese

This commit is contained in:
cieanyau committed 2026-11-06 00:30:15 +08:00
1 parent 2be21c1c62
commit 408f8e5c98
55 files changed
+349

No files matched your search

+4
View File
@@ -1,3 +1,4 @@
/** 登录后的站内回跳规则;只接受单斜杠开头路径,拒绝外站、反斜杠和控制字符。 */
function e(e) {
if (
typeof e != `string` ||
@@ -7,6 +8,7 @@ function e(e) {
)
return `/`;
try {
// 路径解码后再次检查,避免编码后的双斜杠或反斜杠绕过站内限制。
let t = decodeURIComponent(e.split(/[?#]/, 1)[0] || ``);
if (t.startsWith(`//`) || /[\\\u0000-\u0020\u007f]/.test(t)) return `/`;
} catch {
@@ -14,6 +16,7 @@ function e(e) {
}
return e;
}
// 首页不需要额外 query;无效的 redirect 也会被归一为首页。
function t(t) {
let n = e(t);
return n === `/`
@@ -22,6 +25,7 @@ function t(t) {
redirect: n,
};
}
// t 是调用方提供的登录/注册入口,n 是待校验回跳路径;整段编码后作为单一参数附加。
function n(t, n) {
let r = e(n);
return r === `/` ? t : `${t}?redirect=${encodeURIComponent(r)}`;