0904
This commit is contained in:
@@ -0,0 +1,154 @@
|
||||
[app]
|
||||
production = true
|
||||
title = "NekoBox"
|
||||
icp = ""
|
||||
default_lang = "" ; 站点默认语言:zh-CN / zh-TW / en / ja,留空默认简体中文(访客未设置语言时的兜底)
|
||||
uptrace_dsn = ""
|
||||
qiniu_access_key = ""
|
||||
qiniu_access_secret = ""
|
||||
aliyun_access_key = ""
|
||||
aliyun_access_key_secret = ""
|
||||
share_background = "https://your-default-background.jpg" ; 默认分享图背景图链接(1280x720)
|
||||
font_path = "static/fonts/NotoSansSC-Regular.otf" ; 中文字体文件路径(相对项目根目录)
|
||||
|
||||
[security]
|
||||
enable_text_censor = true
|
||||
ip_blacklist = ; 逗号分隔的IP黑名单,支持精确IP(如1.2.3.4)和CIDR(如1.2.3.0/24),留空不启用
|
||||
ip_blacklist_redirect_url = ; 黑名单IP访问时强制跳转到该URL
|
||||
trust_proxy = false ; 是否信任反向代理设置的 CF-Connecting-IP / X-Real-IP / X-Forwarded-For 头。
|
||||
; 仅当站点部署在可信反向代理(如 nginx/Cloudflare)之后且代理已覆盖这些头时设为 true;
|
||||
; 否则保持 false,防止客户端伪造 header 绕过速率限制与 IP 黑名单。
|
||||
; ⚠️ 若站点在 Cloudflare 后且需使用下面的自动封禁,必须设为 true,
|
||||
; 否则解析到的将是 Cloudflare 边缘 IP,自动封禁会误伤所有访客。
|
||||
; ⚠️ 开启 trust_proxy 时,必须配合「Cloudflare Tunnel / Authenticated Origin Pull /
|
||||
; 防火墙仅放行 Cloudflare / EdgeOne 回源网段」锁定源站,否则攻击者可直连源站并伪造
|
||||
; CF-Connecting-IP / EO-Client-IP 头。无需维护 CDN 庞大 CIDR 清单。
|
||||
;
|
||||
; —— 双 CDN(境内腾讯 EdgeOne + 境外 Cloudflare)场景 ——
|
||||
; EdgeOne 回源会用 EO-Client-IP 携带客户端真实 IP(等效 CF-Connecting-IP),
|
||||
; 本程序在 trust_proxy=true 时已同时信任这两个权威头。
|
||||
; 两家 CDN 并存时必须:① 防火墙仅放行两家回源网段;② 在各家 CDN 的规则引擎中
|
||||
; 删除回源请求里「对方 CDN」的权威头(经 EdgeOne 回源删 CF-Connecting-IP、
|
||||
; 经 Cloudflare 回源删 EO-Client-IP),否则攻击者可借道另一家伪造客户端身份,
|
||||
; 绕过限流 / 自动封禁 / 单 IP 投票限制。详细步骤见 outputs/edgeone-cloudflare-dual-cdn-guide.md。
|
||||
|
||||
trusted_proxies =
|
||||
; 逗号分隔的「你自己的」反向代理/负载均衡 IP 或 CIDR(如 127.0.0.1、
|
||||
; 10.0.0.0/8)。仅当 TCP 对端落在该清单内时才解析 X-Forwarded-For / X-Real-IP。
|
||||
; 留空(默认)则这两个头永不被信任,仅采用 CDN 权威头 CF-Connecting-IP /
|
||||
; EO-Client-IP(需源站已锁定)。
|
||||
; 注意:此清单用于你自己的基础设施,不是 CDN 的全量 CIDR 清单。
|
||||
enable_auto_ban = true ; 自动封禁(fail2ban 风格):检测到批量扫描/探测后临时封禁来源 IP
|
||||
ban_track_notfound = false ; 是否把「未注册路径的 404」计入封禁统计(默认 false)。正常业务
|
||||
; (域名/题目不存在等均走 302 业务跳转,不产生 404 计数)一律放行,
|
||||
; 仅命中后台扫描特征路径(/admin、/.env 等)才参与统计封禁,避免
|
||||
; 共享出口(CDN 边缘 / CGNAT)下正常用户被 404 探测连坐误伤。
|
||||
; 如需恢复对纯 404 字典扫描的封禁再置 true。
|
||||
ban_threshold_sensitive = 10 ; 统计窗口内命中敏感路径(/admin、/.env、/wp-admin 等)的次数阈值
|
||||
ban_threshold_404 = 20 ; 统计窗口内返回 404 的次数阈值(仅 ban_track_notfound = true 时生效)
|
||||
ban_window_seconds = 60 ; 统计窗口时长(秒)
|
||||
ban_duration_minutes = 15 ; 临时封禁时长(分钟),到期自动解除,重启即清零
|
||||
security_alert_email = ; 触发封禁时发送告警邮件的收件人(复用下方 SMTP 发信配置),留空不发送
|
||||
|
||||
[server]
|
||||
port = 80
|
||||
; 绑定监听地址(含端口)。Cloudflare Tunnel 部署时强烈建议设为 127.0.0.1:<port>,
|
||||
; 使源站端口仅对本地 cloudflared 可见,即使防火墙误配也无法被外部直连伪造 CF-Connecting-IP。
|
||||
; 留空(默认)则监听所有网卡 ":port"。
|
||||
listen =
|
||||
salt = ""
|
||||
# ⚠️ 必填:密码哈希盐,留空会导致启动失败(已在 conf.Init 强制校验)
|
||||
xsrf_key = ""
|
||||
# ⚠️ 必填:CSRF token 密钥,留空会导致启动失败(已强制校验)
|
||||
xsrf_expire = 3600
|
||||
|
||||
[database]
|
||||
type = "postgres"
|
||||
user = "nekobox"
|
||||
password = ""
|
||||
host = "127.0.0.1"
|
||||
port = 5432
|
||||
name = "nekobox"
|
||||
schema = "public"
|
||||
# 仅在已确认需要自动清理重复 email/domain 时开启;默认关闭,避免启动时改写账号数据。
|
||||
dedupe_unique_fields = false
|
||||
|
||||
[redis]
|
||||
addr = "127.0.0.1:6379"
|
||||
password = ""
|
||||
|
||||
[recaptcha]
|
||||
captcha_type = recaptcha ; recaptcha(默认), turnstile, math(本地算数验证码,国内访问友好)
|
||||
domain = "https://www.recaptcha.net"
|
||||
site_key = ""
|
||||
server_key = ""
|
||||
turnstile_style = false
|
||||
|
||||
[upload]
|
||||
default_avatar = ""
|
||||
default_background = ""
|
||||
|
||||
# User avatar and background.
|
||||
aliyun_endpoint = ""
|
||||
aliyun_access_id = ""
|
||||
aliyun_access_secret = ""
|
||||
aliyun_bucket = ""
|
||||
aliyun_bucket_cdn_host = ""
|
||||
image_endpoint = ""
|
||||
image_access_id = ""
|
||||
image_access_secret =""
|
||||
image_bucket = ""
|
||||
image_bucket_cdn_host = ""
|
||||
|
||||
# User uploaded images.
|
||||
image_endpoint = ""
|
||||
image_access_id = ""
|
||||
image_access_secret = ""
|
||||
image_bucket = ""
|
||||
image_bucket_cdn_host = ""
|
||||
|
||||
[mail]
|
||||
account = ""
|
||||
password = ""
|
||||
port = 465
|
||||
smtp = ""
|
||||
|
||||
[limits]
|
||||
; ── 全站内容 / 数量上限(运行时配置,修改后重启生效)──────────────────────
|
||||
; 缺失本段或个别键时按内置默认值运行。长度统一按字符(rune)计数。
|
||||
; 键留空或填 0/负数时自动回退内置默认值,不会导致启动失败,但也不会按你的意图生效,
|
||||
; 请按需填写正整数。本文件启用 IgnoreInlineComment,行内分号注释会被并入配置值,
|
||||
; 因此下面注释一律独占整行、勿写行内注释。
|
||||
|
||||
; ── 标签与屏蔽词(账号设置页)──────────────────────────────────────────────
|
||||
; 最多标签个数
|
||||
max_tags = 5
|
||||
; 单个标签最大字符数
|
||||
max_tag_len = 5
|
||||
; 最多屏蔽词个数
|
||||
max_block_words = 10
|
||||
; 单个屏蔽词最大字符数
|
||||
max_block_word_len = 10
|
||||
|
||||
; ── 投票 ────────────────────────────────────────────────────────────────────
|
||||
; 参与者填写的「自定义补充选项」(其他/自定义)最大字符数
|
||||
custom_answer_len = 200
|
||||
; 站长创建投票时单个「选项」文本最大字符数(预设选项)
|
||||
vote_option_len = 300
|
||||
|
||||
; ── 提问 / 回答 / 追问 ─────────────────────────────────────────────────────
|
||||
; 提问正文最大字符数(访客提交的问题内容)
|
||||
question_content_len = 1000
|
||||
; 回答正文最大字符数(箱主对提问的回答,及对追问的回复,共用)
|
||||
answer_content_len = 2000
|
||||
; 追问正文最大字符数(提问者被回答后继续追问的内容)
|
||||
followup_content_len = 2000
|
||||
|
||||
; ── 私聊 ────────────────────────────────────────────────────────────────────
|
||||
; 单条消息(发送/回复)最大字符数
|
||||
chat_message_len = 2000
|
||||
; 每个私聊会话的消息条数上限(系统硬顶)。用户只能在 1..该值 之间设置自己的
|
||||
; 会话条数上限;新注册用户的默认值即该硬顶。
|
||||
chat_max_messages = 200
|
||||
; 单用户每日私信条数上限(用户可设范围 0..该值;0 表示不限制每日条数)
|
||||
daily_message_limit_max = 999
|
||||
@@ -0,0 +1,266 @@
|
||||
// Package autoban 提供 fail2ban 风格的自动临时封禁:检测批量扫描/探测特征后
|
||||
// 临时封禁来源 IP,并可回调发送告警。纯标准库实现,便于独立测试与复用。
|
||||
package autoban
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 探测事件类型
|
||||
const (
|
||||
KindNone = 0 // 无探测特征
|
||||
KindSensitive = 1 // 命中敏感路径
|
||||
KindNotFound = 2 // 404 响应(未命中敏感路径)
|
||||
)
|
||||
|
||||
// 默认阈值/窗口(Options 未配置或为 0 时兜底)。
|
||||
const (
|
||||
DefaultWindowSeconds = 60
|
||||
DefaultDurationMinutes = 15
|
||||
DefaultThresholdSensitive = 10
|
||||
DefaultThreshold404 = 20
|
||||
pathSampleMax = 6
|
||||
)
|
||||
|
||||
// Options 自动封禁配置。
|
||||
type Options struct {
|
||||
Enabled bool
|
||||
ThresholdSensitive int // 窗口内敏感路径命中次数
|
||||
Threshold404 int // 窗口内 404 次数
|
||||
Window time.Duration // 统计窗口
|
||||
Duration time.Duration // 封禁时长
|
||||
AlertEmail string // 告警收件人(留空不发送)
|
||||
SendAlert func(ip string, paths []string, durationMinutes int) error // 告警发送函数(nil 则不发送)
|
||||
}
|
||||
|
||||
// sensitivePaths 常见后台/配置/漏洞探测路径特征(忽略大小写,前缀匹配)。
|
||||
var sensitivePaths = []string{
|
||||
"/admin", "/wp-admin", "/wp-login.php", "/wp-content", "/wordpress",
|
||||
"/administrator", "/manager", "/cpanel", "/plesk",
|
||||
"/.env", "/.git", "/.aws", "/.ssh", "/.svn", "/.hg", "/.htaccess",
|
||||
"/config", "/configuration", "/backup", "/database", "/db",
|
||||
"/actuator", "/swagger", "/api-docs", "/openapi", "/v2/api-docs",
|
||||
"/phpmyadmin", "/pma", "/mysql", "/server-status", "/server-info",
|
||||
"/shell", "/webshell", "/cmd", "/eval", "/hack", "/shell.php",
|
||||
"/login.php", "/admin.php", "/index.php", "/console", "/vendor",
|
||||
}
|
||||
|
||||
type probeEvent struct {
|
||||
at time.Time
|
||||
kind int
|
||||
}
|
||||
|
||||
type probeStat struct {
|
||||
events []probeEvent
|
||||
sensitive int
|
||||
notFound int
|
||||
paths []string // 命中路径样本(告警用)
|
||||
}
|
||||
|
||||
// Banner 自动封禁器。方法并发安全。
|
||||
type Banner struct {
|
||||
mu sync.Mutex
|
||||
|
||||
probes map[string]*probeStat
|
||||
banned map[string]time.Time
|
||||
alerted map[string]bool
|
||||
|
||||
thresholdSensitive int
|
||||
threshold404 int
|
||||
window time.Duration
|
||||
duration time.Duration
|
||||
alertEmail string
|
||||
sendAlert func(ip string, paths []string, durationMinutes int) error
|
||||
enabled bool
|
||||
}
|
||||
|
||||
// New 按配置创建封禁器并注册全局清理。
|
||||
func New(opts Options) *Banner {
|
||||
window := opts.Window
|
||||
if window <= 0 {
|
||||
window = DefaultWindowSeconds * time.Second
|
||||
}
|
||||
duration := opts.Duration
|
||||
if duration <= 0 {
|
||||
duration = DefaultDurationMinutes * time.Minute
|
||||
}
|
||||
sensitive := opts.ThresholdSensitive
|
||||
if sensitive <= 0 {
|
||||
sensitive = DefaultThresholdSensitive
|
||||
}
|
||||
notFound := opts.Threshold404
|
||||
if notFound <= 0 {
|
||||
notFound = DefaultThreshold404
|
||||
}
|
||||
b := &Banner{
|
||||
probes: make(map[string]*probeStat),
|
||||
banned: make(map[string]time.Time),
|
||||
alerted: make(map[string]bool),
|
||||
thresholdSensitive: sensitive,
|
||||
threshold404: notFound,
|
||||
window: window,
|
||||
duration: duration,
|
||||
alertEmail: strings.TrimSpace(opts.AlertEmail),
|
||||
sendAlert: opts.SendAlert,
|
||||
enabled: opts.Enabled,
|
||||
}
|
||||
register(b)
|
||||
return b
|
||||
}
|
||||
|
||||
// Record 记录一次探测事件,达到阈值时封禁 IP 并触发一次告警。
|
||||
func (b *Banner) Record(ip, path string, kind int) {
|
||||
if !b.enabled || ip == "" || kind == KindNone {
|
||||
return
|
||||
}
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
|
||||
now := time.Now()
|
||||
cutoff := now.Add(-b.window)
|
||||
|
||||
st := b.probes[ip]
|
||||
if st == nil {
|
||||
st = &probeStat{}
|
||||
b.probes[ip] = st
|
||||
}
|
||||
|
||||
// 滚动清理过期事件并重算计数
|
||||
valid := st.events[:0]
|
||||
sensitive, notFound := 0, 0
|
||||
for _, e := range st.events {
|
||||
if e.at.After(cutoff) {
|
||||
valid = append(valid, e)
|
||||
if e.kind == KindSensitive {
|
||||
sensitive++
|
||||
} else if e.kind == KindNotFound {
|
||||
notFound++
|
||||
}
|
||||
}
|
||||
}
|
||||
valid = append(valid, probeEvent{at: now, kind: kind})
|
||||
if kind == KindSensitive {
|
||||
sensitive++
|
||||
} else {
|
||||
notFound++
|
||||
}
|
||||
st.events = valid
|
||||
st.sensitive = sensitive
|
||||
st.notFound = notFound
|
||||
if len(st.paths) < pathSampleMax && path != "" {
|
||||
st.paths = append(st.paths, path)
|
||||
}
|
||||
|
||||
if sensitive < b.thresholdSensitive && notFound < b.threshold404 {
|
||||
return
|
||||
}
|
||||
|
||||
// 已达阈值:封禁(已在封禁中则跳过)
|
||||
if until, ok := b.banned[ip]; ok && until.After(now) {
|
||||
return
|
||||
}
|
||||
until := now.Add(b.duration)
|
||||
b.banned[ip] = until
|
||||
|
||||
// 告警(每 IP 仅一次)
|
||||
if b.alertEmail != "" && b.sendAlert != nil && !b.alerted[ip] {
|
||||
b.alerted[ip] = true
|
||||
sample := append([]string{}, st.paths...)
|
||||
dur := int(b.duration.Minutes())
|
||||
go func() {
|
||||
_ = b.sendAlert(ip, sample, dur)
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
// IsBanned 判断 IP 是否处于封禁期;到期自动解除。
|
||||
func (b *Banner) IsBanned(ip string) bool {
|
||||
if !b.enabled || ip == "" {
|
||||
return false
|
||||
}
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
if until, ok := b.banned[ip]; ok {
|
||||
if until.After(time.Now()) {
|
||||
return true
|
||||
}
|
||||
delete(b.banned, ip)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsSensitivePath 判断路径是否命中敏感探测特征(忽略大小写,完整段前缀匹配)。
|
||||
func IsSensitivePath(p string) bool {
|
||||
lower := strings.ToLower(p)
|
||||
for _, s := range sensitivePaths {
|
||||
if lower == s || strings.HasPrefix(lower, s+"/") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// ---------- 全局注册与清理 ----------
|
||||
|
||||
var (
|
||||
bannersMu sync.Mutex
|
||||
banners = make(map[*Banner]struct{})
|
||||
bannersOnce sync.Once
|
||||
)
|
||||
|
||||
func register(b *Banner) {
|
||||
bannersMu.Lock()
|
||||
banners[b] = struct{}{}
|
||||
bannersMu.Unlock()
|
||||
|
||||
bannersOnce.Do(func() {
|
||||
go func() {
|
||||
for {
|
||||
time.Sleep(2 * time.Minute)
|
||||
bannersMu.Lock()
|
||||
for b := range banners {
|
||||
b.cleanup()
|
||||
}
|
||||
bannersMu.Unlock()
|
||||
}
|
||||
}()
|
||||
})
|
||||
}
|
||||
|
||||
// cleanup 定期清理过期探测记录与已到期封禁(防止内存膨胀)。
|
||||
func (b *Banner) cleanup() {
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
|
||||
now := time.Now()
|
||||
cutoff := now.Add(-b.window)
|
||||
|
||||
for ip, st := range b.probes {
|
||||
if len(st.events) == 0 || st.events[len(st.events)-1].at.Before(cutoff) {
|
||||
delete(b.probes, ip)
|
||||
continue
|
||||
}
|
||||
valid := st.events[:0]
|
||||
sensitive, notFound := 0, 0
|
||||
for _, e := range st.events {
|
||||
if e.at.After(cutoff) {
|
||||
valid = append(valid, e)
|
||||
if e.kind == KindSensitive {
|
||||
sensitive++
|
||||
} else if e.kind == KindNotFound {
|
||||
notFound++
|
||||
}
|
||||
}
|
||||
}
|
||||
st.events = valid
|
||||
st.sensitive = sensitive
|
||||
st.notFound = notFound
|
||||
}
|
||||
for ip, until := range b.banned {
|
||||
if !until.After(now) {
|
||||
delete(b.banned, ip)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package autoban
|
||||
|
||||
import (
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func newTestBanner(thresholdSensitive, threshold404 int, window, duration time.Duration, alertEmail string, alertCalls *int64) *Banner {
|
||||
return New(Options{
|
||||
Enabled: true,
|
||||
ThresholdSensitive: thresholdSensitive,
|
||||
Threshold404: threshold404,
|
||||
Window: window,
|
||||
Duration: duration,
|
||||
AlertEmail: alertEmail,
|
||||
SendAlert: func(ip string, paths []string, dur int) error {
|
||||
if alertCalls != nil {
|
||||
atomic.AddInt64(alertCalls, 1)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestSensitiveThreshold(t *testing.T) {
|
||||
b := newTestBanner(2, 5, time.Minute, time.Minute, "", nil)
|
||||
b.Record("1.2.3.4", "/admin", KindSensitive)
|
||||
if b.IsBanned("1.2.3.4") {
|
||||
t.Fatal("should not be banned before reaching threshold")
|
||||
}
|
||||
b.Record("1.2.3.4", "/.env", KindSensitive)
|
||||
if !b.IsBanned("1.2.3.4") {
|
||||
t.Fatal("expected ban after reaching sensitive threshold")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNotFoundThreshold(t *testing.T) {
|
||||
b := newTestBanner(10, 3, time.Minute, time.Minute, "", nil)
|
||||
for i := 0; i < 3; i++ {
|
||||
b.Record("5.6.7.8", "/random-"+string(rune('a'+i)), KindNotFound)
|
||||
}
|
||||
if !b.IsBanned("5.6.7.8") {
|
||||
t.Fatal("expected ban after reaching 404 threshold")
|
||||
}
|
||||
}
|
||||
|
||||
func TestWindowExpiry(t *testing.T) {
|
||||
b := newTestBanner(2, 5, 50*time.Millisecond, time.Minute, "", nil)
|
||||
b.Record("1.1.1.1", "/admin", KindSensitive)
|
||||
time.Sleep(80 * time.Millisecond) // 事件滑出窗口
|
||||
b.Record("1.1.1.1", "/.env", KindSensitive)
|
||||
if b.IsBanned("1.1.1.1") {
|
||||
t.Fatal("events outside the window must not accumulate")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDurationExpiry(t *testing.T) {
|
||||
b := newTestBanner(1, 5, time.Minute, 60*time.Millisecond, "", nil)
|
||||
b.Record("2.2.2.2", "/admin", KindSensitive)
|
||||
if !b.IsBanned("2.2.2.2") {
|
||||
t.Fatal("expected ban")
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond) // 封禁到期
|
||||
if b.IsBanned("2.2.2.2") {
|
||||
t.Fatal("ban should expire after duration")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAlertOncePerIP(t *testing.T) {
|
||||
var calls int64
|
||||
b := newTestBanner(1, 5, time.Minute, time.Minute, "[email protected]", &calls)
|
||||
b.Record("9.9.9.9", "/wp-admin", KindSensitive)
|
||||
b.Record("9.9.9.9", "/.git", KindSensitive) // 已在封禁中,不应重复告警
|
||||
b.Record("9.9.9.9", "/config", KindSensitive)
|
||||
|
||||
// sendAlert 异步调用,轮询等待最多 500ms
|
||||
deadline := time.Now().Add(500 * time.Millisecond)
|
||||
for atomic.LoadInt64(&calls) == 0 && time.Now().Before(deadline) {
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
if got := atomic.LoadInt64(&calls); got != 1 {
|
||||
t.Fatalf("expected exactly 1 alert, got %d", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDisabled(t *testing.T) {
|
||||
b := New(Options{Enabled: false})
|
||||
b.Record("3.3.3.3", "/admin", KindSensitive)
|
||||
if b.IsBanned("3.3.3.3") {
|
||||
t.Fatal("disabled auto-ban must not ban")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaults(t *testing.T) {
|
||||
b := New(Options{Enabled: true}) // 全部走默认值
|
||||
if b.thresholdSensitive != DefaultThresholdSensitive || b.threshold404 != DefaultThreshold404 {
|
||||
t.Fatalf("default thresholds wrong: %d/%d", b.thresholdSensitive, b.threshold404)
|
||||
}
|
||||
if b.window != DefaultWindowSeconds*time.Second || b.duration != DefaultDurationMinutes*time.Minute {
|
||||
t.Fatalf("default window/duration wrong: %v/%v", b.window, b.duration)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsSensitivePath(t *testing.T) {
|
||||
cases := []struct {
|
||||
path string
|
||||
want bool
|
||||
}{
|
||||
{"/admin", true},
|
||||
{"/admin/panel", true},
|
||||
{"/WP-ADMIN", true},
|
||||
{"/.env", true},
|
||||
{"/user/questions", false},
|
||||
{"/vote/abc123", false},
|
||||
{"/administratorx", false}, // 前缀必须完整段匹配,避免误伤
|
||||
}
|
||||
for _, c := range cases {
|
||||
if got := IsSensitivePath(c.path); got != c.want {
|
||||
t.Errorf("IsSensitivePath(%q) = %v, want %v", c.path, got, c.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,409 @@
|
||||
// Copyright 2022 E99p1ant. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package route
|
||||
|
||||
import (
|
||||
"encoding/gob"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/flamego/cache"
|
||||
cacheRedis "github.com/flamego/cache/redis"
|
||||
"github.com/flamego/csrf"
|
||||
"github.com/flamego/flamego"
|
||||
"github.com/flamego/recaptcha"
|
||||
"github.com/flamego/session"
|
||||
"github.com/flamego/session/mysql"
|
||||
sessionRedis "github.com/flamego/session/redis"
|
||||
"github.com/flamego/template"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/tamakyi/TamaBox/internal/captcha"
|
||||
"github.com/tamakyi/TamaBox/internal/conf"
|
||||
"github.com/tamakyi/TamaBox/internal/context"
|
||||
"github.com/tamakyi/TamaBox/internal/form"
|
||||
"github.com/tamakyi/TamaBox/internal/i18n"
|
||||
"github.com/tamakyi/TamaBox/internal/mail"
|
||||
"github.com/tamakyi/TamaBox/internal/route/chat" // 私聊路由
|
||||
"github.com/tamakyi/TamaBox/internal/security/autoban"
|
||||
"github.com/tamakyi/TamaBox/internal/shared"
|
||||
templatepkg "github.com/tamakyi/TamaBox/internal/template"
|
||||
"github.com/tamakyi/TamaBox/route"
|
||||
"github.com/tamakyi/TamaBox/route/auth"
|
||||
"github.com/tamakyi/TamaBox/route/pixel"
|
||||
"github.com/tamakyi/TamaBox/route/question"
|
||||
"github.com/tamakyi/TamaBox/route/service"
|
||||
"github.com/tamakyi/TamaBox/route/user"
|
||||
"github.com/tamakyi/TamaBox/route/vote"
|
||||
"github.com/tamakyi/TamaBox/static"
|
||||
"github.com/tamakyi/TamaBox/templates"
|
||||
)
|
||||
|
||||
// CSRFUserSessionKey 是 CSRF token 绑定的会话键,必须与登录时写入的会话键一致
|
||||
// (见 route/auth/login.go 中 ctx.Session.Set("uid", ...))。flamego/csrf 默认使用
|
||||
// "userID",若不与之对齐,token 的 id 恒为 "0",任意匿名访客从公开页面取到的 token
|
||||
// 对全部已登录用户均有效,CSRF 退化为全站公开常量。
|
||||
//
|
||||
// 本常量同时被 csrf_binding_test.go 引用,作为单一事实来源:一旦被误改,回归测试会在
|
||||
// CI 失败,避免修复悄悄倒退。
|
||||
const CSRFUserSessionKey = "uid"
|
||||
|
||||
// securityHeaders adds security-related HTTP headers to every response.
|
||||
func securityHeaders() flamego.Handler {
|
||||
return func(ctx flamego.Context) {
|
||||
w := ctx.ResponseWriter()
|
||||
w.Header().Set("X-Content-Type-Options", "nosniff")
|
||||
w.Header().Set("X-Frame-Options", "DENY")
|
||||
w.Header().Set("X-XSS-Protection", "1; mode=block")
|
||||
w.Header().Set("Referrer-Policy", "strict-origin-when-cross-origin")
|
||||
// HSTS:仅当站点以 https 对外提供服务时下发,避免 http 部署下把用户锁死在 https。
|
||||
if strings.HasPrefix(conf.App.ExternalURL, "https") {
|
||||
w.Header().Set("Strict-Transport-Security", "max-age=31536000; includeSubDomains")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func New() *flamego.Flame {
|
||||
f := flamego.Classic()
|
||||
if conf.App.Production {
|
||||
flamego.SetEnv(flamego.EnvTypeProd)
|
||||
}
|
||||
|
||||
// 自动封禁实例:整个请求链路共享同一个,供中间件与 f.NotFound 复用,
|
||||
// 避免对业务性 302→/(语言切换、登出、投票不存在等)误判为路径扫描。
|
||||
ab := autoban.New(autoban.Options{
|
||||
Enabled: conf.Security.EnableAutoBan,
|
||||
ThresholdSensitive: conf.Security.BanThresholdSensitive,
|
||||
Threshold404: conf.Security.BanThreshold404,
|
||||
Window: time.Duration(conf.Security.BanWindowSeconds) * time.Second,
|
||||
Duration: time.Duration(conf.Security.BanDurationMinutes) * time.Minute,
|
||||
AlertEmail: conf.Security.SecurityAlertEmail,
|
||||
SendAlert: mail.SendSecurityAlertMail,
|
||||
})
|
||||
// 需要输出详细日志时配置如下
|
||||
// if conf.App.Production {
|
||||
// flamego.SetEnv(flamego.EnvTypeProd)
|
||||
// }
|
||||
|
||||
templateFS, err := template.EmbedFS(templates.FS, ".", []string{".html"})
|
||||
if err != nil {
|
||||
logrus.WithError(err).Fatal("Failed to embed templates file system")
|
||||
}
|
||||
|
||||
gob.Register(time.Time{})
|
||||
gob.Register(context.Flash{})
|
||||
gob.Register(captcha.StoredAnswer{})
|
||||
var sessionStorage interface{}
|
||||
initer := session.MemoryIniter()
|
||||
if conf.Database.DSN != "" {
|
||||
initer = mysql.Initer()
|
||||
sessionStorage = mysql.Config{
|
||||
DSN: conf.Database.DSN,
|
||||
Lifetime: 7 * 24 * time.Hour,
|
||||
}
|
||||
}
|
||||
if conf.Redis.Addr != "" {
|
||||
initer = sessionRedis.Initer()
|
||||
sessionStorage = sessionRedis.Config{
|
||||
Options: &sessionRedis.Options{
|
||||
Addr: conf.Redis.Addr,
|
||||
Password: conf.Redis.Password,
|
||||
DB: 1,
|
||||
},
|
||||
Lifetime: 7 * 24 * time.Hour,
|
||||
}
|
||||
}
|
||||
sessioner := session.Sessioner(session.Options{
|
||||
Initer: initer,
|
||||
Config: sessionStorage,
|
||||
// 显式声明 cookie 安全属性,不依赖库默认值:
|
||||
// - HTTPOnly:禁止 JS 读取,降低 XSS 窃取会话的风险
|
||||
// - SameSite=Lax:阻断经典跨站表单 POST(CSRF 的主要防线之一)
|
||||
// - Secure:仅在站点以 https 对外服务时下发,避免 http 本地开发下 cookie 不生效。
|
||||
// 缺失 Secure 时,HSTS 尚未落地的首次访问可被主动 MITM 诱导明文请求窃取会话。
|
||||
Cookie: session.CookieOptions{
|
||||
HTTPOnly: true,
|
||||
SameSite: http.SameSiteLaxMode,
|
||||
Secure: strings.HasPrefix(conf.App.ExternalURL, "https"),
|
||||
},
|
||||
})
|
||||
|
||||
f.Use(flamego.Static(flamego.StaticOptions{
|
||||
FileSystem: http.FS(static.FS),
|
||||
Prefix: "/static",
|
||||
// 静态资源随二进制发布,内容变更需重新部署;1 天缓存是安全折中
|
||||
CacheControl: func() string {
|
||||
return "public, max-age=86400"
|
||||
},
|
||||
}))
|
||||
|
||||
f.Use(securityHeaders())
|
||||
f.Use(ipBlacklistMiddleware())
|
||||
f.Use(autobanMiddleware(ab))
|
||||
// 全局请求体上限:必须在任何会读取 body 的中间件(尤其 Contexter 内的 CSRF 校验)
|
||||
// 之前执行,否则超大 multipart 会在 Bind 的路由级限制生效前落盘临时文件耗尽磁盘。
|
||||
f.Use(requestBodyLimitMiddleware())
|
||||
|
||||
reqUserSignOut := context.Toggle(&context.ToggleOptions{UserSignOutRequired: true})
|
||||
reqUserSignIn := context.Toggle(&context.ToggleOptions{UserSignInRequired: true})
|
||||
|
||||
f.Group("", func() {
|
||||
f.Get("/", route.Home)
|
||||
f.Get("/pixel", reqUserSignIn, pixel.Index)
|
||||
f.Get("/sponsor", route.Sponsor)
|
||||
f.Get("/change-logs", route.ChangeLogs)
|
||||
f.Get("/about-me", route.AboutMe)
|
||||
f.Get("/robots.txt", func(c context.Context) {
|
||||
fs, err := static.FS.Open("robots.txt")
|
||||
if err != nil {
|
||||
c.ResponseWriter().WriteHeader(404)
|
||||
return
|
||||
}
|
||||
defer func() { _ = fs.Close() }()
|
||||
c.ResponseWriter().Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
c.ResponseWriter().Header().Set("Cache-Control", "public, max-age=86400")
|
||||
_, _ = io.Copy(c.ResponseWriter(), fs)
|
||||
})
|
||||
f.Get("/favicon.ico", func(c context.Context) {
|
||||
fs, _ := static.FS.Open("favicon.ico")
|
||||
defer func() { _ = fs.Close() }()
|
||||
c.ResponseWriter().Header().Set("Content-Type", "image/x-icon")
|
||||
c.ResponseWriter().Header().Set("Cache-Control", "public, max-age=86400")
|
||||
_, _ = io.Copy(c.ResponseWriter(), fs)
|
||||
})
|
||||
|
||||
f.Get("/sitemap.xml", func(c context.Context) {
|
||||
fs, err := static.FS.Open("sitemap.xml")
|
||||
if err != nil {
|
||||
c.ResponseWriter().WriteHeader(404)
|
||||
return
|
||||
}
|
||||
defer func() { _ = fs.Close() }()
|
||||
c.ResponseWriter().Header().Set("Content-Type", "application/xml")
|
||||
c.ResponseWriter().Header().Set("Content-Type", "text/xml; charset=utf-8")
|
||||
c.ResponseWriter().Header().Set("Cache-Control", "public, max-age=86400")
|
||||
_, _ = io.Copy(c.ResponseWriter(), fs)
|
||||
})
|
||||
|
||||
f.Get("/llms.txt", func(c context.Context) {
|
||||
fs, err := static.FS.Open("llms.txt")
|
||||
if err != nil {
|
||||
c.ResponseWriter().WriteHeader(404)
|
||||
return
|
||||
}
|
||||
defer func() { _ = fs.Close() }()
|
||||
c.ResponseWriter().Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
c.ResponseWriter().Header().Set("Cache-Control", "public, max-age=86400")
|
||||
_, _ = io.Copy(c.ResponseWriter(), fs)
|
||||
})
|
||||
|
||||
f.Get("/llms-full.txt", func(c context.Context) {
|
||||
fs, err := static.FS.Open("llms-full.txt")
|
||||
if err != nil {
|
||||
c.ResponseWriter().WriteHeader(404)
|
||||
return
|
||||
}
|
||||
defer func() { _ = fs.Close() }()
|
||||
c.ResponseWriter().Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
c.ResponseWriter().Header().Set("Cache-Control", "public, max-age=86400")
|
||||
_, _ = io.Copy(c.ResponseWriter(), fs)
|
||||
})
|
||||
|
||||
f.Group("", func() {
|
||||
f.Combo("/register").Get(auth.Register).Post(form.Bind(form.Register{}), rateLimitMiddleware(10, 1*time.Minute), auth.RegisterAction)
|
||||
f.Combo("/login").Get(auth.Login).Post(form.Bind(form.Login{}), rateLimitMiddleware(20, 1*time.Minute), auth.LoginAction)
|
||||
f.Combo("/forgot-password").Get(auth.ForgotPassword).Post(form.Bind(form.ForgotPassword{}), rateLimitMiddleware(5, 5*time.Minute), auth.ForgotPasswordAction)
|
||||
f.Combo("/recover-password").Get(auth.RecoverPassword).Post(form.Bind(form.RecoverPassword{}), auth.RecoverPasswordAction)
|
||||
}, reqUserSignOut)
|
||||
|
||||
// 页面密码验证路由(独立于密码保护中间件);限流防爆破
|
||||
f.Combo("/_/{domain}/password").Get(question.PasswordPage).Post(rateLimitMiddleware(10, 1*time.Minute), question.VerifyPagePassword)
|
||||
|
||||
// 独立的分享图路由(不经过 Pager 中间件,直接返回图片)
|
||||
// 注意:仍挂载 question.Pager,页面设置了密码时必须先通过密码验证,
|
||||
// 否则分享图会绕过页面密码保护(与单题分享图行为一致)。
|
||||
f.Group("/_/{domain}", func() {
|
||||
f.Get("/share-card", question.ShareCard)
|
||||
}, question.Pager)
|
||||
|
||||
f.Group("/_/{domain}", func() {
|
||||
f.Combo("").Get(question.List).Post(form.Bind(form.NewQuestion{}), rateLimitMiddleware(30, 1*time.Minute), question.New)
|
||||
f.Group("/{questionID}", func() {
|
||||
f.Get("", question.Item)
|
||||
f.Get("/share-card", question.QuestionShareCard)
|
||||
f.Post("/delete", question.Delete)
|
||||
f.Post("/set-private", question.SetPrivate)
|
||||
f.Post("/set-public", question.SetPublic)
|
||||
f.Post("/pin", question.TogglePin)
|
||||
f.Post("/read", question.SetRead)
|
||||
f.Post("/unread", question.SetUnread)
|
||||
f.Post("/answer", reqUserSignIn, form.Bind(form.PublishAnswerQuestion{}), question.PublishAnswer)
|
||||
f.Post("/follow-up", form.Bind(form.PublishFollowUpQuestion{}), question.PublishFollowUp)
|
||||
f.Post("/follow-up/{followUpID}/answer", reqUserSignIn, form.Bind(form.AnswerFollowUpQuestion{}), question.AnswerFollowUp)
|
||||
}, question.Questioner)
|
||||
|
||||
// 新增:私聊路由(需要登录,使用 Token 标识对话)
|
||||
f.Group("/chat/{token}", func() {
|
||||
f.Get("", chat.ConversationPage)
|
||||
f.Post("/send", rateLimitMiddleware(20, 1*time.Minute), chat.SendMessage)
|
||||
f.Post("/delete", chat.DeleteConversation)
|
||||
f.Post("/block", chat.ToggleBlockUser)
|
||||
}, reqUserSignIn)
|
||||
}, question.Pager) // Pager 中间件已内置页面密码检查
|
||||
|
||||
f.Get("/explore", user.Explore)
|
||||
|
||||
// 匿名投票参与端(公开):token 链接入口
|
||||
f.Group("/vote/{token}", func() {
|
||||
f.Get("", vote.Page)
|
||||
// 提交限流优先按登录用户/签名 vote_fp 计数,IP 仅作高阈值兜底,避免共享出口误伤。
|
||||
f.Post("/submit", voteSubmitRateLimitMiddleware(20, 1*time.Minute), vote.Submit)
|
||||
})
|
||||
|
||||
// 公开页语言切换:把语言偏好写入 session(由 session 中间件随其 cookie 一并持久化)
|
||||
// 后跳回原页面。此前写独立 lang cookie 会被 session 中间件的 Set-Cookie 整体覆盖而失效,
|
||||
// 故改为托管在 session 中。仅允许站内相对路径,防开放重定向。
|
||||
f.Get("/i18n/{lang}", func(c context.Context) {
|
||||
lang := i18n.Resolve(c.Param("lang"))
|
||||
// 写入 session,避免被 session 中间件的 Set-Cookie 覆盖(匿名用户也走 session 中间件)。
|
||||
c.Session.Set("lang", lang)
|
||||
to := c.Query("to")
|
||||
// 仅允许站内相对路径,防开放重定向:
|
||||
// 拒绝空、非 "/" 开头、以 "//" 开头的协议相对路径,以及含反斜杠/控制字符的变体。
|
||||
if to == "" || !strings.HasPrefix(to, "/") ||
|
||||
strings.HasPrefix(to, "//") || strings.ContainsAny(to, "\\\x00\r\n\t") {
|
||||
to = "/"
|
||||
}
|
||||
c.Redirect(to)
|
||||
})
|
||||
|
||||
// 算数验证码 API(仅在 captcha_type = "math" 时生效,但路由本身不依赖中间件)
|
||||
// 加限流:防止匿名脚本无限生成/轮询爆破(答案本身对客户端可见,限流是主要节流手段)。
|
||||
f.Get("/api/captcha/generate", rateLimitMiddleware(20, 1*time.Minute), captcha.GenerateHandler)
|
||||
f.Post("/api/captcha/verify", rateLimitMiddleware(20, 1*time.Minute), captcha.VerifyHandler)
|
||||
|
||||
f.Group("/user", func() {
|
||||
f.Get("/questions", user.QuestionList)
|
||||
|
||||
// 匿名投票管理(箱主侧)
|
||||
f.Group("/votes", func() {
|
||||
f.Get("", user.VoteList)
|
||||
f.Get("/new", user.VoteNew)
|
||||
f.Post("", rateLimitMiddleware(10, 1*time.Minute), user.VoteCreate)
|
||||
f.Get("/{voteID}/edit", user.VoteEdit)
|
||||
f.Post("/{voteID}", rateLimitMiddleware(10, 1*time.Minute), user.VoteUpdate)
|
||||
f.Post("/{voteID}/publish", user.VotePublish)
|
||||
f.Post("/{voteID}/close", user.VoteClose)
|
||||
f.Post("/{voteID}/delete", user.VoteDelete)
|
||||
f.Get("/{voteID}/results", user.VoteResults)
|
||||
f.Get("/{voteID}/preview", user.VotePreview)
|
||||
// 导出为只读操作(幂等、无副作用),用 GET 链接下载,避免表单提交
|
||||
f.Get("/{voteID}/export", user.VoteExportCSV)
|
||||
})
|
||||
|
||||
f.Group("/profile", func() {
|
||||
f.Get("", user.Profile)
|
||||
f.Post("/update", form.Bind(form.UpdateProfile{}), rateLimitMiddleware(10, 1*time.Minute), user.UpdateProfile)
|
||||
f.Post("/export", user.ExportProfile)
|
||||
f.Post("/export-json", user.ExportProfileJSON)
|
||||
f.Combo("/deactivate").Get(user.DeactivateProfile).Post(user.DeactivateProfileAction)
|
||||
|
||||
f.Post("/update-page-password", form.Bind(form.UpdatePagePassword{}), rateLimitMiddleware(10, 1*time.Minute), user.UpdatePagePassword)
|
||||
f.Post("/update-ask-password", form.Bind(form.UpdateAskPassword{}), rateLimitMiddleware(10, 1*time.Minute), user.UpdateAskPassword)
|
||||
|
||||
f.Post("/update-chat-settings", user.UpdateChatSettings)
|
||||
|
||||
// 功能管理(提问 / 私聊 / 投票 的开关、定时开关与定量收集):
|
||||
// 不单独开页面,作为账号设置页的三个面板,保存后回跳到对应面板。
|
||||
f.Group("/features", func() {
|
||||
f.Post("/update", rateLimitMiddleware(20, 1*time.Minute), user.FeaturesUpdate)
|
||||
f.Post("/reset-quota", rateLimitMiddleware(20, 1*time.Minute), user.FeatureResetQuota)
|
||||
})
|
||||
})
|
||||
// 防骚扰设置:注册限制(harassment/update)与全局屏蔽词(blockwords/update)
|
||||
// 拆为两个独立入口。屏蔽词在提问/私聊/投票三个设置面板共用一份,保存后经
|
||||
// ?tab= 参数回跳到来源面板。
|
||||
f.Post("/harassment/update", form.Bind(form.UpdateHarassment{}), user.UpdateHarassment)
|
||||
f.Post("/blockwords/update", form.Bind(form.UpdateBlockWords{}), user.UpdateBlockWords)
|
||||
f.Post("/tags/update", form.Bind(form.UpdateTags{}), user.UpdateTags)
|
||||
// Logout 必须用 POST:GET 会留下 CSRF 风险(第三方图片/链接可触发退出登录)
|
||||
f.Post("/logout", auth.Logout)
|
||||
}, reqUserSignIn)
|
||||
|
||||
f.Group("/api/v1", func() {
|
||||
f.Group("/user", func() {
|
||||
f.Get("", reqUserSignIn, user.ProfileAPI)
|
||||
f.Group("/{domain}", func() {
|
||||
f.Group("/questions", func() {
|
||||
f.Get("", rateLimitMiddleware(60, 1*time.Minute), question.ListAPI)
|
||||
})
|
||||
})
|
||||
})
|
||||
// 像素追踪代理:仅暴露只读 GET(f.Any 会放行写方法,曾有 CSRF 豁免 + 写方法放行的风险),
|
||||
// 并加限流防止被用作高频打点通道。
|
||||
f.Get("/pixel/{**}", reqUserSignIn, rateLimitMiddleware(30, 1*time.Minute), pixel.Proxy)
|
||||
// 服务反代仅暴露只读 GET:本网关是把已登录用户的请求转发到配置好的内部服务,
|
||||
// 不应允许任意写方法,避免被用作对内网后端的越权操作入口。
|
||||
f.Get("/service/{**}", reqUserSignIn, service.Proxy)
|
||||
f.Get("/explore/random", rateLimitMiddleware(60, 1*time.Minute), user.RandomRecommend)
|
||||
// 首页"提问箱信息统计"公开接口(服务端 30 分钟缓存),供前端定时刷新
|
||||
f.Get("/site-stats", rateLimitMiddleware(60, 1*time.Minute), route.SiteStatsAPI)
|
||||
}, context.APIEndpoint)
|
||||
},
|
||||
cache.Cacher(cache.Options{
|
||||
Initer: cacheRedis.Initer(),
|
||||
Config: cacheRedis.Config{
|
||||
Options: &cacheRedis.Options{
|
||||
Addr: conf.Redis.Addr,
|
||||
Password: conf.Redis.Password,
|
||||
DB: 0,
|
||||
},
|
||||
},
|
||||
}),
|
||||
recaptcha.V3(
|
||||
recaptcha.Options{
|
||||
Secret: conf.Recaptcha.ServerKey,
|
||||
VerifyURL: func() recaptcha.VerifyURL {
|
||||
if conf.Recaptcha.TurnstileStyle {
|
||||
return "https://challenges.cloudflare.com/turnstile/v0/siteverify"
|
||||
}
|
||||
return recaptcha.VerifyURLGlobal
|
||||
}(),
|
||||
},
|
||||
),
|
||||
sessioner,
|
||||
csrf.Csrfer(csrf.Options{
|
||||
Secret: conf.Server.XSRFKey,
|
||||
Header: "X-CSRF-Token",
|
||||
// ⚠️ 必须与 route/auth/login.go 中 ctx.Session.Set("uid", ...) 的 key 一致。
|
||||
// flamego/csrf 默认 SessionKey 为 "userID",若不显式指定,s.Get("userID")
|
||||
// 恒为 nil,token 内绑定的 id 恒为 "0" —— 由于校验是无状态 HMAC 重算
|
||||
// (不与 session 中存储的 token 比对),这会导致任意匿名访客从公开的
|
||||
// /login 页面取到的 token 对所有已登录用户均有效,CSRF 退化为全站公开常量。
|
||||
// 回归测试见 route/csrf_binding_test.go(引用 CSRFUserSessionKey)。
|
||||
SessionKey: CSRFUserSessionKey,
|
||||
}),
|
||||
template.Templater(template.Options{
|
||||
FileSystem: templateFS,
|
||||
FuncMaps: templatepkg.FuncMap(),
|
||||
}),
|
||||
context.Contexter(),
|
||||
)
|
||||
f.NotFound(func(ctx flamego.Context) {
|
||||
// 真正的 404 探测在此计数(仅此处,不把业务 302→/ 误判为扫描)。
|
||||
// 注意:flamego 的 NotFound 会先写入 404 状态再 Redirect 到 "/",
|
||||
// 因此这里在 Redirect 之前记录,确保状态为 404。
|
||||
// 键必须与 autobanMiddleware 中的 IsBanned/Record 保持一致(同样经 LimitKey 聚合),
|
||||
// 否则 404 计数会记在另一个键上,导致封禁永不生效。
|
||||
if ip := shared.LimitKey(shared.ResolveClientIP(ctx.Request().Request)); ip != "" {
|
||||
ab.Record(ip, ctx.Request().URL.Path, autoban.KindNotFound)
|
||||
}
|
||||
ctx.Redirect("/")
|
||||
})
|
||||
|
||||
return f
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
// Copyright 2022 E99p1ant. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package conf
|
||||
|
||||
// Build time and commit information.
|
||||
//
|
||||
// ⚠️ WARNING: should only be set by "-ldflags".
|
||||
var (
|
||||
BuildTime string
|
||||
BuildCommit = "dev"
|
||||
)
|
||||
|
||||
var (
|
||||
App struct {
|
||||
Production bool `ini:"production"`
|
||||
ExternalURL string `ini:"external_url"`
|
||||
ICP string `ini:"icp"`
|
||||
DefaultLang string `ini:"default_lang"` // 站点默认语言(zh-CN/zh-TW/en/ja),留空回退简体中文
|
||||
UptraceDSN string `ini:"uptrace_dsn"`
|
||||
QiniuAccessKey string `ini:"qiniu_access_key"`
|
||||
QiniuAccessSecret string `ini:"qiniu_access_secret"`
|
||||
AliyunAccessKey string `ini:"aliyun_access_key"`
|
||||
AliyunAccessKeySecret string `ini:"aliyun_access_key_secret"`
|
||||
SentryDSN string `ini:"sentry_dsn"`
|
||||
MaintenanceMode bool `ini:"maintenance_mode"`
|
||||
ShareBackground string `ini:"share_background"`
|
||||
FontPath string `ini:"font_path"`
|
||||
}
|
||||
|
||||
Security struct {
|
||||
EnableTextCensor bool `ini:"enable_text_censor"`
|
||||
IPBlacklist string `ini:"ip_blacklist"`
|
||||
IPBlacklistRedirectURL string `ini:"ip_blacklist_redirect_url"`
|
||||
// TrustProxy 为 true 时信任 CDN 权威客户端头 CF-Connecting-IP / EO-Client-IP
|
||||
// (以及受信代理设置的 X-Real-IP / X-Forwarded-For);否则一律使用 RemoteAddr,
|
||||
// 防止客户端伪造 header 绕过速率限制与 IP 黑名单。
|
||||
TrustProxy bool `ini:"trust_proxy"`
|
||||
// TrustedProxies 逗号分隔的 IP / CIDR 列表,仅限“你自己的”反向代理/负载均衡基础设施
|
||||
// (例如本机 nginx 的 127.0.0.1、私有网络 LB)。仅当 TCP 对端落在该清单内时才会解析
|
||||
// X-Forwarded-For / X-Real-IP。留空则这两个头永不被信任(CDN 权威头 CF-Connecting-IP /
|
||||
// EO-Client-IP 仍会被采用,前提是源站已被对应 CDN 锁定)。
|
||||
// 目的:避免维护 Cloudflare / EdgeOne 等上游 CDN 的庞大 CIDR 清单——源站应配合
|
||||
// Cloudflare Tunnel / Authenticated Origin Pull / 防火墙仅放行 CDN 回源网段锁定,
|
||||
// 使 CF-Connecting-IP / EO-Client-IP 成为权威客户端 IP。
|
||||
TrustedProxies string `ini:"trusted_proxies"`
|
||||
// 自动封禁(fail2ban 风格):检测批量扫描/探测特征后临时封禁来源 IP。
|
||||
EnableAutoBan bool `ini:"enable_auto_ban"`
|
||||
BanThresholdSensitive int `ini:"ban_threshold_sensitive"` // 窗口内敏感路径命中次数
|
||||
BanThreshold404 int `ini:"ban_threshold_404"` // 窗口内 404 次数
|
||||
BanWindowSeconds int `ini:"ban_window_seconds"` // 统计窗口(秒)
|
||||
BanDurationMinutes int `ini:"ban_duration_minutes"` // 封禁时长(分钟)
|
||||
SecurityAlertEmail string `ini:"security_alert_email"` // 触发封禁时告警收件人(留空不发送)
|
||||
}
|
||||
|
||||
Server struct {
|
||||
Port int `ini:"port"`
|
||||
Listen string `ini:"listen"` // 绑定监听地址(含端口)。留空则默认 ":port"(监听所有网卡)。
|
||||
Salt string `ini:"salt"`
|
||||
XSRFKey string `ini:"xsrf_key"`
|
||||
}
|
||||
|
||||
Database struct {
|
||||
DSN string
|
||||
|
||||
Type string `ini:"type"`
|
||||
User string `ini:"user"`
|
||||
Password string `ini:"password"`
|
||||
Host string `ini:"host"`
|
||||
Port uint `ini:"port"`
|
||||
Name string `ini:"name"`
|
||||
Schema string `ini:"schema"`
|
||||
DedupeUniqueFields bool `ini:"dedupe_unique_fields"`
|
||||
}
|
||||
|
||||
Redis struct {
|
||||
Addr string `ini:"addr"`
|
||||
Password string `ini:"password"`
|
||||
}
|
||||
|
||||
Recaptcha struct {
|
||||
CaptchaType string `ini:"captcha_type"`
|
||||
Domain string `ini:"domain"`
|
||||
SiteKey string `ini:"site_key"`
|
||||
ServerKey string `ini:"server_key"`
|
||||
TurnstileStyle bool `ini:"turnstile_style"`
|
||||
}
|
||||
|
||||
Pixel struct {
|
||||
Host string `ini:"host"`
|
||||
}
|
||||
|
||||
Upload struct {
|
||||
DefaultAvatarURL string `ini:"default_avatar"`
|
||||
DefaultBackground string `ini:"default_background"`
|
||||
DefaultBackgroundImageURL string `ini:"default_qrbackgroundimage"`
|
||||
AliyunEndpoint string `ini:"aliyun_endpoint"`
|
||||
AliyunAccessID string `ini:"aliyun_access_id"`
|
||||
AliyunAccessSecret string `ini:"aliyun_access_secret"`
|
||||
AliyunBucket string `ini:"aliyun_bucket"`
|
||||
AliyunBucketCDNHost string `ini:"aliyun_bucket_cdn_host"`
|
||||
ImageEndpoint string `ini:"image_endpoint"`
|
||||
ImageAccessID string `ini:"image_access_id"`
|
||||
ImageAccessSecret string `ini:"image_access_secret"`
|
||||
ImageBucket string `ini:"image_bucket"`
|
||||
ImageBucketCDNHost string `ini:"image_bucket_cdn_host"`
|
||||
}
|
||||
|
||||
Mail struct {
|
||||
Account string `ini:"account"`
|
||||
Password string `ini:"password"`
|
||||
Port int `ini:"port"`
|
||||
SMTP string `ini:"smtp"`
|
||||
// SkipTLSVerify 跳过 SMTP TLS 证书校验(仅自签名/内网 SMTP 需要,默认 false 校验证书)
|
||||
SkipTLSVerify bool `ini:"skip_tls_verify"`
|
||||
}
|
||||
|
||||
Service struct {
|
||||
Backends []struct {
|
||||
Prefix string `ini:"prefix"`
|
||||
ForwardURL string `ini:"forward_url"`
|
||||
}
|
||||
// TLSInsecureSkipVerify 跳过反向代理到后端服务的 TLS 证书校验
|
||||
// (仅内网后端使用自签名证书时需要,默认 false 校验证书)
|
||||
TLSInsecureSkipVerify bool `ini:"tls_insecure_skip_verify"`
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,977 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{.LangCode}}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<title>{{ .Title }}</title>
|
||||
<meta name="description" content="{{ if .MetaDescription }}{{ .MetaDescription }}{{ else }}{{ t .LangCode "site.description" }}{{ end }}">
|
||||
<meta name="keywords" content="{{ t .LangCode "site.keywords" }}">
|
||||
<!-- 预连接:UIkit 走公共 CDN(cdnjs.snrat.com),其余自托管库仍在本站 R2,均需预连接 -->
|
||||
<link rel="preconnect" href="https://r2.337845818.best" crossorigin>
|
||||
<link rel="preconnect" href="https://cdnjs.snrat.com" crossorigin>
|
||||
<link rel="dns-prefetch" href="https://cn.vercount.one">
|
||||
<!-- UIkit 3.3.3 切到公共 CDN(cdnjs.snrat.com,国内实测全量下载 ~0.25s,原 R2 自建 ~1.4-2.0s) -->
|
||||
<link rel="stylesheet" href="https://cdnjs.snrat.com/ajax/libs/uikit/3.3.3/css/uikit.min.css"/>
|
||||
<!-- Waline 评论区样式:非阻塞加载,不阻塞首屏渲染 -->
|
||||
<link rel="stylesheet" href="https://r2.337845818.best/tamabox/cdn/waline/client/v2/waline-no-commits.css" media="print" onload="this.media='all'"/>
|
||||
<script defer src="https://cdnjs.snrat.com/ajax/libs/uikit/3.3.3/js/uikit.min.js"></script>
|
||||
<script defer src="https://cdnjs.snrat.com/ajax/libs/uikit/3.3.3/js/uikit-icons.min.js"></script>
|
||||
<!-- UIkit 补丁:复刻原自建版 "modify-black-font"(官方版与自建版仅 3 处颜色差异——把有色容器内默认白字/白标题改为黑字)。
|
||||
模板当前只用到 .uk-light 容器(用户背景封面,question/list.html、question-not-found.html;
|
||||
其中 h3/p 已由 #usernamecolor/#introcolor 内联 style 覆盖),故只需补该容器的 3 处投影即可保持渲染一致。
|
||||
若日后新增 .uk-card-primary/.uk-card-secondary/.uk-section-primary/.uk-tile-*/.uk-overlay-primary 等容器且需黑字,须同步扩展。 -->
|
||||
<style>
|
||||
.uk-light { color: rgba(0,0,0,.7); }
|
||||
.uk-light .uk-h1, .uk-light .uk-h2, .uk-light .uk-h3, .uk-light .uk-h4, .uk-light .uk-h5, .uk-light .uk-h6,
|
||||
.uk-light .uk-heading-2xlarge, .uk-light .uk-heading-large, .uk-light .uk-heading-medium, .uk-light .uk-heading-small, .uk-light .uk-heading-xlarge,
|
||||
.uk-light h1, .uk-light h2, .uk-light h3, .uk-light h4, .uk-light h5, .uk-light h6 { color: #000; }
|
||||
.uk-light .uk-table th { color: rgba(0,0,0,.7); }
|
||||
</style>
|
||||
<script defer src="https://r2.337845818.best/tamabox/cdn/lib/dayjs/1.10.8/dayjs.min.js"></script>
|
||||
<script defer src="https://r2.337845818.best/tamabox/cdn/lib/alpinejs/3.9.0/cdn.min.js"></script>
|
||||
{{ if .VConsole }}
|
||||
<script src="https://r2.337845818.best/tamabox/cdn/lib/vconsole/3.12.1/vconsole.min.js" type="application/javascript"></script>
|
||||
<script>new window.VConsole()</script>
|
||||
{{ end }}
|
||||
<!-- jQuery 已改为按需加载:仅 easy.qrcode 二维码页(list/question-not-found/profile)自行引入 -->
|
||||
<script defer src="https://r2.337845818.best/tamabox/cdn/time.box.js"></script>
|
||||
<!--<script src="https://r2.337845818.best/tamabox/cdn/busuanzi.pure.mini.js"/></script>-->
|
||||
<script defer src="https://cn.vercount.one/js"></script>
|
||||
<script defer src="https://r2.337845818.best/tamabox/cdn/lib/waline/2.15.8/waline.js"></script>
|
||||
{{ if eq .CaptchaType "math" }}
|
||||
<!-- 算数验证码:弹窗模式,不影响原布局 -->
|
||||
<style>
|
||||
.captcha-equation-box {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
background: #f0f2f5;
|
||||
border: 1px solid #dcdcdc;
|
||||
border-radius: 8px;
|
||||
padding: 8px 8px 8px 16px;
|
||||
gap: 6px;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
.captcha-equation-box:focus-within {
|
||||
border-color: #1e87f0;
|
||||
box-shadow: 0 0 0 3px rgba(30,135,240,0.12);
|
||||
}
|
||||
.math-captcha-modal-question {
|
||||
font-size: 1.4rem;
|
||||
font-family: "Courier New", monospace;
|
||||
font-weight: 700;
|
||||
color: #333;
|
||||
letter-spacing: 1px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#captcha-modal-answer {
|
||||
width: 80px;
|
||||
padding: 6px 10px;
|
||||
text-align: center;
|
||||
font-size: 1.2rem;
|
||||
font-family: "Courier New", monospace;
|
||||
font-weight: 600;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
outline: none;
|
||||
transition: border-color 0.15s, box-shadow 0.15s;
|
||||
background: #fff;
|
||||
}
|
||||
#captcha-modal-answer:focus {
|
||||
border-color: #1e87f0;
|
||||
box-shadow: 0 0 0 2px rgba(30,135,240,0.2);
|
||||
}
|
||||
/* 隐藏数字输入框的上下箭头 */
|
||||
#captcha-modal-answer::-webkit-inner-spin-button,
|
||||
#captcha-modal-answer::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
#captcha-modal-answer {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
</style>
|
||||
{{ else if .RecaptchaTurnstileStyle }}
|
||||
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js?compat=recaptcha" async defer></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.querySelectorAll('.g-recaptcha').forEach(item => {
|
||||
item.disabled = true;
|
||||
});
|
||||
});
|
||||
|
||||
function onSubmit() {
|
||||
document.querySelectorAll('.g-recaptcha').forEach(item => {
|
||||
item.disabled = false;
|
||||
})
|
||||
}</script>
|
||||
{{ else }}
|
||||
<script src="{{.RecaptchaDomain}}/recaptcha/api.js" async defer></script>
|
||||
<script>function onSubmit() {document.getElementById('form').submit();}</script>
|
||||
{{ end }}
|
||||
{{ if ne SentryDSN "" }}
|
||||
<script
|
||||
src="https://browser.sentry-cdn.com/7.37.2/bundle.tracing.replay.min.js"
|
||||
integrity="sha384-o0mU2P+zsvXua0Y6f/J55PKWZt3sZCv3qDqJe6J5lZklyIQkpgjBVqNnPWYWqGhf"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script>
|
||||
Sentry.init({
|
||||
dsn: "{{ SentryDSN }}",
|
||||
integrations: [new Sentry.BrowserTracing(), new Sentry.Replay()],
|
||||
tracesSampleRate: 1.0,
|
||||
replaysSessionSampleRate: 0.1,
|
||||
replaysOnErrorSampleRate: 1.0,
|
||||
});
|
||||
</script>
|
||||
{{ end }}
|
||||
<style>
|
||||
.grecaptcha-badge {visibility: hidden;}
|
||||
.icon-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
}
|
||||
.icon {
|
||||
margin-left: 10px;
|
||||
width: 20px; /* 设置图标的宽度 */
|
||||
height: auto; /* 保持图标的高度自动调整 */
|
||||
}
|
||||
.emoji-placeholder {
|
||||
display: inline-block;
|
||||
animation: jump 0.5s ease-in-out;
|
||||
}
|
||||
|
||||
@keyframes jump {
|
||||
0%, 100% { transform: translateY(0); }
|
||||
50% { transform: translateY(-5px); }
|
||||
}
|
||||
/* 防止 UIkit Dropbar 初始闪烁 */
|
||||
.uk-dropbar {
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transition: opacity 0.2s ease, visibility 0.2s ease;
|
||||
}
|
||||
|
||||
.uk-dropbar.uk-open {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
a.uk-button.uk-button-link {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
/* 移动端优化:缩小字体和间距,避免右侧空白 */
|
||||
@media (max-width: 640px) {
|
||||
.uk-logo {
|
||||
font-size: 1rem;
|
||||
}
|
||||
.uk-navbar-nav a {
|
||||
font-size: 0.78rem;
|
||||
padding: 0 4px;
|
||||
}
|
||||
.emoji-placeholder {
|
||||
font-size: 1rem;
|
||||
}
|
||||
/* 移动端用户名限宽省略,避免长英文用户名撑爆顶栏 */
|
||||
.tb-nav-username {
|
||||
max-width: 64px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- 深色模式:html[data-theme="dark"] 时覆盖 UIkit 3.3.3 编译主题的关键颜色 -->
|
||||
<style>
|
||||
html[data-theme="dark"] {
|
||||
--tb-bg: #1a1d23;
|
||||
--tb-surface: #242830;
|
||||
--tb-surface-2: #2d323c;
|
||||
--tb-border: #3a404c;
|
||||
--tb-text: #d8dce4;
|
||||
--tb-text-muted: #8b93a1;
|
||||
--tb-primary: #5c8dff;
|
||||
}
|
||||
/* 根元素与 body 一起覆盖,确保整个视口(含内容不足一屏时的空白区)都是深色背景 */
|
||||
html[data-theme="dark"],
|
||||
html[data-theme="dark"] body {
|
||||
background-color: var(--tb-bg) !important;
|
||||
color: var(--tb-text) !important;
|
||||
}
|
||||
/* 通用表面容器 */
|
||||
html[data-theme="dark"] .uk-card,
|
||||
html[data-theme="dark"] .uk-card-default,
|
||||
html[data-theme="dark"] .uk-card-secondary,
|
||||
html[data-theme="dark"] .uk-dropbar,
|
||||
html[data-theme="dark"] .uk-navbar-dropdown,
|
||||
html[data-theme="dark"] .uk-modal-dialog,
|
||||
html[data-theme="dark"] .uk-dropdown,
|
||||
html[data-theme="dark"] .uk-offcanvas-bar,
|
||||
html[data-theme="dark"] .uk-section,
|
||||
html[data-theme="dark"] .uk-tile,
|
||||
html[data-theme="dark"] .uk-panel,
|
||||
html[data-theme="dark"] .uk-background-default,
|
||||
html[data-theme="dark"] .uk-search-default .uk-search-input {
|
||||
background-color: var(--tb-surface) !important;
|
||||
color: var(--tb-text) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-navbar-container {
|
||||
background-color: var(--tb-surface) !important;
|
||||
color: var(--tb-text) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-navbar-nav > li > a,
|
||||
html[data-theme="dark"] .uk-card a,
|
||||
html[data-theme="dark"] .uk-link,
|
||||
html[data-theme="dark"] a.uk-button-link,
|
||||
html[data-theme="dark"] .uk-navbar-dropdown-nav > li > a,
|
||||
html[data-theme="dark"] .uk-dropdown-nav > li > a,
|
||||
html[data-theme="dark"] .uk-list a {
|
||||
color: var(--tb-text) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-navbar-nav > li > a:hover,
|
||||
html[data-theme="dark"] .uk-card a:hover,
|
||||
html[data-theme="dark"] .uk-navbar-dropdown-nav > li > a:hover,
|
||||
html[data-theme="dark"] .uk-dropdown-nav > li > a:hover {
|
||||
color: var(--tb-primary) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-input,
|
||||
html[data-theme="dark"] .uk-textarea,
|
||||
html[data-theme="dark"] .uk-select {
|
||||
background-color: var(--tb-surface-2) !important;
|
||||
color: var(--tb-text) !important;
|
||||
border-color: var(--tb-border) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-input:focus,
|
||||
html[data-theme="dark"] .uk-textarea:focus,
|
||||
html[data-theme="dark"] .uk-select:focus {
|
||||
border-color: var(--tb-primary) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-text-muted,
|
||||
html[data-theme="dark"] .uk-text-meta,
|
||||
html[data-theme="dark"] .uk-text-secondary,
|
||||
html[data-theme="dark"] .uk-text-muted a,
|
||||
html[data-theme="dark"] .uk-text-small.uk-text-muted {
|
||||
color: var(--tb-text-muted) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-divider-icon::after,
|
||||
html[data-theme="dark"] hr,
|
||||
html[data-theme="dark"] .uk-table th,
|
||||
html[data-theme="dark"] .uk-table td,
|
||||
html[data-theme="dark"] .uk-list-divider > li:nth-child(n+2) {
|
||||
border-color: var(--tb-border) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-button-default {
|
||||
background-color: var(--tb-surface-2) !important;
|
||||
color: var(--tb-text) !important;
|
||||
border-color: var(--tb-border) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-modal-title,
|
||||
html[data-theme="dark"] h1, html[data-theme="dark"] h2, html[data-theme="dark"] h3,
|
||||
html[data-theme="dark"] h4, html[data-theme="dark"] h5, html[data-theme="dark"] h6,
|
||||
html[data-theme="dark"] .uk-card-title {
|
||||
color: var(--tb-text) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-alert-warning,
|
||||
html[data-theme="dark"] .uk-alert-danger,
|
||||
html[data-theme="dark"] .uk-alert-success,
|
||||
html[data-theme="dark"] .uk-alert-primary {
|
||||
background-color: var(--tb-surface-2) !important;
|
||||
color: var(--tb-text) !important;
|
||||
}
|
||||
html[data-theme="dark"] #math-captcha-modal .uk-modal-dialog {
|
||||
background-color: var(--tb-surface) !important;
|
||||
color: var(--tb-text) !important;
|
||||
}
|
||||
html[data-theme="dark"] #math-captcha-modal .captcha-equation-box {
|
||||
background-color: var(--tb-surface-2) !important;
|
||||
border-color: var(--tb-border) !important;
|
||||
}
|
||||
html[data-theme="dark"] #math-captcha-modal .math-captcha-modal-question {
|
||||
color: var(--tb-text) !important;
|
||||
}
|
||||
html[data-theme="dark"] #math-captcha-modal #captcha-modal-answer {
|
||||
background-color: var(--tb-surface) !important;
|
||||
color: var(--tb-text) !important;
|
||||
border-color: var(--tb-border) !important;
|
||||
}
|
||||
html[data-theme="dark"] #math-captcha-modal #captcha-modal-answer::placeholder {
|
||||
color: var(--tb-text-muted) !important;
|
||||
}
|
||||
html[data-theme="dark"] #math-captcha-modal .uk-text-meta,
|
||||
html[data-theme="dark"] #math-captcha-modal #captcha-modal-refresh {
|
||||
color: var(--tb-text-muted) !important;
|
||||
}
|
||||
html[data-theme="dark"] #math-captcha-modal #captcha-modal-refresh:hover {
|
||||
color: var(--tb-primary) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-label {
|
||||
color: #fff !important;
|
||||
}
|
||||
/* 自定义组件(探索页推荐卡片等)深色覆盖 */
|
||||
html[data-theme="dark"] .recommend-card,
|
||||
html[data-theme="dark"] .recommend-card:hover {
|
||||
background-color: var(--tb-surface-2) !important;
|
||||
}
|
||||
html[data-theme="dark"] .explore-name a {
|
||||
color: var(--tb-text) !important;
|
||||
}
|
||||
html[data-theme="dark"] .explore-name a:hover {
|
||||
color: var(--tb-primary) !important;
|
||||
}
|
||||
html[data-theme="dark"] .explore-intro {
|
||||
color: var(--tb-text-muted) !important;
|
||||
}
|
||||
/* 切换按钮图标切换 */
|
||||
#theme-toggle .tb-icon-dark, #theme-toggle-mobile .tb-icon-dark { display: none; }
|
||||
html[data-theme="dark"] #theme-toggle .tb-icon-light,
|
||||
html[data-theme="dark"] #theme-toggle-mobile .tb-icon-light { display: none; }
|
||||
html[data-theme="dark"] #theme-toggle .tb-icon-dark,
|
||||
html[data-theme="dark"] #theme-toggle-mobile .tb-icon-dark { display: inline; }
|
||||
</style>
|
||||
|
||||
<!-- 顶栏自适应:导航全部直接显示,窄屏时分级缩小字号/间距,保证英文/日文等长文字不溢出 -->
|
||||
<style>
|
||||
.uk-navbar-nav a {
|
||||
font-size: 0.95rem;
|
||||
padding: 0 10px;
|
||||
}
|
||||
/* 未登录移动端占位:桌面端隐藏,仅 ≤640px 显示(见下方 media 查询)。
|
||||
桌面端布局与改动前完全一致,不受影响。 */
|
||||
.tb-mobile-balancer { display: none; }
|
||||
/* 桌面端保持 UIkit 原生居中三列布局(无需额外 CSS) */
|
||||
.tb-navbar .uk-logo {
|
||||
white-space: nowrap;
|
||||
}
|
||||
@media (max-width: 1200px) {
|
||||
.uk-navbar-nav a {
|
||||
font-size: 0.88rem;
|
||||
padding: 0 8px;
|
||||
}
|
||||
}
|
||||
@media (max-width: 1000px) {
|
||||
.uk-navbar-nav a {
|
||||
font-size: 0.82rem;
|
||||
padding: 0 6px;
|
||||
}
|
||||
.uk-logo {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
/* 登录用户名限宽,过长省略号截断 */
|
||||
.tb-nav-username {
|
||||
max-width: 110px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
@media (max-width: 800px) {
|
||||
.uk-navbar-nav a {
|
||||
font-size: 0.78rem;
|
||||
padding: 0 4px;
|
||||
}
|
||||
.uk-logo {
|
||||
font-size: 1rem;
|
||||
}
|
||||
.tb-nav-username {
|
||||
max-width: 80px;
|
||||
}
|
||||
}
|
||||
/* 手机端(≤640px):沿用 UIkit 桌面端 navbar 的原生三列定位。
|
||||
不再重写 .uk-navbar-center / center-left / center-right 的定位,
|
||||
避免 logo 被挤到下一行;底部语言与深色模式按钮仍由下方独立栏承载。 */
|
||||
@media (max-width: 640px) {
|
||||
.tb-navbar {
|
||||
position: relative;
|
||||
min-height: 56px;
|
||||
overflow: visible;
|
||||
}
|
||||
.tb-navbar > .uk-navbar-center {
|
||||
position: relative !important;
|
||||
top: auto !important;
|
||||
left: auto !important;
|
||||
right: auto !important;
|
||||
bottom: auto !important;
|
||||
transform: none !important;
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
min-height: 56px;
|
||||
white-space: nowrap;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
.tb-navbar .uk-navbar-center-left,
|
||||
.tb-navbar .uk-navbar-center-right {
|
||||
position: static !important;
|
||||
top: auto !important;
|
||||
left: auto !important;
|
||||
right: auto !important;
|
||||
bottom: auto !important;
|
||||
transform: none !important;
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
flex: 0 0 auto;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.tb-navbar .uk-navbar-center-left > div,
|
||||
.tb-navbar .uk-navbar-center-right > div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.tb-navbar .uk-navbar-nav {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.tb-navbar .uk-navbar-nav > li > a,
|
||||
.tb-navbar .uk-logo {
|
||||
white-space: nowrap;
|
||||
}
|
||||
/* 未登录:移动端显示与「我的」等宽的隐藏占位,使左栏「探索+占位」与
|
||||
右栏「注册/登录」两项等宽,logo 真正居中,左右视觉平衡 */
|
||||
.tb-mobile-balancer { display: block; }
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- 标签样式的按钮(管理页置顶等):
|
||||
尺寸完全继承 .uk-label(font-size/padding/line-height/text-transform 等),
|
||||
仅覆盖 button 元素特有的默认样式(边框/字体族/光标等),保证与相邻 span 标签完全一致。 -->
|
||||
<style>
|
||||
.tb-label-btn {
|
||||
border: none !important;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
margin: 0;
|
||||
vertical-align: middle;
|
||||
outline: none;
|
||||
background-image: none;
|
||||
box-sizing: border-box;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
.tb-label-btn:hover {
|
||||
opacity: 0.85;
|
||||
}
|
||||
/* 公开页置顶小图标:仅一个图钉,不占行高、不影响原布局 */
|
||||
.tb-pin-flag {
|
||||
font-size: 0.9em;
|
||||
margin-right: 4px;
|
||||
vertical-align: -1px;
|
||||
cursor: default;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- 页脚统计加载动画:替代 fontawesome 的 fa-spinner(纯 CSS,不引字体库) -->
|
||||
<style>
|
||||
.tb-spinner {
|
||||
display: inline-block;
|
||||
width: 0.9em;
|
||||
height: 0.9em;
|
||||
border: 2px solid rgba(128, 128, 128, 0.25);
|
||||
border-top-color: #666;
|
||||
border-radius: 50%;
|
||||
vertical-align: -2px;
|
||||
animation: tb-spin 0.8s linear infinite;
|
||||
}
|
||||
html[data-theme="dark"] .tb-spinner {
|
||||
border-color: rgba(255, 255, 255, 0.2);
|
||||
border-top-color: #bbb;
|
||||
}
|
||||
@keyframes tb-spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Markdown 渲染排版(问题/回答/追问正文,左对齐以保留排版格式) -->
|
||||
<style>
|
||||
/* 纯文本列表:保留换行与连续空格(pre-wrap),不渲染 Markdown 大字号/彩色 */
|
||||
.tb-preline {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
/* 纯文本列表:超过 5 行截断并显示省略号(不足 5 行则完整显示) */
|
||||
.tb-clamp-5 {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 5;
|
||||
overflow: hidden;
|
||||
}
|
||||
.md-body {
|
||||
line-height: 1.7;
|
||||
text-align: left;
|
||||
word-break: break-word;
|
||||
}
|
||||
.md-body p { margin: 0.5em 0; }
|
||||
.md-body h1, .md-body h2, .md-body h3,
|
||||
.md-body h4, .md-body h5, .md-body h6 {
|
||||
margin: 0.8em 0 0.4em;
|
||||
font-weight: 600;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.md-body ul, .md-body ol { padding-left: 1.6em; margin: 0.5em 0; }
|
||||
.md-body li { margin: 0.2em 0; }
|
||||
.md-body blockquote {
|
||||
border-left: 3px solid #d3d1c7;
|
||||
margin: 0.6em 0;
|
||||
padding: 0.2em 1em;
|
||||
color: #5f5e5a;
|
||||
}
|
||||
.md-body pre {
|
||||
background: #f5f5f5;
|
||||
padding: 0.8em 1em;
|
||||
border-radius: 6px;
|
||||
overflow-x: auto;
|
||||
margin: 0.6em 0;
|
||||
}
|
||||
.md-body code {
|
||||
background: #f0f0f0;
|
||||
padding: 0.1em 0.35em;
|
||||
border-radius: 4px;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.md-body pre code { background: none; padding: 0; }
|
||||
.md-body img { max-width: 100%; height: auto; }
|
||||
.md-body table { border-collapse: collapse; margin: 0.6em 0; }
|
||||
.md-body th, .md-body td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 0.4em 0.8em;
|
||||
}
|
||||
.md-body hr { margin: 1em 0; }
|
||||
html[data-theme="dark"] .md-body blockquote {
|
||||
border-color: #3a404c;
|
||||
color: #8b93a1;
|
||||
}
|
||||
html[data-theme="dark"] .md-body pre,
|
||||
html[data-theme="dark"] .md-body code { background: #2d323c; }
|
||||
html[data-theme="dark"] .md-body th,
|
||||
html[data-theme="dark"] .md-body td { border-color: #3a404c; }
|
||||
</style>
|
||||
|
||||
<!-- 投票结果占比条:UIkit 3 已无 .uk-progressbar 类(那是 UIkit 2 的),
|
||||
模板用 <div class="uk-progress"><div class="uk-progressbar"> 结构,需补一套填充样式,
|
||||
否则内层填充无高度/背景,所有占比条都只剩外层灰色轨道,看起来一模一样。 -->
|
||||
<style>
|
||||
.uk-progress {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
height: 10px;
|
||||
margin: 0;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
background-color: #e5e5e5;
|
||||
overflow: hidden;
|
||||
box-shadow: none;
|
||||
}
|
||||
.uk-progressbar {
|
||||
display: block;
|
||||
height: 100%;
|
||||
background-color: #1e87f0;
|
||||
border-radius: 6px 0 0 6px;
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
html[data-theme="dark"] .uk-progress {
|
||||
background-color: var(--tb-border);
|
||||
}
|
||||
html[data-theme="dark"] .uk-progressbar {
|
||||
background-color: var(--tb-primary);
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- 移动端底部操作栏:固定底栏承载语言切换与深色模式,桌面端隐藏 -->
|
||||
<style>
|
||||
#tb-mobile-utils {
|
||||
display: none;
|
||||
}
|
||||
@media (max-width: 640px) {
|
||||
/* 顶栏不再容纳语言/深色按钮,恢复原有导航空间 */
|
||||
.tb-nav-utils {
|
||||
display: none !important;
|
||||
}
|
||||
/* 手机端隐藏登录用户名(左边仅保留"探索"),保证 logo 居中、
|
||||
两侧各不超过 2 个短按钮,避免用户名宽度挤压布局 */
|
||||
.tb-nav-username {
|
||||
display: none !important;
|
||||
}
|
||||
/* 固定底部操作栏 */
|
||||
#tb-mobile-utils {
|
||||
display: flex;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 1000;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
|
||||
background: rgba(255, 255, 255, 0.92);
|
||||
-webkit-backdrop-filter: blur(8px);
|
||||
backdrop-filter: blur(8px);
|
||||
box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
#tb-mobile-utils .uk-select {
|
||||
width: 110px;
|
||||
}
|
||||
html[data-theme="dark"] #tb-mobile-utils {
|
||||
background: rgba(36, 40, 48, 0.92);
|
||||
box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
/* 给页面底部预留空间,避免页脚内容被固定底栏遮挡 */
|
||||
body {
|
||||
padding-bottom: 56px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Commit 6d0a3ad -->
|
||||
<meta property="og:site_name" content="{{ t .LangCode "site.title" }}" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="{{ if .IsUserPage }}{{ .PageUser.Name }} - {{ t .LangCode "site.title" }}{{ else }}{{ t .LangCode "site.title" }}{{ end }}" />
|
||||
<meta property="og:url" content="{{ .ExternalURL }}{{ .CurrentURI }}" />
|
||||
<meta property="og:description" content="{{ if .IsUserPage }}{{ .PageUser.Name }} - {{ t .LangCode "site.description" }}{{ else }}{{ t .LangCode "site.description" }}{{ end }}" />
|
||||
{{ if .NoIndex }}<meta name="robots" content="noindex">{{ end }}
|
||||
{{ if .IsUserPage }}
|
||||
<meta property="og:image" content="{{ .PageUser.Avatar }}?og-image=1" />
|
||||
<meta property="og:image:alt" content="{{ .PageUser.Name }}" />
|
||||
<meta itemprop="image" content="{{ .PageUser.Avatar }}?og-image=1"/>
|
||||
<meta name="msapplication-TileImage" content="{{ .PageUser.Avatar }}"/>
|
||||
<link rel="shortcut icon" href="{{ .PageUser.Avatar }}?og-image=1"/>
|
||||
<link rel="apple-touch-icon" href="{{ .PageUser.Avatar }}?og-image=1"/>
|
||||
<link rel="icon" sizes="192x192" href="{{ .PageUser.Avatar }}?og-image=1">
|
||||
<meta name="twitter:image:src" content="{{ .PageUser.Avatar }}?og-image=1" />
|
||||
{{ else }}
|
||||
<meta itemprop="image" content="https://r2.337845818.best/tamabox/tamabox_low.png"/>
|
||||
<meta name="msapplication-TileImage" content="https://r2.337845818.best/tamabox/tamabox_low.png"/>
|
||||
<link rel="shortcut icon" href="https://r2.337845818.best/tamabox/tamabox_low.png" />
|
||||
<link rel="apple-touch-icon" href="https://r2.337845818.best/tamabox/tamabox_low.png"/>
|
||||
<link rel="icon" sizes="192x192" href="https://r2.337845818.best/tamabox/tamabox_low.png">
|
||||
<meta name="twitter:image:src" content="https://r2.337845818.best/tamabox/tamabox_low.png" />
|
||||
{{ end }}
|
||||
|
||||
<!-- Google and Bing -->
|
||||
<meta name="google-site-verification" content="fEPwRRJfiGsgwc5SINBQwZhPK8F0cwRaOvRx0YRurI4" />
|
||||
<meta name="msvalidate.01" content="2F185E8E63C93635F50B3574F3B31E42" />
|
||||
<script defer src="https://mami.tama.guru/tamami.js" data-website-id="c42ebe8b-9281-4da0-83a4-8f18b3e710fe"></script>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="uk-navbar-container uk-margin tb-navbar" uk-navbar>
|
||||
<div class="uk-navbar-center">
|
||||
<div class="uk-navbar-center-left">
|
||||
<div>
|
||||
<ul class="uk-navbar-nav">
|
||||
<!-- 探索链接,始终显示 -->
|
||||
<li><a href="/explore">{{t .LangCode "nav.explore"}}</a></li>
|
||||
{{ if .IsLogged }}
|
||||
<!-- 我的:进入自己的提问箱主页(与右侧「提问/设置」形成左右均衡) -->
|
||||
<li><a href="/_/{{ .LoggedUser.Domain }}">{{t .LangCode "nav.mine"}}</a></li>
|
||||
{{ else }}
|
||||
<!-- 移动端占位:未登录时左栏仅「探索」一项,与右栏「注册/登录」两项不等宽,
|
||||
导致 logo 整体被拉向左(偏左)。移动端(≤640px)显示一个与「我的」等宽的隐藏占位,
|
||||
使左右视觉平衡;桌面端由 .tb-mobile-balancer 隐藏,保持原布局完全不变。 -->
|
||||
<li class="tb-mobile-balancer" aria-hidden="true"><a tabindex="-1" style="visibility:hidden">{{t .LangCode "nav.mine"}}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a class="uk-navbar-item uk-logo" href="/"><span class="emoji-placeholder" aria-label="random animal">🐺</span>{{t .LangCode "site.logoSuffix"}}</a>
|
||||
|
||||
<div class="uk-navbar-center-right">
|
||||
<div>
|
||||
{{ if .IsLogged }}
|
||||
<ul class="uk-navbar-nav">
|
||||
<li><a href="/user/questions">{{t .LangCode "nav.ask"}}</a></li>
|
||||
</ul>
|
||||
<ul class="uk-navbar-nav">
|
||||
<li><a href="/user/profile">{{t .LangCode "nav.settings"}}</a></li>
|
||||
</ul>
|
||||
{{ else}}
|
||||
<ul class="uk-navbar-nav">
|
||||
<li><a href="/register">{{t .LangCode "nav.register"}}</a></li>
|
||||
</ul>
|
||||
<ul class="uk-navbar-nav">
|
||||
<li><a href="/login">{{t .LangCode "nav.login"}}</a></li>
|
||||
</ul>
|
||||
{{ end }}
|
||||
{{ if not .IsUserPage }}
|
||||
<!-- 语言切换(紧凑图标,点击展开;移动端隐藏,见底部操作栏) -->
|
||||
<ul class="uk-navbar-nav tb-nav-utils">
|
||||
<li>
|
||||
<a href="#" aria-label="{{t .LangCode "common.lang"}}" title="{{t .LangCode "common.lang"}}">🌐</a>
|
||||
<div class="uk-navbar-dropdown" uk-drop="mode: click; pos: bottom-right">
|
||||
<ul class="uk-nav uk-navbar-dropdown-nav">
|
||||
{{ range .SupportedLangs }}
|
||||
<li class="{{ if eq .Code $.LangCode }}uk-active{{ end }}">
|
||||
<a href="/i18n/{{ .Code }}?to={{ urlquery $.CurrentURI }}">{{ .Name }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
{{ end }}
|
||||
<!-- 深色模式切换(紧凑图标;移动端隐藏,见底部操作栏) -->
|
||||
<ul class="uk-navbar-nav tb-nav-utils">
|
||||
<li>
|
||||
<a href="#" id="theme-toggle" title="{{t .LangCode "common.theme"}}" aria-label="{{t .LangCode "common.theme"}}">
|
||||
<span class="tb-icon-light">🌙</span><span class="tb-icon-dark">☀️</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const emojis = ["🐺","🐗","🐻","🐨","🐼","🐹","🐭","🐰","🦊","🐮","🐷","🐽","🐸","🐒","🦍","🐔","🐧","🐦","🐤","🐦⬛","🦅","🦉","🦇","🐴","🦄","🐝","🦎","🦖","🦕","🐙","🦑","🦐","🦞","🦀","🐡","🐠","🐟","🐬","🐳","🐋","🦈","🐊","🐅","🐆","🦓","🦍","🦧","🐘","🦛","🦏","🐪","🐫","🦒","🦘","🐃","🐂","🐄","🐎","🐖","🐏","🐑","🦙","🐐","🦌","🐕","🐩","🦮","🐕🦺","🐈","🐋","🐳","🐬","🐉","🐲"];
|
||||
const placeholder = document.querySelector('.emoji-placeholder');
|
||||
if (placeholder) {
|
||||
placeholder.textContent = emojis[Math.floor(Math.random() * emojis.length)];
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- 移动端固定底部操作栏:语言切换 + 深色模式(桌面端隐藏) -->
|
||||
<div id="tb-mobile-utils">
|
||||
{{ if not .IsUserPage }}
|
||||
<select id="mobile-lang-select" class="uk-select uk-form-small" aria-label="{{t .LangCode "common.lang"}}">
|
||||
{{ range .SupportedLangs }}
|
||||
<option value="{{ .Code }}" {{ if eq .Code $.LangCode }}selected{{ end }}>{{ .Name }}</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
{{ end }}
|
||||
<button type="button" id="theme-toggle-mobile" class="uk-button uk-button-default uk-button-small"
|
||||
title="{{t .LangCode "common.theme"}}" aria-label="{{t .LangCode "common.theme"}}">
|
||||
<span class="tb-icon-light">🌙</span><span class="tb-icon-dark">☀️</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
// 深色模式:读取 cookie 应用主题,按钮切换并持久化
|
||||
var THEME_COOKIE = 'theme';
|
||||
function getTheme() {
|
||||
var m = document.cookie.match(/(?:^|;\s*)theme=([^;]*)/);
|
||||
return m ? m[1] : '';
|
||||
}
|
||||
function applyTheme(theme) {
|
||||
if (theme === 'dark') {
|
||||
document.documentElement.setAttribute('data-theme', 'dark');
|
||||
} else {
|
||||
document.documentElement.removeAttribute('data-theme');
|
||||
}
|
||||
}
|
||||
function toggleTheme() {
|
||||
var next = getTheme() === 'dark' ? 'light' : 'dark';
|
||||
applyTheme(next);
|
||||
var expires = new Date(Date.now() + 365 * 24 * 3600 * 1000).toUTCString();
|
||||
document.cookie = THEME_COOKIE + '=' + next + '; path=/; max-age=' + (365 * 24 * 3600) + '; SameSite=Lax';
|
||||
}
|
||||
// 首屏前应用,避免闪烁
|
||||
applyTheme(getTheme());
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// 桌面顶栏按钮与移动端底部按钮都绑定
|
||||
var buttons = document.querySelectorAll('#theme-toggle, #theme-toggle-mobile');
|
||||
buttons.forEach(function(btn) {
|
||||
btn.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
toggleTheme();
|
||||
});
|
||||
});
|
||||
|
||||
// 移动端底部语言切换:onchange 跳转到 /i18n/{code},保留当前页面位置
|
||||
var langSel = document.getElementById('mobile-lang-select');
|
||||
if (langSel) {
|
||||
langSel.addEventListener('change', function() {
|
||||
if (!this.value) return;
|
||||
var to = window.location.pathname + window.location.search;
|
||||
window.location.href = '/i18n/' + encodeURIComponent(this.value) + '?to=' + encodeURIComponent(to);
|
||||
});
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
{{ if .IsPixel }}
|
||||
<div>
|
||||
{{ else }}
|
||||
<div class="uk-container uk-container-xsmall">
|
||||
{{ end }}
|
||||
|
||||
{{ if eq .CaptchaType "math" }}
|
||||
<!-- 算数验证码弹窗 --><div id="math-captcha-modal" uk-modal>
|
||||
<div class="uk-modal-dialog uk-modal-body uk-text-center">
|
||||
<h3 class="uk-modal-title">{{t .LangCode "captcha.title"}}</h3>
|
||||
<p class="uk-text-meta">{{t .LangCode "captcha.hint"}}</p>
|
||||
<div class="captcha-equation-box">
|
||||
<span id="captcha-modal-question" class="math-captcha-modal-question">{{t .LangCode "captcha.loading"}}</span>
|
||||
<input type="number" id="captcha-modal-answer" placeholder="?" autocomplete="off" inputmode="numeric">
|
||||
</div>
|
||||
<div style="margin-top:6px;">
|
||||
<button type="button" class="uk-button uk-button-text uk-text-small" id="captcha-modal-refresh">{{t .LangCode "captcha.refresh"}}</button>
|
||||
</div>
|
||||
<div id="captcha-modal-error" class="uk-text-danger uk-text-small" style="display:none;min-height:20px;"></div>
|
||||
<div class="uk-margin-small-top">
|
||||
<button type="button" class="uk-button uk-button-primary" id="captcha-modal-submit">{{t .LangCode "captcha.submit"}}</button>
|
||||
<button type="button" class="uk-button uk-button-default uk-modal-close">{{t .LangCode "common.cancel"}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var CAPTCHA_I18N = {
|
||||
loading: "{{t .LangCode "captcha.loading"}}",
|
||||
loadFailed: "{{t .LangCode "captcha.loadFailed"}}",
|
||||
loadRetry: "{{t .LangCode "captcha.loadRetry"}}",
|
||||
inputAnswer: "{{t .LangCode "captcha.inputAnswer"}}",
|
||||
wrongAnswer: "{{t .LangCode "captcha.wrongAnswer"}}",
|
||||
verifyFailed: "{{t .LangCode "captcha.verifyFailed"}}",
|
||||
needPassword: "{{t .LangCode "ask.needPassword"}}",
|
||||
needEmail: "{{t .LangCode "ask.pleaseEmail"}}"
|
||||
};
|
||||
</script>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
var captchaId = '';
|
||||
var pendingForm = null;
|
||||
var pendingNeedPassword = false;
|
||||
var verifying = false;
|
||||
|
||||
function fetchCaptcha() {
|
||||
var qEl = document.getElementById('captcha-modal-question');
|
||||
var errEl = document.getElementById('captcha-modal-error');
|
||||
var ansEl = document.getElementById('captcha-modal-answer');
|
||||
qEl.textContent = CAPTCHA_I18N.loading;
|
||||
fetch('/api/captcha/generate')
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(data) {
|
||||
if (data.code === 0 && data.data) {
|
||||
captchaId = data.data.id;
|
||||
qEl.textContent = data.data.question;
|
||||
if (errEl) errEl.style.display = 'none';
|
||||
if (ansEl) { ansEl.value = ''; ansEl.focus(); }
|
||||
} else {
|
||||
qEl.textContent = CAPTCHA_I18N.loadFailed;
|
||||
}
|
||||
})
|
||||
.catch(function() {
|
||||
qEl.textContent = CAPTCHA_I18N.loadRetry;
|
||||
});
|
||||
}
|
||||
|
||||
function getCSRFToken() {
|
||||
var input = document.querySelector('input[name="_csrf"]');
|
||||
return input ? input.value : '';
|
||||
}
|
||||
|
||||
function doSubmit(form) {
|
||||
// 将 captcha 答案填入隐藏字段
|
||||
var ans = document.getElementById('captcha-modal-answer').value.trim();
|
||||
var hidden = form.querySelector('[name="g-recaptcha-response"]');
|
||||
if (hidden) hidden.value = captchaId + ':' + (ans || '0');
|
||||
|
||||
UIkit.modal('#math-captcha-modal').hide();
|
||||
|
||||
// 处理 AskPassword(提问箱密码)
|
||||
if (pendingNeedPassword) {
|
||||
UIkit.modal.prompt(CAPTCHA_I18N.needPassword, '', 'password')
|
||||
.then(function(password) {
|
||||
if (password) {
|
||||
var pwInput = document.getElementById('ask_password_input');
|
||||
if (pwInput) pwInput.value = password;
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
|
||||
// 验证按钮
|
||||
document.getElementById('captcha-modal-submit').addEventListener('click', function() {
|
||||
if (verifying) return;
|
||||
var ans = document.getElementById('captcha-modal-answer').value.trim();
|
||||
if (!ans) {
|
||||
var errEl = document.getElementById('captcha-modal-error');
|
||||
errEl.textContent = CAPTCHA_I18N.inputAnswer;
|
||||
errEl.style.display = 'block';
|
||||
return;
|
||||
}
|
||||
verifying = true;
|
||||
fetch('/api/captcha/verify', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-Token': getCSRFToken()
|
||||
},
|
||||
body: JSON.stringify({ id: captchaId, answer: parseInt(ans, 10) })
|
||||
})
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(data) {
|
||||
verifying = false;
|
||||
if (data.correct) {
|
||||
if (pendingForm) doSubmit(pendingForm);
|
||||
} else {
|
||||
var errEl = document.getElementById('captcha-modal-error');
|
||||
errEl.textContent = CAPTCHA_I18N.wrongAnswer;
|
||||
errEl.style.display = 'block';
|
||||
fetchCaptcha(); // 自动刷新题目
|
||||
}
|
||||
})
|
||||
.catch(function() {
|
||||
verifying = false;
|
||||
var errEl = document.getElementById('captcha-modal-error');
|
||||
errEl.textContent = CAPTCHA_I18N.verifyFailed;
|
||||
errEl.style.display = 'block';
|
||||
fetchCaptcha();
|
||||
});
|
||||
});
|
||||
|
||||
// 回车提交
|
||||
document.getElementById('captcha-modal-answer').addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
document.getElementById('captcha-modal-submit').click();
|
||||
}
|
||||
});
|
||||
|
||||
// 刷新按钮
|
||||
document.getElementById('captcha-modal-refresh').addEventListener('click', fetchCaptcha);
|
||||
|
||||
// 拦截所有带 class="math-captcha-trigger" 的按钮
|
||||
document.addEventListener('click', function(e) {
|
||||
var btn = e.target.closest('.math-captcha-trigger');
|
||||
if (!btn) return;
|
||||
e.preventDefault();
|
||||
|
||||
var form = btn.closest('form');
|
||||
if (!form) return;
|
||||
pendingForm = form;
|
||||
|
||||
// 检查是否需要提问密码
|
||||
pendingNeedPassword = !!(form.querySelector('#ask_password_input'));
|
||||
|
||||
// 邮箱校验(提问页面)
|
||||
var notifyCb = document.getElementById('notify-checkbox');
|
||||
var emailInput = document.getElementById('email-input');
|
||||
if (notifyCb && notifyCb.checked && emailInput && emailInput.value.trim() === '') {
|
||||
UIkit.modal.alert(CAPTCHA_I18N.needEmail);
|
||||
return;
|
||||
}
|
||||
|
||||
fetchCaptcha();
|
||||
UIkit.modal('#math-captcha-modal').show();
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,309 @@
|
||||
{{template "base/header" .}}
|
||||
<!-- 头像直连 R2:crossorigin 让 favicon 也以 CORS 模式请求,确保浏览器缓存的响应都带 ACAO;
|
||||
?v=2 击穿历史上被「无 ACAO 响应」污染的缓存条目(R2 对无 Origin 请求的响应无 Vary,可缓存 31 天) -->
|
||||
<link rel="shortcut icon" href="{{.PageUser.Avatar}}?v=2" crossorigin="anonymous"/>
|
||||
<link rel="apple-touch-icon" href="{{.PageUser.Avatar}}?v=2" crossorigin="anonymous"/>
|
||||
<link rel="icon" sizes="192x192" href="{{.PageUser.Avatar}}?v=2" crossorigin="anonymous">
|
||||
<style>
|
||||
/* 投票列表:与探索页"全部投票"一致的列表行样式 */
|
||||
.profile-votes-list { display: grid; gap: 0; }
|
||||
.profile-vote-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
min-width: 0;
|
||||
padding: 14px 16px;
|
||||
border-bottom: 1px solid var(--tb-border, #e9e9e9);
|
||||
text-decoration: none;
|
||||
}
|
||||
.profile-vote-item:first-child { border-top: 1px solid var(--tb-border, #e9e9e9); }
|
||||
.profile-vote-item:hover { background: var(--tb-surface-hover, #f8fbff); text-decoration: none; }
|
||||
.profile-vote-content { min-width: 0; }
|
||||
.profile-vote-title {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
color: var(--tb-text, #333);
|
||||
font-size: 0.98rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.45;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.profile-vote-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.profile-vote-meta .uk-label { font-size: 0.72rem; line-height: 1.6; }
|
||||
.profile-vote-action {
|
||||
flex: 0 0 auto;
|
||||
color: var(--tb-primary, #1e87f0);
|
||||
font-size: 0.82rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
html[data-theme="dark"] .profile-vote-item { border-color: var(--tb-border); }
|
||||
html[data-theme="dark"] .profile-vote-title { color: var(--tb-text); }
|
||||
html[data-theme="dark"] .profile-vote-item:hover { background: rgba(78, 168, 245, 0.10); }
|
||||
/* 个人主页 Tab:与探索页一致的胶囊切换样式 */
|
||||
/* 个人主页 Tab:全宽等分,置于主体顶部,作为一级导航(移动端整行可点) */
|
||||
.profile-tabs {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
padding: 4px;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 18px;
|
||||
border: 1px solid var(--tb-border, #e5e5e5);
|
||||
border-radius: 9px;
|
||||
background: var(--tb-surface-2, #fafafa);
|
||||
}
|
||||
.profile-tab {
|
||||
flex: 1;
|
||||
border: 0;
|
||||
border-radius: 6px;
|
||||
padding: 9px 15px;
|
||||
background: transparent;
|
||||
color: var(--tb-text-muted, #666);
|
||||
cursor: pointer;
|
||||
font-size: 0.9rem;
|
||||
transition: background 0.2s ease, color 0.2s ease;
|
||||
}
|
||||
.profile-tab:hover { color: var(--tb-primary, #1e87f0); }
|
||||
.profile-tab.is-active {
|
||||
background: var(--tb-surface, #fff);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10);
|
||||
color: var(--tb-primary, #1e87f0);
|
||||
font-weight: 600;
|
||||
}
|
||||
/* 功能关闭时置灰禁用的 Tab(如投票功能关闭) */
|
||||
.profile-tab.is-disabled,
|
||||
.profile-tab:disabled {
|
||||
cursor: not-allowed;
|
||||
color: var(--tb-text-muted, #999);
|
||||
opacity: 0.7;
|
||||
}
|
||||
.profile-tab.is-disabled:hover { color: var(--tb-text-muted, #999); }
|
||||
.profile-panel[hidden] { display: none !important; }
|
||||
html[data-theme="dark"] .profile-tabs {
|
||||
border-color: var(--tb-border);
|
||||
background: var(--tb-surface-2);
|
||||
}
|
||||
html[data-theme="dark"] .profile-tab { color: var(--tb-text-muted); }
|
||||
html[data-theme="dark"] .profile-tab.is-active { background: var(--tb-surface); color: var(--tb-primary); }
|
||||
html[data-theme="dark"] .profile-tab.is-disabled { color: var(--tb-text-muted); opacity: 0.55; }
|
||||
</style>
|
||||
<div class="uk-card uk-card-default uk-text-center">
|
||||
<div class="uk-flex uk-flex-center uk-flex-middle uk-background-cover uk-light" style="min-height: 260px;" data-src="{{ .PageUser.Background }}" uk-img>
|
||||
<div class="uk-card-body">
|
||||
<img class="uk-border-circle uk-box-shadow-large" src="{{ if .PageUser.Avatar }}{{ .PageUser.Avatar }}?v=2{{ else }}{{ .DefaultAvatar }}{{ end }}" crossorigin="anonymous" style="width: 100px; height: 100px; max-width: 100%; max-height: 100%;">
|
||||
<h3 id="usernamecolor">{{ .PageUser.Name }}</h3>
|
||||
<p id="introcolor">{{ .PageUser.Intro }}</p>
|
||||
<div class="icon-container">
|
||||
{{ if and .PageUser.Acfunlink (ne .PageUser.Acfunlink "none") }}
|
||||
<a href="https://{{.PageUser.Acfunlink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/ailicili.png" alt="acfunlink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if and .PageUser.Bililink (ne .PageUser.Bililink "none") }}
|
||||
<a href="https://{{.PageUser.Bililink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/bili.png" alt="bililink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if and .PageUser.Weibolink (ne .PageUser.Weibolink "none") }}
|
||||
<a href="https://{{.PageUser.Weibolink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/weibo.png" alt="weibolink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if and .PageUser.Xiaohongshulink (ne .PageUser.Xiaohongshulink "none") }}
|
||||
<a href="https://{{.PageUser.Xiaohongshulink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/xiaohongshu.png" alt="xiaohongshulink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if and .PageUser.Bloglink (ne .PageUser.Bloglink "none") }}
|
||||
<a href="https://{{.PageUser.Bloglink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/blog.png" alt="bloglink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.getElementById("usernamecolor").style.color = "{{.PageUser.Usernamecolor}}";
|
||||
document.getElementById("introcolor").style.color = "{{.PageUser.Introcolor}}";
|
||||
</script>
|
||||
<div>
|
||||
<div class="uk-card uk-card-default uk-card-small uk-card-body">
|
||||
{{ if .CanAsk }}
|
||||
<!-- jQuery 已改为按需加载:defer 按文档顺序先于 easy.qrcode 执行,保证就绪 -->
|
||||
<script defer src="https://r2.337845818.best/tamabox/cdn/lib/jquery/3.7.1/jquery.min.js"></script>
|
||||
<script defer src='https://r2.337845818.best/tamabox/cdn/js/remake/easy.qrcode.min.js' type="text/javascript" charset="utf-8"></script>
|
||||
<center><div id="boxqrimg"></div></center>
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
var options = {
|
||||
text: window.location.href,
|
||||
width: 200,
|
||||
height: 200,
|
||||
// 与 Profile 编辑器保持一致:仅当启用自定义前景色时,才把 Qrcodebackcolor 作为前景色;
|
||||
// 否则强制黑色 #000000,避免未勾选却显示自定义前景色、与 Profile 预览不一致。
|
||||
colorDark: ({{.PageUser.UseCustomQRColor}} ? "{{.PageUser.Qrcodebackcolor}}" : "#000000") || "#000000",
|
||||
colorLight: "{{.PageUser.Qrcodecolor}}" || "#FFFFFF",
|
||||
dotScale: parseFloat("{{.PageUser.Dotscale}}") || 0.4,
|
||||
dotScaleTiming: parseFloat("{{.PageUser.Dotscale}}") || 0.4,
|
||||
dotScaleA: parseFloat("{{.PageUser.Dotscale}}") || 0.4,
|
||||
correctLevel: QRCode.CorrectLevel.H,
|
||||
logo: (function () {
|
||||
// ?v=2:击穿曾被无 ACAO 响应污染的浏览器缓存条目;仅对 http(s) 绝对地址追加
|
||||
var a = "{{.PageUser.Avatar}}" || "{{.DefaultAvatar}}";
|
||||
return a ? (a.indexOf("http") === 0 ? a + "?v=2" : a) : undefined;
|
||||
})(),
|
||||
logoWidth: 60,
|
||||
logoHeight: 60,
|
||||
logoBackgroundTransparent: true,
|
||||
// 直连 R2 等跨域图片须以 CORS 模式加载,canvas 才不被污染、可正常导出
|
||||
crossOrigin: 'anonymous',
|
||||
backgroundImage: ("{{.PageUser.BackgroundImage}}" ? "{{.PageUser.BackgroundImage}}" : undefined),
|
||||
backgroundImageAlpha: parseFloat("{{.PageUser.Backgroundimagealpha}}") || 0.8,
|
||||
autoColor: false,
|
||||
PO: "{{.PageUser.Qrcodepdpcolor}}" || "#000000",
|
||||
PI: "{{.PageUser.Qrcodepdpcolor}}" || "#000000",
|
||||
AO: '',
|
||||
AI: '',
|
||||
timing: "{{.PageUser.Qrcodepdpcolor}}" || "#000000"
|
||||
};
|
||||
new QRCode(document.getElementById("boxqrimg"), options);
|
||||
});
|
||||
</script>
|
||||
|
||||
<p class="uk-text-center uk-text-small">{{t .LangCode "ask.scan" .PageUser.Name}}<br>{{ if .RegisterOnlyAsk }}{{t .LangCode "ask.registerOnly"}}{{ else }}{{t .LangCode "ask.anonymous"}}{{ end }}</p>
|
||||
|
||||
<div class="uk-text-center uk-margin-small-top">
|
||||
<a id="share-btn" href="/_/{{ .PageUser.Domain }}/share-card" download class="uk-button uk-button-default uk-button-small">
|
||||
📤 {{t .LangCode "ask.share"}}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="share-loading-overlay" style="display:none; position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(255,255,255,0.85); z-index:9999;">
|
||||
<div style="display:flex; flex-direction:column; align-items:center; justify-content:center; height:100%;">
|
||||
<div uk-spinner="ratio: 2" class="uk-margin-bottom"></div>
|
||||
<p class="uk-text-large uk-text-muted">{{t .LangCode "ask.generating"}}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
var btn = document.getElementById('share-btn');
|
||||
var overlay = document.getElementById('share-loading-overlay');
|
||||
if (!btn || !overlay) return;
|
||||
btn.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
overlay.style.display = 'block';
|
||||
btn.style.pointerEvents = 'none';
|
||||
fetch(btn.href)
|
||||
.then(function(response) {
|
||||
if (!response.ok) throw new Error('{{t .LangCode "ask.networkError"}}');
|
||||
return response.blob();
|
||||
})
|
||||
.then(function(blob) {
|
||||
var url = URL.createObjectURL(blob);
|
||||
var a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = '{{t .LangCode "ask.shareFilename"}}';
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
setTimeout(function() {
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(url);
|
||||
}, 100);
|
||||
})
|
||||
.catch(function(err) {
|
||||
alert('{{t .LangCode "ask.genFailed"}}');
|
||||
console.error(err);
|
||||
})
|
||||
.finally(function() {
|
||||
overlay.style.display = 'none';
|
||||
btn.style.pointerEvents = 'auto';
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
{{ end }}
|
||||
{{template "base/alert" .}}
|
||||
|
||||
<!-- 提问 / 投票 切换:默认显示提问,支持 ?tab=votes 直达(服务端初始态)与 #votes hash 覆盖 -->
|
||||
<div class="profile-tabs" role="tablist">
|
||||
<button type="button" class="profile-tab{{ if eq .ActiveProfileTab "questions" }} is-active{{ end }}" data-profile-tab="questions" role="tab" aria-selected="{{ if eq .ActiveProfileTab "questions" }}true{{ else }}false{{ end }}">{{t .LangCode "explore.questionsTab"}}</button>
|
||||
{{ if .VoteEnabled }}
|
||||
<button type="button" class="profile-tab{{ if eq .ActiveProfileTab "votes" }} is-active{{ end }}" data-profile-tab="votes" role="tab" aria-selected="{{ if eq .ActiveProfileTab "votes" }}true{{ else }}false{{ end }}">{{t .LangCode "explore.votesTab"}}</button>
|
||||
{{ else }}
|
||||
<!-- 投票功能关闭:保留 Tab 展示但置灰禁用,hover 提示原因 -->
|
||||
<button type="button" class="profile-tab is-disabled" disabled aria-disabled="true" uk-tooltip="{{ .VoteClosedMessage }}">{{t .LangCode "explore.votesTab"}} <span uk-icon="icon: lock; ratio: 0.8"></span></button>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="profile-panel" data-profile-panel="questions"{{ if eq .ActiveProfileTab "votes" }} hidden{{ end }}>
|
||||
{{template "question/new-question-template" .}}
|
||||
|
||||
{{ if ne (len .PageQuestions) 0 }}
|
||||
<p class="uk-text-left uk-text-muted uk-text-small">{{t .LangCode "ask.history" .PageUser.Name}} ({{ .AnsweredCount }})</p>
|
||||
{{ template "question/history-template" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="profile-panel" data-profile-panel="votes"{{ if ne .ActiveProfileTab "votes" }} hidden{{ end }}>
|
||||
{{ if .PageVotes }}
|
||||
<!-- 匿名投票板块:箱主"进行中"的公开投票(列表行样式,与探索页"全部投票"一致) -->
|
||||
<div class="profile-votes-list">
|
||||
{{ range .PageVotes }}
|
||||
<a href="/vote/{{ .LinkToken }}" class="profile-vote-item">
|
||||
<div class="profile-vote-content">
|
||||
<span class="profile-vote-title" title="{{ .Title }}">{{ .Title }}</span>
|
||||
<span class="profile-vote-meta">
|
||||
{{ if eq .Type "single" }}<span class="uk-label uk-label-primary">{{t $.LangCode "vote.typeSingle"}}</span>{{ end }}
|
||||
{{ if eq .Type "multiple" }}<span class="uk-label uk-label-primary">{{t $.LangCode "vote.typeMultiple"}}</span>{{ end }}
|
||||
{{ if eq .Type "rating" }}<span class="uk-label uk-label-primary">{{t $.LangCode "vote.typeRating"}}</span>{{ end }}
|
||||
{{ if eq .Type "rank" }}<span class="uk-label uk-label-primary">{{t $.LangCode "vote.typeRank"}}</span>{{ end }}
|
||||
{{ if eq .Type "form" }}<span class="uk-label uk-label-primary">{{t $.LangCode "vote.typeForm"}}</span>{{ end }}
|
||||
<span class="uk-text-meta">{{ .CreatedAt.Format "2006-01-02" }}</span>
|
||||
</span>
|
||||
</div>
|
||||
<span class="profile-vote-action">{{t $.LangCode "vote.page.goVote"}} <span uk-icon="icon: arrow-right; ratio: .8"></span></span>
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="uk-alert uk-alert-primary uk-margin-remove-top">{{t .LangCode "explore.noVotes"}}</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var tabs = document.querySelectorAll('[data-profile-tab]');
|
||||
var panels = document.querySelectorAll('[data-profile-panel]');
|
||||
function showPanel(name) {
|
||||
tabs.forEach(function(tab) {
|
||||
var active = tab.dataset.profileTab === name;
|
||||
tab.classList.toggle('is-active', active);
|
||||
tab.setAttribute('aria-selected', active ? 'true' : 'false');
|
||||
});
|
||||
panels.forEach(function(panel) {
|
||||
panel.hidden = panel.dataset.profilePanel !== name;
|
||||
});
|
||||
if (window.history && window.history.replaceState) {
|
||||
window.history.replaceState({}, document.title, window.location.pathname + window.location.search + (name === 'votes' ? '#votes' : ''));
|
||||
}
|
||||
}
|
||||
tabs.forEach(function(tab) {
|
||||
tab.addEventListener('click', function() { showPanel(tab.dataset.profileTab); });
|
||||
});
|
||||
// 仅当投票 Tab 可点击(功能开启)时才响应 #votes hash,避免投票关闭时切到空面板
|
||||
if (window.location.hash === '#votes' && document.querySelector('[data-profile-tab="votes"]')) {
|
||||
showPanel('votes');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{{template "base/footer" .}}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,105 @@
|
||||
{{template "base/header" .}}
|
||||
<!--<link rel="stylesheet" href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/uikit/3.3.3/css/uikit.min.css">-->
|
||||
<!-- 头像直连 R2:crossorigin 让 favicon 也以 CORS 模式请求,确保浏览器缓存的响应都带 ACAO;
|
||||
?v=2 击穿历史上被「无 ACAO 响应」污染的缓存条目 -->
|
||||
<link rel="shortcut icon"
|
||||
href="{{.PageUser.Avatar}}?v=2" crossorigin="anonymous"/>
|
||||
<link rel="apple-touch-icon"
|
||||
href="{{.PageUser.Avatar}}?v=2" crossorigin="anonymous"/>
|
||||
<link rel="icon" sizes="192x192"
|
||||
href="{{.PageUser.Avatar}}?v=2" crossorigin="anonymous">
|
||||
<div class="uk-card uk-card-default uk-text-center">
|
||||
<div class="uk-flex uk-flex-center uk-flex-middle uk-background-cover uk-light" style="min-height: 260px;" data-src="{{ .PageUser.Background }}" uk-img>
|
||||
<div class="uk-card-body">
|
||||
<img class="uk-border-circle uk-box-shadow-large" src="{{ if .PageUser.Avatar }}{{ .PageUser.Avatar }}?v=2{{ else }}{{ .DefaultAvatar }}{{ end }}" crossorigin="anonymous" style="width: 100px; height: 100px; max-width: 100%; max-height: 100%;">
|
||||
<h3 id="usernamecolor">{{ .PageUser.Name }}</h3>
|
||||
<p id="introcolor">{{ .PageUser.Intro }}</p>
|
||||
<div class="icon-container">
|
||||
{{ if and .PageUser.Acfunlink (ne .PageUser.Acfunlink "none") }}
|
||||
<a href="https://{{.PageUser.Acfunlink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/ailicili.png" alt="acfunlink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if and .PageUser.Bililink (ne .PageUser.Bililink "none") }}
|
||||
<a href="https://{{.PageUser.Bililink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/bili.png" alt="bililink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if and .PageUser.Weibolink (ne .PageUser.Weibolink "none") }}
|
||||
<a href="https://{{.PageUser.Weibolink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/weibo.png" alt="weibolink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if and .PageUser.Xiaohongshulink (ne .PageUser.Xiaohongshulink "none") }}
|
||||
<a href="https://{{.PageUser.Xiaohongshulink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/xiaohongshu.png" alt="xiaohongshulink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if and .PageUser.Bloglink (ne .PageUser.Bloglink "none") }}
|
||||
<a href="https://{{.PageUser.Bloglink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/blog.png" alt="bloglink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.getElementById("usernamecolor").style.color = {{.PageUser.Usernamecolor}};
|
||||
document.getElementById("introcolor").style.color = {{.PageUser.Introcolor}};
|
||||
</script>
|
||||
<div>
|
||||
<div class="uk-card uk-card-default uk-card-small uk-card-body">
|
||||
{{ if .CanAsk }}
|
||||
<!-- jQuery 按需加载(同步,保证下方内联二维码初始化就绪) -->
|
||||
<script src="https://r2.337845818.best/tamabox/cdn/lib/jquery/3.7.1/jquery.min.js"></script>
|
||||
<script src='https://r2.337845818.best/tamabox/cdn/js/remake/easy.qrcode.min.js' type="text/javascript" charset="utf-8"></script>
|
||||
<center><div id="boxqrimg"></div></center>
|
||||
<script type="text/javascript">
|
||||
var options = {
|
||||
text: window.location.href,
|
||||
width: 200,
|
||||
height: 200,
|
||||
// 与 Profile 编辑器保持一致:仅当启用自定义前景色时,才把 Qrcodebackcolor 作为前景色;
|
||||
// 否则强制黑色 #000000,避免未勾选却显示自定义前景色、与 Profile 预览不一致。
|
||||
colorDark: ({{.PageUser.UseCustomQRColor}} ? "{{.PageUser.Qrcodebackcolor}}" : "#000000") || "#000000",
|
||||
colorLight: "{{.PageUser.Qrcodecolor}}" || "#FFFFFF",
|
||||
dotScale: parseFloat("{{.PageUser.Dotscale}}") || 0.4,
|
||||
dotScaleTiming: parseFloat("{{.PageUser.Dotscale}}") || 0.4,
|
||||
dotScaleA: parseFloat("{{.PageUser.Dotscale}}") || 0.4,
|
||||
correctLevel: QRCode.CorrectLevel.H,
|
||||
logo: (function () {
|
||||
// ?v=2:击穿曾被无 ACAO 响应污染的浏览器缓存条目;仅对 http(s) 绝对地址追加
|
||||
var a = "{{.PageUser.Avatar}}" || "{{.DefaultAvatar}}";
|
||||
return a ? (a.indexOf("http") === 0 ? a + "?v=2" : a) : undefined;
|
||||
})(),
|
||||
logoWidth: 60,
|
||||
logoHeight: 60,
|
||||
logoBackgroundTransparent: true,
|
||||
// 直连 R2 等跨域图片须以 CORS 模式加载,canvas 才不被污染、可正常导出
|
||||
crossOrigin: 'anonymous',
|
||||
backgroundImage: ("{{.PageUser.BackgroundImage}}" ? "{{.PageUser.BackgroundImage}}" : undefined),
|
||||
backgroundImageAlpha: parseFloat("{{.PageUser.Backgroundimagealpha}}") || 0.8,
|
||||
autoColor: false,
|
||||
PO: "{{.PageUser.Qrcodepdpcolor}}" || "#000000",
|
||||
PI: "{{.PageUser.Qrcodepdpcolor}}" || "#000000",
|
||||
AO: '',
|
||||
AI: '',
|
||||
timing: "{{.PageUser.Qrcodepdpcolor}}" || "#000000"
|
||||
};
|
||||
new QRCode(document.getElementById("boxqrimg"), options);
|
||||
</script>
|
||||
|
||||
<p class="uk-text-center uk-text-small">扫码向@{{ .PageUser.Name }}提问<br>{{ if .RegisterOnlyAsk }}{{t .LangCode "ask.registerOnly"}}{{ else }}{{t .LangCode "ask.anonymous"}}{{ end }}</p>
|
||||
{{ end }}
|
||||
{{template "base/alert" .}}
|
||||
{{template "question/new-question-template" .}}
|
||||
|
||||
<hr class="uk-divider-icon">
|
||||
{{ if ne (len .PageQuestions) 0 }}
|
||||
<p class="uk-text-left uk-text-muted uk-text-small">@{{ .PageUser.Name }} 以前回答过的问题 ({{ .AnsweredCount }})</p>
|
||||
{{ template "question/history-template" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{template "base/footer" .}}
|
||||
@@ -0,0 +1,102 @@
|
||||
<p class="{{ if .IsPixel }}uk-container{{end}} uk-text-right uk-text-muted uk-text-small">
|
||||
<br>Powered by NekoBox | {{ ICP }}<br>{{t .LangCode "site.footer.runtime"}}:<span id="box_runtime"></span>
|
||||
<br>
|
||||
<!--<a href="/pixel">画板</a> | -->
|
||||
<a href="https://box.tama.guru/_/tamakyi" target="_blank">{{t .LangCode "site.footer.admin"}}</a>
|
||||
| <a href="https://blog.tama.guru" target="_blank">{{t .LangCode "site.footer.notice"}}</a>
|
||||
| <a href="https://chat.tama.guru" target="_blank">{{t .LangCode "site.footer.chat"}}</a>
|
||||
| <a href="https://share.tama.guru" target="_blank">{{t .LangCode "site.footer.drive"}}</a>
|
||||
| <a href="https://status.tama.guru" target="_blank">{{t .LangCode "site.footer.status"}}</a>
|
||||
| <a href="https://tama.guru" target="_blank">{{t .LangCode "site.footer.nav"}}</a>
|
||||
</p>
|
||||
|
||||
<script>
|
||||
// 页脚「提问箱已成功存活」倒计时:原 R2 cdn/time.box.js(1.6KB)内联于此,
|
||||
// 消除全站每页一个 R2 慢 defer(实测 0.7-1.7s 波动)。相对原脚本两处修复:
|
||||
// 1) 先判空再写入(原版先赋值后判空,box_runtime 缺失时会抛 ReferenceError 中断脚本);
|
||||
// 2) 首帧立即填充(原版 DOMContentLoaded + 首个 1s 间隔后才显示,首秒为空)。
|
||||
(function () {
|
||||
var create = Math.round(Date.UTC(2023, 6, 1, 18, 15, 43) / 1000); // 提问箱创建时刻(UTC)
|
||||
function tick() {
|
||||
var el = document.getElementById("box_runtime");
|
||||
if (!el) return;
|
||||
var s = Math.round((Date.now() + 8 * 3600 * 1000) / 1000) - create; // UTC+8 秒级存活
|
||||
var t = [0, 0, 0, 0, 0];
|
||||
if (s >= 31536000) { t[0] = s / 31536000 | 0; s %= 31536000; }
|
||||
if (s >= 86400) { t[1] = s / 86400 | 0; s %= 86400; }
|
||||
if (s >= 3600) { t[2] = s / 3600 | 0; s %= 3600; }
|
||||
if (s >= 60) { t[3] = s / 60 | 0; s %= 60; }
|
||||
if (s > 0) { t[4] = s; }
|
||||
el.innerHTML = t[0] + '年 ' + t[1] + '天 ' + t[2] + '时 ' + t[3] + '分 ' + t[4] + '秒 ';
|
||||
}
|
||||
tick();
|
||||
setInterval(tick, 1000);
|
||||
})();
|
||||
</script>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 提交反馈(P0):点击任意表单的提交按钮后,立即把触发按钮变成「转圈 + 本地化文字」,
|
||||
// 并禁用表单内全部按钮,物理阻止在上传/网络慢时的重复点击与重复提交。
|
||||
// 浏览器前进/后退(bfcache)回到本页时自动复位,避免停留在禁用或转圈状态。
|
||||
// 纯内联反馈,不使用全屏遮罩。
|
||||
var SUBMIT_I18N = {
|
||||
submitting: '{{t .LangCode "common.submitting"}}',
|
||||
uploading: '{{t .LangCode "common.uploading"}}'
|
||||
};
|
||||
|
||||
function tbResetSubmitButtons() {
|
||||
document.querySelectorAll('button[data-tb-submitting]').forEach(function(b) {
|
||||
b.disabled = false;
|
||||
b.removeAttribute('data-tb-submitting');
|
||||
var orig = b.getAttribute('data-tb-restore');
|
||||
if (orig !== null) {
|
||||
b.innerHTML = orig;
|
||||
b.removeAttribute('data-tb-restore');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('submit', function(e) {
|
||||
var form = e.target;
|
||||
if (!form || form.tagName !== 'FORM') return;
|
||||
|
||||
// 页面级提交反馈必须尊重前置校验:投票编辑页等 onsubmit 返回 false 时,
|
||||
// submit 事件仍可能继续到达此监听器;此时绝不能切换到“提交中”状态。
|
||||
if (e.defaultPrevented || form.getAttribute('data-tb-skip-submit-feedback') === '1') {
|
||||
form.removeAttribute('data-tb-skip-submit-feedback');
|
||||
return;
|
||||
}
|
||||
|
||||
// 下载 / 新窗口类表单(target="_blank",如导出):当前页不发生导航,也没有 bfcache
|
||||
// 复位机会,进入“提交中”状态后按钮会永远卡在转圈 + 禁用。这类表单直接跳过提交反馈。
|
||||
if (form.getAttribute('target') === '_blank') return;
|
||||
|
||||
// 触发提交的按钮(programmatic submit 时 e.submitter 为 null,回退到首个 submit 按钮)
|
||||
var trigger = e.submitter || form.querySelector('button[type="submit"]');
|
||||
|
||||
// 表单含已选中的文件 → 提示“上传中”,否则“提交中”
|
||||
var hasFile = false;
|
||||
form.querySelectorAll('input[type="file"]').forEach(function(f) {
|
||||
if (f.files && f.files.length > 0) hasFile = true;
|
||||
});
|
||||
var label = hasFile ? SUBMIT_I18N.uploading : SUBMIT_I18N.submitting;
|
||||
|
||||
if (trigger && trigger.tagName === 'BUTTON') {
|
||||
trigger.setAttribute('data-tb-restore', trigger.innerHTML);
|
||||
trigger.innerHTML = '<span uk-spinner="ratio: 0.6"></span> ' + label;
|
||||
}
|
||||
|
||||
// 禁用表单内所有按钮,防止重复提交
|
||||
form.querySelectorAll('button').forEach(function(b) {
|
||||
b.disabled = true;
|
||||
b.setAttribute('data-tb-submitting', '1');
|
||||
});
|
||||
});
|
||||
|
||||
// bfcache 还原时复位按钮
|
||||
window.addEventListener('pageshow', tbResetSubmitButtons);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,122 @@
|
||||
{{template "base/header" .}}
|
||||
<div class="uk-card uk-card-default uk-card-body">
|
||||
<h1 class="uk-heading-small">{{t .LangCode "site.title"}}</h1>
|
||||
<p><br>⭐一个无需注册即可提问的匿名提问箱。你不需要下载App,不需要绑定社交账号,甚至连邮箱都不需要是真的。<br>⭐本站在原版的基础上新增了问题页面的二维码、私聊、投票、追加提问等功能以及更多自定义内容。各位用户可自行修改二维码背景图、颜色等个性化配置。<br>⭐可以到站长唯一提问提问箱链接<a href="//box.tama.guru/_/tamakyi">小狼的提问箱</a>尝试相关功能或给我提意见。<br>⭐可以加群:<a href="http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=rRy9g5XY34LIzOITGGmQHjX6BIICFpam&authKey=EjyNjp60KyG8BtKZGN8BXJaf1jl8okkCcUhVF2zAnGPRjhvuSdopnVqOSfSymnGg&noverify=0&group_code=777163254">小狼的群</a>一起水群。<br></p>
|
||||
<hr><p style="color: red;">近期将国内段访问交由EdgeOne接管,境外访问照旧由CloudFlare提供,经测试国内访问速度有所提升。但因EdgeOne Free套餐不提供CIDR列表,IP放行采取自动抓取手动维护模式,如果出现521错误请刷新一下页面,过几天应该就好了。</p>
|
||||
<hr><p style="color: red; font-weight: bold;">近期更新:<br>⭐2026.9 增加了提问、投票、私聊的总开关,可以设置定时收集、定量收集或关闭功能,顺便调整了前后端显示,看起来更易用了一些。<br>⭐2026.8 新增了<a href="https://box.tama.guru/vote/sANyLkiBNUGN">投票功能</a>、追加提问、多语言、<a href="https://box.tama.guru/_/tamakyi/2894">Markdown显示</a>、置顶显示等多个功能,详情见<a href="https://blog.tama.guru/record/tamabox_changelog_20260813">这里</a>。<br>⭐2026.8 放弃使用recaptcha等对国内用户非常不友好的验证方式,更新了密码加密方式,修复了图片上传等一系列问题。<br>⭐2026.5 增加了私聊功能,可进行连续性对话,详见<a href="https://blog.tama.guru/record/tamabox-update-20260513">介绍</a>;另有增加提问箱的卡片分享,更直观和美观。<br>⭐2026.2 新增了用户展示和标签功能,如果你希望陌生人给你提问,可以在设置页面给自己贴上5个标签并选择是否展示在探索页面:<a href="https://box.tama.guru/explore">点我访问</a>,详情见<a href="https://blog.tama.guru/record/tamabox-tags">狼的公告板</a><br></p>
|
||||
<hr><p>一点提醒:<br>⭐本站唯一指定认证站长:<a href="//box.tama.guru/_/tamakyi">小狼</a>,注意不要被骗。
|
||||
<br>⭐本站不允许垃圾信息、广告、辱骂、涉政、暴恐、色情、违禁、无意义、灌水提问的出现,如有涉证或不良言论将直接删除。</p>
|
||||
</div>
|
||||
<p>{{t .LangCode "site.stats"}}:<pre style="overflow: hidden;" id="site-stats-text">{{if .SiteStats}}{{.SiteStats.Text}}{{end}}</pre></p>
|
||||
<script type="text/javascript">
|
||||
// 首页统计已改为程序内直接计算(服务端 30 分钟缓存),这里每 30 分钟定时拉取最新值刷新,
|
||||
// 与原来 crontab 生成 question.count.txt 的节奏一致,且不再依赖外部静态文件。
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
setInterval(function () {
|
||||
fetch("/api/v1/site-stats")
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (resp) {
|
||||
var d = resp.data;
|
||||
if (!d || !d.text) return;
|
||||
var el = document.getElementById("site-stats-text");
|
||||
if (el) el.textContent = d.text;
|
||||
})
|
||||
.catch(function () {});
|
||||
}, 30 * 60 * 1000);
|
||||
});
|
||||
</script>
|
||||
<!--<script src="https://r2.337845818.best/oss-to-r2/nekobox/cdn/waline/client/v2/waline.js"></script>
|
||||
<link href='https://r2.337845818.best/oss-to-r2/nekobox/cdn/waline/client/v2/waline-no-commits.css' rel='stylesheet' />-->
|
||||
<div id="waline"></div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const waline = Waline.init({
|
||||
el: '#waline',
|
||||
//后端服务器地址
|
||||
serverURL: 'https://waline.337845818.best/',
|
||||
path: window.location.href,
|
||||
// 中文默认
|
||||
locale: {
|
||||
nick: '昵称',
|
||||
nickError: '昵称不能少于3个字符',
|
||||
mail: '邮箱',
|
||||
mailError: '请填写正确的邮件地址',
|
||||
link: '网址',
|
||||
optional: '可选',
|
||||
placeholder: '欢迎评论(可以无需登录,但需要手工审核,不会立即展现)',
|
||||
sofa: '来发评论吧~',
|
||||
submit: '提交',
|
||||
like: '喜欢',
|
||||
cancelLike: '取消喜欢',
|
||||
reply: '回复',
|
||||
cancelReply: '取消回复',
|
||||
comment: '评论',
|
||||
refresh: '刷新',
|
||||
more: '加载更多...',
|
||||
preview: '预览',
|
||||
emoji: '表情',
|
||||
uploadImage: '上传图片',
|
||||
seconds: '秒前',
|
||||
minutes: '分钟前',
|
||||
hours: '小时前',
|
||||
days: '天前',
|
||||
now: '刚刚',
|
||||
uploading: '正在上传',
|
||||
login: '登录',
|
||||
logout: '退出',
|
||||
admin: '博主',
|
||||
sticky: '置顶',
|
||||
word: '字',
|
||||
wordHint: '评论字数应在 $0 到 $1 字之间!\n当前字数:$2',
|
||||
anonymous: '无名小狼',
|
||||
level0: '潜水',
|
||||
level1: '冒泡',
|
||||
level2: '吐槽',
|
||||
level3: '活跃',
|
||||
level4: '话痨',
|
||||
level5: '传说',
|
||||
gif: '表情包',
|
||||
gifSearchPlaceholder: '搜索表情包',
|
||||
profile: '个人资料',
|
||||
approved: '通过',
|
||||
waiting: '待审核',
|
||||
spam: '垃圾',
|
||||
unsticky: '取消置顶',
|
||||
oldest: '按倒序',
|
||||
latest: '按正序',
|
||||
hottest: '按热度',
|
||||
reactionTitle: '',
|
||||
reaction0: '哇哦',
|
||||
reaction1: 'prpr',
|
||||
reaction2: '流汗',
|
||||
reaction3: '生气',
|
||||
reaction4: '流鼻血',
|
||||
reaction5: 'あべ',
|
||||
},
|
||||
reaction: [
|
||||
'https://ali-imgs.acfun.cn/kimg/bs2/zt-image-host/ChYwOGQ3OTRhYzRjMTBkZmZhZDVmZTA1EIjM1y8.gif',
|
||||
'https://ali-imgs.acfun.cn/kimg/bs2/zt-image-host/ChQwOGEyOTlhYzRjMTBmOWFkZjAwYRCIzNcv.gif',
|
||||
'https://ali-imgs.acfun.cn/kimg/bs2/zt-image-host/ChYwOGRhOTVhYzRjMTBkNmViYTVlNTA2EIjM1y8.gif',
|
||||
'https://ali-imgs.acfun.cn/kimg/bs2/zt-image-host/ChYwOGU1OTJhYzRjMTBmMzk3ZmVmNTAyEIjM1y8.gif',
|
||||
'https://ali-imgs.acfun.cn/kimg/bs2/zt-image-host/ChYwOGNkODdhYzRjMTBjYmEwOTFjNjAxEIjM1y8.gif',
|
||||
'https://ali-imgs.acfun.cn/kimg/bs2/zt-image-host/ChQwODliOGVhYzRjMTBmOGM0ZWY1ZRCIzNcv.gif',
|
||||
],
|
||||
meta: ['nick','mail'],
|
||||
requiredMeta: ['mail'],
|
||||
pageview: true,
|
||||
search: false,
|
||||
login: 'enable',
|
||||
wordLimit: 50,
|
||||
pageSize: 5,
|
||||
avatar: 'identicon',
|
||||
emoji: [
|
||||
'https://gcore.jsdelivr.net/gh/tamakyi/emoji-collection@main/acfun-color/60x60',
|
||||
],
|
||||
//禁止图片上传按钮
|
||||
imageUploader: false,
|
||||
//不显示版权标志
|
||||
copyright: false,
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{{template "base/footer" .}}
|
||||
@@ -0,0 +1,121 @@
|
||||
# 狼的提问箱 / Wolf's Question Box — 完整说明
|
||||
|
||||
狼的提问箱(Wolf's Question Box)是一个免费、无需注册的匿名提问箱服务,是 NekoBox 的社区分支(community fork)。访客无需下载 App、绑定社交账号或提供邮箱,即可向箱主匿名提问;箱主可公开或私密回答,并与提问者进行追问式的多轮对话。
|
||||
|
||||
> 隐私声明:单个提问箱内的问答内容属于用户隐私,不对外公开索引,也不写入 sitemap。本文件仅使用站点的公开功能信息,不包含任何具体提问箱或提问内容。
|
||||
|
||||
## 1. 服务定位
|
||||
|
||||
- 面向个人创作者、UP 主、博主等,提供一个让粉丝/陌生人匿名提问的入口。
|
||||
- 匿名是核心:提问者不需要任何账号、邮箱或社交登录。
|
||||
- 多语言界面:简体中文、繁体中文、英文、日文。
|
||||
- 内置浅色 / 深色主题切换。
|
||||
|
||||
## 2. 核心功能详解
|
||||
|
||||
### 2.1 匿名提问
|
||||
访客打开任意箱主的提问箱页面即可直接提问,全程无需登录。提问内容以纯文本或 Markdown 提交。
|
||||
|
||||
### 2.2 回答与追问(多轮对话)
|
||||
- 箱主可对问题进行公开回答。
|
||||
- 提问者可就同一问题「继续追问」,箱主可再次回复,形成来回多轮对话,适合连续交流、澄清或访谈场景。
|
||||
- 已回答的追问,箱主可随时「更新回答」。
|
||||
|
||||
### 2.3 Markdown 渲染
|
||||
问题与回答支持 Markdown 显示(标题、列表、引用、代码块、表格、图片等),保留排版格式。
|
||||
|
||||
### 2.4 置顶
|
||||
箱主可将重要或精彩的问题「置顶」,固定展示在提问箱顶部,便于新访客一眼看到。
|
||||
|
||||
### 2.5 访问密码 / 提问密码
|
||||
- **查看密码**:访问提问箱页面时需要输入密码,适合仅对特定人群开放。
|
||||
- **提问密码**:向某提问箱提问时需要输入密码,防止陌生人随意刷屏。
|
||||
- 密码采用加密方式存储,不保存明文。
|
||||
|
||||
### 2.6 二维码分享
|
||||
每个问题页均可生成分享二维码,箱主可自定义二维码的背景图与颜色,方便线下或社媒直接扫码访问。
|
||||
|
||||
### 2.7 标签与探索页
|
||||
- 箱主最多可设置 5 个标签,并选择是否展示在「探索」页面。
|
||||
- 「探索」页(`/explore`)按用户与标签发现其他公开提问箱,是站内唯一的公开内容发现入口。
|
||||
|
||||
### 2.8 私聊
|
||||
箱主与访客之间可进行一对一的连续私密对话(私聊),区别于公开问答,内容不对外展示。
|
||||
|
||||
### 2.9 多语言
|
||||
界面支持简体中文、繁体中文、英文、日文四种语言,跟随用户选择或浏览器/站点偏好。
|
||||
|
||||
### 2.10 深色模式
|
||||
全站内置浅色 / 深色主题切换,偏好记忆在本地 cookie。
|
||||
|
||||
### 2.11 验证码与图片上传
|
||||
- 为兼顾国内外用户,已弃用对国内不友好的 reCAPTCHA,改用更友好的验证方式(如算数验证码 / Turnstile)。
|
||||
- 提问与回答支持图片上传,上传前会做像素总量校验以防解压炸弹。
|
||||
|
||||
## 3. 使用流程
|
||||
|
||||
### 创建提问箱(箱主)
|
||||
1. 访问 `/register` 注册一个免费账号,获得专属提问箱与二级域名(如 `/_/你的用户名`)。
|
||||
2. 在 `/user/profile` 设置用户名、头像、简介与标签。
|
||||
3. 按需开启「查看密码」或「提问密码」,并设置是否参与探索页。
|
||||
|
||||
### 匿名提问(访客)
|
||||
1. 打开某箱主的提问箱页面(如 `/_/用户名`)。
|
||||
2. 若箱主设置了提问密码,先输入密码。
|
||||
3. 填写问题并提交(可勾选邮件通知,但邮箱非必填)。
|
||||
4. 等待箱主公开回答;如需补充,可使用「追问」。
|
||||
|
||||
### 分享
|
||||
- 复制提问箱链接,或使用问题页二维码分享。
|
||||
- 推荐国内用户使用主域名 `https://box.tama.guru`。
|
||||
|
||||
## 4. 常见问题(FAQ)
|
||||
|
||||
### 4.1 给提问者(访客)
|
||||
|
||||
- **提问需要注册吗?** 不需要。任何人都能匿名提问;只有创建与管理提问箱(注册账号)才需要登录。
|
||||
- **我的匿名性能保证吗?** 提问者无需提供账号或邮箱即可提问;是否填写通知邮箱完全可选,不填也能正常使用。
|
||||
- **我可以追问吗?** 可以。对箱主已公开回答的问题,你可「继续追问」,箱主再次回复后形成来回多轮对话,适合澄清、访谈或连续交流。
|
||||
- **我能收到回答通知吗?** 可以。提问时若留下邮箱(可选),箱主首次公开回答后你会收到邮件通知;邮件内含一条私密链接,可凭其查看该问题、接收回复并继续追问。
|
||||
- **提问有数量限制吗?** 有基础频率限制(约 30 条/分钟/IP)以防刷屏滥用,正常使用基本无感。
|
||||
- **能上传图片吗?** 能。提问与回答均支持图片上传,上传前会做像素总量等安全校验以防解压炸弹。
|
||||
- **需要验证码吗?** 需要。提问前需通过验证码(算数验证码 / Turnstile),已弃用对国内不友好的 reCAPTCHA,兼顾国内外用户。
|
||||
- **提问内容会被搜索引擎收录吗?** 不会。单个提问箱及其问答内容属于用户隐私,已排除在索引与 sitemap 之外;仅首页、注册、登录、探索页等公开页可被收录。
|
||||
|
||||
### 4.2 给箱主(创作者)
|
||||
|
||||
- **如何创建提问箱?** 注册一个免费账号,即可获得专属路径(如 `/_/你的用户名`),作为你的匿名提问箱。
|
||||
- **如何设置个人资料?** 在 `/user/profile` 设置用户名、头像、简介与标签。
|
||||
- **如何限制谁能访问或提问?** 可开启「查看密码」(访问页面需密码)与「提问密码」(提问需密码),均以加密形式存储,服务端不保存明文。
|
||||
- **我能删除某条提问吗?** 可以。箱主可删除提问箱内的任意提问。
|
||||
- **我能隐藏某条提问/回答吗?** 可以。单条问题可设为「私密」不对外公开展示,也可随时改回公开。
|
||||
- **如何把精彩问题置顶?** 使用「置顶」功能,将重要或精彩的问题固定在提问箱顶部,便于新访客一眼看到。
|
||||
- **如何出现在探索页?** 设置最多 5 个标签,并选择是否展示在「探索」页(`/explore`),这是站内唯一的公开内容发现入口。
|
||||
- **我能和访客私聊吗?** 可以。支持一对一连续私密对话(区别于公开问答);可拉黑对方、或删除整个对话,被拉黑方将无法继续发送。
|
||||
- **有新提问/新消息会通知我吗?** 会。若你已设置邮箱,有新提问、新私聊消息时会收到邮件通知。
|
||||
- **分享卡片 / 二维码能自定义吗?** 可以。问题页与提问箱页面均可生成分享卡片与二维码,并自定义二维码背景图与颜色,方便线下或社媒直接扫码访问。
|
||||
- **内容审核如何运作?** 采用自动与人工结合的审核,对垃圾信息、广告、辱骂、涉政、暴恐、色情、违禁及无意义灌水内容进行处置与删除。
|
||||
|
||||
### 4.3 通用
|
||||
|
||||
- **支持哪些语言?** 简体中文、繁体中文、英文、日文;可在页面切换,偏好记忆于本地 cookie。
|
||||
- **支持深色模式吗?** 支持。全站内置浅色 / 深色主题切换,偏好同样记忆于本地 cookie。
|
||||
- **这是 NekoBox 吗?** 不是。TamaBox(狼的提问箱)是 NekoBox 的社区分支(community fork),在功能与多语言方面做了扩展。
|
||||
- **收费吗?** 免费。
|
||||
- **数据安全吗?** 密码加密存储,图片上传前后均做安全校验,单个提问箱内容不对外索引。
|
||||
- **如何分享我的提问箱?** 复制提问箱链接,或使用页面二维码、分享卡片;国内用户推荐使用主域名 `https://box.tama.guru`。
|
||||
- **忘记密码怎么办?** 登录页提供找回密码流程(通过注册邮箱重置),具体以登录页提示为准。
|
||||
|
||||
## 5. 隐私与使用政策
|
||||
|
||||
- **隐私**:单个提问箱内容属于用户隐私,不对外索引、不写入 sitemap。
|
||||
- **内容规范**:禁止垃圾信息、广告、辱骂、涉政、暴恐、色情、违禁、无意义或灌水内容;违规内容将被删除。
|
||||
- **数据安全**:图片上传前后均做安全校验,密码加密存储。
|
||||
|
||||
## 6. 资源
|
||||
|
||||
- 更新日志(功能更新记录):https://blog.tama.guru/record/tamabox_changelog_20260813
|
||||
- 站点首页:https://box.tama.guru/
|
||||
- 探索页:https://box.tama.guru/explore
|
||||
- 注册:https://box.tama.guru/register
|
||||
- 登录:https://box.tama.guru/login
|
||||
@@ -0,0 +1,29 @@
|
||||
# 狼的提问箱 / Wolf's Question Box
|
||||
|
||||
> 狼的提问箱(Wolf's Question Box)是一个免费、无需注册的匿名提问箱服务。访客无需下载 App、绑定社交账号或提供邮箱,即可向箱主匿名提问;箱主可公开或私密回答,并与提问者进行追问式的多轮对话。本站为 NekoBox 的社区分支(community fork)。单个提问箱内的问答内容属于用户隐私,不对外公开索引。
|
||||
|
||||
## 概述
|
||||
- [首页](https://box.tama.guru/): 站点介绍与多语言落地页。
|
||||
- [探索](https://box.tama.guru/explore): 按用户与标签发现公开的提问箱。
|
||||
- [注册](https://box.tama.guru/register): 免费创建自己的提问箱。
|
||||
- [登录](https://box.tama.guru/login): 登录以管理你的提问箱。
|
||||
|
||||
## 核心功能
|
||||
- 匿名提问:无需账号、邮箱或社交登录即可提问。
|
||||
- 回答与追问:箱主可公开回答;提问者可继续追问,箱主可回复,形成多轮来回对话。
|
||||
- Markdown 渲染:问题与回答支持 Markdown 显示。
|
||||
- 访问控制:可分别设置「查看提问箱密码」与「提问密码」,密码加密存储。
|
||||
- 置顶:将重要问题置顶展示。
|
||||
- 二维码分享:每个问题页生成可分享二维码,背景图与颜色可自定义。
|
||||
- 标签与发现:最多添加 5 个标签,展示于探索页。
|
||||
- 私聊:与箱主一对一的连续私密对话。
|
||||
- 多语言界面:简体中文、繁体中文、英文、日文。
|
||||
- 深色模式:内置浅色 / 深色主题切换。
|
||||
|
||||
## 资源
|
||||
- [完整说明 (llms-full.txt)](https://box.tama.guru/llms-full.txt): 站点完整功能说明、使用流程、FAQ 与隐私政策。
|
||||
- [更新日志](https://blog.tama.guru/record/tamabox_changelog_20260813): 近期功能更新(追问、多语言、Markdown、置顶等)。
|
||||
|
||||
## 使用政策
|
||||
- 隐私:单个提问箱内容属于隐私,已排除在搜索引擎索引与 sitemap 之外。
|
||||
- 内容规范:禁止垃圾信息、广告、辱骂、涉政、暴恐、色情、违禁、无意义或灌水内容,违规内容将被删除。
|
||||
@@ -0,0 +1,92 @@
|
||||
// Copyright 2022 E99p1ant. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package auth
|
||||
|
||||
import (
|
||||
"github.com/flamego/recaptcha"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/tamakyi/TamaBox/internal/captcha"
|
||||
"github.com/tamakyi/TamaBox/internal/conf"
|
||||
"github.com/tamakyi/TamaBox/internal/context"
|
||||
"github.com/tamakyi/TamaBox/internal/db"
|
||||
"github.com/tamakyi/TamaBox/internal/form"
|
||||
"github.com/tamakyi/TamaBox/internal/i18n"
|
||||
"github.com/tamakyi/TamaBox/internal/shared"
|
||||
)
|
||||
|
||||
func Register(ctx context.Context) {
|
||||
ctx.Success("auth/register")
|
||||
}
|
||||
|
||||
func RegisterAction(ctx context.Context, f form.Register, recaptcha recaptcha.RecaptchaV3) {
|
||||
if ctx.HasError() {
|
||||
ctx.Success("auth/register")
|
||||
return
|
||||
}
|
||||
|
||||
// Check captcha code (unified: recaptcha, turnstile, or math).
|
||||
ok, err := captcha.Verify(f.Recaptcha, shared.ResolveClientIP(ctx.Request().Request), ctx.Session, recaptcha, ctx.Lang())
|
||||
if err != nil {
|
||||
logrus.WithContext(ctx.Request().Context()).WithError(err).Error("Failed to check captcha")
|
||||
ctx.SetErrorFlash(err.Error())
|
||||
ctx.Redirect("/register")
|
||||
return
|
||||
}
|
||||
if !ok {
|
||||
ctx.SetErrorFlash(i18n.T(ctx.Lang(), "captcha.error"))
|
||||
ctx.Redirect("/register")
|
||||
return
|
||||
}
|
||||
|
||||
if err := db.Users.Create(ctx.Request().Context(), db.CreateUserOptions{
|
||||
Name: f.Name,
|
||||
Password: f.Password,
|
||||
Email: f.Email,
|
||||
Avatar: conf.Upload.DefaultAvatarURL,
|
||||
Domain: f.Domain,
|
||||
Background: conf.Upload.DefaultBackground,
|
||||
Intro: "问你想问的",
|
||||
Qrcodebackcolor: "#FDF8F0",
|
||||
Qrcodecolor: "#C45500",
|
||||
Usernamecolor: "#000000",
|
||||
Introcolor: "#000000",
|
||||
Dotscale: "0.35",
|
||||
BackgroundImage: conf.Upload.DefaultBackgroundImageURL,
|
||||
Backgroundimagealpha: "0.8",
|
||||
Qrcodepdpcolor: "#C45500",
|
||||
Acfunlink: "none",
|
||||
Bililink: "none",
|
||||
Weibolink: "none",
|
||||
Bloglink: "box.tama.guru",
|
||||
Xiaohongshulink: "none",
|
||||
Language: i18n.Resolve(f.Language), // 注册时选择的界面语言;留空回退站点默认
|
||||
}); err != nil {
|
||||
switch {
|
||||
case errors.Is(err, db.ErrDuplicateEmail):
|
||||
ctx.SetError(errors.New(i18n.T(ctx.Lang(), "auth.errDuplicateEmail")))
|
||||
case errors.Is(err, db.ErrDuplicateDomain):
|
||||
ctx.SetError(errors.New(i18n.T(ctx.Lang(), "auth.errDuplicateDomain")))
|
||||
case errors.Is(err, db.ErrBadCredential):
|
||||
ctx.SetError(errors.New(i18n.T(ctx.Lang(), "auth.errBadCredential")))
|
||||
|
||||
default:
|
||||
logrus.WithContext(ctx.Request().Context()).WithError(err).Error("Failed to create new user")
|
||||
ctx.SetInternalError()
|
||||
}
|
||||
|
||||
ctx.Success("auth/register")
|
||||
return
|
||||
}
|
||||
|
||||
// 成功提示跟随用户注册时选择的语言
|
||||
lang := "zh-CN"
|
||||
if l, ok := ctx.Data["Lang"].(string); ok && l != "" {
|
||||
lang = l
|
||||
}
|
||||
ctx.SetSuccessFlash(i18n.T(lang, "auth.register.success"))
|
||||
ctx.Redirect("/login")
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
User-agent: *
|
||||
Disallow: /_/
|
||||
Disallow: /user/
|
||||
Allow: /explore
|
||||
Allow: /llms.txt
|
||||
Allow: /llms-full.txt
|
||||
Sitemap: https://box.tama.guru/sitemap.xml
|
||||
@@ -0,0 +1,414 @@
|
||||
// Copyright 2022 E99p1ant. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package route
|
||||
|
||||
import (
|
||||
"encoding/gob"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/flamego/cache"
|
||||
cacheRedis "github.com/flamego/cache/redis"
|
||||
"github.com/flamego/csrf"
|
||||
"github.com/flamego/flamego"
|
||||
"github.com/flamego/recaptcha"
|
||||
"github.com/flamego/session"
|
||||
"github.com/flamego/session/mysql"
|
||||
sessionRedis "github.com/flamego/session/redis"
|
||||
"github.com/flamego/template"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/tamakyi/TamaBox/internal/captcha"
|
||||
"github.com/tamakyi/TamaBox/internal/conf"
|
||||
"github.com/tamakyi/TamaBox/internal/context"
|
||||
"github.com/tamakyi/TamaBox/internal/form"
|
||||
"github.com/tamakyi/TamaBox/internal/i18n"
|
||||
"github.com/tamakyi/TamaBox/internal/mail"
|
||||
"github.com/tamakyi/TamaBox/internal/route/chat" // 私聊路由
|
||||
"github.com/tamakyi/TamaBox/internal/security/autoban"
|
||||
"github.com/tamakyi/TamaBox/internal/shared"
|
||||
templatepkg "github.com/tamakyi/TamaBox/internal/template"
|
||||
"github.com/tamakyi/TamaBox/route"
|
||||
"github.com/tamakyi/TamaBox/route/auth"
|
||||
"github.com/tamakyi/TamaBox/route/pixel"
|
||||
"github.com/tamakyi/TamaBox/route/question"
|
||||
"github.com/tamakyi/TamaBox/route/service"
|
||||
"github.com/tamakyi/TamaBox/route/user"
|
||||
"github.com/tamakyi/TamaBox/route/vote"
|
||||
"github.com/tamakyi/TamaBox/static"
|
||||
"github.com/tamakyi/TamaBox/templates"
|
||||
)
|
||||
|
||||
// CSRFUserSessionKey 是 CSRF token 绑定的会话键,必须与登录时写入的会话键一致
|
||||
// (见 route/auth/login.go 中 ctx.Session.Set("uid", ...))。flamego/csrf 默认使用
|
||||
// "userID",若不与之对齐,token 的 id 恒为 "0",任意匿名访客从公开页面取到的 token
|
||||
// 对全部已登录用户均有效,CSRF 退化为全站公开常量。
|
||||
//
|
||||
// 本常量同时被 csrf_binding_test.go 引用,作为单一事实来源:一旦被误改,回归测试会在
|
||||
// CI 失败,避免修复悄悄倒退。
|
||||
const CSRFUserSessionKey = "uid"
|
||||
|
||||
// securityHeaders adds security-related HTTP headers to every response.
|
||||
func securityHeaders() flamego.Handler {
|
||||
return func(ctx flamego.Context) {
|
||||
w := ctx.ResponseWriter()
|
||||
w.Header().Set("X-Content-Type-Options", "nosniff")
|
||||
w.Header().Set("X-Frame-Options", "DENY")
|
||||
w.Header().Set("X-XSS-Protection", "1; mode=block")
|
||||
w.Header().Set("Referrer-Policy", "strict-origin-when-cross-origin")
|
||||
// HSTS:仅当站点以 https 对外提供服务时下发,避免 http 部署下把用户锁死在 https。
|
||||
if strings.HasPrefix(conf.App.ExternalURL, "https") {
|
||||
w.Header().Set("Strict-Transport-Security", "max-age=31536000; includeSubDomains")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func New() *flamego.Flame {
|
||||
f := flamego.Classic()
|
||||
if conf.App.Production {
|
||||
flamego.SetEnv(flamego.EnvTypeProd)
|
||||
}
|
||||
|
||||
// 自动封禁实例:整个请求链路共享同一个,供中间件与 f.NotFound 复用,
|
||||
// 避免对业务性 302→/(语言切换、登出、投票不存在等)误判为路径扫描。
|
||||
// 404 是否参与统计由 ban_track_notfound 控制(默认 false:正常业务一律放行,
|
||||
// 仅敏感扫描路径计数封禁,见 conf.Security.BanTrackNotFound)。
|
||||
ab := autoban.New(autoban.Options{
|
||||
Enabled: conf.Security.EnableAutoBan,
|
||||
TrackNotFound: conf.Security.BanTrackNotFound,
|
||||
ThresholdSensitive: conf.Security.BanThresholdSensitive,
|
||||
Threshold404: conf.Security.BanThreshold404,
|
||||
Window: time.Duration(conf.Security.BanWindowSeconds) * time.Second,
|
||||
Duration: time.Duration(conf.Security.BanDurationMinutes) * time.Minute,
|
||||
AlertEmail: conf.Security.SecurityAlertEmail,
|
||||
SendAlert: mail.SendSecurityAlertMail,
|
||||
})
|
||||
// 需要输出详细日志时配置如下
|
||||
// if conf.App.Production {
|
||||
// flamego.SetEnv(flamego.EnvTypeProd)
|
||||
// }
|
||||
|
||||
templateFS, err := template.EmbedFS(templates.FS, ".", []string{".html"})
|
||||
if err != nil {
|
||||
logrus.WithError(err).Fatal("Failed to embed templates file system")
|
||||
}
|
||||
|
||||
gob.Register(time.Time{})
|
||||
gob.Register(context.Flash{})
|
||||
gob.Register(captcha.StoredAnswer{})
|
||||
var sessionStorage interface{}
|
||||
initer := session.MemoryIniter()
|
||||
if conf.Database.DSN != "" {
|
||||
initer = mysql.Initer()
|
||||
sessionStorage = mysql.Config{
|
||||
DSN: conf.Database.DSN,
|
||||
Lifetime: 7 * 24 * time.Hour,
|
||||
}
|
||||
}
|
||||
if conf.Redis.Addr != "" {
|
||||
initer = sessionRedis.Initer()
|
||||
sessionStorage = sessionRedis.Config{
|
||||
Options: &sessionRedis.Options{
|
||||
Addr: conf.Redis.Addr,
|
||||
Password: conf.Redis.Password,
|
||||
DB: 1,
|
||||
},
|
||||
Lifetime: 7 * 24 * time.Hour,
|
||||
}
|
||||
}
|
||||
sessioner := session.Sessioner(session.Options{
|
||||
Initer: initer,
|
||||
Config: sessionStorage,
|
||||
// 显式声明 cookie 安全属性,不依赖库默认值:
|
||||
// - HTTPOnly:禁止 JS 读取,降低 XSS 窃取会话的风险
|
||||
// - SameSite=Lax:阻断经典跨站表单 POST(CSRF 的主要防线之一)
|
||||
// - Secure:仅在站点以 https 对外服务时下发,避免 http 本地开发下 cookie 不生效。
|
||||
// 缺失 Secure 时,HSTS 尚未落地的首次访问可被主动 MITM 诱导明文请求窃取会话。
|
||||
Cookie: session.CookieOptions{
|
||||
HTTPOnly: true,
|
||||
SameSite: http.SameSiteLaxMode,
|
||||
Secure: strings.HasPrefix(conf.App.ExternalURL, "https"),
|
||||
},
|
||||
})
|
||||
|
||||
f.Use(flamego.Static(flamego.StaticOptions{
|
||||
FileSystem: http.FS(static.FS),
|
||||
Prefix: "/static",
|
||||
// 静态资源随二进制发布,内容变更需重新部署;1 天缓存是安全折中
|
||||
CacheControl: func() string {
|
||||
return "public, max-age=86400"
|
||||
},
|
||||
}))
|
||||
|
||||
f.Use(securityHeaders())
|
||||
f.Use(ipBlacklistMiddleware())
|
||||
f.Use(autobanMiddleware(ab))
|
||||
// 全局请求体上限:必须在任何会读取 body 的中间件(尤其 Contexter 内的 CSRF 校验)
|
||||
// 之前执行,否则超大 multipart 会在 Bind 的路由级限制生效前落盘临时文件耗尽磁盘。
|
||||
f.Use(requestBodyLimitMiddleware())
|
||||
|
||||
reqUserSignOut := context.Toggle(&context.ToggleOptions{UserSignOutRequired: true})
|
||||
reqUserSignIn := context.Toggle(&context.ToggleOptions{UserSignInRequired: true})
|
||||
|
||||
f.Group("", func() {
|
||||
f.Get("/", route.Home)
|
||||
f.Get("/pixel", reqUserSignIn, pixel.Index)
|
||||
f.Get("/sponsor", route.Sponsor)
|
||||
f.Get("/change-logs", route.ChangeLogs)
|
||||
f.Get("/about-me", route.AboutMe)
|
||||
f.Get("/robots.txt", func(c context.Context) {
|
||||
fs, err := static.FS.Open("robots.txt")
|
||||
if err != nil {
|
||||
c.ResponseWriter().WriteHeader(404)
|
||||
return
|
||||
}
|
||||
defer func() { _ = fs.Close() }()
|
||||
c.ResponseWriter().Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
c.ResponseWriter().Header().Set("Cache-Control", "public, max-age=86400")
|
||||
_, _ = io.Copy(c.ResponseWriter(), fs)
|
||||
})
|
||||
f.Get("/favicon.ico", func(c context.Context) {
|
||||
fs, _ := static.FS.Open("favicon.ico")
|
||||
defer func() { _ = fs.Close() }()
|
||||
c.ResponseWriter().Header().Set("Content-Type", "image/x-icon")
|
||||
c.ResponseWriter().Header().Set("Cache-Control", "public, max-age=86400")
|
||||
_, _ = io.Copy(c.ResponseWriter(), fs)
|
||||
})
|
||||
|
||||
f.Get("/sitemap.xml", func(c context.Context) {
|
||||
fs, err := static.FS.Open("sitemap.xml")
|
||||
if err != nil {
|
||||
c.ResponseWriter().WriteHeader(404)
|
||||
return
|
||||
}
|
||||
defer func() { _ = fs.Close() }()
|
||||
c.ResponseWriter().Header().Set("Content-Type", "application/xml")
|
||||
c.ResponseWriter().Header().Set("Content-Type", "text/xml; charset=utf-8")
|
||||
c.ResponseWriter().Header().Set("Cache-Control", "public, max-age=86400")
|
||||
_, _ = io.Copy(c.ResponseWriter(), fs)
|
||||
})
|
||||
|
||||
f.Get("/llms.txt", func(c context.Context) {
|
||||
fs, err := static.FS.Open("llms.txt")
|
||||
if err != nil {
|
||||
c.ResponseWriter().WriteHeader(404)
|
||||
return
|
||||
}
|
||||
defer func() { _ = fs.Close() }()
|
||||
c.ResponseWriter().Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
c.ResponseWriter().Header().Set("Cache-Control", "public, max-age=86400")
|
||||
_, _ = io.Copy(c.ResponseWriter(), fs)
|
||||
})
|
||||
|
||||
f.Get("/llms-full.txt", func(c context.Context) {
|
||||
fs, err := static.FS.Open("llms-full.txt")
|
||||
if err != nil {
|
||||
c.ResponseWriter().WriteHeader(404)
|
||||
return
|
||||
}
|
||||
defer func() { _ = fs.Close() }()
|
||||
c.ResponseWriter().Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
c.ResponseWriter().Header().Set("Cache-Control", "public, max-age=86400")
|
||||
_, _ = io.Copy(c.ResponseWriter(), fs)
|
||||
})
|
||||
|
||||
f.Group("", func() {
|
||||
f.Combo("/register").Get(auth.Register).Post(form.Bind(form.Register{}), rateLimitMiddleware(10, 1*time.Minute), auth.RegisterAction)
|
||||
f.Combo("/login").Get(auth.Login).Post(form.Bind(form.Login{}), rateLimitMiddleware(20, 1*time.Minute), auth.LoginAction)
|
||||
f.Combo("/forgot-password").Get(auth.ForgotPassword).Post(form.Bind(form.ForgotPassword{}), rateLimitMiddleware(5, 5*time.Minute), auth.ForgotPasswordAction)
|
||||
f.Combo("/recover-password").Get(auth.RecoverPassword).Post(form.Bind(form.RecoverPassword{}), auth.RecoverPasswordAction)
|
||||
}, reqUserSignOut)
|
||||
|
||||
// 页面密码验证路由(独立于密码保护中间件);限流防爆破
|
||||
f.Combo("/_/{domain}/password").Get(question.PasswordPage).Post(rateLimitMiddleware(10, 1*time.Minute), question.VerifyPagePassword)
|
||||
|
||||
// 独立的分享图路由(不经过 Pager 中间件,直接返回图片)
|
||||
// 注意:仍挂载 question.Pager,页面设置了密码时必须先通过密码验证,
|
||||
// 否则分享图会绕过页面密码保护(与单题分享图行为一致)。
|
||||
f.Group("/_/{domain}", func() {
|
||||
f.Get("/share-card", question.ShareCard)
|
||||
}, question.Pager)
|
||||
|
||||
f.Group("/_/{domain}", func() {
|
||||
f.Combo("").Get(question.List).Post(form.Bind(form.NewQuestion{}), rateLimitMiddleware(30, 1*time.Minute), question.New)
|
||||
f.Group("/{questionID}", func() {
|
||||
f.Get("", question.Item)
|
||||
f.Get("/share-card", question.QuestionShareCard)
|
||||
f.Post("/delete", question.Delete)
|
||||
f.Post("/set-private", question.SetPrivate)
|
||||
f.Post("/set-public", question.SetPublic)
|
||||
f.Post("/pin", question.TogglePin)
|
||||
f.Post("/read", question.SetRead)
|
||||
f.Post("/unread", question.SetUnread)
|
||||
f.Post("/answer", reqUserSignIn, form.Bind(form.PublishAnswerQuestion{}), question.PublishAnswer)
|
||||
f.Post("/follow-up", form.Bind(form.PublishFollowUpQuestion{}), question.PublishFollowUp)
|
||||
f.Post("/follow-up/{followUpID}/answer", reqUserSignIn, form.Bind(form.AnswerFollowUpQuestion{}), question.AnswerFollowUp)
|
||||
}, question.Questioner)
|
||||
|
||||
// 新增:私聊路由(需要登录,使用 Token 标识对话)
|
||||
f.Group("/chat/{token}", func() {
|
||||
f.Get("", chat.ConversationPage)
|
||||
f.Post("/send", rateLimitMiddleware(20, 1*time.Minute), chat.SendMessage)
|
||||
f.Post("/delete", chat.DeleteConversation)
|
||||
f.Post("/block", chat.ToggleBlockUser)
|
||||
}, reqUserSignIn)
|
||||
}, question.Pager) // Pager 中间件已内置页面密码检查
|
||||
|
||||
f.Get("/explore", user.Explore)
|
||||
|
||||
// 匿名投票参与端(公开):token 链接入口
|
||||
f.Group("/vote/{token}", func() {
|
||||
f.Get("", vote.Page)
|
||||
// 提交限流优先按登录用户/签名 vote_fp 计数,IP 仅作高阈值兜底,避免共享出口误伤。
|
||||
f.Post("/submit", voteSubmitRateLimitMiddleware(20, 1*time.Minute), vote.Submit)
|
||||
})
|
||||
|
||||
// 公开页语言切换:把语言偏好写入 session(由 session 中间件随其 cookie 一并持久化)
|
||||
// 后跳回原页面。此前写独立 lang cookie 会被 session 中间件的 Set-Cookie 整体覆盖而失效,
|
||||
// 故改为托管在 session 中。仅允许站内相对路径,防开放重定向。
|
||||
f.Get("/i18n/{lang}", func(c context.Context) {
|
||||
lang := i18n.Resolve(c.Param("lang"))
|
||||
// 写入 session,避免被 session 中间件的 Set-Cookie 覆盖(匿名用户也走 session 中间件)。
|
||||
c.Session.Set("lang", lang)
|
||||
to := c.Query("to")
|
||||
// 仅允许站内相对路径,防开放重定向:
|
||||
// 拒绝空、非 "/" 开头、以 "//" 开头的协议相对路径,以及含反斜杠/控制字符的变体。
|
||||
if to == "" || !strings.HasPrefix(to, "/") ||
|
||||
strings.HasPrefix(to, "//") || strings.ContainsAny(to, "\\\x00\r\n\t") {
|
||||
to = "/"
|
||||
}
|
||||
c.Redirect(to)
|
||||
})
|
||||
|
||||
// 算数验证码 API(仅在 captcha_type = "math" 时生效,但路由本身不依赖中间件)
|
||||
// 加限流:防止匿名脚本无限生成/轮询爆破(答案本身对客户端可见,限流是主要节流手段)。
|
||||
f.Get("/api/captcha/generate", rateLimitMiddleware(20, 1*time.Minute), captcha.GenerateHandler)
|
||||
f.Post("/api/captcha/verify", rateLimitMiddleware(20, 1*time.Minute), captcha.VerifyHandler)
|
||||
|
||||
f.Group("/user", func() {
|
||||
f.Get("/questions", user.QuestionList)
|
||||
|
||||
// 匿名投票管理(箱主侧)
|
||||
f.Group("/votes", func() {
|
||||
f.Get("", user.VoteList)
|
||||
f.Get("/new", user.VoteNew)
|
||||
f.Post("", rateLimitMiddleware(10, 1*time.Minute), user.VoteCreate)
|
||||
f.Get("/{voteID}/edit", user.VoteEdit)
|
||||
f.Post("/{voteID}", rateLimitMiddleware(10, 1*time.Minute), user.VoteUpdate)
|
||||
f.Post("/{voteID}/publish", user.VotePublish)
|
||||
f.Post("/{voteID}/close", user.VoteClose)
|
||||
f.Post("/{voteID}/delete", user.VoteDelete)
|
||||
f.Get("/{voteID}/results", user.VoteResults)
|
||||
f.Get("/{voteID}/preview", user.VotePreview)
|
||||
// 导出为只读操作(幂等、无副作用),用 GET 链接下载,避免表单提交
|
||||
f.Get("/{voteID}/export", user.VoteExportCSV)
|
||||
})
|
||||
|
||||
f.Group("/profile", func() {
|
||||
f.Get("", user.Profile)
|
||||
f.Post("/update", form.Bind(form.UpdateProfile{}), rateLimitMiddleware(10, 1*time.Minute), user.UpdateProfile)
|
||||
f.Post("/export", user.ExportProfile)
|
||||
f.Post("/export-json", user.ExportProfileJSON)
|
||||
f.Combo("/deactivate").Get(user.DeactivateProfile).Post(user.DeactivateProfileAction)
|
||||
|
||||
f.Post("/update-page-password", form.Bind(form.UpdatePagePassword{}), rateLimitMiddleware(10, 1*time.Minute), user.UpdatePagePassword)
|
||||
f.Post("/update-ask-password", form.Bind(form.UpdateAskPassword{}), rateLimitMiddleware(10, 1*time.Minute), user.UpdateAskPassword)
|
||||
|
||||
f.Post("/update-chat-settings", user.UpdateChatSettings)
|
||||
|
||||
// 功能管理(提问 / 私聊 / 投票 的开关、定时开关与定量收集):
|
||||
// 不单独开页面,作为账号设置页的三个面板,保存后回跳到对应面板。
|
||||
f.Group("/features", func() {
|
||||
f.Post("/update", rateLimitMiddleware(20, 1*time.Minute), user.FeaturesUpdate)
|
||||
f.Post("/reset-quota", rateLimitMiddleware(20, 1*time.Minute), user.FeatureResetQuota)
|
||||
})
|
||||
})
|
||||
// 防骚扰设置:注册限制(harassment/update)与全局屏蔽词(blockwords/update)
|
||||
// 拆为两个独立入口。屏蔽词在提问/私聊/投票三个设置面板共用一份,保存后经
|
||||
// ?tab= 参数回跳到来源面板。
|
||||
f.Post("/harassment/update", form.Bind(form.UpdateHarassment{}), user.UpdateHarassment)
|
||||
f.Post("/blockwords/update", form.Bind(form.UpdateBlockWords{}), user.UpdateBlockWords)
|
||||
f.Post("/tags/update", form.Bind(form.UpdateTags{}), user.UpdateTags)
|
||||
// Logout 必须用 POST:GET 会留下 CSRF 风险(第三方图片/链接可触发退出登录)
|
||||
f.Post("/logout", auth.Logout)
|
||||
}, reqUserSignIn)
|
||||
|
||||
f.Group("/api/v1", func() {
|
||||
f.Group("/user", func() {
|
||||
f.Get("", reqUserSignIn, user.ProfileAPI)
|
||||
f.Group("/{domain}", func() {
|
||||
f.Group("/questions", func() {
|
||||
f.Get("", rateLimitMiddleware(60, 1*time.Minute), question.ListAPI)
|
||||
})
|
||||
})
|
||||
})
|
||||
// 像素追踪代理:仅暴露只读 GET(f.Any 会放行写方法,曾有 CSRF 豁免 + 写方法放行的风险),
|
||||
// 并加限流防止被用作高频打点通道。
|
||||
f.Get("/pixel/{**}", reqUserSignIn, rateLimitMiddleware(30, 1*time.Minute), pixel.Proxy)
|
||||
// 服务反代仅暴露只读 GET:本网关是把已登录用户的请求转发到配置好的内部服务,
|
||||
// 不应允许任意写方法,避免被用作对内网后端的越权操作入口。
|
||||
f.Get("/service/{**}", reqUserSignIn, service.Proxy)
|
||||
f.Get("/explore/random", rateLimitMiddleware(60, 1*time.Minute), user.RandomRecommend)
|
||||
// 首页"提问箱信息统计"公开接口(服务端 30 分钟缓存),供前端定时刷新
|
||||
f.Get("/site-stats", rateLimitMiddleware(60, 1*time.Minute), route.SiteStatsAPI)
|
||||
}, context.APIEndpoint)
|
||||
},
|
||||
cache.Cacher(cache.Options{
|
||||
Initer: cacheRedis.Initer(),
|
||||
Config: cacheRedis.Config{
|
||||
Options: &cacheRedis.Options{
|
||||
Addr: conf.Redis.Addr,
|
||||
Password: conf.Redis.Password,
|
||||
DB: 0,
|
||||
},
|
||||
},
|
||||
}),
|
||||
recaptcha.V3(
|
||||
recaptcha.Options{
|
||||
Secret: conf.Recaptcha.ServerKey,
|
||||
VerifyURL: func() recaptcha.VerifyURL {
|
||||
if conf.Recaptcha.TurnstileStyle {
|
||||
return "https://challenges.cloudflare.com/turnstile/v0/siteverify"
|
||||
}
|
||||
return recaptcha.VerifyURLGlobal
|
||||
}(),
|
||||
},
|
||||
),
|
||||
sessioner,
|
||||
csrf.Csrfer(csrf.Options{
|
||||
Secret: conf.Server.XSRFKey,
|
||||
Header: "X-CSRF-Token",
|
||||
// ⚠️ 必须与 route/auth/login.go 中 ctx.Session.Set("uid", ...) 的 key 一致。
|
||||
// flamego/csrf 默认 SessionKey 为 "userID",若不显式指定,s.Get("userID")
|
||||
// 恒为 nil,token 内绑定的 id 恒为 "0" —— 由于校验是无状态 HMAC 重算
|
||||
// (不与 session 中存储的 token 比对),这会导致任意匿名访客从公开的
|
||||
// /login 页面取到的 token 对所有已登录用户均有效,CSRF 退化为全站公开常量。
|
||||
// 回归测试见 route/csrf_binding_test.go(引用 CSRFUserSessionKey)。
|
||||
SessionKey: CSRFUserSessionKey,
|
||||
}),
|
||||
template.Templater(template.Options{
|
||||
FileSystem: templateFS,
|
||||
FuncMaps: templatepkg.FuncMap(),
|
||||
}),
|
||||
context.Contexter(),
|
||||
)
|
||||
f.NotFound(func(ctx flamego.Context) {
|
||||
// 真正的 404 探测在此记录(仅此处,不把业务 302→/ 误判为扫描)。
|
||||
// 注意:flamego 的 NotFound 会先写入 404 状态再 Redirect 到 "/",
|
||||
// 因此这里在 Redirect 之前记录,确保状态为 404。
|
||||
// 键必须与 autobanMiddleware 中的 IsBanned/Record 保持一致(同样经 LimitKey 聚合),
|
||||
// 否则 404 计数会记在另一个键上,导致封禁永不生效。
|
||||
// ⚠️ 该 404 计数受 ban_track_notfound 配置控制,默认关闭(正常业务一律放行,
|
||||
// 仅敏感扫描路径计数封禁);Record 内部对未开启的 KindNotFound 直接忽略。
|
||||
if ip := shared.LimitKey(shared.ResolveClientIP(ctx.Request().Request)); ip != "" {
|
||||
ab.Record(ip, ctx.Request().URL.Path, autoban.KindNotFound)
|
||||
}
|
||||
ctx.Redirect("/")
|
||||
})
|
||||
|
||||
return f
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset
|
||||
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
|
||||
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
|
||||
>
|
||||
|
||||
<url>
|
||||
<loc>https://box.tama.guru/explore</loc>
|
||||
<priority>0.3</priority>
|
||||
<lastmod>2026-02-27</lastmod>
|
||||
<changefreq>weekly</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://box.tama.guru/</loc>
|
||||
<priority>0.3</priority>
|
||||
<lastmod>2026-02-27</lastmod>
|
||||
<changefreq>weekly</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://box.tama.guru/register</loc>
|
||||
<priority>0.3</priority>
|
||||
<lastmod>2026-02-27</lastmod>
|
||||
<changefreq>weekly</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://box.tama.guru/login</loc>
|
||||
<priority>0.3</priority>
|
||||
<lastmod>2026-02-27</lastmod>
|
||||
<changefreq>weekly</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://box.tama.guru/_/tamakyi</loc>
|
||||
<priority>0.3</priority>
|
||||
<lastmod>2026-02-27</lastmod>
|
||||
<changefreq>weekly</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://box.tama.guru</loc>
|
||||
<priority>0.3</priority>
|
||||
<lastmod>2026-02-27</lastmod>
|
||||
<changefreq>weekly</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://box.tama.guru/change-logs</loc>
|
||||
<priority>0.3</priority>
|
||||
<lastmod>2026-02-27</lastmod>
|
||||
<changefreq>weekly</changefreq>
|
||||
</url>
|
||||
|
||||
</urlset>
|
||||
@@ -0,0 +1,118 @@
|
||||
// Copyright 2022 E99p1ant. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package censor
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type ForbiddenType string
|
||||
|
||||
const (
|
||||
ForbiddenTypeSpam ForbiddenType = "spam"
|
||||
ForbiddenTypeAd ForbiddenType = "ad"
|
||||
ForbiddenTypePolitics ForbiddenType = "politics"
|
||||
ForbiddenTypeTerrorism ForbiddenType = "terrorism"
|
||||
ForbiddenTypeAbuse ForbiddenType = "abuse"
|
||||
ForbiddenTypePorn ForbiddenType = "porn"
|
||||
ForbiddenTypeFlood ForbiddenType = "flood"
|
||||
ForbiddenTypeContraband ForbiddenType = "contraband"
|
||||
ForbiddenTypeMeaningless ForbiddenType = "meaningless"
|
||||
ForbiddenTypeHarmful ForbiddenType = "harmful"
|
||||
)
|
||||
|
||||
func (f ForbiddenType) String() string {
|
||||
return map[ForbiddenType]string{
|
||||
ForbiddenTypeSpam: "含垃圾信息",
|
||||
ForbiddenTypeAd: "广告",
|
||||
ForbiddenTypePolitics: "涉政",
|
||||
ForbiddenTypeTerrorism: "暴恐",
|
||||
ForbiddenTypeAbuse: "辱骂",
|
||||
ForbiddenTypePorn: "色情",
|
||||
ForbiddenTypeFlood: "灌水",
|
||||
ForbiddenTypeContraband: "违禁",
|
||||
ForbiddenTypeMeaningless: "无意义",
|
||||
ForbiddenTypeHarmful: "不良场景",
|
||||
}[f]
|
||||
}
|
||||
|
||||
type TextCensorResponse struct {
|
||||
SourceName string `json:"source_name"`
|
||||
Pass bool `json:"pass"`
|
||||
ForbiddenType ForbiddenType `json:"forbidden_type"`
|
||||
Hint string `json:"hint"`
|
||||
Confidence float64 `json:"confidence"`
|
||||
RawResponse json.RawMessage `json:"raw_response"`
|
||||
}
|
||||
|
||||
func (r *TextCensorResponse) ToJSON() []byte {
|
||||
jsonBytes, _ := json.Marshal(r)
|
||||
return jsonBytes
|
||||
}
|
||||
|
||||
func (r *TextCensorResponse) ErrorMessage() string {
|
||||
errorMessage := "内容安全检查不通过"
|
||||
if r.ForbiddenType != "" {
|
||||
errorMessage += fmt.Sprintf(" [%s]", r.ForbiddenType.String())
|
||||
}
|
||||
if r.Hint != "" {
|
||||
errorMessage += fmt.Sprintf(",相关标签:%q", r.Hint)
|
||||
}
|
||||
return errorMessage
|
||||
}
|
||||
|
||||
type TextCensor interface {
|
||||
Censor(ctx context.Context, text string) (*TextCensorResponse, error)
|
||||
String() string
|
||||
}
|
||||
|
||||
var TrustedHosts = []string{
|
||||
"xhslink.com", // 小红书
|
||||
"weibo.com", // 微博
|
||||
"b23.tv", // Bilibili
|
||||
"acfun.cn",
|
||||
"aixifan.com",
|
||||
"github.com",
|
||||
"tama.guru",
|
||||
"337845818.best",
|
||||
"x.com",
|
||||
"bilibili.com",
|
||||
}
|
||||
|
||||
// RemoveTrustedURL removes the trusted URL from the text,
|
||||
// in order to bypass the URL censoring.
|
||||
// 仅当可信域名后紧跟路径分隔符(/ ? #)或位于字符串结尾时才视为可信,
|
||||
// 避免 github.com.evil.tld 被朴素替换误判为 github.com 之子域而漏审。
|
||||
func RemoveTrustedURL(str string) string {
|
||||
for _, host := range TrustedHosts {
|
||||
for _, protocol := range []string{"http://", "https://"} {
|
||||
needle := protocol + host
|
||||
var b strings.Builder
|
||||
rest := str
|
||||
for {
|
||||
idx := strings.Index(rest, needle)
|
||||
if idx < 0 {
|
||||
b.WriteString(rest)
|
||||
break
|
||||
}
|
||||
b.WriteString(rest[:idx])
|
||||
after := rest[idx+len(needle):]
|
||||
if len(after) == 0 || after[0] == '/' || after[0] == '?' || after[0] == '#' {
|
||||
// 可信域名边界:跳过该前缀,从域名之后继续(域名本身被移除,不进入审核)。
|
||||
rest = after
|
||||
} else {
|
||||
// 非可信域名边界(如 github.com.evil):保留前缀,从其后继续扫描。
|
||||
b.WriteString(needle)
|
||||
rest = after
|
||||
}
|
||||
}
|
||||
str = b.String()
|
||||
}
|
||||
}
|
||||
return str
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
// Copyright 2024 E99p1ant. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package storage
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"image"
|
||||
_ "image/gif"
|
||||
_ "image/jpeg"
|
||||
_ "image/png"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
"os"
|
||||
"os/exec"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go-v2/aws"
|
||||
"github.com/aws/aws-sdk-go-v2/service/s3"
|
||||
"github.com/chai2010/webp"
|
||||
"github.com/disintegration/imaging"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/thanhpk/randstr"
|
||||
"github.com/wuhan005/gadget"
|
||||
|
||||
"github.com/tamakyi/TamaBox/internal/conf"
|
||||
"github.com/tamakyi/TamaBox/internal/imagecheck"
|
||||
)
|
||||
|
||||
// MaxUploadBytes 是单次图片上传的内存读取上限(8MB)。
|
||||
// 调用方虽在 HTTP 层对 fileHeader.Size 做了校验,但该值可被客户端伪造,
|
||||
// 因此在读取前用 io.LimitReader 兜底,避免超大文件将内存撑爆(DoS)。
|
||||
const MaxUploadBytes = 8 * 1024 * 1024
|
||||
|
||||
// aspect 约束一次上传的宽高比(wantW:wantH,容差 DefaultAspectTolerance)。
|
||||
// 头像固定 1:1、页面背景固定 16:9:客户端裁剪后即为精确比例,
|
||||
// 服务端复校验用于拦截绕过前端直接 POST 的越界图片。
|
||||
type aspect struct {
|
||||
W, H float64
|
||||
}
|
||||
|
||||
func (a *aspect) check(data []byte) error {
|
||||
if a == nil {
|
||||
return nil
|
||||
}
|
||||
return imagecheck.CheckAspectRatio(bytes.NewReader(data), a.W, a.H, imagecheck.DefaultAspectTolerance)
|
||||
}
|
||||
|
||||
// UploadAvatarToS3 上传头像:除通用校验/转换外强制 1:1 宽高比。
|
||||
func UploadAvatarToS3(file multipart.File, fileHeader *multipart.FileHeader) (string, error) {
|
||||
return uploadPictureToS3(file, fileHeader, &aspect{W: 1, H: 1})
|
||||
}
|
||||
|
||||
// UploadBackgroundToS3 上传页面背景:除通用校验/转换外强制 16:9 宽高比。
|
||||
func UploadBackgroundToS3(file multipart.File, fileHeader *multipart.FileHeader) (string, error) {
|
||||
return uploadPictureToS3(file, fileHeader, &aspect{W: 16, H: 9})
|
||||
}
|
||||
|
||||
// UploadPictureToS3 上传通用图片到 Cloudflare R2,自动转换为 WebP(动画 GIF 可选转换)
|
||||
func UploadPictureToS3(file multipart.File, fileHeader *multipart.FileHeader) (string, error) {
|
||||
return uploadPictureToS3(file, fileHeader, nil)
|
||||
}
|
||||
|
||||
// uploadPictureToS3 是上传管线实现:读入 → 魔数 → (可选)比例校验 → 像素总量校验
|
||||
// → 解码 → WebP 转换 → 落盘 R2。avatar/background 的固定比例校验复用同一管线,
|
||||
// 仅通过 aspect 参数区分,避免为一种用途复制一套上传代码。
|
||||
func uploadPictureToS3(file multipart.File, fileHeader *multipart.FileHeader, asp *aspect) (string, error) {
|
||||
// 1. 限制读取大小,防止超大上传撑爆内存(DoS)。
|
||||
// 先用 LimitReader 截断到 MaxUploadBytes+1 字节;若实际读到的字节数超过上限则直接拒绝。
|
||||
limited := io.LimitReader(file, MaxUploadBytes+1)
|
||||
fileData, err := io.ReadAll(limited)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "read file data")
|
||||
}
|
||||
if int64(len(fileData)) > MaxUploadBytes {
|
||||
return "", errors.New("uploaded file is too large")
|
||||
}
|
||||
|
||||
// 2. 校验文件魔数,仅允许 JPEG / PNG / GIF / WebP
|
||||
if !isSupportedImage(fileData) {
|
||||
return "", errors.New("unsupported file type: not a valid image")
|
||||
}
|
||||
|
||||
// 2.5 用途宽高比校验(头像 1:1 / 背景 16:9),绕过前端裁剪的直传在此被拦截
|
||||
if err := asp.check(fileData); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
fileReader := bytes.NewReader(fileData)
|
||||
|
||||
// 3. 解码前先校验像素总量(防解压炸弹),再解码图片获取格式;解码失败则直接返回错误。
|
||||
if err := imagecheck.CheckPixelLimit(bytes.NewReader(fileData)); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
_, format, err := image.Decode(fileReader)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "image decode failed, file may be corrupted")
|
||||
}
|
||||
|
||||
var uploadData []byte
|
||||
var contentType string
|
||||
|
||||
// 重置 reader,以便后续可能的 resize 操作
|
||||
if _, err := fileReader.Seek(0, io.SeekStart); err != nil {
|
||||
return "", errors.Wrap(err, "reset reader")
|
||||
}
|
||||
|
||||
// 4. 根据格式进行转换或直接使用原图
|
||||
switch format {
|
||||
case "gif":
|
||||
webpData, err := convertGifToAnimatedWebP(fileData)
|
||||
if err != nil {
|
||||
// 转换失败则回退到原始 GIF
|
||||
uploadData = fileData
|
||||
contentType = "image/gif"
|
||||
} else {
|
||||
uploadData = webpData
|
||||
contentType = "image/webp"
|
||||
}
|
||||
default:
|
||||
// 静态图片(JPEG / PNG / WebP 等)转换为静态 WebP
|
||||
webpData, err := ConvertStaticImageToWebP(fileReader)
|
||||
if err != nil {
|
||||
// 转换失败时回退到原始图片
|
||||
uploadData = fileData
|
||||
contentType = mimeTypeFromFormat(format)
|
||||
} else {
|
||||
uploadData = webpData
|
||||
contentType = "image/webp"
|
||||
}
|
||||
}
|
||||
|
||||
// 5. 生成存储路径(无后缀名)
|
||||
now := time.Now()
|
||||
year := now.Year()
|
||||
month := int(now.Month())
|
||||
day := now.Day()
|
||||
key := fmt.Sprintf("%s%d/%02d/%02d/%s", PictureKeyPrefix, year, month, day, randstr.Hex(15))
|
||||
|
||||
// 6. 获取共享 S3 客户端
|
||||
client, err := GetS3Client()
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "get S3 client")
|
||||
}
|
||||
|
||||
// 7. 上传到 R2
|
||||
if err := gadget.Retry(5, func() error {
|
||||
_, err := client.PutObject(context.Background(), &s3.PutObjectInput{
|
||||
Bucket: aws.String(conf.Upload.ImageBucket),
|
||||
Key: aws.String(key),
|
||||
Body: bytes.NewReader(uploadData),
|
||||
ContentLength: aws.Int64(int64(len(uploadData))),
|
||||
ContentType: aws.String(contentType),
|
||||
})
|
||||
return err
|
||||
}); err != nil {
|
||||
return "", errors.Wrap(err, "put object after retry")
|
||||
}
|
||||
|
||||
// 8. 返回 CDN URL
|
||||
return fmt.Sprintf("https://%s/%s", conf.Upload.ImageBucketCDNHost, key), nil
|
||||
}
|
||||
|
||||
// ConvertStaticImageToWebP 将静态图片(JPEG/PNG等)转换为 WebP 格式
|
||||
// 限制最大宽度为 1920px,保持比例
|
||||
func ConvertStaticImageToWebP(r io.Reader) ([]byte, error) {
|
||||
// 先整体读入并校验像素总量(防解压炸弹),再完整解码。
|
||||
data, err := io.ReadAll(r)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "read image")
|
||||
}
|
||||
if err := imagecheck.CheckPixelLimit(bytes.NewReader(data)); err != nil {
|
||||
return nil, errors.Wrap(err, "check image pixel limit")
|
||||
}
|
||||
|
||||
img, _, err := image.Decode(bytes.NewReader(data))
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "decode image")
|
||||
}
|
||||
|
||||
maxWidth := 1920
|
||||
if img.Bounds().Dx() > maxWidth {
|
||||
img = imaging.Resize(img, maxWidth, 0, imaging.Lanczos)
|
||||
}
|
||||
|
||||
buf := new(bytes.Buffer)
|
||||
if err := webp.Encode(buf, img, &webp.Options{Quality: 80}); err != nil {
|
||||
return nil, errors.Wrap(err, "webp encode")
|
||||
}
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
// convertGifToAnimatedWebP 将 GIF 文件数据转换为动画 WebP(需要系统安装 cwebp 工具)
|
||||
// 如果 cwebp 不可用,返回错误,调用方应回退到原始 GIF
|
||||
func convertGifToAnimatedWebP(gifData []byte) ([]byte, error) {
|
||||
_, err := exec.LookPath("cwebp")
|
||||
if err != nil {
|
||||
return nil, errors.New("cwebp not found in PATH")
|
||||
}
|
||||
|
||||
tmpGif, err := os.CreateTemp("", "input_*.gif")
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "create temp gif")
|
||||
}
|
||||
defer os.Remove(tmpGif.Name())
|
||||
if _, err := tmpGif.Write(gifData); err != nil {
|
||||
return nil, errors.Wrap(err, "write temp gif")
|
||||
}
|
||||
tmpGif.Close()
|
||||
|
||||
tmpWebp, err := os.CreateTemp("", "output_*.webp")
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "create temp webp")
|
||||
}
|
||||
defer os.Remove(tmpWebp.Name())
|
||||
tmpWebp.Close()
|
||||
|
||||
cmd := exec.Command("cwebp", "-q", "80", "-mixed", "-mt", "-quiet", tmpGif.Name(), "-o", tmpWebp.Name())
|
||||
if err := cmd.Run(); err != nil {
|
||||
return nil, errors.Wrap(err, "run cwebp")
|
||||
}
|
||||
|
||||
webpData, err := os.ReadFile(tmpWebp.Name())
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "read webp output")
|
||||
}
|
||||
return webpData, nil
|
||||
}
|
||||
|
||||
// mimeTypeFromFormat 根据图片格式返回 MIME 类型
|
||||
func mimeTypeFromFormat(format string) string {
|
||||
switch format {
|
||||
case "jpeg":
|
||||
return "image/jpeg"
|
||||
case "png":
|
||||
return "image/png"
|
||||
case "gif":
|
||||
return "image/gif"
|
||||
case "webp":
|
||||
return "image/webp"
|
||||
default:
|
||||
return "application/octet-stream"
|
||||
}
|
||||
}
|
||||
|
||||
// isSupportedImage 通过文件头魔数判断是否为支持的图片格式
|
||||
func isSupportedImage(data []byte) bool {
|
||||
if len(data) < 4 {
|
||||
return false
|
||||
}
|
||||
|
||||
// JPEG: FF D8 FF
|
||||
if data[0] == 0xFF && data[1] == 0xD8 && data[2] == 0xFF {
|
||||
return true
|
||||
}
|
||||
|
||||
// PNG: 89 50 4E 47
|
||||
if bytes.Equal(data[:4], []byte{0x89, 0x50, 0x4E, 0x47}) {
|
||||
return true
|
||||
}
|
||||
|
||||
// GIF: GIF87a / GIF89a
|
||||
if len(data) >= 6 {
|
||||
if bytes.Equal(data[:6], []byte("GIF87a")) || bytes.Equal(data[:6], []byte("GIF89a")) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// WebP: RIFF ... WEBP
|
||||
if len(data) >= 12 && bytes.Equal(data[:4], []byte("RIFF")) && bytes.Equal(data[8:12], []byte("WEBP")) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
@@ -0,0 +1,977 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{.LangCode}}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<title>{{ .Title }}</title>
|
||||
<meta name="description" content="{{ if .MetaDescription }}{{ .MetaDescription }}{{ else }}{{ t .LangCode "site.description" }}{{ end }}">
|
||||
<meta name="keywords" content="{{ t .LangCode "site.keywords" }}">
|
||||
<!-- 预连接:UIkit 走公共 CDN(cdnjs.snrat.com),其余自托管库仍在本站 R2,均需预连接 -->
|
||||
<link rel="preconnect" href="https://r2.337845818.best" crossorigin>
|
||||
<link rel="preconnect" href="https://cdnjs.snrat.com" crossorigin>
|
||||
<link rel="dns-prefetch" href="https://cn.vercount.one">
|
||||
<!-- UIkit 3.3.3 切到公共 CDN(cdnjs.snrat.com,国内实测全量下载 ~0.25s,原 R2 自建 ~1.4-2.0s) -->
|
||||
<link rel="stylesheet" href="https://cdnjs.snrat.com/ajax/libs/uikit/3.3.3/css/uikit.min.css"/>
|
||||
<!-- Waline 评论区样式:非阻塞加载,不阻塞首屏渲染 -->
|
||||
<link rel="stylesheet" href="https://r2.337845818.best/tamabox/cdn/waline/client/v2/waline-no-commits.css" media="print" onload="this.media='all'"/>
|
||||
<script defer src="https://cdnjs.snrat.com/ajax/libs/uikit/3.3.3/js/uikit.min.js"></script>
|
||||
<script defer src="https://cdnjs.snrat.com/ajax/libs/uikit/3.3.3/js/uikit-icons.min.js"></script>
|
||||
<!-- UIkit 补丁:复刻原自建版 "modify-black-font"(官方版与自建版仅 3 处颜色差异——把有色容器内默认白字/白标题改为黑字)。
|
||||
模板当前只用到 .uk-light 容器(用户背景封面,question/list.html、question-not-found.html;
|
||||
其中 h3/p 已由 #usernamecolor/#introcolor 内联 style 覆盖),故只需补该容器的 3 处投影即可保持渲染一致。
|
||||
若日后新增 .uk-card-primary/.uk-card-secondary/.uk-section-primary/.uk-tile-*/.uk-overlay-primary 等容器且需黑字,须同步扩展。 -->
|
||||
<style>
|
||||
.uk-light { color: rgba(0,0,0,.7); }
|
||||
.uk-light .uk-h1, .uk-light .uk-h2, .uk-light .uk-h3, .uk-light .uk-h4, .uk-light .uk-h5, .uk-light .uk-h6,
|
||||
.uk-light .uk-heading-2xlarge, .uk-light .uk-heading-large, .uk-light .uk-heading-medium, .uk-light .uk-heading-small, .uk-light .uk-heading-xlarge,
|
||||
.uk-light h1, .uk-light h2, .uk-light h3, .uk-light h4, .uk-light h5, .uk-light h6 { color: #000; }
|
||||
.uk-light .uk-table th { color: rgba(0,0,0,.7); }
|
||||
</style>
|
||||
<!-- dayjs/alpinejs/vconsole/waline.js 已迁 cdnjs.snrat.com(sha256 与官方一致,国内实测快 2-7x) -->
|
||||
<script defer src="https://cdnjs.snrat.com/ajax/libs/dayjs/1.10.8/dayjs.min.js"></script>
|
||||
<script defer src="https://cdnjs.snrat.com/ajax/libs/alpinejs/3.9.0/cdn.min.js"></script>
|
||||
{{ if .VConsole }}
|
||||
<script src="https://cdnjs.snrat.com/ajax/libs/vConsole/3.12.1/vconsole.min.js" type="application/javascript"></script>
|
||||
<script>new window.VConsole()</script>
|
||||
{{ end }}
|
||||
<!-- jQuery 已改为按需加载:仅 easy.qrcode 二维码页(list/question-not-found/profile)自行引入 -->
|
||||
<script defer src="https://r2.337845818.best/tamabox/cdn/time.box.js"></script>
|
||||
<!--<script src="https://r2.337845818.best/tamabox/cdn/busuanzi.pure.mini.js"/></script>-->
|
||||
<script defer src="https://cn.vercount.one/js"></script>
|
||||
<script defer src="https://cdnjs.snrat.com/ajax/libs/waline/2.15.8/waline.js"></script>
|
||||
{{ if eq .CaptchaType "math" }}
|
||||
<!-- 算数验证码:弹窗模式,不影响原布局 -->
|
||||
<style>
|
||||
.captcha-equation-box {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
background: #f0f2f5;
|
||||
border: 1px solid #dcdcdc;
|
||||
border-radius: 8px;
|
||||
padding: 8px 8px 8px 16px;
|
||||
gap: 6px;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
.captcha-equation-box:focus-within {
|
||||
border-color: #1e87f0;
|
||||
box-shadow: 0 0 0 3px rgba(30,135,240,0.12);
|
||||
}
|
||||
.math-captcha-modal-question {
|
||||
font-size: 1.4rem;
|
||||
font-family: "Courier New", monospace;
|
||||
font-weight: 700;
|
||||
color: #333;
|
||||
letter-spacing: 1px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#captcha-modal-answer {
|
||||
width: 80px;
|
||||
padding: 6px 10px;
|
||||
text-align: center;
|
||||
font-size: 1.2rem;
|
||||
font-family: "Courier New", monospace;
|
||||
font-weight: 600;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
outline: none;
|
||||
transition: border-color 0.15s, box-shadow 0.15s;
|
||||
background: #fff;
|
||||
}
|
||||
#captcha-modal-answer:focus {
|
||||
border-color: #1e87f0;
|
||||
box-shadow: 0 0 0 2px rgba(30,135,240,0.2);
|
||||
}
|
||||
/* 隐藏数字输入框的上下箭头 */
|
||||
#captcha-modal-answer::-webkit-inner-spin-button,
|
||||
#captcha-modal-answer::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
#captcha-modal-answer {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
</style>
|
||||
{{ else if .RecaptchaTurnstileStyle }}
|
||||
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js?compat=recaptcha" async defer></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.querySelectorAll('.g-recaptcha').forEach(item => {
|
||||
item.disabled = true;
|
||||
});
|
||||
});
|
||||
|
||||
function onSubmit() {
|
||||
document.querySelectorAll('.g-recaptcha').forEach(item => {
|
||||
item.disabled = false;
|
||||
})
|
||||
}</script>
|
||||
{{ else }}
|
||||
<script src="{{.RecaptchaDomain}}/recaptcha/api.js" async defer></script>
|
||||
<script>function onSubmit() {document.getElementById('form').submit();}</script>
|
||||
{{ end }}
|
||||
{{ if ne SentryDSN "" }}
|
||||
<script
|
||||
src="https://browser.sentry-cdn.com/7.37.2/bundle.tracing.replay.min.js"
|
||||
integrity="sha384-o0mU2P+zsvXua0Y6f/J55PKWZt3sZCv3qDqJe6J5lZklyIQkpgjBVqNnPWYWqGhf"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script>
|
||||
Sentry.init({
|
||||
dsn: "{{ SentryDSN }}",
|
||||
integrations: [new Sentry.BrowserTracing(), new Sentry.Replay()],
|
||||
tracesSampleRate: 1.0,
|
||||
replaysSessionSampleRate: 0.1,
|
||||
replaysOnErrorSampleRate: 1.0,
|
||||
});
|
||||
</script>
|
||||
{{ end }}
|
||||
<style>
|
||||
.grecaptcha-badge {visibility: hidden;}
|
||||
.icon-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
}
|
||||
.icon {
|
||||
margin-left: 10px;
|
||||
width: 20px; /* 设置图标的宽度 */
|
||||
height: auto; /* 保持图标的高度自动调整 */
|
||||
}
|
||||
.emoji-placeholder {
|
||||
display: inline-block;
|
||||
animation: jump 0.5s ease-in-out;
|
||||
}
|
||||
|
||||
@keyframes jump {
|
||||
0%, 100% { transform: translateY(0); }
|
||||
50% { transform: translateY(-5px); }
|
||||
}
|
||||
/* 防止 UIkit Dropbar 初始闪烁 */
|
||||
.uk-dropbar {
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transition: opacity 0.2s ease, visibility 0.2s ease;
|
||||
}
|
||||
|
||||
.uk-dropbar.uk-open {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
a.uk-button.uk-button-link {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
/* 移动端优化:缩小字体和间距,避免右侧空白 */
|
||||
@media (max-width: 640px) {
|
||||
.uk-logo {
|
||||
font-size: 1rem;
|
||||
}
|
||||
.uk-navbar-nav a {
|
||||
font-size: 0.78rem;
|
||||
padding: 0 4px;
|
||||
}
|
||||
.emoji-placeholder {
|
||||
font-size: 1rem;
|
||||
}
|
||||
/* 移动端用户名限宽省略,避免长英文用户名撑爆顶栏 */
|
||||
.tb-nav-username {
|
||||
max-width: 64px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- 深色模式:html[data-theme="dark"] 时覆盖 UIkit 3.3.3 编译主题的关键颜色 -->
|
||||
<style>
|
||||
html[data-theme="dark"] {
|
||||
--tb-bg: #1a1d23;
|
||||
--tb-surface: #242830;
|
||||
--tb-surface-2: #2d323c;
|
||||
--tb-border: #3a404c;
|
||||
--tb-text: #d8dce4;
|
||||
--tb-text-muted: #8b93a1;
|
||||
--tb-primary: #5c8dff;
|
||||
}
|
||||
/* 根元素与 body 一起覆盖,确保整个视口(含内容不足一屏时的空白区)都是深色背景 */
|
||||
html[data-theme="dark"],
|
||||
html[data-theme="dark"] body {
|
||||
background-color: var(--tb-bg) !important;
|
||||
color: var(--tb-text) !important;
|
||||
}
|
||||
/* 通用表面容器 */
|
||||
html[data-theme="dark"] .uk-card,
|
||||
html[data-theme="dark"] .uk-card-default,
|
||||
html[data-theme="dark"] .uk-card-secondary,
|
||||
html[data-theme="dark"] .uk-dropbar,
|
||||
html[data-theme="dark"] .uk-navbar-dropdown,
|
||||
html[data-theme="dark"] .uk-modal-dialog,
|
||||
html[data-theme="dark"] .uk-dropdown,
|
||||
html[data-theme="dark"] .uk-offcanvas-bar,
|
||||
html[data-theme="dark"] .uk-section,
|
||||
html[data-theme="dark"] .uk-tile,
|
||||
html[data-theme="dark"] .uk-panel,
|
||||
html[data-theme="dark"] .uk-background-default,
|
||||
html[data-theme="dark"] .uk-search-default .uk-search-input {
|
||||
background-color: var(--tb-surface) !important;
|
||||
color: var(--tb-text) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-navbar-container {
|
||||
background-color: var(--tb-surface) !important;
|
||||
color: var(--tb-text) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-navbar-nav > li > a,
|
||||
html[data-theme="dark"] .uk-card a,
|
||||
html[data-theme="dark"] .uk-link,
|
||||
html[data-theme="dark"] a.uk-button-link,
|
||||
html[data-theme="dark"] .uk-navbar-dropdown-nav > li > a,
|
||||
html[data-theme="dark"] .uk-dropdown-nav > li > a,
|
||||
html[data-theme="dark"] .uk-list a {
|
||||
color: var(--tb-text) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-navbar-nav > li > a:hover,
|
||||
html[data-theme="dark"] .uk-card a:hover,
|
||||
html[data-theme="dark"] .uk-navbar-dropdown-nav > li > a:hover,
|
||||
html[data-theme="dark"] .uk-dropdown-nav > li > a:hover {
|
||||
color: var(--tb-primary) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-input,
|
||||
html[data-theme="dark"] .uk-textarea,
|
||||
html[data-theme="dark"] .uk-select {
|
||||
background-color: var(--tb-surface-2) !important;
|
||||
color: var(--tb-text) !important;
|
||||
border-color: var(--tb-border) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-input:focus,
|
||||
html[data-theme="dark"] .uk-textarea:focus,
|
||||
html[data-theme="dark"] .uk-select:focus {
|
||||
border-color: var(--tb-primary) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-text-muted,
|
||||
html[data-theme="dark"] .uk-text-meta,
|
||||
html[data-theme="dark"] .uk-text-secondary,
|
||||
html[data-theme="dark"] .uk-text-muted a,
|
||||
html[data-theme="dark"] .uk-text-small.uk-text-muted {
|
||||
color: var(--tb-text-muted) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-divider-icon::after,
|
||||
html[data-theme="dark"] hr,
|
||||
html[data-theme="dark"] .uk-table th,
|
||||
html[data-theme="dark"] .uk-table td,
|
||||
html[data-theme="dark"] .uk-list-divider > li:nth-child(n+2) {
|
||||
border-color: var(--tb-border) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-button-default {
|
||||
background-color: var(--tb-surface-2) !important;
|
||||
color: var(--tb-text) !important;
|
||||
border-color: var(--tb-border) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-modal-title,
|
||||
html[data-theme="dark"] h1, html[data-theme="dark"] h2, html[data-theme="dark"] h3,
|
||||
html[data-theme="dark"] h4, html[data-theme="dark"] h5, html[data-theme="dark"] h6,
|
||||
html[data-theme="dark"] .uk-card-title {
|
||||
color: var(--tb-text) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-alert-warning,
|
||||
html[data-theme="dark"] .uk-alert-danger,
|
||||
html[data-theme="dark"] .uk-alert-success,
|
||||
html[data-theme="dark"] .uk-alert-primary {
|
||||
background-color: var(--tb-surface-2) !important;
|
||||
color: var(--tb-text) !important;
|
||||
}
|
||||
html[data-theme="dark"] #math-captcha-modal .uk-modal-dialog {
|
||||
background-color: var(--tb-surface) !important;
|
||||
color: var(--tb-text) !important;
|
||||
}
|
||||
html[data-theme="dark"] #math-captcha-modal .captcha-equation-box {
|
||||
background-color: var(--tb-surface-2) !important;
|
||||
border-color: var(--tb-border) !important;
|
||||
}
|
||||
html[data-theme="dark"] #math-captcha-modal .math-captcha-modal-question {
|
||||
color: var(--tb-text) !important;
|
||||
}
|
||||
html[data-theme="dark"] #math-captcha-modal #captcha-modal-answer {
|
||||
background-color: var(--tb-surface) !important;
|
||||
color: var(--tb-text) !important;
|
||||
border-color: var(--tb-border) !important;
|
||||
}
|
||||
html[data-theme="dark"] #math-captcha-modal #captcha-modal-answer::placeholder {
|
||||
color: var(--tb-text-muted) !important;
|
||||
}
|
||||
html[data-theme="dark"] #math-captcha-modal .uk-text-meta,
|
||||
html[data-theme="dark"] #math-captcha-modal #captcha-modal-refresh {
|
||||
color: var(--tb-text-muted) !important;
|
||||
}
|
||||
html[data-theme="dark"] #math-captcha-modal #captcha-modal-refresh:hover {
|
||||
color: var(--tb-primary) !important;
|
||||
}
|
||||
html[data-theme="dark"] .uk-label {
|
||||
color: #fff !important;
|
||||
}
|
||||
/* 自定义组件(探索页推荐卡片等)深色覆盖 */
|
||||
html[data-theme="dark"] .recommend-card,
|
||||
html[data-theme="dark"] .recommend-card:hover {
|
||||
background-color: var(--tb-surface-2) !important;
|
||||
}
|
||||
html[data-theme="dark"] .explore-name a {
|
||||
color: var(--tb-text) !important;
|
||||
}
|
||||
html[data-theme="dark"] .explore-name a:hover {
|
||||
color: var(--tb-primary) !important;
|
||||
}
|
||||
html[data-theme="dark"] .explore-intro {
|
||||
color: var(--tb-text-muted) !important;
|
||||
}
|
||||
/* 切换按钮图标切换 */
|
||||
#theme-toggle .tb-icon-dark, #theme-toggle-mobile .tb-icon-dark { display: none; }
|
||||
html[data-theme="dark"] #theme-toggle .tb-icon-light,
|
||||
html[data-theme="dark"] #theme-toggle-mobile .tb-icon-light { display: none; }
|
||||
html[data-theme="dark"] #theme-toggle .tb-icon-dark,
|
||||
html[data-theme="dark"] #theme-toggle-mobile .tb-icon-dark { display: inline; }
|
||||
</style>
|
||||
|
||||
<!-- 顶栏自适应:导航全部直接显示,窄屏时分级缩小字号/间距,保证英文/日文等长文字不溢出 -->
|
||||
<style>
|
||||
.uk-navbar-nav a {
|
||||
font-size: 0.95rem;
|
||||
padding: 0 10px;
|
||||
}
|
||||
/* 未登录移动端占位:桌面端隐藏,仅 ≤640px 显示(见下方 media 查询)。
|
||||
桌面端布局与改动前完全一致,不受影响。 */
|
||||
.tb-mobile-balancer { display: none; }
|
||||
/* 桌面端保持 UIkit 原生居中三列布局(无需额外 CSS) */
|
||||
.tb-navbar .uk-logo {
|
||||
white-space: nowrap;
|
||||
}
|
||||
@media (max-width: 1200px) {
|
||||
.uk-navbar-nav a {
|
||||
font-size: 0.88rem;
|
||||
padding: 0 8px;
|
||||
}
|
||||
}
|
||||
@media (max-width: 1000px) {
|
||||
.uk-navbar-nav a {
|
||||
font-size: 0.82rem;
|
||||
padding: 0 6px;
|
||||
}
|
||||
.uk-logo {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
/* 登录用户名限宽,过长省略号截断 */
|
||||
.tb-nav-username {
|
||||
max-width: 110px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
@media (max-width: 800px) {
|
||||
.uk-navbar-nav a {
|
||||
font-size: 0.78rem;
|
||||
padding: 0 4px;
|
||||
}
|
||||
.uk-logo {
|
||||
font-size: 1rem;
|
||||
}
|
||||
.tb-nav-username {
|
||||
max-width: 80px;
|
||||
}
|
||||
}
|
||||
/* 手机端(≤640px):沿用 UIkit 桌面端 navbar 的原生三列定位。
|
||||
不再重写 .uk-navbar-center / center-left / center-right 的定位,
|
||||
避免 logo 被挤到下一行;底部语言与深色模式按钮仍由下方独立栏承载。 */
|
||||
@media (max-width: 640px) {
|
||||
.tb-navbar {
|
||||
position: relative;
|
||||
min-height: 56px;
|
||||
overflow: visible;
|
||||
}
|
||||
.tb-navbar > .uk-navbar-center {
|
||||
position: relative !important;
|
||||
top: auto !important;
|
||||
left: auto !important;
|
||||
right: auto !important;
|
||||
bottom: auto !important;
|
||||
transform: none !important;
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
min-height: 56px;
|
||||
white-space: nowrap;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
.tb-navbar .uk-navbar-center-left,
|
||||
.tb-navbar .uk-navbar-center-right {
|
||||
position: static !important;
|
||||
top: auto !important;
|
||||
left: auto !important;
|
||||
right: auto !important;
|
||||
bottom: auto !important;
|
||||
transform: none !important;
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
flex: 0 0 auto;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.tb-navbar .uk-navbar-center-left > div,
|
||||
.tb-navbar .uk-navbar-center-right > div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.tb-navbar .uk-navbar-nav {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.tb-navbar .uk-navbar-nav > li > a,
|
||||
.tb-navbar .uk-logo {
|
||||
white-space: nowrap;
|
||||
}
|
||||
/* 未登录:移动端显示与「我的」等宽的隐藏占位,使左栏「探索+占位」与
|
||||
右栏「注册/登录」两项等宽,logo 真正居中,左右视觉平衡 */
|
||||
.tb-mobile-balancer { display: block; }
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- 标签样式的按钮(管理页置顶等):
|
||||
尺寸完全继承 .uk-label(font-size/padding/line-height/text-transform 等),
|
||||
仅覆盖 button 元素特有的默认样式(边框/字体族/光标等),保证与相邻 span 标签完全一致。 -->
|
||||
<style>
|
||||
.tb-label-btn {
|
||||
border: none !important;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
margin: 0;
|
||||
vertical-align: middle;
|
||||
outline: none;
|
||||
background-image: none;
|
||||
box-sizing: border-box;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
.tb-label-btn:hover {
|
||||
opacity: 0.85;
|
||||
}
|
||||
/* 公开页置顶小图标:仅一个图钉,不占行高、不影响原布局 */
|
||||
.tb-pin-flag {
|
||||
font-size: 0.9em;
|
||||
margin-right: 4px;
|
||||
vertical-align: -1px;
|
||||
cursor: default;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- 页脚统计加载动画:替代 fontawesome 的 fa-spinner(纯 CSS,不引字体库) -->
|
||||
<style>
|
||||
.tb-spinner {
|
||||
display: inline-block;
|
||||
width: 0.9em;
|
||||
height: 0.9em;
|
||||
border: 2px solid rgba(128, 128, 128, 0.25);
|
||||
border-top-color: #666;
|
||||
border-radius: 50%;
|
||||
vertical-align: -2px;
|
||||
animation: tb-spin 0.8s linear infinite;
|
||||
}
|
||||
html[data-theme="dark"] .tb-spinner {
|
||||
border-color: rgba(255, 255, 255, 0.2);
|
||||
border-top-color: #bbb;
|
||||
}
|
||||
@keyframes tb-spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Markdown 渲染排版(问题/回答/追问正文,左对齐以保留排版格式) -->
|
||||
<style>
|
||||
/* 纯文本列表:保留换行与连续空格(pre-wrap),不渲染 Markdown 大字号/彩色 */
|
||||
.tb-preline {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
/* 纯文本列表:超过 5 行截断并显示省略号(不足 5 行则完整显示) */
|
||||
.tb-clamp-5 {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 5;
|
||||
overflow: hidden;
|
||||
}
|
||||
.md-body {
|
||||
line-height: 1.7;
|
||||
text-align: left;
|
||||
word-break: break-word;
|
||||
}
|
||||
.md-body p { margin: 0.5em 0; }
|
||||
.md-body h1, .md-body h2, .md-body h3,
|
||||
.md-body h4, .md-body h5, .md-body h6 {
|
||||
margin: 0.8em 0 0.4em;
|
||||
font-weight: 600;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.md-body ul, .md-body ol { padding-left: 1.6em; margin: 0.5em 0; }
|
||||
.md-body li { margin: 0.2em 0; }
|
||||
.md-body blockquote {
|
||||
border-left: 3px solid #d3d1c7;
|
||||
margin: 0.6em 0;
|
||||
padding: 0.2em 1em;
|
||||
color: #5f5e5a;
|
||||
}
|
||||
.md-body pre {
|
||||
background: #f5f5f5;
|
||||
padding: 0.8em 1em;
|
||||
border-radius: 6px;
|
||||
overflow-x: auto;
|
||||
margin: 0.6em 0;
|
||||
}
|
||||
.md-body code {
|
||||
background: #f0f0f0;
|
||||
padding: 0.1em 0.35em;
|
||||
border-radius: 4px;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.md-body pre code { background: none; padding: 0; }
|
||||
.md-body img { max-width: 100%; height: auto; }
|
||||
.md-body table { border-collapse: collapse; margin: 0.6em 0; }
|
||||
.md-body th, .md-body td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 0.4em 0.8em;
|
||||
}
|
||||
.md-body hr { margin: 1em 0; }
|
||||
html[data-theme="dark"] .md-body blockquote {
|
||||
border-color: #3a404c;
|
||||
color: #8b93a1;
|
||||
}
|
||||
html[data-theme="dark"] .md-body pre,
|
||||
html[data-theme="dark"] .md-body code { background: #2d323c; }
|
||||
html[data-theme="dark"] .md-body th,
|
||||
html[data-theme="dark"] .md-body td { border-color: #3a404c; }
|
||||
</style>
|
||||
|
||||
<!-- 投票结果占比条:UIkit 3 已无 .uk-progressbar 类(那是 UIkit 2 的),
|
||||
模板用 <div class="uk-progress"><div class="uk-progressbar"> 结构,需补一套填充样式,
|
||||
否则内层填充无高度/背景,所有占比条都只剩外层灰色轨道,看起来一模一样。 -->
|
||||
<style>
|
||||
.uk-progress {
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
height: 10px;
|
||||
margin: 0;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
background-color: #e5e5e5;
|
||||
overflow: hidden;
|
||||
box-shadow: none;
|
||||
}
|
||||
.uk-progressbar {
|
||||
display: block;
|
||||
height: 100%;
|
||||
background-color: #1e87f0;
|
||||
border-radius: 6px 0 0 6px;
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
html[data-theme="dark"] .uk-progress {
|
||||
background-color: var(--tb-border);
|
||||
}
|
||||
html[data-theme="dark"] .uk-progressbar {
|
||||
background-color: var(--tb-primary);
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- 移动端底部操作栏:固定底栏承载语言切换与深色模式,桌面端隐藏 -->
|
||||
<style>
|
||||
#tb-mobile-utils {
|
||||
display: none;
|
||||
}
|
||||
@media (max-width: 640px) {
|
||||
/* 顶栏不再容纳语言/深色按钮,恢复原有导航空间 */
|
||||
.tb-nav-utils {
|
||||
display: none !important;
|
||||
}
|
||||
/* 手机端隐藏登录用户名(左边仅保留"探索"),保证 logo 居中、
|
||||
两侧各不超过 2 个短按钮,避免用户名宽度挤压布局 */
|
||||
.tb-nav-username {
|
||||
display: none !important;
|
||||
}
|
||||
/* 固定底部操作栏 */
|
||||
#tb-mobile-utils {
|
||||
display: flex;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 1000;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
|
||||
background: rgba(255, 255, 255, 0.92);
|
||||
-webkit-backdrop-filter: blur(8px);
|
||||
backdrop-filter: blur(8px);
|
||||
box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
#tb-mobile-utils .uk-select {
|
||||
width: 110px;
|
||||
}
|
||||
html[data-theme="dark"] #tb-mobile-utils {
|
||||
background: rgba(36, 40, 48, 0.92);
|
||||
box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
/* 给页面底部预留空间,避免页脚内容被固定底栏遮挡 */
|
||||
body {
|
||||
padding-bottom: 56px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Commit 6d0a3ad -->
|
||||
<meta property="og:site_name" content="{{ t .LangCode "site.title" }}" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="{{ if .IsUserPage }}{{ .PageUser.Name }} - {{ t .LangCode "site.title" }}{{ else }}{{ t .LangCode "site.title" }}{{ end }}" />
|
||||
<meta property="og:url" content="{{ .ExternalURL }}{{ .CurrentURI }}" />
|
||||
<meta property="og:description" content="{{ if .IsUserPage }}{{ .PageUser.Name }} - {{ t .LangCode "site.description" }}{{ else }}{{ t .LangCode "site.description" }}{{ end }}" />
|
||||
{{ if .NoIndex }}<meta name="robots" content="noindex">{{ end }}
|
||||
{{ if .IsUserPage }}
|
||||
<meta property="og:image" content="{{ .PageUser.Avatar }}?og-image=1" />
|
||||
<meta property="og:image:alt" content="{{ .PageUser.Name }}" />
|
||||
<meta itemprop="image" content="{{ .PageUser.Avatar }}?og-image=1"/>
|
||||
<meta name="msapplication-TileImage" content="{{ .PageUser.Avatar }}"/>
|
||||
<link rel="shortcut icon" href="{{ .PageUser.Avatar }}?og-image=1"/>
|
||||
<link rel="apple-touch-icon" href="{{ .PageUser.Avatar }}?og-image=1"/>
|
||||
<link rel="icon" sizes="192x192" href="{{ .PageUser.Avatar }}?og-image=1">
|
||||
<meta name="twitter:image:src" content="{{ .PageUser.Avatar }}?og-image=1" />
|
||||
{{ else }}
|
||||
<meta itemprop="image" content="https://r2.337845818.best/tamabox/tamabox_low.png"/>
|
||||
<meta name="msapplication-TileImage" content="https://r2.337845818.best/tamabox/tamabox_low.png"/>
|
||||
<link rel="shortcut icon" href="https://r2.337845818.best/tamabox/tamabox_low.png" />
|
||||
<link rel="apple-touch-icon" href="https://r2.337845818.best/tamabox/tamabox_low.png"/>
|
||||
<link rel="icon" sizes="192x192" href="https://r2.337845818.best/tamabox/tamabox_low.png">
|
||||
<meta name="twitter:image:src" content="https://r2.337845818.best/tamabox/tamabox_low.png" />
|
||||
{{ end }}
|
||||
|
||||
<!-- Google and Bing -->
|
||||
<meta name="google-site-verification" content="fEPwRRJfiGsgwc5SINBQwZhPK8F0cwRaOvRx0YRurI4" />
|
||||
<meta name="msvalidate.01" content="2F185E8E63C93635F50B3574F3B31E42" />
|
||||
<script defer src="https://mami.tama.guru/tamami.js" data-website-id="c42ebe8b-9281-4da0-83a4-8f18b3e710fe"></script>
|
||||
</head>
|
||||
<nav class="uk-navbar-container uk-margin tb-navbar" uk-navbar>
|
||||
<div class="uk-navbar-center">
|
||||
<div class="uk-navbar-center-left">
|
||||
<div>
|
||||
<ul class="uk-navbar-nav">
|
||||
<!-- 探索链接,始终显示 -->
|
||||
<li><a href="/explore">{{t .LangCode "nav.explore"}}</a></li>
|
||||
{{ if .IsLogged }}
|
||||
<!-- 我的:进入自己的提问箱主页(与右侧「提问/设置」形成左右均衡) -->
|
||||
<li><a href="/_/{{ .LoggedUser.Domain }}">{{t .LangCode "nav.mine"}}</a></li>
|
||||
{{ else }}
|
||||
<!-- 移动端占位:未登录时左栏仅「探索」一项,与右栏「注册/登录」两项不等宽,
|
||||
导致 logo 整体被拉向左(偏左)。移动端(≤640px)显示一个与「我的」等宽的隐藏占位,
|
||||
使左右视觉平衡;桌面端由 .tb-mobile-balancer 隐藏,保持原布局完全不变。 -->
|
||||
<li class="tb-mobile-balancer" aria-hidden="true"><a tabindex="-1" style="visibility:hidden">{{t .LangCode "nav.mine"}}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a class="uk-navbar-item uk-logo" href="/"><span class="emoji-placeholder" aria-label="random animal">🐺</span>{{t .LangCode "site.logoSuffix"}}</a>
|
||||
|
||||
<div class="uk-navbar-center-right">
|
||||
<div>
|
||||
{{ if .IsLogged }}
|
||||
<ul class="uk-navbar-nav">
|
||||
<li><a href="/user/questions">{{t .LangCode "nav.ask"}}</a></li>
|
||||
</ul>
|
||||
<ul class="uk-navbar-nav">
|
||||
<li><a href="/user/profile">{{t .LangCode "nav.settings"}}</a></li>
|
||||
</ul>
|
||||
{{ else}}
|
||||
<ul class="uk-navbar-nav">
|
||||
<li><a href="/register">{{t .LangCode "nav.register"}}</a></li>
|
||||
</ul>
|
||||
<ul class="uk-navbar-nav">
|
||||
<li><a href="/login">{{t .LangCode "nav.login"}}</a></li>
|
||||
</ul>
|
||||
{{ end }}
|
||||
{{ if not .IsUserPage }}
|
||||
<!-- 语言切换(紧凑图标,点击展开;移动端隐藏,见底部操作栏) -->
|
||||
<ul class="uk-navbar-nav tb-nav-utils">
|
||||
<li>
|
||||
<a href="#" aria-label="{{t .LangCode "common.lang"}}" title="{{t .LangCode "common.lang"}}">🌐</a>
|
||||
<div class="uk-navbar-dropdown" uk-drop="mode: click; pos: bottom-right">
|
||||
<ul class="uk-nav uk-navbar-dropdown-nav">
|
||||
{{ range .SupportedLangs }}
|
||||
<li class="{{ if eq .Code $.LangCode }}uk-active{{ end }}">
|
||||
<a href="/i18n/{{ .Code }}?to={{ urlquery $.CurrentURI }}">{{ .Name }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
{{ end }}
|
||||
<!-- 深色模式切换(紧凑图标;移动端隐藏,见底部操作栏) -->
|
||||
<ul class="uk-navbar-nav tb-nav-utils">
|
||||
<li>
|
||||
<a href="#" id="theme-toggle" title="{{t .LangCode "common.theme"}}" aria-label="{{t .LangCode "common.theme"}}">
|
||||
<span class="tb-icon-light">🌙</span><span class="tb-icon-dark">☀️</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const emojis = ["🐺","🐗","🐻","🐨","🐼","🐹","🐭","🐰","🦊","🐮","🐷","🐽","🐸","🐒","🦍","🐔","🐧","🐦","🐤","🐦⬛","🦅","🦉","🦇","🐴","🦄","🐝","🦎","🦖","🦕","🐙","🦑","🦐","🦞","🦀","🐡","🐠","🐟","🐬","🐳","🐋","🦈","🐊","🐅","🐆","🦓","🦍","🦧","🐘","🦛","🦏","🐪","🐫","🦒","🦘","🐃","🐂","🐄","🐎","🐖","🐏","🐑","🦙","🐐","🦌","🐕","🐩","🦮","🐕🦺","🐈","🐋","🐳","🐬","🐉","🐲"];
|
||||
const placeholder = document.querySelector('.emoji-placeholder');
|
||||
if (placeholder) {
|
||||
placeholder.textContent = emojis[Math.floor(Math.random() * emojis.length)];
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- 移动端固定底部操作栏:语言切换 + 深色模式(桌面端隐藏) -->
|
||||
<div id="tb-mobile-utils">
|
||||
{{ if not .IsUserPage }}
|
||||
<select id="mobile-lang-select" class="uk-select uk-form-small" aria-label="{{t .LangCode "common.lang"}}">
|
||||
{{ range .SupportedLangs }}
|
||||
<option value="{{ .Code }}" {{ if eq .Code $.LangCode }}selected{{ end }}>{{ .Name }}</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
{{ end }}
|
||||
<button type="button" id="theme-toggle-mobile" class="uk-button uk-button-default uk-button-small"
|
||||
title="{{t .LangCode "common.theme"}}" aria-label="{{t .LangCode "common.theme"}}">
|
||||
<span class="tb-icon-light">🌙</span><span class="tb-icon-dark">☀️</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
// 深色模式:读取 cookie 应用主题,按钮切换并持久化
|
||||
var THEME_COOKIE = 'theme';
|
||||
function getTheme() {
|
||||
var m = document.cookie.match(/(?:^|;\s*)theme=([^;]*)/);
|
||||
return m ? m[1] : '';
|
||||
}
|
||||
function applyTheme(theme) {
|
||||
if (theme === 'dark') {
|
||||
document.documentElement.setAttribute('data-theme', 'dark');
|
||||
} else {
|
||||
document.documentElement.removeAttribute('data-theme');
|
||||
}
|
||||
}
|
||||
function toggleTheme() {
|
||||
var next = getTheme() === 'dark' ? 'light' : 'dark';
|
||||
applyTheme(next);
|
||||
var expires = new Date(Date.now() + 365 * 24 * 3600 * 1000).toUTCString();
|
||||
document.cookie = THEME_COOKIE + '=' + next + '; path=/; max-age=' + (365 * 24 * 3600) + '; SameSite=Lax';
|
||||
}
|
||||
// 首屏前应用,避免闪烁
|
||||
applyTheme(getTheme());
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// 桌面顶栏按钮与移动端底部按钮都绑定
|
||||
var buttons = document.querySelectorAll('#theme-toggle, #theme-toggle-mobile');
|
||||
buttons.forEach(function(btn) {
|
||||
btn.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
toggleTheme();
|
||||
});
|
||||
});
|
||||
|
||||
// 移动端底部语言切换:onchange 跳转到 /i18n/{code},保留当前页面位置
|
||||
var langSel = document.getElementById('mobile-lang-select');
|
||||
if (langSel) {
|
||||
langSel.addEventListener('change', function() {
|
||||
if (!this.value) return;
|
||||
var to = window.location.pathname + window.location.search;
|
||||
window.location.href = '/i18n/' + encodeURIComponent(this.value) + '?to=' + encodeURIComponent(to);
|
||||
});
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
{{ if .IsPixel }}
|
||||
<div>
|
||||
{{ else }}
|
||||
<div class="uk-container uk-container-xsmall">
|
||||
{{ end }}
|
||||
|
||||
{{ if eq .CaptchaType "math" }}
|
||||
<!-- 算数验证码弹窗 --><div id="math-captcha-modal" uk-modal>
|
||||
<div class="uk-modal-dialog uk-modal-body uk-text-center">
|
||||
<h3 class="uk-modal-title">{{t .LangCode "captcha.title"}}</h3>
|
||||
<p class="uk-text-meta">{{t .LangCode "captcha.hint"}}</p>
|
||||
<div class="captcha-equation-box">
|
||||
<span id="captcha-modal-question" class="math-captcha-modal-question">{{t .LangCode "captcha.loading"}}</span>
|
||||
<input type="number" id="captcha-modal-answer" placeholder="?" autocomplete="off" inputmode="numeric">
|
||||
</div>
|
||||
<div style="margin-top:6px;">
|
||||
<button type="button" class="uk-button uk-button-text uk-text-small" id="captcha-modal-refresh">{{t .LangCode "captcha.refresh"}}</button>
|
||||
</div>
|
||||
<div id="captcha-modal-error" class="uk-text-danger uk-text-small" style="display:none;min-height:20px;"></div>
|
||||
<div class="uk-margin-small-top">
|
||||
<button type="button" class="uk-button uk-button-primary" id="captcha-modal-submit">{{t .LangCode "captcha.submit"}}</button>
|
||||
<button type="button" class="uk-button uk-button-default uk-modal-close">{{t .LangCode "common.cancel"}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var CAPTCHA_I18N = {
|
||||
loading: "{{t .LangCode "captcha.loading"}}",
|
||||
loadFailed: "{{t .LangCode "captcha.loadFailed"}}",
|
||||
loadRetry: "{{t .LangCode "captcha.loadRetry"}}",
|
||||
inputAnswer: "{{t .LangCode "captcha.inputAnswer"}}",
|
||||
wrongAnswer: "{{t .LangCode "captcha.wrongAnswer"}}",
|
||||
verifyFailed: "{{t .LangCode "captcha.verifyFailed"}}",
|
||||
needPassword: "{{t .LangCode "ask.needPassword"}}",
|
||||
needEmail: "{{t .LangCode "ask.pleaseEmail"}}"
|
||||
};
|
||||
</script>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
var captchaId = '';
|
||||
var pendingForm = null;
|
||||
var pendingNeedPassword = false;
|
||||
var verifying = false;
|
||||
|
||||
function fetchCaptcha() {
|
||||
var qEl = document.getElementById('captcha-modal-question');
|
||||
var errEl = document.getElementById('captcha-modal-error');
|
||||
var ansEl = document.getElementById('captcha-modal-answer');
|
||||
qEl.textContent = CAPTCHA_I18N.loading;
|
||||
fetch('/api/captcha/generate')
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(data) {
|
||||
if (data.code === 0 && data.data) {
|
||||
captchaId = data.data.id;
|
||||
qEl.textContent = data.data.question;
|
||||
if (errEl) errEl.style.display = 'none';
|
||||
if (ansEl) { ansEl.value = ''; ansEl.focus(); }
|
||||
} else {
|
||||
qEl.textContent = CAPTCHA_I18N.loadFailed;
|
||||
}
|
||||
})
|
||||
.catch(function() {
|
||||
qEl.textContent = CAPTCHA_I18N.loadRetry;
|
||||
});
|
||||
}
|
||||
|
||||
function getCSRFToken() {
|
||||
var input = document.querySelector('input[name="_csrf"]');
|
||||
return input ? input.value : '';
|
||||
}
|
||||
|
||||
function doSubmit(form) {
|
||||
// 将 captcha 答案填入隐藏字段
|
||||
var ans = document.getElementById('captcha-modal-answer').value.trim();
|
||||
var hidden = form.querySelector('[name="g-recaptcha-response"]');
|
||||
if (hidden) hidden.value = captchaId + ':' + (ans || '0');
|
||||
|
||||
UIkit.modal('#math-captcha-modal').hide();
|
||||
|
||||
// 处理 AskPassword(提问箱密码)
|
||||
if (pendingNeedPassword) {
|
||||
UIkit.modal.prompt(CAPTCHA_I18N.needPassword, '', 'password')
|
||||
.then(function(password) {
|
||||
if (password) {
|
||||
var pwInput = document.getElementById('ask_password_input');
|
||||
if (pwInput) pwInput.value = password;
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
|
||||
// 验证按钮
|
||||
document.getElementById('captcha-modal-submit').addEventListener('click', function() {
|
||||
if (verifying) return;
|
||||
var ans = document.getElementById('captcha-modal-answer').value.trim();
|
||||
if (!ans) {
|
||||
var errEl = document.getElementById('captcha-modal-error');
|
||||
errEl.textContent = CAPTCHA_I18N.inputAnswer;
|
||||
errEl.style.display = 'block';
|
||||
return;
|
||||
}
|
||||
verifying = true;
|
||||
fetch('/api/captcha/verify', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-Token': getCSRFToken()
|
||||
},
|
||||
body: JSON.stringify({ id: captchaId, answer: parseInt(ans, 10) })
|
||||
})
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(data) {
|
||||
verifying = false;
|
||||
if (data.correct) {
|
||||
if (pendingForm) doSubmit(pendingForm);
|
||||
} else {
|
||||
var errEl = document.getElementById('captcha-modal-error');
|
||||
errEl.textContent = CAPTCHA_I18N.wrongAnswer;
|
||||
errEl.style.display = 'block';
|
||||
fetchCaptcha(); // 自动刷新题目
|
||||
}
|
||||
})
|
||||
.catch(function() {
|
||||
verifying = false;
|
||||
var errEl = document.getElementById('captcha-modal-error');
|
||||
errEl.textContent = CAPTCHA_I18N.verifyFailed;
|
||||
errEl.style.display = 'block';
|
||||
fetchCaptcha();
|
||||
});
|
||||
});
|
||||
|
||||
// 回车提交
|
||||
document.getElementById('captcha-modal-answer').addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
document.getElementById('captcha-modal-submit').click();
|
||||
}
|
||||
});
|
||||
|
||||
// 刷新按钮
|
||||
document.getElementById('captcha-modal-refresh').addEventListener('click', fetchCaptcha);
|
||||
|
||||
// 拦截所有带 class="math-captcha-trigger" 的按钮
|
||||
document.addEventListener('click', function(e) {
|
||||
var btn = e.target.closest('.math-captcha-trigger');
|
||||
if (!btn) return;
|
||||
e.preventDefault();
|
||||
|
||||
var form = btn.closest('form');
|
||||
if (!form) return;
|
||||
pendingForm = form;
|
||||
|
||||
// 检查是否需要提问密码
|
||||
pendingNeedPassword = !!(form.querySelector('#ask_password_input'));
|
||||
|
||||
// 邮箱校验(提问页面)
|
||||
var notifyCb = document.getElementById('notify-checkbox');
|
||||
var emailInput = document.getElementById('email-input');
|
||||
if (notifyCb && notifyCb.checked && emailInput && emailInput.value.trim() === '') {
|
||||
UIkit.modal.alert(CAPTCHA_I18N.needEmail);
|
||||
return;
|
||||
}
|
||||
|
||||
fetchCaptcha();
|
||||
UIkit.modal('#math-captcha-modal').show();
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,309 @@
|
||||
{{template "base/header" .}}
|
||||
<!-- 头像直连 R2:crossorigin 让 favicon 也以 CORS 模式请求,确保浏览器缓存的响应都带 ACAO;
|
||||
?v=2 击穿历史上被「无 ACAO 响应」污染的缓存条目(R2 对无 Origin 请求的响应无 Vary,可缓存 31 天) -->
|
||||
<link rel="shortcut icon" href="{{.PageUser.Avatar}}?v=2" crossorigin="anonymous"/>
|
||||
<link rel="apple-touch-icon" href="{{.PageUser.Avatar}}?v=2" crossorigin="anonymous"/>
|
||||
<link rel="icon" sizes="192x192" href="{{.PageUser.Avatar}}?v=2" crossorigin="anonymous">
|
||||
<style>
|
||||
/* 投票列表:与探索页"全部投票"一致的列表行样式 */
|
||||
.profile-votes-list { display: grid; gap: 0; }
|
||||
.profile-vote-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
min-width: 0;
|
||||
padding: 14px 16px;
|
||||
border-bottom: 1px solid var(--tb-border, #e9e9e9);
|
||||
text-decoration: none;
|
||||
}
|
||||
.profile-vote-item:first-child { border-top: 1px solid var(--tb-border, #e9e9e9); }
|
||||
.profile-vote-item:hover { background: var(--tb-surface-hover, #f8fbff); text-decoration: none; }
|
||||
.profile-vote-content { min-width: 0; }
|
||||
.profile-vote-title {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
color: var(--tb-text, #333);
|
||||
font-size: 0.98rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.45;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.profile-vote-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.profile-vote-meta .uk-label { font-size: 0.72rem; line-height: 1.6; }
|
||||
.profile-vote-action {
|
||||
flex: 0 0 auto;
|
||||
color: var(--tb-primary, #1e87f0);
|
||||
font-size: 0.82rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
html[data-theme="dark"] .profile-vote-item { border-color: var(--tb-border); }
|
||||
html[data-theme="dark"] .profile-vote-title { color: var(--tb-text); }
|
||||
html[data-theme="dark"] .profile-vote-item:hover { background: rgba(78, 168, 245, 0.10); }
|
||||
/* 个人主页 Tab:与探索页一致的胶囊切换样式 */
|
||||
/* 个人主页 Tab:全宽等分,置于主体顶部,作为一级导航(移动端整行可点) */
|
||||
.profile-tabs {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
padding: 4px;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 18px;
|
||||
border: 1px solid var(--tb-border, #e5e5e5);
|
||||
border-radius: 9px;
|
||||
background: var(--tb-surface-2, #fafafa);
|
||||
}
|
||||
.profile-tab {
|
||||
flex: 1;
|
||||
border: 0;
|
||||
border-radius: 6px;
|
||||
padding: 9px 15px;
|
||||
background: transparent;
|
||||
color: var(--tb-text-muted, #666);
|
||||
cursor: pointer;
|
||||
font-size: 0.9rem;
|
||||
transition: background 0.2s ease, color 0.2s ease;
|
||||
}
|
||||
.profile-tab:hover { color: var(--tb-primary, #1e87f0); }
|
||||
.profile-tab.is-active {
|
||||
background: var(--tb-surface, #fff);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10);
|
||||
color: var(--tb-primary, #1e87f0);
|
||||
font-weight: 600;
|
||||
}
|
||||
/* 功能关闭时置灰禁用的 Tab(如投票功能关闭) */
|
||||
.profile-tab.is-disabled,
|
||||
.profile-tab:disabled {
|
||||
cursor: not-allowed;
|
||||
color: var(--tb-text-muted, #999);
|
||||
opacity: 0.7;
|
||||
}
|
||||
.profile-tab.is-disabled:hover { color: var(--tb-text-muted, #999); }
|
||||
.profile-panel[hidden] { display: none !important; }
|
||||
html[data-theme="dark"] .profile-tabs {
|
||||
border-color: var(--tb-border);
|
||||
background: var(--tb-surface-2);
|
||||
}
|
||||
html[data-theme="dark"] .profile-tab { color: var(--tb-text-muted); }
|
||||
html[data-theme="dark"] .profile-tab.is-active { background: var(--tb-surface); color: var(--tb-primary); }
|
||||
html[data-theme="dark"] .profile-tab.is-disabled { color: var(--tb-text-muted); opacity: 0.55; }
|
||||
</style>
|
||||
<div class="uk-card uk-card-default uk-text-center">
|
||||
<div class="uk-flex uk-flex-center uk-flex-middle uk-background-cover uk-light" style="min-height: 260px;" data-src="{{ .PageUser.Background }}" uk-img>
|
||||
<div class="uk-card-body">
|
||||
<img class="uk-border-circle uk-box-shadow-large" src="{{ if .PageUser.Avatar }}{{ .PageUser.Avatar }}?v=2{{ else }}{{ .DefaultAvatar }}{{ end }}" crossorigin="anonymous" style="width: 100px; height: 100px; max-width: 100%; max-height: 100%;">
|
||||
<h3 id="usernamecolor">{{ .PageUser.Name }}</h3>
|
||||
<p id="introcolor">{{ .PageUser.Intro }}</p>
|
||||
<div class="icon-container">
|
||||
{{ if and .PageUser.Acfunlink (ne .PageUser.Acfunlink "none") }}
|
||||
<a href="https://{{.PageUser.Acfunlink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/ailicili.png" alt="acfunlink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if and .PageUser.Bililink (ne .PageUser.Bililink "none") }}
|
||||
<a href="https://{{.PageUser.Bililink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/bili.png" alt="bililink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if and .PageUser.Weibolink (ne .PageUser.Weibolink "none") }}
|
||||
<a href="https://{{.PageUser.Weibolink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/weibo.png" alt="weibolink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if and .PageUser.Xiaohongshulink (ne .PageUser.Xiaohongshulink "none") }}
|
||||
<a href="https://{{.PageUser.Xiaohongshulink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/xiaohongshu.png" alt="xiaohongshulink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if and .PageUser.Bloglink (ne .PageUser.Bloglink "none") }}
|
||||
<a href="https://{{.PageUser.Bloglink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/blog.png" alt="bloglink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.getElementById("usernamecolor").style.color = "{{.PageUser.Usernamecolor}}";
|
||||
document.getElementById("introcolor").style.color = "{{.PageUser.Introcolor}}";
|
||||
</script>
|
||||
<div>
|
||||
<div class="uk-card uk-card-default uk-card-small uk-card-body">
|
||||
{{ if .CanAsk }}
|
||||
<!-- jQuery 已改为按需加载:defer 按文档顺序先于 easy.qrcode 执行,保证就绪 -->
|
||||
<script defer src="https://cdnjs.snrat.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
|
||||
<script defer src='https://r2.337845818.best/tamabox/cdn/js/remake/easy.qrcode.min.js' type="text/javascript" charset="utf-8"></script>
|
||||
<center><div id="boxqrimg"></div></center>
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
var options = {
|
||||
text: window.location.href,
|
||||
width: 200,
|
||||
height: 200,
|
||||
// 与 Profile 编辑器保持一致:仅当启用自定义前景色时,才把 Qrcodebackcolor 作为前景色;
|
||||
// 否则强制黑色 #000000,避免未勾选却显示自定义前景色、与 Profile 预览不一致。
|
||||
colorDark: ({{.PageUser.UseCustomQRColor}} ? "{{.PageUser.Qrcodebackcolor}}" : "#000000") || "#000000",
|
||||
colorLight: "{{.PageUser.Qrcodecolor}}" || "#FFFFFF",
|
||||
dotScale: parseFloat("{{.PageUser.Dotscale}}") || 0.4,
|
||||
dotScaleTiming: parseFloat("{{.PageUser.Dotscale}}") || 0.4,
|
||||
dotScaleA: parseFloat("{{.PageUser.Dotscale}}") || 0.4,
|
||||
correctLevel: QRCode.CorrectLevel.H,
|
||||
logo: (function () {
|
||||
// ?v=2:击穿曾被无 ACAO 响应污染的浏览器缓存条目;仅对 http(s) 绝对地址追加
|
||||
var a = "{{.PageUser.Avatar}}" || "{{.DefaultAvatar}}";
|
||||
return a ? (a.indexOf("http") === 0 ? a + "?v=2" : a) : undefined;
|
||||
})(),
|
||||
logoWidth: 60,
|
||||
logoHeight: 60,
|
||||
logoBackgroundTransparent: true,
|
||||
// 直连 R2 等跨域图片须以 CORS 模式加载,canvas 才不被污染、可正常导出
|
||||
crossOrigin: 'anonymous',
|
||||
backgroundImage: ("{{.PageUser.BackgroundImage}}" ? "{{.PageUser.BackgroundImage}}" : undefined),
|
||||
backgroundImageAlpha: parseFloat("{{.PageUser.Backgroundimagealpha}}") || 0.8,
|
||||
autoColor: false,
|
||||
PO: "{{.PageUser.Qrcodepdpcolor}}" || "#000000",
|
||||
PI: "{{.PageUser.Qrcodepdpcolor}}" || "#000000",
|
||||
AO: '',
|
||||
AI: '',
|
||||
timing: "{{.PageUser.Qrcodepdpcolor}}" || "#000000"
|
||||
};
|
||||
new QRCode(document.getElementById("boxqrimg"), options);
|
||||
});
|
||||
</script>
|
||||
|
||||
<p class="uk-text-center uk-text-small">{{t .LangCode "ask.scan" .PageUser.Name}}<br>{{ if .RegisterOnlyAsk }}{{t .LangCode "ask.registerOnly"}}{{ else }}{{t .LangCode "ask.anonymous"}}{{ end }}</p>
|
||||
|
||||
<div class="uk-text-center uk-margin-small-top">
|
||||
<a id="share-btn" href="/_/{{ .PageUser.Domain }}/share-card" download class="uk-button uk-button-default uk-button-small">
|
||||
📤 {{t .LangCode "ask.share"}}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="share-loading-overlay" style="display:none; position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(255,255,255,0.85); z-index:9999;">
|
||||
<div style="display:flex; flex-direction:column; align-items:center; justify-content:center; height:100%;">
|
||||
<div uk-spinner="ratio: 2" class="uk-margin-bottom"></div>
|
||||
<p class="uk-text-large uk-text-muted">{{t .LangCode "ask.generating"}}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
var btn = document.getElementById('share-btn');
|
||||
var overlay = document.getElementById('share-loading-overlay');
|
||||
if (!btn || !overlay) return;
|
||||
btn.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
overlay.style.display = 'block';
|
||||
btn.style.pointerEvents = 'none';
|
||||
fetch(btn.href)
|
||||
.then(function(response) {
|
||||
if (!response.ok) throw new Error('{{t .LangCode "ask.networkError"}}');
|
||||
return response.blob();
|
||||
})
|
||||
.then(function(blob) {
|
||||
var url = URL.createObjectURL(blob);
|
||||
var a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = '{{t .LangCode "ask.shareFilename"}}';
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
setTimeout(function() {
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(url);
|
||||
}, 100);
|
||||
})
|
||||
.catch(function(err) {
|
||||
alert('{{t .LangCode "ask.genFailed"}}');
|
||||
console.error(err);
|
||||
})
|
||||
.finally(function() {
|
||||
overlay.style.display = 'none';
|
||||
btn.style.pointerEvents = 'auto';
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
{{ end }}
|
||||
{{template "base/alert" .}}
|
||||
|
||||
<!-- 提问 / 投票 切换:默认显示提问,支持 ?tab=votes 直达(服务端初始态)与 #votes hash 覆盖 -->
|
||||
<div class="profile-tabs" role="tablist">
|
||||
<button type="button" class="profile-tab{{ if eq .ActiveProfileTab "questions" }} is-active{{ end }}" data-profile-tab="questions" role="tab" aria-selected="{{ if eq .ActiveProfileTab "questions" }}true{{ else }}false{{ end }}">{{t .LangCode "explore.questionsTab"}}</button>
|
||||
{{ if .VoteEnabled }}
|
||||
<button type="button" class="profile-tab{{ if eq .ActiveProfileTab "votes" }} is-active{{ end }}" data-profile-tab="votes" role="tab" aria-selected="{{ if eq .ActiveProfileTab "votes" }}true{{ else }}false{{ end }}">{{t .LangCode "explore.votesTab"}}</button>
|
||||
{{ else }}
|
||||
<!-- 投票功能关闭:保留 Tab 展示但置灰禁用,hover 提示原因 -->
|
||||
<button type="button" class="profile-tab is-disabled" disabled aria-disabled="true" uk-tooltip="{{ .VoteClosedMessage }}">{{t .LangCode "explore.votesTab"}} <span uk-icon="icon: lock; ratio: 0.8"></span></button>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="profile-panel" data-profile-panel="questions"{{ if eq .ActiveProfileTab "votes" }} hidden{{ end }}>
|
||||
{{template "question/new-question-template" .}}
|
||||
|
||||
{{ if ne (len .PageQuestions) 0 }}
|
||||
<p class="uk-text-left uk-text-muted uk-text-small">{{t .LangCode "ask.history" .PageUser.Name}} ({{ .AnsweredCount }})</p>
|
||||
{{ template "question/history-template" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="profile-panel" data-profile-panel="votes"{{ if ne .ActiveProfileTab "votes" }} hidden{{ end }}>
|
||||
{{ if .PageVotes }}
|
||||
<!-- 匿名投票板块:箱主"进行中"的公开投票(列表行样式,与探索页"全部投票"一致) -->
|
||||
<div class="profile-votes-list">
|
||||
{{ range .PageVotes }}
|
||||
<a href="/vote/{{ .LinkToken }}" class="profile-vote-item">
|
||||
<div class="profile-vote-content">
|
||||
<span class="profile-vote-title" title="{{ .Title }}">{{ .Title }}</span>
|
||||
<span class="profile-vote-meta">
|
||||
{{ if eq .Type "single" }}<span class="uk-label uk-label-primary">{{t $.LangCode "vote.typeSingle"}}</span>{{ end }}
|
||||
{{ if eq .Type "multiple" }}<span class="uk-label uk-label-primary">{{t $.LangCode "vote.typeMultiple"}}</span>{{ end }}
|
||||
{{ if eq .Type "rating" }}<span class="uk-label uk-label-primary">{{t $.LangCode "vote.typeRating"}}</span>{{ end }}
|
||||
{{ if eq .Type "rank" }}<span class="uk-label uk-label-primary">{{t $.LangCode "vote.typeRank"}}</span>{{ end }}
|
||||
{{ if eq .Type "form" }}<span class="uk-label uk-label-primary">{{t $.LangCode "vote.typeForm"}}</span>{{ end }}
|
||||
<span class="uk-text-meta">{{ .CreatedAt.Format "2006-01-02" }}</span>
|
||||
</span>
|
||||
</div>
|
||||
<span class="profile-vote-action">{{t $.LangCode "vote.page.goVote"}} <span uk-icon="icon: arrow-right; ratio: .8"></span></span>
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="uk-alert uk-alert-primary uk-margin-remove-top">{{t .LangCode "explore.noVotes"}}</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var tabs = document.querySelectorAll('[data-profile-tab]');
|
||||
var panels = document.querySelectorAll('[data-profile-panel]');
|
||||
function showPanel(name) {
|
||||
tabs.forEach(function(tab) {
|
||||
var active = tab.dataset.profileTab === name;
|
||||
tab.classList.toggle('is-active', active);
|
||||
tab.setAttribute('aria-selected', active ? 'true' : 'false');
|
||||
});
|
||||
panels.forEach(function(panel) {
|
||||
panel.hidden = panel.dataset.profilePanel !== name;
|
||||
});
|
||||
if (window.history && window.history.replaceState) {
|
||||
window.history.replaceState({}, document.title, window.location.pathname + window.location.search + (name === 'votes' ? '#votes' : ''));
|
||||
}
|
||||
}
|
||||
tabs.forEach(function(tab) {
|
||||
tab.addEventListener('click', function() { showPanel(tab.dataset.profileTab); });
|
||||
});
|
||||
// 仅当投票 Tab 可点击(功能开启)时才响应 #votes hash,避免投票关闭时切到空面板
|
||||
if (window.location.hash === '#votes' && document.querySelector('[data-profile-tab="votes"]')) {
|
||||
showPanel('votes');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{{template "base/footer" .}}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
{{template "base/header" .}}
|
||||
<!--<link rel="stylesheet" href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/uikit/3.3.3/css/uikit.min.css">-->
|
||||
<!-- 头像直连 R2:crossorigin 让 favicon 也以 CORS 模式请求,确保浏览器缓存的响应都带 ACAO;
|
||||
?v=2 击穿历史上被「无 ACAO 响应」污染的缓存条目 -->
|
||||
<link rel="shortcut icon"
|
||||
href="{{.PageUser.Avatar}}?v=2" crossorigin="anonymous"/>
|
||||
<link rel="apple-touch-icon"
|
||||
href="{{.PageUser.Avatar}}?v=2" crossorigin="anonymous"/>
|
||||
<link rel="icon" sizes="192x192"
|
||||
href="{{.PageUser.Avatar}}?v=2" crossorigin="anonymous">
|
||||
<div class="uk-card uk-card-default uk-text-center">
|
||||
<div class="uk-flex uk-flex-center uk-flex-middle uk-background-cover uk-light" style="min-height: 260px;" data-src="{{ .PageUser.Background }}" uk-img>
|
||||
<div class="uk-card-body">
|
||||
<img class="uk-border-circle uk-box-shadow-large" src="{{ if .PageUser.Avatar }}{{ .PageUser.Avatar }}?v=2{{ else }}{{ .DefaultAvatar }}{{ end }}" crossorigin="anonymous" style="width: 100px; height: 100px; max-width: 100%; max-height: 100%;">
|
||||
<h3 id="usernamecolor">{{ .PageUser.Name }}</h3>
|
||||
<p id="introcolor">{{ .PageUser.Intro }}</p>
|
||||
<div class="icon-container">
|
||||
{{ if and .PageUser.Acfunlink (ne .PageUser.Acfunlink "none") }}
|
||||
<a href="https://{{.PageUser.Acfunlink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/ailicili.png" alt="acfunlink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if and .PageUser.Bililink (ne .PageUser.Bililink "none") }}
|
||||
<a href="https://{{.PageUser.Bililink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/bili.png" alt="bililink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if and .PageUser.Weibolink (ne .PageUser.Weibolink "none") }}
|
||||
<a href="https://{{.PageUser.Weibolink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/weibo.png" alt="weibolink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if and .PageUser.Xiaohongshulink (ne .PageUser.Xiaohongshulink "none") }}
|
||||
<a href="https://{{.PageUser.Xiaohongshulink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/xiaohongshu.png" alt="xiaohongshulink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if and .PageUser.Bloglink (ne .PageUser.Bloglink "none") }}
|
||||
<a href="https://{{.PageUser.Bloglink}}" target="_blank">
|
||||
<img src="https://r2.337845818.best/tamabox/icon/social/blog.png" alt="bloglink" class="icon">
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.getElementById("usernamecolor").style.color = {{.PageUser.Usernamecolor}};
|
||||
document.getElementById("introcolor").style.color = {{.PageUser.Introcolor}};
|
||||
</script>
|
||||
<div>
|
||||
<div class="uk-card uk-card-default uk-card-small uk-card-body">
|
||||
{{ if .CanAsk }}
|
||||
<!-- jQuery 按需加载(同步,保证下方内联二维码初始化就绪) -->
|
||||
<script src="https://cdnjs.snrat.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
|
||||
<script src='https://r2.337845818.best/tamabox/cdn/js/remake/easy.qrcode.min.js' type="text/javascript" charset="utf-8"></script>
|
||||
<center><div id="boxqrimg"></div></center>
|
||||
<script type="text/javascript">
|
||||
var options = {
|
||||
text: window.location.href,
|
||||
width: 200,
|
||||
height: 200,
|
||||
// 与 Profile 编辑器保持一致:仅当启用自定义前景色时,才把 Qrcodebackcolor 作为前景色;
|
||||
// 否则强制黑色 #000000,避免未勾选却显示自定义前景色、与 Profile 预览不一致。
|
||||
colorDark: ({{.PageUser.UseCustomQRColor}} ? "{{.PageUser.Qrcodebackcolor}}" : "#000000") || "#000000",
|
||||
colorLight: "{{.PageUser.Qrcodecolor}}" || "#FFFFFF",
|
||||
dotScale: parseFloat("{{.PageUser.Dotscale}}") || 0.4,
|
||||
dotScaleTiming: parseFloat("{{.PageUser.Dotscale}}") || 0.4,
|
||||
dotScaleA: parseFloat("{{.PageUser.Dotscale}}") || 0.4,
|
||||
correctLevel: QRCode.CorrectLevel.H,
|
||||
logo: (function () {
|
||||
// ?v=2:击穿曾被无 ACAO 响应污染的浏览器缓存条目;仅对 http(s) 绝对地址追加
|
||||
var a = "{{.PageUser.Avatar}}" || "{{.DefaultAvatar}}";
|
||||
return a ? (a.indexOf("http") === 0 ? a + "?v=2" : a) : undefined;
|
||||
})(),
|
||||
logoWidth: 60,
|
||||
logoHeight: 60,
|
||||
logoBackgroundTransparent: true,
|
||||
// 直连 R2 等跨域图片须以 CORS 模式加载,canvas 才不被污染、可正常导出
|
||||
crossOrigin: 'anonymous',
|
||||
backgroundImage: ("{{.PageUser.BackgroundImage}}" ? "{{.PageUser.BackgroundImage}}" : undefined),
|
||||
backgroundImageAlpha: parseFloat("{{.PageUser.Backgroundimagealpha}}") || 0.8,
|
||||
autoColor: false,
|
||||
PO: "{{.PageUser.Qrcodepdpcolor}}" || "#000000",
|
||||
PI: "{{.PageUser.Qrcodepdpcolor}}" || "#000000",
|
||||
AO: '',
|
||||
AI: '',
|
||||
timing: "{{.PageUser.Qrcodepdpcolor}}" || "#000000"
|
||||
};
|
||||
new QRCode(document.getElementById("boxqrimg"), options);
|
||||
</script>
|
||||
|
||||
<p class="uk-text-center uk-text-small">扫码向@{{ .PageUser.Name }}提问<br>{{ if .RegisterOnlyAsk }}{{t .LangCode "ask.registerOnly"}}{{ else }}{{t .LangCode "ask.anonymous"}}{{ end }}</p>
|
||||
{{ end }}
|
||||
{{template "base/alert" .}}
|
||||
{{template "question/new-question-template" .}}
|
||||
|
||||
<hr class="uk-divider-icon">
|
||||
{{ if ne (len .PageQuestions) 0 }}
|
||||
<p class="uk-text-left uk-text-muted uk-text-small">@{{ .PageUser.Name }} 以前回答过的问题 ({{ .AnsweredCount }})</p>
|
||||
{{ template "question/history-template" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{template "base/footer" .}}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,842 @@
|
||||
// Copyright 2022 E99p1ant. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package i18n
|
||||
|
||||
// enDict English copy.
|
||||
var enDict = map[string]string{
|
||||
// Navigation
|
||||
"nav.explore": "Explore",
|
||||
"nav.mine": "Mine",
|
||||
"nav.register": "Sign up",
|
||||
"nav.login": "Log in",
|
||||
"nav.ask": "Ask",
|
||||
"nav.settings": "Settings",
|
||||
"nav.lang": "Language",
|
||||
|
||||
// Common
|
||||
"common.login": "Log in",
|
||||
"common.forgot": "Forgot password",
|
||||
"common.submit": "Submit",
|
||||
"common.cancel": "Cancel",
|
||||
"common.save": "Save",
|
||||
"common.close": "Close",
|
||||
"common.delete": "Delete",
|
||||
"common.moveUp": "Move up",
|
||||
"common.moveDown": "Move down",
|
||||
"common.share": "Share",
|
||||
"common.verifying": "Verifying...",
|
||||
"common.submitting": "Submitting...",
|
||||
"common.uploading": "Uploading...",
|
||||
"common.lang": "Language",
|
||||
"common.menu": "Menu",
|
||||
|
||||
"common.pleaseWait": "Please wait...",
|
||||
"common.backHome": "Back to Home",
|
||||
"common.theme": "Toggle dark/light mode",
|
||||
|
||||
// Site
|
||||
"site.title": "Wolf's Question Box | Anonymous Question Box",
|
||||
"site.description": "Wolf's Question Box is an anonymous question box — ask me anything without signing up, a safe space to share and respond.",
|
||||
"site.keywords": "Anonymous Question Box,question box,anonymous ask,ask anonymously,Wolf's Question Box,anonymous Q&A",
|
||||
"site.footer.visitor": "You are visitor #%s",
|
||||
"site.footer.pageview": "This page has been viewed %s times",
|
||||
"site.footer.runtime": "The box has been alive for",
|
||||
"site.footer.admin": "Contact admin",
|
||||
"site.footer.notice": "Announcements",
|
||||
"site.footer.chat": "Chat room",
|
||||
"site.footer.drive": "Drive",
|
||||
"site.footer.status": "Status",
|
||||
"site.footer.nav": "Links",
|
||||
"site.maintenance": "The site is under maintenance. Please come back later ~",
|
||||
|
||||
// Auth
|
||||
"auth.login.title": "User Log in",
|
||||
"auth.login.email": "Email",
|
||||
"auth.login.password": "Password",
|
||||
"auth.login.submit": "Log in",
|
||||
"auth.login.forgot": "Forgot password",
|
||||
"auth.register.title": "User Sign up",
|
||||
"auth.register.name": "Nickname",
|
||||
"auth.register.email": "Email",
|
||||
"auth.register.password": "Password",
|
||||
"auth.register.submit": "Sign up",
|
||||
"auth.forgot.title": "Forgot password",
|
||||
"auth.forgot.email": "Email",
|
||||
"auth.forgot.submit": "Send reset email",
|
||||
"auth.forgot.submitBtn": "Recover password",
|
||||
"auth.forgot.sent": "An email has been sent to %s, please check your inbox.",
|
||||
"auth.recover.title": "Reset password",
|
||||
"auth.recover.greeting": "%s, you are resetting your password:",
|
||||
"auth.recover.password": "New password",
|
||||
"auth.recover.confirm": "Confirm password",
|
||||
"auth.recover.submit": "Reset password",
|
||||
|
||||
// Explore
|
||||
"explore.title": "Explore User Tags",
|
||||
"explore.notice": "Here you can find users who enabled <span class=\"uk-text-bold\">\"Show my tags on the homepage\"</span>. This feature is off by default. To get discovered here, go to <a href=\"/user/profile\" class=\"uk-text-bold\">your profile settings</a> and enable it.",
|
||||
"explore.shuffle": "Shuffle",
|
||||
"explore.empty": "No users to show yet. Enable it and be the first!",
|
||||
"explore.hotVotes": "Hot polls",
|
||||
"explore.questionsTab": "Questions",
|
||||
"explore.votesTab": "Polls",
|
||||
"explore.votesTitle": "Public polls",
|
||||
"explore.votesDesc": "Browse active public polls and join the topics that interest you.",
|
||||
"explore.randomVote": "Random pick",
|
||||
"explore.allVotes": "All polls",
|
||||
"explore.noVotes": "There are no public polls available right now.",
|
||||
|
||||
// Ask page
|
||||
"ask.scan": "Scan to ask @%s",
|
||||
"ask.anonymous": "Anyone can ask anonymously",
|
||||
"ask.registerOnly": "Only registered users can ask",
|
||||
"ask.nextOpenAt": "Next opening: %s",
|
||||
"ask.lastCloseAt": "Last closed: %s",
|
||||
"weekday.0": "Sun",
|
||||
"weekday.1": "Mon",
|
||||
"weekday.2": "Tue",
|
||||
"weekday.3": "Wed",
|
||||
"weekday.4": "Thu",
|
||||
"weekday.5": "Fri",
|
||||
"weekday.6": "Sat",
|
||||
"ask.pinned": "Pinned",
|
||||
"ask.share": "Share this box",
|
||||
"ask.placeholder": "Write your question here...",
|
||||
"ask.chatPlaceholder": "Write your chat message here...",
|
||||
"ask.addImage": "Add image",
|
||||
"ask.private": "Don't publish after reply",
|
||||
"ask.notify": "Notify me",
|
||||
"ask.emailPlaceholder": "Enter your email address",
|
||||
"ask.submit": "Send question",
|
||||
"ask.chat": "Start a chat",
|
||||
"ask.chatDisabled": "Chat is disabled on this box",
|
||||
"ask.chatLimit": "Message limit: %d",
|
||||
"ask.history": "Previously answered by @%s",
|
||||
"ask.loginRequired": "Log in required",
|
||||
"ask.loginRequiredChat": "You need to log in to start a chat",
|
||||
"ask.goLogin": "Go to login",
|
||||
"ask.needPassword": "This box requires a password",
|
||||
"ask.needLogin": "The owner only allows registered users to ask questions. Please log in first.",
|
||||
"ask.pleaseEmail": "Please enter your email to receive notifications",
|
||||
"ask.generating": "Generating share card…",
|
||||
"ask.genFailed": "Failed to generate share card. Please try again later",
|
||||
"ask.networkError": "Network error",
|
||||
"ask.shareFilename": "share.png",
|
||||
|
||||
// Question item
|
||||
"qitem.answer": "Answer",
|
||||
"qitem.delete": "Delete",
|
||||
"qitem.private": "Make private",
|
||||
"qitem.public": "Make public",
|
||||
"qitem.asked": "Asked",
|
||||
"qitem.pending": "Pending reply",
|
||||
"qitem.answeredBy": "Answer by @%s on %s",
|
||||
"qitem.danger": "Danger!",
|
||||
"qitem.deleteConfirm": "Are you sure you want to delete this question? This cannot be undone.",
|
||||
"qitem.deleteConfirmBtn": "Yes, delete",
|
||||
"qitem.backToBox": "Back to %s's question box",
|
||||
"qitem.answerTitle": "Answer the question",
|
||||
"qitem.answerPlaceholder": "Write your answer here...",
|
||||
"qitem.emailNotifyHint": "The asker left their email. Once you answer this question for the first time, they will receive an email notification.",
|
||||
"qitem.submitAnswer": "Answer",
|
||||
"qitem.updateAnswer": "Update answer",
|
||||
"qitem.askMore": "Ask something else?",
|
||||
"qitem.markRead": "Mark as read",
|
||||
"qitem.markUnread": "Mark as unread",
|
||||
"qitem.readLocked": "Answered, locked as read",
|
||||
|
||||
// Admin / profile page
|
||||
"admin.profile": "Profile",
|
||||
"admin.lang": "Language",
|
||||
"admin.langHint": "Choose the language visitors see when they open your question box (admin pages follow this too)",
|
||||
"admin.email": "Email",
|
||||
"admin.name": "Nickname",
|
||||
"admin.nameColor": "Nickname color",
|
||||
"admin.oldPassword": "Old password",
|
||||
"admin.newPassword": "New password",
|
||||
"admin.notify": "New question notifications",
|
||||
"admin.personalize": "Customization",
|
||||
"admin.intro": "Box introduction",
|
||||
"admin.introColor": "Introduction color",
|
||||
"admin.qrBgColor": "QR background color (light part)",
|
||||
"admin.qrPdColor": "QR finder pattern color (corner squares)",
|
||||
"admin.qrFgColor": "QR foreground color",
|
||||
"admin.qrDotSize": "QR dot size (←small large→)",
|
||||
"admin.qrBgAlpha": "QR background opacity (←opaque transparent→)",
|
||||
"admin.avatar": "Avatar",
|
||||
"admin.background": "Box background",
|
||||
"admin.qrBackground": "QR background image",
|
||||
"admin.social": "Social links",
|
||||
"admin.harassment": "Anti-harassment",
|
||||
"admin.askLimit": "Asking restriction",
|
||||
"admin.blockWords": "Blocked words (press Enter or comma to add, up to 10 words, 10 characters each)",
|
||||
"admin.chat": "Chat settings",
|
||||
"admin.chatMaxMessages": "Max messages per chat",
|
||||
"admin.chatDailyLimit": "Daily message limit per user",
|
||||
"admin.tags": "Tags",
|
||||
"admin.tagsHint": "Tags (up to 5, 5 characters each, press Enter or comma to add)",
|
||||
"admin.tagsPlaceholder": "e.g. anime, music, games",
|
||||
"admin.tagInputHint": "Type and press Enter or comma to add",
|
||||
"admin.tagInputDuplicate": "Already exists, ignored",
|
||||
"admin.pagePassword": "Page access password",
|
||||
"admin.pagePasswordHint": "Set a page password (leave empty to disable)",
|
||||
"admin.askPassword": "Ask password",
|
||||
"admin.askPasswordHint": "Set a password for asking (leave empty to disable)",
|
||||
"admin.saveProfile": "Save changes",
|
||||
"admin.updated": "Profile updated successfully",
|
||||
"admin.logout": "Log out",
|
||||
"admin.export": "Export data",
|
||||
|
||||
// Admin settings (additional)
|
||||
"admin.oldPasswordHint": "Only needed when changing password; leave empty to keep it unchanged",
|
||||
"admin.newPasswordHint": "6-64 characters; leave empty to keep it unchanged",
|
||||
"admin.notifyEmail": "Email",
|
||||
"admin.useCustomFg": "Use custom foreground color (otherwise auto-matched)",
|
||||
"admin.customFgHint": "Only takes effect when enabled; otherwise the color is auto-generated",
|
||||
"admin.avatarPlaceholder": "Upload avatar (non-1:1 images will be squished)",
|
||||
"admin.backgroundPlaceholder": "Upload box background",
|
||||
"admin.qrBackgroundPlaceholder": "Upload QR background (a background that is too dark may make the QR code unreadable)",
|
||||
"admin.qrPreviewHint": "The preview updates instantly after choosing an image",
|
||||
"admin.preview": "Live preview",
|
||||
"admin.themePreset": "Preset themes",
|
||||
"admin.themeDefault": "Default",
|
||||
"admin.themeDark": "Dark",
|
||||
"admin.themeOcean": "Ocean",
|
||||
"admin.themeSunset": "Sunset",
|
||||
"admin.resetDefaults": "🔄 Reset to defaults",
|
||||
"admin.previewHint": "Adjustments are for preview only; click \"Save changes\" to apply",
|
||||
"admin.socialHint": "Check the box and fill in the profile URL (no https:// needed). Unchecked items won't be shown on your page.",
|
||||
"admin.enableAcfun": "Enable AcFun",
|
||||
"admin.enableBili": "Enable Bilibili",
|
||||
"admin.enableWeibo": "Enable Weibo",
|
||||
"admin.enableXiaohongshu": "Enable Xiaohongshu",
|
||||
"admin.enableBlog": "Enable Personal Blog",
|
||||
"admin.registerOnly": "Only allow registered users to ask me questions",
|
||||
"admin.updateHarassment": "Update anti-harassment settings",
|
||||
"admin.globalBlockWords": "Global blocked words",
|
||||
"admin.globalBlockWordsHint": "Blocked words apply to questions, chat messages sent to you, and vote submissions. This single setting is shared across the question / chat / vote panels and takes effect immediately from any of them.",
|
||||
"admin.updateBlockWords": "Save blocked words",
|
||||
"admin.allowChat": "Allow registered users to start a chat with me",
|
||||
"admin.dailyLimitHint": "0 means unlimited",
|
||||
"admin.updateChat": "Update chat settings",
|
||||
"admin.showInHome": "Show my tags on the home page (let other users find me by tags)",
|
||||
"admin.updateTags": "Update tags",
|
||||
"admin.updatePagePassword": "Update page password",
|
||||
"admin.pagePasswordPlaceholder": "Enter page access password",
|
||||
"admin.updateAskPassword": "Update ask password",
|
||||
"admin.askPasswordPlaceholder": "Enter ask password",
|
||||
"admin.account": "Account settings",
|
||||
"admin.exportHint": "You can export all your personal data from %s, including your basic information, received questions and answers.",
|
||||
"admin.exportJSON": "Export all data (JSON)",
|
||||
"admin.exportJSONHint": "Includes questions, answers, follow-ups and chats for full backup or migration.",
|
||||
"admin.deactivate": "Deactivate my account",
|
||||
"admin.deactivateHint": "You can deactivate your account at any time. After deactivation, your account can no longer log in, your question box page and questions will be inaccessible, and others won't be able to send you new questions.<b>This action cannot be undone. Please be careful!</b>",
|
||||
"admin.socialRequired": "Please fill in the link or uncheck the box",
|
||||
|
||||
// Question management
|
||||
"qlist.title": "My Questions",
|
||||
"qlist.answered": "Answered",
|
||||
"qlist.pending": "Pending",
|
||||
"qlist.private": "Private",
|
||||
"qlist.empty": "No questions yet. Share your box and get some!",
|
||||
"qlist.action": "Actions",
|
||||
"qlist.answerNow": "Answer",
|
||||
"qlist.sort": "Sort",
|
||||
"qlist.status": "Status",
|
||||
"qlist.type": "Type",
|
||||
"qlist.latest": "Latest",
|
||||
"qlist.oldest": "Oldest",
|
||||
"qlist.all": "All",
|
||||
"qlist.public": "Normal question",
|
||||
"qlist.privateQuestion": "Private question",
|
||||
"qlist.received": "Questions I received",
|
||||
"qlist.myChats": "Chats I started",
|
||||
"qlist.statsTotal": "Total questions",
|
||||
"qlist.statsAnswered": "Answered",
|
||||
"qlist.statsUnanswered": "Unanswered",
|
||||
"qlist.statsPrivate": "Private",
|
||||
"qlist.statsPinned": "Pinned",
|
||||
"qlist.statsChats": "Chats",
|
||||
"qlist.searchPlaceholder": "Search questions or answers...",
|
||||
"qlist.searchBtn": "Search",
|
||||
"qlist.searchClear": "Clear",
|
||||
"qlist.questionsTab": "Questions",
|
||||
"qlist.votesTab": "Votes",
|
||||
"qlist.chatsTab": "Chats",
|
||||
"qlist.receivedChats": "Chats I received",
|
||||
"qlist.chatEmpty": "No chats yet. Share your question box to start chatting!",
|
||||
"qlist.pinnedShort": "Pin",
|
||||
"qlist.privateShort": "Pvt",
|
||||
"qlist.chatStatsTotal": "Total chats",
|
||||
"qlist.chatStatsReceived": "Received",
|
||||
"qlist.chatStatsInitiated": "Initiated",
|
||||
"qlist.chatStatsClosed": "Closed",
|
||||
"qlist.unansweredShort": "Open",
|
||||
"qlist.readShort": "Read",
|
||||
"qlist.unreadShort": "Unread",
|
||||
"qitem.markReadShort": "Mark",
|
||||
"qlist.pinShort": "Pin",
|
||||
"qlist.unpinShort": "Unpin",
|
||||
"qlist.myVotes": "My votes",
|
||||
"qlist.loadMore": "Load more",
|
||||
"qlist.newVote": "New vote",
|
||||
"qlist.edit": "Edit",
|
||||
"qlist.untitledVote": "Untitled vote",
|
||||
"qlist.blocked": "Blocked",
|
||||
"qlist.unanswered": "Unanswered",
|
||||
|
||||
// Site logo suffix (random animal emoji + suffix)
|
||||
"site.logoSuffix": "'s Question Box",
|
||||
"site.stats": "Question Box Statistics",
|
||||
|
||||
// Captcha modal
|
||||
"captcha.title": "Verification",
|
||||
"captcha.hint": "Solve the math problem below to prove you are not a robot",
|
||||
"captcha.refresh": "New problem",
|
||||
"captcha.submit": "Verify & submit",
|
||||
"captcha.loading": "Loading...",
|
||||
"captcha.loadFailed": "Load failed",
|
||||
"captcha.loadRetry": "Load failed, please retry",
|
||||
"captcha.inputAnswer": "Please enter the answer",
|
||||
"captcha.wrongAnswer": "Wrong answer, please recalculate",
|
||||
"captcha.verifyFailed": "Verification failed, please retry",
|
||||
|
||||
// Register page extras
|
||||
"auth.register.domain.prefix": "Custom domain (your box URL will be: %s + ",
|
||||
"auth.register.domain.suffix": " + what you fill in below)",
|
||||
"auth.register.confirm": "Confirm password",
|
||||
"auth.register.language": "Language",
|
||||
"auth.register.languageDefault": "Use site default",
|
||||
"auth.register.success": "Registration successful, welcome to TamaBox!",
|
||||
|
||||
// Explore page extras
|
||||
"explore.recommend": "Random picks",
|
||||
"explore.search": "Search tags...",
|
||||
"explore.sortLatest": "Newest",
|
||||
"explore.sortOldest": "Oldest",
|
||||
"explore.noTags": "No tags",
|
||||
"explore.noRecommend": "No recommendations yet",
|
||||
"explore.hotTags": "Hot Tags",
|
||||
"explore.hotQuestions": "Hot Questions",
|
||||
"explore.noResult": "No users match your criteria.",
|
||||
"explore.lazy": "This user is too lazy to write anything~",
|
||||
"explore.prevPage": "Previous",
|
||||
"explore.nextPage": "Next",
|
||||
"explore.loading": "Loading...",
|
||||
"explore.loadFailed": "Load failed",
|
||||
|
||||
// Question box password page
|
||||
"password.title": "This question box is password protected",
|
||||
"password.desc": "This question box is password protected. Enter the password to view its contents.",
|
||||
"password.input": "Enter the access password",
|
||||
"password.enter": "Enter",
|
||||
"password.submit": "Confirm",
|
||||
|
||||
// Question not found
|
||||
"qitem.notFound": "Question not found or has been deleted",
|
||||
|
||||
// Chat page
|
||||
"chat.title": "Chat",
|
||||
"chat.input": "Type a message...",
|
||||
"chat.send": "Send",
|
||||
"chat.delete": "Delete conversation",
|
||||
"chat.block": "Block user",
|
||||
"chat.unblock": "Unblock user",
|
||||
"chat.empty": "No messages yet. Say something~",
|
||||
"chat.withAsker": "Chat with the asker",
|
||||
"chat.withUser": "Chat with %s",
|
||||
"chat.closed": "Conversation closed",
|
||||
"chat.closedNoSend": "The conversation is closed. You cannot send new messages.",
|
||||
"chat.remaining": "Messages left: %d (of %d total)",
|
||||
"chat.me": "Me",
|
||||
"chat.other": "Other",
|
||||
"chat.userBlocked": "This user has been blocked",
|
||||
"chat.addImage": "Add image (optional, max 5MB)",
|
||||
"chat.confirm": "Confirm",
|
||||
"chat.confirmBlock": "Block this user? They won't be able to send you messages anymore.",
|
||||
"chat.confirmUnblock": "Unblock this user? They will be able to send you messages again.",
|
||||
"chat.deleteConfirm": "Delete this conversation? The other party will no longer be able to see it, and this cannot be undone.",
|
||||
"maintenance.title": "NekoBox is under maintenance...",
|
||||
"maintenance.desc": "NekoBox is currently under maintenance and temporarily unavailable. Please come back later~",
|
||||
|
||||
// Single-question share (v4)
|
||||
"qitem.shareCard": "Share this question",
|
||||
|
||||
// Follow-ups (v4)
|
||||
"followup.title": "Follow-ups",
|
||||
"followup.content": "Follow-up: ",
|
||||
"followup.answerPlaceholder": "Answer this follow-up...",
|
||||
"followup.answerBtn": "Answer",
|
||||
"followup.waiting": "Waiting for answer...",
|
||||
"followup.askMore": "Add a follow-up",
|
||||
"followup.remaining": "%d / %d follow-ups remaining",
|
||||
"followup.contentPlaceholder": "Add more details...",
|
||||
"followup.waitingReply": "Your follow-up has been sent. Waiting for the box owner to reply...",
|
||||
"followup.submit": "Submit",
|
||||
|
||||
// Pinning (v4)
|
||||
"qlist.pinned": "Pinned",
|
||||
"qlist.pin": "Pin",
|
||||
"qlist.unpin": "Unpin",
|
||||
"qlist.readStatus": "Read status",
|
||||
"qlist.read": "Read",
|
||||
"qlist.unread": "Unread",
|
||||
"qlist.statsRead": "Read",
|
||||
"qlist.statsUnread": "Unread",
|
||||
|
||||
// Question submitted page (v4)
|
||||
"success.title": "Question sent successfully!",
|
||||
"success.yourQuestion": "Your question:",
|
||||
"success.emailSent": "A private link to this question was sent to your email. You can also use the link below to view the question, receive replies, and follow up.",
|
||||
"success.saveLink": "<strong>Please save the private link below!</strong> Since you didn't leave an email, this link (including the token) is your <strong>only credential</strong> to view the question, receive replies, and follow up. If you lose it, it cannot be recovered.",
|
||||
"success.privateLink": "Your private link (click to copy)",
|
||||
"success.copy": "Copy",
|
||||
"success.copied": "Copied ✓",
|
||||
"success.copyFailed": "Copy failed",
|
||||
"success.token": "Token: %s (the asker uses this token to access the private link)",
|
||||
"success.viewQuestion": "View my question",
|
||||
"success.backToBox": "Back to %s's box",
|
||||
"success.pageTitle": "Question Sent - %s",
|
||||
|
||||
// Deactivate page
|
||||
"deactivate.title": "Deactivate account",
|
||||
"deactivate.desc": "After deactivation your question box will be inaccessible and all data will be deleted. This cannot be undone!",
|
||||
"deactivate.confirm": "I confirm I want to deactivate my account",
|
||||
"deactivate.submit": "Deactivate account",
|
||||
|
||||
// Anonymous voting
|
||||
"nav.votes": "Polls",
|
||||
|
||||
"common.back": "Back",
|
||||
|
||||
"vote.listTitle": "Poll Management",
|
||||
"vote.newTitle": "New Poll",
|
||||
"vote.editTitle": "Edit Poll",
|
||||
"vote.resultsTitle": "Poll Results",
|
||||
"vote.statsTotal": "Total Polls",
|
||||
"vote.statsPublished": "Active",
|
||||
"vote.createNew": "New Poll",
|
||||
"vote.typeSingle": "Single choice",
|
||||
"vote.typeMultiple": "Multiple choice",
|
||||
"vote.typeRating": "Rating",
|
||||
"vote.typeRank": "Ranking",
|
||||
"vote.typeForm": "Form",
|
||||
"vote.statusNotStarted": "Not started",
|
||||
"vote.statusDraft": "Draft",
|
||||
"vote.statusPublished": "Active",
|
||||
"vote.statusEnded": "Ended",
|
||||
"vote.statusArchived": "Archived",
|
||||
"vote.participants": "Participants",
|
||||
"vote.remainLabel": "Remaining",
|
||||
"vote.perpetual": "No deadline",
|
||||
"vote.durationDay": "d",
|
||||
"vote.durationHour": "h",
|
||||
"vote.durationMinute": "m",
|
||||
"vote.createdAt": "Created",
|
||||
"vote.edit": "Edit",
|
||||
"vote.results": "Results",
|
||||
"vote.preview": "Preview",
|
||||
"vote.page.mustComplete": "Please complete",
|
||||
"vote.page.rankHintRequired": "Rank 1-N (required)",
|
||||
"vote.page.rankHintOptional": "Rank 1-N (optional, partial OK)",
|
||||
"vote.page.previewHint": "Preview mode: this is a sample of the live page; submitting is disabled",
|
||||
"vote.page.previewSubmitHint": "Preview mode; submitting is enabled after publish",
|
||||
"vote.publish": "Publish",
|
||||
"vote.close": "End",
|
||||
"vote.share": "Copy link",
|
||||
"vote.copied": "Copied",
|
||||
"vote.shareURL": "Poll share link",
|
||||
"vote.confirmPublish": "Publish this poll? A shareable link will be generated.",
|
||||
"vote.confirmClose": "End this poll? Participants will no longer be able to vote.",
|
||||
"vote.confirmDelete": "Delete this poll? All vote data will be removed and cannot be recovered!",
|
||||
"vote.manageEntry": "Manage polls",
|
||||
|
||||
"vote.manageTitle": "Manage polls",
|
||||
"vote.manageDesc": "Create and manage your anonymous polls", "vote.empty": "No polls yet. Click \"New Poll\" in the top right to get started.",
|
||||
"vote.formLockedHint": "This poll is live. Only basic info can be edited; type and options are locked to protect collected votes.",
|
||||
"vote.formBasic": "Basic Settings",
|
||||
"vote.formTitle": "Poll Title",
|
||||
"vote.formTitlePlaceholder": "e.g. What should we eat today?",
|
||||
"vote.formDescription": "Description",
|
||||
"vote.formDescriptionPlaceholder": "Optional details",
|
||||
"vote.formType": "Poll Type",
|
||||
"vote.formVisibility": "Visibility",
|
||||
"vote.formVisibilityPublic": "Public (Explore + question box)",
|
||||
"vote.formVisibilityLinkOnly": "Link only",
|
||||
"vote.formVoterScope": "Voting Scope",
|
||||
"vote.formVoterScopeAnyone": "Anyone (including anonymous)",
|
||||
"vote.formVoterScopeRegistered": "Registered users only",
|
||||
"vote.formShowResult": "Result Visibility",
|
||||
"vote.formShowResultAfterVote": "Visible right after voting",
|
||||
"vote.formShowResultAfterEnd": "Visible after the poll ends",
|
||||
"vote.formShowResultOwnerOnly": "Owner only",
|
||||
"vote.formStartAt": "Start time (empty = now)",
|
||||
"vote.formEndAt": "End time (empty = no limit)",
|
||||
"vote.formMaxChoices": "Max choices",
|
||||
"vote.formMaxVotesPerFingerprint": "One vote per device per poll; repeated submissions from the same browser are blocked.",
|
||||
"vote.formMaxVotesPerAccount": "One vote per registered account per poll; repeated submissions from the same account are blocked.",
|
||||
"vote.formAllowCustom": "Allow participants to add custom options",
|
||||
"vote.formRequireCaptcha": "Require captcha for anonymous voting",
|
||||
"vote.formOptions": "Poll Options",
|
||||
"vote.formRatingHint": "Rating polls need no options (1-10).",
|
||||
"vote.addOption": "Add option",
|
||||
"vote.optionPlaceholder": "Option text",
|
||||
"vote.formFields": "Form Fields",
|
||||
"vote.addField": "Add field",
|
||||
"vote.field": "Field",
|
||||
"vote.formFieldType": "Field Type",
|
||||
"vote.fieldTypeText": "Single-line text",
|
||||
"vote.fieldTypeTextarea": "Multi-line text",
|
||||
"vote.fieldTypeSelect": "Dropdown select",
|
||||
"vote.fieldTypeRadio": "Single choice",
|
||||
"vote.fieldTypeCheckbox": "Multiple choice",
|
||||
"vote.fieldTypeNumber": "Number",
|
||||
"vote.fieldTypeRank": "Ranking",
|
||||
"vote.page.selectPlaceholder": "Select...",
|
||||
"vote.page.avgNumber": "Average",
|
||||
"vote.page.fieldFilled": "Filled",
|
||||
"vote.fieldTypeRating": "Rating",
|
||||
"vote.formFieldLabel": "Field Label",
|
||||
"vote.formFieldRequired": "Required",
|
||||
"vote.formFieldMaxLength": "Max length (0 = unlimited)",
|
||||
"vote.formFieldOptions": "Options",
|
||||
"vote.formFieldOptionsHint": "Click \"Add option\" to add each option; no comma needed",
|
||||
"vote.fieldAllowCustom": "Allow participants to add a custom option",
|
||||
"vote.formFieldOptionsPlaceholder": "e.g. Great,Okay,Poor",
|
||||
"vote.createDraft": "Save draft",
|
||||
"vote.builderHintOptions": "At least 2 options are required",
|
||||
"vote.builderHintFields": "Add at least 1 field",
|
||||
"vote.builderHintFieldOptions": "Choice/rank fields need options (rank needs at least 2)",
|
||||
"vote.resultsAnswered": "Answered",
|
||||
"vote.page.rankedTimes": "Ranked",
|
||||
"vote.resultsTotal": "Total participants",
|
||||
"vote.resultsSubmissions": "Form responses",
|
||||
"vote.resultsViewTexts": "View text responses",
|
||||
"vote.resultsToggleHint": "Click to expand or collapse text responses",
|
||||
"vote.resultsOptions": "Poll results",
|
||||
"vote.resultsVotes": "votes",
|
||||
"vote.export": "Export CSV",
|
||||
"vote.resultsEmpty": "No participation yet. Share the link!",
|
||||
|
||||
// Poll participation page
|
||||
"vote.inlineTitle": "Polls",
|
||||
"vote.page.by": "poll",
|
||||
"vote.page.goVote": "Vote",
|
||||
"vote.page.notStarted": "Not started",
|
||||
"vote.page.notStartedHint": "This poll has not started yet.",
|
||||
"vote.page.ended": "Ended",
|
||||
"vote.page.endedHint": "This poll has ended.",
|
||||
"vote.page.active": "Active",
|
||||
"vote.page.participated": "Participated",
|
||||
"vote.page.loginRequired": "This poll is limited to registered users. Please log in first.",
|
||||
"vote.page.anonymousHint": "Anonymous participation is allowed and your identity is not recorded (max 1 per device).",
|
||||
"vote.page.submit": "Submit vote",
|
||||
"vote.page.alreadyVoted": "You have already participated in this poll. Thanks!",
|
||||
"vote.page.resultsTitle": "Poll Results",
|
||||
"vote.page.totalVotes": "Total",
|
||||
"vote.page.avgRating": "Average",
|
||||
"vote.page.avgRank": "Avg rank",
|
||||
"vote.page.optionColumn": "Option",
|
||||
"vote.page.ratingLabel": "Rate",
|
||||
"vote.page.ratingUnit": "pts",
|
||||
"vote.page.rankHint": "Rank each option 1-N (smaller = higher, no duplicates)",
|
||||
"vote.page.rankPlaceholder": "Rank",
|
||||
"vote.page.multipleHint": "Multiple choice",
|
||||
"vote.page.customOption": "Custom option (optional)",
|
||||
"vote.page.customPlaceholder": "Type your own option",
|
||||
"vote.page.customOther": "Other",
|
||||
"vote.page.customFieldPlaceholder": "Type a custom option...",
|
||||
"vote.page.customStats": "Custom options",
|
||||
"vote.page.formCount": "Responses received",
|
||||
"vote.page.ownerManage": "Manage this poll (results visible only to you)",
|
||||
|
||||
// Per-poll quota collection
|
||||
"vote.formQuotaLimit": "Collection quota (responses)",
|
||||
"vote.formQuotaHint": "0 means unlimited; the poll ends automatically once the quota is reached.",
|
||||
"vote.flash.notFound": "This poll does not exist or is no longer available",
|
||||
"vote.flash.notPublished": "This poll has not been published yet",
|
||||
"vote.flash.archived": "This poll has been archived and is closed",
|
||||
"vote.flash.ended": "This poll has ended",
|
||||
"vote.flash.notStarted": "This poll has not started yet",
|
||||
"vote.flash.success": "Vote submitted. Thanks for participating!",
|
||||
"vote.err.noChoice": "Please select at least one option",
|
||||
"vote.err.tooManyChoices": "You can select at most %d options",
|
||||
"vote.err.pickOne": "Please select an option",
|
||||
"vote.err.invalidOption": "Invalid option",
|
||||
"vote.err.optionDuplicate": "Options cannot be duplicated",
|
||||
"vote.err.ratingRequired": "Please provide a rating from 1 to 10",
|
||||
"vote.err.rankRequired": "Please rank every option from 1 to %d",
|
||||
"vote.err.rankDuplicate": "Rankings must not repeat",
|
||||
"vote.err.fieldRequired": "Please fill in \"%s\"",
|
||||
"vote.err.fieldCustomRequired": "Please fill in the custom option for \"%s\"",
|
||||
"vote.err.fieldCustomTooLong": "The custom option for \"%s\" must be at most %d characters",
|
||||
"vote.err.fieldInvalidOption": "Invalid option for \"%s\"",
|
||||
"vote.err.fieldConfigError": "Misconfigured options for \"%s\"",
|
||||
"vote.err.fieldRankIncomplete": "Please provide a complete ranking for \"%s\"",
|
||||
"vote.err.fieldRankRange": "The ranking for \"%s\" must be a number between 1 and %d",
|
||||
"vote.err.fieldRankDuplicate": "Rankings for \"%s\" must not repeat",
|
||||
"vote.err.fieldTooLong": "\"%s\" exceeds the length limit (max %d characters)",
|
||||
"vote.err.fieldNotNumber": "\"%s\" must be a number",
|
||||
"vote.err.fieldRating": "\"%s\" requires a rating from 1 to 10",
|
||||
"vote.err.unknownType": "Unknown poll type",
|
||||
"vote.err.customTooLong": "The custom option must be at most %d characters",
|
||||
"vote.err.blockWords": "Your submission contains a blocked word set by the poll creator and could not be submitted",
|
||||
"vote.err.serialize": "Failed to serialize the submission",
|
||||
"captcha.error": "Captcha verification failed",
|
||||
"captcha.errEmpty": "Captcha cannot be empty",
|
||||
"captcha.errFormat": "Invalid captcha format, please refresh and try again",
|
||||
"captcha.errAnswerFormat": "Invalid captcha answer format",
|
||||
"captcha.errExpired": "Captcha expired, please refresh and try again",
|
||||
"captcha.errService": "Captcha service error, please try again later",
|
||||
"captcha.errAnswerWrong": "Incorrect captcha answer",
|
||||
"censor.unavailable": "The content moderation service is temporarily unavailable. Please try again later.",
|
||||
|
||||
// Feature management: switch / schedule / quota for questions, chats and polls
|
||||
"admin.tabAccount": "Settings",
|
||||
"admin.featuresHint": "Manage the switch, opening hours and collection quota of each feature on the Questions / Chats / Polls panels. A feature closes automatically once its quota is reached.",
|
||||
"admin.featuresEntry": "Settings",
|
||||
"admin.featureHint.question": "Visitors cannot submit new questions while closed; collection stops automatically once the quota is reached (private questions included).",
|
||||
"admin.featureHint.chat": "Visitors cannot start new chats while closed; existing conversations are unaffected.",
|
||||
"admin.featureHint.vote": "Your polls are hidden from your box page and cannot be answered while closed. Each poll can also define its own quota on the edit page.",
|
||||
"admin.featureEnabled": "Enable this feature",
|
||||
"admin.featureOpenAt": "Open at",
|
||||
"admin.featureCloseAt": "Close at",
|
||||
"admin.featureTimeHint": "Leave blank for no limit; the feature is unavailable before the open time and after the close time.",
|
||||
"admin.featureSchedule": "Recurring schedule (weekly)",
|
||||
"admin.featureScheduleStart": "Daily start",
|
||||
"admin.featureScheduleEnd": "Daily end",
|
||||
"admin.featureScheduleHint": "Select the weekdays and a daily time window to open every week. Leave all empty to disable. Days without a time window open all day; a time window with no weekday selected opens every day.",
|
||||
"admin.featureMode": "Schedule mode",
|
||||
"admin.featureModeAlways": "Always open",
|
||||
"admin.featureModeWindow": "One-time window",
|
||||
"admin.featureModeRecurring": "Weekly schedule",
|
||||
"admin.featureModeHint": "Always open: no time limit until manually disabled. One-time window: a single open/close time window. Weekly schedule: recurring weekly open days and hours. Modes are mutually exclusive; settings of unselected modes are cleared on save.",
|
||||
"admin.featureQuotaLimit": "Collection quota (items)",
|
||||
"admin.featureQuotaHint": "0 means unlimited; the feature closes automatically once the quota is reached. Reset the counter to start a new round.",
|
||||
"admin.featureQuotaCount": "Collected",
|
||||
"admin.featureQuotaUnlimited": "Unlimited",
|
||||
"admin.featureQuotaResetAt": "Last reset: ",
|
||||
"admin.featureResetQuota": "Reset counter",
|
||||
"admin.featureSave": "Save this feature",
|
||||
|
||||
// Feature management: states and messages
|
||||
"feature.name.question": "Questions",
|
||||
"feature.name.chat": "Chats",
|
||||
"feature.name.vote": "Polls",
|
||||
"feature.statusOpen": "Open",
|
||||
"feature.status.disabled": "Closed",
|
||||
"feature.status.not_started": "Not started",
|
||||
"feature.status.ended": "Ended",
|
||||
"feature.status.quota_reached": "Quota reached",
|
||||
"feature.saved": "Feature settings saved",
|
||||
"feature.errTime": "Invalid date for %s, please use the date-time picker",
|
||||
"feature.errTimeRange": "The close time of %s must be later than the open time",
|
||||
"feature.errQuota": "The collection quota of %s must be an integer between 0 and 1000000",
|
||||
"feature.errInvalid": "Unknown feature",
|
||||
"feature.quotaReset": "The collection counter of %s has been reset",
|
||||
"feature.errScheduleHalf": "The recurring start and end times of %s must be filled in together",
|
||||
"feature.errScheduleTime": "Invalid recurring time for %s, please use the time picker",
|
||||
"feature.errScheduleRange": "The recurring end time of %s must be later than the start time",
|
||||
|
||||
// Messages shown to visitors when a feature is closed
|
||||
"feature.disabled.question": "The box owner has closed questions",
|
||||
"feature.disabled.chat": "This box does not accept chats",
|
||||
"feature.disabled.vote": "This box has closed polls",
|
||||
"feature.not_started.question": "Questions are not open yet",
|
||||
"feature.not_started.chat": "Chats are not open yet",
|
||||
"feature.not_started.vote": "Polls are not open yet",
|
||||
"feature.ended.question": "Question collection has ended",
|
||||
"feature.ended.chat": "Chats have ended",
|
||||
"feature.ended.vote": "Polls have ended",
|
||||
"feature.quota_reached.question": "The question quota has been reached",
|
||||
"feature.quota_reached.chat": "The chat quota has been reached",
|
||||
"feature.quota_reached.vote": "The poll quota has been reached",
|
||||
|
||||
// Auth: visitor-visible messages (P0)
|
||||
"auth.errBadCredential": "Incorrect email or password",
|
||||
"auth.errUserNotFound": "User does not exist",
|
||||
"auth.errEmailFrequent": "Emails are sent too frequently, please try again later",
|
||||
"auth.errEmailFailed": "Failed to send email, please try again later",
|
||||
"auth.errCodeExpired": "The verification code has expired",
|
||||
"auth.errPasswordChanged": "Password changed successfully",
|
||||
"auth.errLoginRequired": "Please log in first",
|
||||
"auth.errDuplicateEmail": "This email is already registered",
|
||||
"auth.errDuplicateDomain": "This custom domain is already taken",
|
||||
|
||||
// Question box page: visitor-visible (P0)
|
||||
"question.errWrongPassword": "Wrong password",
|
||||
"question.errAskPasswordWrong": "Wrong ask password",
|
||||
"question.errLoginRequired": "The owner only allows registered users to ask questions. Please log in first.",
|
||||
"question.errSelfChat": "You cannot start a chat with yourself",
|
||||
"question.errBlockedChat": "You have been blocked by the other party and cannot start a chat",
|
||||
"question.errChatDailyLimit": "You have reached today's message limit (%d). Please try again tomorrow",
|
||||
"question.errDuplicateSubmit": "Duplicate submission detected, please try again later",
|
||||
"question.errImageTooLarge": "Image file size cannot exceed 5Mb",
|
||||
"question.errUploadImageFailed": "Failed to upload image",
|
||||
"question.errBlockWords": "The question contains a blocked word set by the box owner, and could not be sent",
|
||||
"question.errAnsweredLocked": "An answered question cannot be marked as unread",
|
||||
"question.flash.chatSent": "Chat request sent! You can view the conversation via this link: %s",
|
||||
"question.flash.answered": "Answer published successfully!",
|
||||
"question.flash.operated": "Operation successful",
|
||||
"question.flash.markedRead": "Marked as read",
|
||||
"question.flash.markedUnread": "Marked as unread",
|
||||
|
||||
// Follow-ups: visitor/owner visible (P0)
|
||||
"followup.errNoPermission": "Permission denied",
|
||||
"followup.errNotAnswered": "This question has not been answered yet, so you cannot follow up",
|
||||
"followup.errLimit": "Each question allows at most %d follow-ups, and the limit has been reached",
|
||||
"followup.errWaitReply": "Please wait for the owner to reply to your previous follow-up before continuing",
|
||||
"followup.errNotFound": "The follow-up does not exist",
|
||||
"followup.flash.sent": "Follow-up sent successfully!",
|
||||
"followup.flash.answered": "Answer posted successfully!",
|
||||
|
||||
// Admin settings: owner visible (P1)
|
||||
"admin.flash.profileUpdated": "Profile updated successfully",
|
||||
"admin.flash.chatUpdated": "Chat settings updated successfully",
|
||||
"admin.flash.pagePwdOff": "Page password access disabled",
|
||||
"admin.flash.pagePwdUpdated": "Page access password updated",
|
||||
"admin.flash.askPwdOff": "Ask password disabled",
|
||||
"admin.flash.askPwdUpdated": "Ask password updated",
|
||||
"admin.flash.tagsTooMany": "You can have at most 5 tags",
|
||||
"admin.flash.tagsUpdated": "Tags updated successfully",
|
||||
"admin.flash.tagTooLong": "Each tag cannot exceed 5 characters: %s",
|
||||
"admin.flash.blockWordsTooMany": "You can have at most 10 blocked words",
|
||||
"admin.flash.blockWordTooLong": "A blocked word cannot exceed 10 characters: %s",
|
||||
"admin.flash.harassmentUpdated": "Anti-harassment settings updated successfully",
|
||||
"admin.flash.blockWordsUpdated": "Blocked words updated",
|
||||
"admin.flash.deactivated": "Your account has been deactivated. Thank you for using Wolf's Question Box. We hope to see you again 👋🏻",
|
||||
"admin.export.errUser": "Export failed: could not get user information",
|
||||
"admin.export.errQuestion": "Export failed: could not get question information",
|
||||
|
||||
// Vote management: owner visible (P1)
|
||||
"vote.err.invalidID": "Invalid vote ID",
|
||||
"vote.err.notExist": "The vote does not exist",
|
||||
"vote.err.noPermission": "You are not allowed to operate this vote",
|
||||
"vote.err.type": "Unknown poll type",
|
||||
"vote.err.titleRequired": "Please fill in the poll title",
|
||||
"vote.err.titleTooLong": "The poll title cannot exceed 100 characters",
|
||||
"vote.err.visibility": "Unknown visibility setting",
|
||||
"vote.err.voterScope": "Unknown voting scope setting",
|
||||
"vote.err.showResult": "Unknown result visibility setting",
|
||||
"vote.err.timeRange": "The end time must be later than the start time",
|
||||
"vote.err.quota": "The collection quota must be an integer between 0 and 1000000",
|
||||
"vote.err.optionsTooFew": "Please add at least 2 options",
|
||||
"vote.err.optionsFormat": "Invalid options data format",
|
||||
"vote.err.optionTooLong": "A single option cannot exceed %d characters",
|
||||
"vote.err.maxChoicesExceed": "The max choices cannot exceed the total number of options",
|
||||
"vote.err.fieldsTooFew": "Please add at least 1 form field",
|
||||
"vote.err.fieldsFormat": "Invalid form fields data format",
|
||||
"vote.err.fieldsTooMany": "You can have at most 50 form fields",
|
||||
"vote.err.fieldType": "Unknown form field type",
|
||||
"vote.err.fieldLabelMissing": "Field #%d is missing a label",
|
||||
"vote.err.fieldLabelTooLong": "Field #%d label cannot exceed 100 characters",
|
||||
"vote.err.fieldLabelDuplicate": "The field label \"%s\" is duplicated, please use a different label",
|
||||
"vote.err.fieldMaxLength": "Field #%d max length must be between 0 and 2000",
|
||||
"vote.err.fieldReservedOption": "Field #%d (%s) contains a reserved option value, please change it",
|
||||
"vote.err.fieldOptionsTooFew": "Field #%d (%s) needs at least 1 option",
|
||||
"vote.err.fieldRankTooFew": "Field #%d (%s) ranking questions need at least 2 options",
|
||||
"vote.err.fieldSerialize": "Failed to serialize field options",
|
||||
"vote.err.editClosed": "Votes that are ended or archived cannot be edited",
|
||||
"vote.err.publishDraftOnly": "Only draft polls can be published",
|
||||
"vote.err.closePublishedOnly": "Only active polls can be closed",
|
||||
"vote.err.publishTitleRequired": "Please fill in the poll title before publishing",
|
||||
"vote.err.publishFormFieldsRequired": "Form polls need at least 1 field",
|
||||
"vote.err.publishOptionsRequired": "Choice polls need at least 2 options",
|
||||
"vote.err.optionUpdateFailed": "Failed to update options, please retry",
|
||||
"vote.err.fieldUpdateFailed": "Failed to update form fields, please retry",
|
||||
"vote.flash.published": "Poll published! Share link: %s",
|
||||
"vote.flash.updated": "Poll info updated (active polls cannot change type or options)",
|
||||
"vote.flash.draftSaved": "Saved to draft",
|
||||
"vote.flash.closed": "Poll ended",
|
||||
"vote.flash.deleted": "Poll deleted",
|
||||
"vote.err.timeFormat": "Invalid time format, please use the datetime picker",
|
||||
"vote.err.maxChoicesLimit": "Maximum number of choices cannot exceed 20",
|
||||
"vote.err.descriptionTooLong": "Vote description cannot exceed 5000 characters",
|
||||
"profile.err.avatarTooLarge": "Avatar file is too large, maximum 2MB",
|
||||
"profile.err.backgroundTooLarge": "Background image is too large, maximum 2MB",
|
||||
"profile.err.newPasswordTooShort": "New password must be at least 8 characters",
|
||||
"profile.err.badOldPassword": "Incorrect old password",
|
||||
"admin.export.errCreateExcel": "Export failed: could not create Excel file",
|
||||
"admin.export.errWriteExcel": "Export failed: could not write Excel file",
|
||||
|
||||
// Profile page UI rework: card sections / avatar & background cropping / force re-login after password change
|
||||
"profile.card.basic": "Basic info",
|
||||
"profile.card.avatarBg": "Avatar & background",
|
||||
"profile.card.qr": "QR code style",
|
||||
"profile.card.password": "Change password",
|
||||
"profile.avatarCropHint": "Crop frame is locked to 1:1 (square)",
|
||||
"profile.backgroundCropHint": "Crop frame is locked to 16:9",
|
||||
"profile.cropTitle": "Crop image",
|
||||
"profile.cropConfirm": "Apply crop",
|
||||
"profile.err.avatarRatio": "Avatar image must be a 1:1 square. Please crop it and upload again.",
|
||||
"profile.err.backgroundRatio": "Background image must have a 16:9 aspect ratio. Please crop it and upload again.",
|
||||
"profile.flash.passwordChanged": "Password changed. You have been signed out; please sign in again with your new password.",
|
||||
"profile.pwdNote": "After saving, your current session will end immediately and you will need to sign in again with the new password.",
|
||||
"profile.pickAvatar": "Change avatar",
|
||||
"profile.pickBackground": "Change background",
|
||||
"profile.saveBasic": "Save basic info",
|
||||
"profile.saveMedia": "Save avatar & background",
|
||||
"profile.savePassword": "Update password",
|
||||
"profile.saveQR": "Save QR code style",
|
||||
"profile.saveSocial": "Save social links",
|
||||
"profile.err.cropLibUnavailable": "The image cropper failed to load. Please refresh the page and try again.",
|
||||
|
||||
// Captcha JSON endpoint: consumed by frontend (P2)
|
||||
"captcha.json.badRequest": "Invalid request format",
|
||||
"captcha.json.idRequired": "Captcha ID cannot be empty",
|
||||
"captcha.json.genFailed": "Failed to generate captcha",
|
||||
"chat.errDeletedByOwner": "This private conversation has been deleted by the other party.",
|
||||
"chat.errBlockedView": "You have been blocked by the other party and cannot view this chat",
|
||||
"chat.errEmpty": "Message cannot be empty",
|
||||
"chat.errTooLong": "Message is too long, please keep it within %d characters",
|
||||
"chat.errConvDeletedSend": "This conversation has been deleted and messages cannot be sent",
|
||||
"chat.errBlockedSend": "You have been blocked by the other party and cannot send messages",
|
||||
"chat.errBlockWords": "Your message contains a blocked word set by the box owner and could not be sent",
|
||||
"chat.errDailyLimit": "You have reached today's message limit (%d), please try again tomorrow",
|
||||
"chat.errLimitReached": "The conversation has reached its limit and no new messages can be sent",
|
||||
"chat.errChatClosed": "The box owner has disabled private chat and messages cannot be sent",
|
||||
"chat.errImageTooLarge": "Image size cannot exceed %dMB",
|
||||
"chat.errUploadFailed": "Image upload failed, please try again later",
|
||||
"chat.errNoPermission": "You are not authorized to perform this action",
|
||||
"chat.flash.sent": "Message sent successfully",
|
||||
"chat.flash.deleted": "Private conversation deleted",
|
||||
"chat.flash.operated": "Operation successful",
|
||||
"image.errTooLarge": "Image is too large, maximum supported size is %d×%d pixels, please compress and re-upload",
|
||||
"internal.errFlash": "Internal server error, please try again later.",
|
||||
"internal.errServer": "Internal server error",
|
||||
"home.errStats": "Failed to retrieve statistics",
|
||||
"pixel.errPath": "Invalid request path",
|
||||
"proxy.errNotFound": "Page not found",
|
||||
"proxy.errInternal": "Service gateway internal error",
|
||||
"explore.errRandomUser": "Failed to retrieve random users",
|
||||
// 表单校验
|
||||
"form.answer.content": "Answer content is required",
|
||||
"form.answer.contentTooLong": "Answer content must be within %d characters",
|
||||
"form.email.required": "Please enter a valid email address",
|
||||
"form.followup.answer": "Follow-up answer is required",
|
||||
"form.followup.answerTooLong": "Follow-up answer must be within %d characters",
|
||||
"form.followup.content": "Follow-up content is required",
|
||||
"form.followup.contentTooLong": "Follow-up content must be within %d characters",
|
||||
"form.login.password": "Please enter your password",
|
||||
"form.profile.backgroundimagealpha": "Please enter the QR code background opacity",
|
||||
"form.profile.colorHex": "Please enter a 7-character hex color code (including #)",
|
||||
"form.profile.dotscale": "Please enter the QR code dot size",
|
||||
"form.profile.intro": "Bio is required and must be at most 100 characters",
|
||||
"form.profile.linkMax": "Profile link must be at most 30 characters",
|
||||
"form.profile.name": "Nickname is required and must be at most 20 characters",
|
||||
"form.profile.newPassword": "New password must be at most 30 characters",
|
||||
"form.profile.passwordMax": "Password must be at most 30 characters",
|
||||
"form.question.content": "Question content is required",
|
||||
"form.question.contentTooLong": "Question content must be within %d characters",
|
||||
"form.question.receiveReplyEmail": "Please enter a valid email address to receive replies",
|
||||
"form.recaptcha": "Please complete the CAPTCHA verification",
|
||||
"form.recover.newPassword": "Please set a new password of 8–30 characters",
|
||||
"form.recover.repeatPassword": "The two new passwords do not match",
|
||||
"form.register.domain": "The custom domain may only contain letters, digits and underscores, and must be 3–20 characters long",
|
||||
"form.register.email": "Please enter a valid email address (max 100 characters)",
|
||||
"form.register.name": "Nickname is required and must be at most 20 characters",
|
||||
"form.register.password": "Please set a password of 8–30 characters",
|
||||
"form.register.recaptcha": "Unable to load the CAPTCHA. Please refresh the page or switch your network and try again",
|
||||
"form.register.repeatPassword": "The two passwords do not match",
|
||||
}
|
||||
@@ -0,0 +1,842 @@
|
||||
// Copyright 2022 E99p1ant. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package i18n
|
||||
|
||||
// jaDict 日本語文案。
|
||||
var jaDict = map[string]string{
|
||||
// ナビゲーション
|
||||
"nav.explore": "探索",
|
||||
"nav.mine": "マイ",
|
||||
"nav.register": "登録",
|
||||
"nav.login": "ログイン",
|
||||
"nav.ask": "質問",
|
||||
"nav.settings": "設定",
|
||||
"nav.lang": "言語",
|
||||
|
||||
// 共通
|
||||
"common.login": "ログイン",
|
||||
"common.forgot": "パスワードを忘れた",
|
||||
"common.submit": "送信",
|
||||
"common.cancel": "キャンセル",
|
||||
"common.save": "保存",
|
||||
"common.close": "閉じる",
|
||||
"common.delete": "削除",
|
||||
"common.moveUp": "上へ移動",
|
||||
"common.moveDown": "下へ移動",
|
||||
"common.share": "共有",
|
||||
"common.verifying": "認証中...",
|
||||
"common.submitting": "送信中...",
|
||||
"common.uploading": "アップロード中...",
|
||||
"common.lang": "言語",
|
||||
"common.menu": "メニュー",
|
||||
|
||||
"common.pleaseWait": "お待ちください...",
|
||||
"common.backHome": "ホームに戻る",
|
||||
"common.theme": "ダーク/ライトモード切替",
|
||||
|
||||
// サイト
|
||||
"site.title": "狼の質問箱 | 匿名質問箱",
|
||||
"site.description": "狼の質問箱は登録不要で使える匿名質問箱。誰でも匿名で質問でき、安心してやり取りできる場所です。",
|
||||
"site.keywords": "匿名質問箱,質問箱,匿名質問,狼の質問箱,匿名で質問,匿名Q&A",
|
||||
"site.footer.visitor": "あなたは %s 人目の訪問者です",
|
||||
"site.footer.pageview": "このページは %s 回閲覧されました",
|
||||
"site.footer.runtime": "質問箱は稼働中",
|
||||
"site.footer.admin": "管理者へ",
|
||||
"site.footer.notice": "お知らせ",
|
||||
"site.footer.chat": "チャット",
|
||||
"site.footer.drive": "ドライブ",
|
||||
"site.footer.status": "ステータス",
|
||||
"site.footer.nav": "リンク",
|
||||
"site.maintenance": "メンテナンス中です。しばらくお待ちください~",
|
||||
|
||||
// 認証
|
||||
"auth.login.title": "ログイン",
|
||||
"auth.login.email": "メールアドレス",
|
||||
"auth.login.password": "パスワード",
|
||||
"auth.login.submit": "ログイン",
|
||||
"auth.login.forgot": "パスワードを忘れた",
|
||||
"auth.register.title": "ユーザー登録",
|
||||
"auth.register.name": "ニックネーム",
|
||||
"auth.register.email": "メールアドレス",
|
||||
"auth.register.password": "パスワード",
|
||||
"auth.register.submit": "登録",
|
||||
"auth.forgot.title": "パスワードを忘れた",
|
||||
"auth.forgot.email": "メールアドレス",
|
||||
"auth.forgot.submit": "再設定メールを送信",
|
||||
"auth.forgot.submitBtn": "パスワードを再取得",
|
||||
"auth.forgot.sent": "%s にメールを送信しました。ご確認ください。",
|
||||
"auth.recover.title": "パスワード再設定",
|
||||
"auth.recover.greeting": "%s さん、パスワードを再設定しています:",
|
||||
"auth.recover.password": "新しいパスワード",
|
||||
"auth.recover.confirm": "パスワード(確認)",
|
||||
"auth.recover.submit": "パスワードを再設定",
|
||||
|
||||
// 探索ページ
|
||||
"explore.title": "ユーザータグを探索",
|
||||
"explore.notice": "ここでは<span class=\"uk-text-bold\">「ホームでタグを表示」</span>を有効にしたユーザーを紹介しています。この機能は初期状態でオフです。自分の質問箱を見つけてもらいたい場合は <a href=\"/user/profile\" class=\"uk-text-bold\">個人設定</a> から有効にしてください。",
|
||||
"explore.shuffle": "シャッフル",
|
||||
"explore.empty": "表示できるユーザーがいません。有効にしてみましょう~",
|
||||
"explore.hotVotes": "人気の投票",
|
||||
"explore.questionsTab": "質問",
|
||||
"explore.votesTab": "投票",
|
||||
"explore.votesTitle": "公開投票",
|
||||
"explore.votesDesc": "開催中の公開投票を見て、興味のあるテーマに参加できます。",
|
||||
"explore.randomVote": "ランダムおすすめ",
|
||||
"explore.allVotes": "すべての投票",
|
||||
"explore.noVotes": "現在、参加できる公開投票はありません。",
|
||||
|
||||
// 質問ページ
|
||||
"ask.scan": "QRコードで@%sに質問",
|
||||
"ask.anonymous": "誰でも匿名で質問できます",
|
||||
"ask.registerOnly": "登録ユーザーのみ質問できます",
|
||||
"ask.nextOpenAt": "次回開放:%s",
|
||||
"ask.lastCloseAt": "前回終了:%s",
|
||||
"weekday.0": "日",
|
||||
"weekday.1": "月",
|
||||
"weekday.2": "火",
|
||||
"weekday.3": "水",
|
||||
"weekday.4": "木",
|
||||
"weekday.5": "金",
|
||||
"weekday.6": "土",
|
||||
"ask.pinned": "ピン留め済み",
|
||||
"ask.share": "質問箱を共有",
|
||||
"ask.placeholder": "ここに質問を書いてください...",
|
||||
"ask.chatPlaceholder": "ここにチャットメッセージを書いてください...",
|
||||
"ask.addImage": "画像を追加",
|
||||
"ask.private": "返信後に公開しない",
|
||||
"ask.notify": "通知を受け取る",
|
||||
"ask.emailPlaceholder": "メールアドレスを入力してください",
|
||||
"ask.submit": "質問を送信",
|
||||
"ask.chat": "チャットを開始",
|
||||
"ask.chatDisabled": "この質問箱ではチャットが無効です",
|
||||
"ask.chatLimit": "メッセージ上限:%d件",
|
||||
"ask.history": "@%s が以前回答した質問",
|
||||
"ask.loginRequired": "ログインが必要",
|
||||
"ask.loginRequiredChat": "チャットを開始するにはログインが必要です",
|
||||
"ask.goLogin": "ログインへ",
|
||||
"ask.needPassword": "この質問箱にはパスワードが必要です",
|
||||
"ask.needLogin": "質問箱の所有者は登録ユーザーのみ質問できるように設定しています。先にログインしてください。",
|
||||
"ask.pleaseEmail": "通知を受け取るメールアドレスを入力してください",
|
||||
"ask.generating": "共有カードを生成中…",
|
||||
"ask.genFailed": "共有カードの生成に失敗しました。しばらくしてからお試しください",
|
||||
"ask.networkError": "ネットワークエラー",
|
||||
"ask.shareFilename": "share.png",
|
||||
|
||||
// 質問アイテム
|
||||
"qitem.answer": "回答",
|
||||
"qitem.delete": "削除",
|
||||
"qitem.private": "非公開にする",
|
||||
"qitem.public": "公開にする",
|
||||
"qitem.asked": "質問",
|
||||
"qitem.pending": "回答待ち",
|
||||
"qitem.answeredBy": "@%s による %s の回答",
|
||||
"qitem.danger": "危険!",
|
||||
"qitem.deleteConfirm": "この質問を削除してもよろしいですか?この操作は取り消せません。",
|
||||
"qitem.deleteConfirmBtn": "削除する",
|
||||
"qitem.backToBox": "%sの質問箱に戻る",
|
||||
"qitem.answerTitle": "質問に回答する",
|
||||
"qitem.answerPlaceholder": "ここに回答を入力...",
|
||||
"qitem.emailNotifyHint": "質問者はメールアドレスを残しています。最初に回答すると、質問者にメール通知が送信されます。",
|
||||
"qitem.submitAnswer": "回答",
|
||||
"qitem.updateAnswer": "回答を更新",
|
||||
"qitem.askMore": "ほかの質問は?",
|
||||
"qitem.markRead": "既読にする",
|
||||
"qitem.markUnread": "未読にする",
|
||||
"qitem.readLocked": "回答済みのため既読に固定",
|
||||
|
||||
// 個人設定ページ
|
||||
"admin.profile": "プロフィール",
|
||||
"admin.lang": "表示言語",
|
||||
"admin.langHint": "訪問者があなたの質問箱を開いたときに表示する言語を選択します(管理画面もこの設定に従います)",
|
||||
"admin.email": "メールアドレス",
|
||||
"admin.name": "ニックネーム",
|
||||
"admin.nameColor": "ニックネームの色",
|
||||
"admin.oldPassword": "現在のパスワード",
|
||||
"admin.newPassword": "新しいパスワード",
|
||||
"admin.notify": "新着質問の通知",
|
||||
"admin.personalize": "カスタマイズ",
|
||||
"admin.intro": "質問箱の紹介文",
|
||||
"admin.introColor": "紹介文の色",
|
||||
"admin.qrBgColor": "QRコードの背景色(明るい部分)",
|
||||
"admin.qrPdColor": "QRコードのファインダーパターン色(角の四角)",
|
||||
"admin.qrFgColor": "QRコードの前景色",
|
||||
"admin.qrDotSize": "QRコードのドットサイズ (←小 大→)",
|
||||
"admin.qrBgAlpha": "QRコードの背景透明度 (←不透明 透明→)",
|
||||
"admin.avatar": "アバター",
|
||||
"admin.background": "質問箱の背景",
|
||||
"admin.qrBackground": "QRコードの背景画像",
|
||||
"admin.social": "ソーシャルリンク",
|
||||
"admin.harassment": "迷惑行為対策",
|
||||
"admin.askLimit": "質問制限",
|
||||
"admin.blockWords": "ブロックワード設定(Enter またはカンマ区切り、最大10個、各10文字まで)",
|
||||
"admin.chat": "チャット設定",
|
||||
"admin.chatMaxMessages": "チャットのメッセージ上限",
|
||||
"admin.chatDailyLimit": "1ユーザーあたりの1日のメッセージ上限",
|
||||
"admin.tags": "タグ設定",
|
||||
"admin.tagsHint": "タグ(最大5個、各5文字まで、Enter またはカンマ区切り)",
|
||||
"admin.tagsPlaceholder": "例:アニメ,音楽,ゲーム",
|
||||
"admin.tagInputHint": "入力して Enter またはカンマで追加",
|
||||
"admin.tagInputDuplicate": "既に存在するため無視しました",
|
||||
"admin.pagePassword": "ページアクセスパスワード",
|
||||
"admin.pagePasswordHint": "アクセスパスワードを設定(空欄で無効)",
|
||||
"admin.askPassword": "質問パスワード",
|
||||
"admin.askPasswordHint": "質問用パスワードを設定(空欄で無効)",
|
||||
"admin.saveProfile": "変更を保存",
|
||||
"admin.updated": "プロフィールを更新しました",
|
||||
"admin.logout": "ログアウト",
|
||||
"admin.export": "データをエクスポート",
|
||||
|
||||
// 管理画面設定(追加)
|
||||
"admin.oldPasswordHint": "パスワード変更時のみ使用。空欄のままなら変更されません",
|
||||
"admin.newPasswordHint": "6〜64文字。空欄のままなら変更されません",
|
||||
"admin.notifyEmail": "メール",
|
||||
"admin.useCustomFg": "カスタム前景色を使用(それ以外は自動マッチ)",
|
||||
"admin.customFgHint": "有効時のみ適用されます。それ以外は自動生成されます",
|
||||
"admin.avatarPlaceholder": "アバターをアップロード(1:1 以外は縦横比が崩れます)",
|
||||
"admin.backgroundPlaceholder": "質問箱の背景をアップロード",
|
||||
"admin.qrBackgroundPlaceholder": "QRコードの背景画像をアップロード(暗すぎる背景はQRコードが読み取れなくなることがあります)",
|
||||
"admin.qrPreviewHint": "画像を選択するとプレビューが即時更新されます",
|
||||
"admin.preview": "ライブプレビュー",
|
||||
"admin.themePreset": "プリセットテーマ",
|
||||
"admin.themeDefault": "デフォルト",
|
||||
"admin.themeDark": "ダーク",
|
||||
"admin.themeOcean": "オーシャン",
|
||||
"admin.themeSunset": "サンセット",
|
||||
"admin.resetDefaults": "🔄 デフォルトに戻す",
|
||||
"admin.previewHint": "調整はプレビューのみです。「変更を保存」をクリックすると反映されます",
|
||||
"admin.socialHint": "チェックを入れてプロフィールURLを入力してください(https:// は不要)。チェックのない項目は表示されません。",
|
||||
"admin.enableAcfun": "AcFun を有効にする",
|
||||
"admin.enableBili": "Bilibili を有効にする",
|
||||
"admin.enableWeibo": "Weibo を有効にする",
|
||||
"admin.enableXiaohongshu": "小紅書 を有効にする",
|
||||
"admin.enableBlog": "個人ブログを有効にする",
|
||||
"admin.registerOnly": "登録ユーザーのみ質問を許可",
|
||||
"admin.updateHarassment": "迷惑行為対策を更新",
|
||||
"admin.globalBlockWords": "共通ブロックワード",
|
||||
"admin.globalBlockWordsHint": "ブロックワードは質問・チャット(相手からあなたへのメッセージ)・投票の投稿内容に適用されます。この設定は質問/チャット/投票の3つのタブで共有され、どこで変更してもすぐに反映されます。",
|
||||
"admin.updateBlockWords": "ブロックワードを保存",
|
||||
"admin.allowChat": "登録ユーザーからのチャットを許可",
|
||||
"admin.dailyLimitHint": "0 は無制限",
|
||||
"admin.updateChat": "チャット設定を更新",
|
||||
"admin.showInHome": "ホームページでタグを表示(タグで検索されることを許可)",
|
||||
"admin.updateTags": "タグを更新",
|
||||
"admin.updatePagePassword": "ページパスワードを更新",
|
||||
"admin.pagePasswordPlaceholder": "ページアクセスパスワードを入力",
|
||||
"admin.updateAskPassword": "質問パスワードを更新",
|
||||
"admin.askPasswordPlaceholder": "質問パスワードを入力",
|
||||
"admin.account": "アカウント設定",
|
||||
"admin.exportHint": "%s のすべての個人データ(基本情報、受け取った質問と回答を含む)をエクスポートできます。",
|
||||
"admin.exportJSON": "全データをエクスポート(JSON)",
|
||||
"admin.exportJSONHint": "質問・回答・追加質問・チャットを含む完全バックアップ。",
|
||||
"admin.deactivate": "アカウントを停止",
|
||||
"admin.deactivateHint": "いつでもアカウントを停止できます。停止後はログインできなくなり、質問箱のページや質問にもアクセスできなくなります。新しい質問も受け付けられません。<b>この操作は取り消せません。ご注意ください!</b>",
|
||||
"admin.socialRequired": "リンクを入力するか、チェックを外してください",
|
||||
|
||||
// 質問管理ページ
|
||||
"qlist.title": "マイ質問",
|
||||
"qlist.answered": "回答済み",
|
||||
"qlist.pending": "回答待ち",
|
||||
"qlist.private": "非公開",
|
||||
"qlist.empty": "質問はまだありません。質問箱を共有しましょう~",
|
||||
"qlist.action": "操作",
|
||||
"qlist.answerNow": "回答する",
|
||||
"qlist.sort": "並び替え",
|
||||
"qlist.status": "状態",
|
||||
"qlist.type": "種類",
|
||||
"qlist.latest": "最新",
|
||||
"qlist.oldest": "最古",
|
||||
"qlist.all": "すべて",
|
||||
"qlist.public": "通常の質問",
|
||||
"qlist.privateQuestion": "非公開の質問",
|
||||
"qlist.received": "受け取った質問",
|
||||
"qlist.myChats": "開始したチャット",
|
||||
"qlist.statsTotal": "質問総数",
|
||||
"qlist.statsAnswered": "回答済み",
|
||||
"qlist.statsUnanswered": "未回答",
|
||||
"qlist.statsPrivate": "非公開質問",
|
||||
"qlist.statsPinned": "ピン留め",
|
||||
"qlist.statsChats": "チャット",
|
||||
"qlist.searchPlaceholder": "質問や回答を検索...",
|
||||
"qlist.searchBtn": "検索",
|
||||
"qlist.searchClear": "クリア",
|
||||
"qlist.questionsTab": "質問",
|
||||
"qlist.votesTab": "投票",
|
||||
"qlist.chatsTab": "チャット",
|
||||
"qlist.receivedChats": "受け取ったチャット",
|
||||
"qlist.chatEmpty": "まだチャットがありません。質問箱を共有してチャットを始めましょう!",
|
||||
"qlist.pinnedShort": "ピン",
|
||||
"qlist.privateShort": "非公開",
|
||||
"qlist.chatStatsTotal": "チャット総数",
|
||||
"qlist.chatStatsReceived": "受け取った",
|
||||
"qlist.chatStatsInitiated": "開始した",
|
||||
"qlist.chatStatsClosed": "終了",
|
||||
"qlist.unansweredShort": "未答",
|
||||
"qlist.readShort": "既読",
|
||||
"qlist.unreadShort": "未読",
|
||||
"qitem.markReadShort": "既読に",
|
||||
"qlist.pinShort": "ピン",
|
||||
"qlist.unpinShort": "解除",
|
||||
"qlist.myVotes": "作成した投票",
|
||||
"qlist.loadMore": "もっと読み込む",
|
||||
"qlist.newVote": "投票を作成",
|
||||
"qlist.edit": "編集",
|
||||
"qlist.untitledVote": "無題の投票",
|
||||
"qlist.blocked": "ブロック済み",
|
||||
"qlist.unanswered": "未回答",
|
||||
|
||||
// サイトロゴの接尾辞
|
||||
"site.logoSuffix": "の質問箱",
|
||||
"site.stats": "質問箱の統計",
|
||||
|
||||
// キャプチャモーダル
|
||||
"captcha.title": "人機認証",
|
||||
"captcha.hint": "以下の計算問題を解いて、ロボットでないことを証明してください",
|
||||
"captcha.refresh": "別の問題",
|
||||
"captcha.submit": "認証して送信",
|
||||
"captcha.loading": "読み込み中...",
|
||||
"captcha.loadFailed": "読み込み失敗",
|
||||
"captcha.loadRetry": "読み込み失敗、再試行してください",
|
||||
"captcha.inputAnswer": "答えを入力してください",
|
||||
"captcha.wrongAnswer": "答えが違います。もう一度計算してください",
|
||||
"captcha.verifyFailed": "認証失敗、再試行してください",
|
||||
|
||||
// 登録ページ補足
|
||||
"auth.register.domain.prefix": "カスタムドメイン(あなたの質問箱URLは %s + ",
|
||||
"auth.register.domain.suffix": " + 下記に入力した内容になります)",
|
||||
"auth.register.confirm": "パスワード(確認)",
|
||||
"auth.register.language": "表示言語",
|
||||
"auth.register.languageDefault": "サイト既定に従う",
|
||||
"auth.register.success": "登録が完了しました。狼の質問箱へようこそ!",
|
||||
|
||||
// 探索ページ補足
|
||||
"explore.recommend": "ランダムおすすめ",
|
||||
"explore.search": "タグを検索...",
|
||||
"explore.sortLatest": "新着順",
|
||||
"explore.sortOldest": "古い順",
|
||||
"explore.noTags": "タグなし",
|
||||
"explore.noRecommend": "おすすめユーザーはいません",
|
||||
"explore.hotTags": "人気タグ",
|
||||
"explore.hotQuestions": "人気質問",
|
||||
"explore.noResult": "条件に一致するユーザーはいません。",
|
||||
"explore.lazy": "このユーザーは何も書いていません~",
|
||||
"explore.prevPage": "前へ",
|
||||
"explore.nextPage": "次へ",
|
||||
"explore.loading": "読み込み中...",
|
||||
"explore.loadFailed": "読み込み失敗",
|
||||
|
||||
// 質問箱パスワードページ
|
||||
"password.title": "この質問箱はパスワード保護されています",
|
||||
"password.desc": "この質問箱はパスワード保護されています。パスワードを入力して内容を表示してください",
|
||||
"password.input": "アクセスパスワードを入力してください",
|
||||
"password.enter": "認証して入る",
|
||||
"password.submit": "確認",
|
||||
|
||||
// 質問が見つかりません
|
||||
"qitem.notFound": "質問が見つからないか、削除されました",
|
||||
|
||||
// チャットページ
|
||||
"chat.title": "チャット",
|
||||
"chat.input": "メッセージを入力...",
|
||||
"chat.send": "送信",
|
||||
"chat.delete": "会話を削除",
|
||||
"chat.block": "相手をブロック",
|
||||
"chat.unblock": "ブロック解除",
|
||||
"chat.empty": "メッセージはまだありません。何か書いてみましょう~",
|
||||
"chat.withAsker": "質問者とのチャット",
|
||||
"chat.withUser": "%s とのチャット",
|
||||
"chat.closed": "会話は終了しました",
|
||||
"chat.closedNoSend": "会話は終了したため、新しいメッセージを送信できません",
|
||||
"chat.remaining": "残りメッセージ:%d 件(全 %d 件)",
|
||||
"chat.me": "自分",
|
||||
"chat.other": "相手",
|
||||
"chat.userBlocked": "このユーザーはブロックされています",
|
||||
"chat.addImage": "画像を追加(任意、最大5MB)",
|
||||
"chat.confirm": "確認",
|
||||
"chat.confirmBlock": "このユーザーをブロックしますか?ブロック後はメッセージを送信できなくなります。",
|
||||
"chat.confirmUnblock": "このユーザーのブロックを解除しますか?再度メッセージを送信できるようになります。",
|
||||
"chat.deleteConfirm": "このチャットを削除しますか?相手はこの会話を見られなくなり、この操作は取り消せません。",
|
||||
"maintenance.title": "NekoBox メンテナンス中...",
|
||||
"maintenance.desc": "NekoBox はメンテナンス中のため、一時的にご利用いただけません。また後でお越しください~",
|
||||
|
||||
// 質問の個別シェア(v4)
|
||||
"qitem.shareCard": "この質問をシェア",
|
||||
|
||||
// 追加質問(v4)
|
||||
"followup.title": "追加質問",
|
||||
"followup.content": "追加質問:",
|
||||
"followup.answerPlaceholder": "この追加質問に回答...",
|
||||
"followup.answerBtn": "回答する",
|
||||
"followup.waiting": "回答待ち...",
|
||||
"followup.askMore": "追加で質問する",
|
||||
"followup.remaining": "追加質問可能: %d / %d 回",
|
||||
"followup.contentPlaceholder": "質問を補足...",
|
||||
"followup.submit": "送信",
|
||||
"followup.waitingReply": "追記を送信しました。ボックス所有者の返信をお待ちください...",
|
||||
|
||||
// ピン留め(v4)
|
||||
"qlist.pinned": "ピン留め中",
|
||||
"qlist.pin": "ピン留め",
|
||||
"qlist.unpin": "ピン留め解除",
|
||||
"qlist.readStatus": "既読ステータス",
|
||||
"qlist.read": "既読",
|
||||
"qlist.unread": "未読",
|
||||
"qlist.statsRead": "既読",
|
||||
"qlist.statsUnread": "未読",
|
||||
|
||||
// 質問送信完了ページ(v4)
|
||||
"success.title": "質問を送信しました!",
|
||||
"success.yourQuestion": "あなたの質問:",
|
||||
"success.emailSent": "この質問のプライベートリンクをメールで送信しました。以下のリンクからいつでも質問の確認、回答の受信、追加質問ができます。",
|
||||
"success.saveLink": "<strong>以下のプライベートリンクを必ず保存してください!</strong>メールアドレスを入力しなかったため、このリンク(トークンを含む)が質問の確認・回答の受信・追加質問のための<strong>唯一の証拠</strong>です。失くすと復元できません。",
|
||||
"success.privateLink": "あなたのプライベートリンク(クリックしてコピー)",
|
||||
"success.copy": "コピー",
|
||||
"success.copied": "コピーしました ✓",
|
||||
"success.copyFailed": "コピーに失敗",
|
||||
"success.token": "トークン: %s(質問者はこのトークンでプライベートリンクにアクセス)",
|
||||
"success.viewQuestion": "質問を確認する",
|
||||
"success.backToBox": "%sの質問箱に戻る",
|
||||
"success.pageTitle": "質問送信完了 - %s",
|
||||
|
||||
// アカウント停止ページ
|
||||
"deactivate.title": "アカウント停止",
|
||||
"deactivate.desc": "停止後、あなたの質問箱にはアクセスできなくなり、すべてのデータが削除されます。この操作は取り消せません!",
|
||||
"deactivate.confirm": "アカウントを停止することに同意します",
|
||||
"deactivate.submit": "アカウントを停止",
|
||||
|
||||
// 匿名投票
|
||||
"nav.votes": "投票",
|
||||
|
||||
"common.back": "戻る",
|
||||
|
||||
"vote.listTitle": "投票管理",
|
||||
"vote.newTitle": "投票を作成",
|
||||
"vote.editTitle": "投票を編集",
|
||||
"vote.resultsTitle": "投票結果",
|
||||
"vote.statsTotal": "投票総数",
|
||||
"vote.statsPublished": "進行中",
|
||||
"vote.createNew": "投票を作成",
|
||||
"vote.typeSingle": "単一選択",
|
||||
"vote.typeMultiple": "複数選択",
|
||||
"vote.typeRating": "評価",
|
||||
"vote.typeRank": "順位付け",
|
||||
"vote.typeForm": "フォーム",
|
||||
"vote.statusNotStarted": "未開始",
|
||||
"vote.statusDraft": "下書き",
|
||||
"vote.statusPublished": "進行中",
|
||||
"vote.statusEnded": "終了",
|
||||
"vote.statusArchived": "アーカイブ",
|
||||
"vote.participants": "参加者",
|
||||
"vote.remainLabel": "残り",
|
||||
"vote.perpetual": "期限なし",
|
||||
"vote.durationDay": "日",
|
||||
"vote.durationHour": "時間",
|
||||
"vote.durationMinute": "分",
|
||||
"vote.createdAt": "作成日時",
|
||||
"vote.edit": "編集",
|
||||
"vote.results": "結果",
|
||||
"vote.preview": "プレビュー",
|
||||
"vote.page.mustComplete": "入力してください",
|
||||
"vote.page.rankHintRequired": "順位 1-N(必須)",
|
||||
"vote.page.rankHintOptional": "順位 1-N(任意、一部のみ可)",
|
||||
"vote.page.previewHint": "プレビューモード:公開前のサンプルです。送信は無効です",
|
||||
"vote.page.previewSubmitHint": "プレビューモード。公開後に送信できます",
|
||||
"vote.publish": "公開",
|
||||
"vote.close": "終了",
|
||||
"vote.share": "リンクをコピー",
|
||||
"vote.copied": "コピーしました",
|
||||
"vote.shareURL": "投票の共有リンク",
|
||||
"vote.confirmPublish": "この投票を公開しますか?公開後、共有リンクが生成されます。",
|
||||
"vote.confirmClose": "この投票を終了しますか?終了後、参加者は投票できなくなります。",
|
||||
"vote.confirmDelete": "この投票を削除しますか?投票データもすべて削除され、元に戻せません!",
|
||||
"vote.manageEntry": "投票を管理",
|
||||
|
||||
"vote.manageTitle": "投票管理",
|
||||
"vote.manageDesc": "匿名投票の作成と管理", "vote.empty": "投票はまだありません。右上の\"投票を作成\"から始めましょう。",
|
||||
"vote.formLockedHint": "この投票は公開中です。基本情報のみ編集可能です(収集済みデータを守るため、タイプと選択肢はロックされています)",
|
||||
"vote.formBasic": "基本設定",
|
||||
"vote.formTitle": "投票タイトル",
|
||||
"vote.formTitlePlaceholder": "例:今日の昼ごはんは?",
|
||||
"vote.formDescription": "説明",
|
||||
"vote.formDescriptionPlaceholder": "補足説明(任意)",
|
||||
"vote.formType": "投票タイプ",
|
||||
"vote.formVisibility": "表示方法",
|
||||
"vote.formVisibilityPublic": "公開(探索ページ + 質問箱ページ)",
|
||||
"vote.formVisibilityLinkOnly": "リンクのみ",
|
||||
"vote.formVoterScope": "投票範囲",
|
||||
"vote.formVoterScopeAnyone": "誰でも(匿名含む)",
|
||||
"vote.formVoterScopeRegistered": "登録ユーザーのみ",
|
||||
"vote.formShowResult": "結果の表示タイミング",
|
||||
"vote.formShowResultAfterVote": "投票後すぐに表示",
|
||||
"vote.formShowResultAfterEnd": "終了後に表示",
|
||||
"vote.formShowResultOwnerOnly": "本人のみ",
|
||||
"vote.formStartAt": "開始時間(空欄=すぐ開始)",
|
||||
"vote.formEndAt": "終了時間(空欄=制限なし)",
|
||||
"vote.formMaxChoices": "最大選択数",
|
||||
"vote.formMaxVotesPerFingerprint": "投票ごとに1台の端末につき1回まで。同じブラウザからの再送信は拒否されます。",
|
||||
"vote.formMaxVotesPerAccount": "投票ごとに1つの登録アカウントにつき1回まで。同じアカウントからの再送信は拒否されます。",
|
||||
"vote.formAllowCustom": "参加者がカスタム選択肢を追加できる",
|
||||
"vote.formRequireCaptcha": "匿名投票にキャプチャを要求",
|
||||
"vote.formOptions": "投票の選択肢",
|
||||
"vote.formRatingHint": "評価投票は選択肢不要(1-10点)",
|
||||
"vote.addOption": "選択肢を追加",
|
||||
"vote.optionPlaceholder": "選択肢の内容",
|
||||
"vote.formFields": "フォーム項目",
|
||||
"vote.addField": "項目を追加",
|
||||
"vote.field": "項目",
|
||||
"vote.formFieldType": "項目タイプ",
|
||||
"vote.fieldTypeText": "一行テキスト",
|
||||
"vote.fieldTypeTextarea": "複数行テキスト",
|
||||
"vote.fieldTypeSelect": "ドロップダウン選択",
|
||||
"vote.fieldTypeRadio": "単一選択",
|
||||
"vote.fieldTypeCheckbox": "複数選択",
|
||||
"vote.fieldTypeNumber": "数値",
|
||||
"vote.fieldTypeRank": "順位",
|
||||
"vote.page.selectPlaceholder": "選択してください",
|
||||
"vote.page.avgNumber": "平均",
|
||||
"vote.page.fieldFilled": "回答数",
|
||||
"vote.fieldTypeRating": "評価",
|
||||
"vote.formFieldLabel": "項目ラベル",
|
||||
"vote.formFieldRequired": "必須",
|
||||
"vote.formFieldMaxLength": "文字数上限(0=制限なし)",
|
||||
"vote.formFieldOptions": "選択肢",
|
||||
"vote.formFieldOptionsHint": "下の「選択肢を追加」で一つずつ追加してください(カンマ不要)",
|
||||
"vote.fieldAllowCustom": "参加者がカスタム選択肢を追加できる",
|
||||
"vote.formFieldOptionsPlaceholder": "例:良い,普通,悪い",
|
||||
"vote.createDraft": "下書きを保存",
|
||||
"vote.builderHintOptions": "選択肢は最低 2 つ必要です",
|
||||
"vote.builderHintFields": "フィールドを最低 1 つ追加してください",
|
||||
"vote.builderHintFieldOptions": "選択・順位題には選択肢が必要です(順位は最低 2 つ)",
|
||||
"vote.resultsAnswered": "回答数",
|
||||
"vote.page.rankedTimes": "順位付け数",
|
||||
"vote.resultsTotal": "総参加人数",
|
||||
"vote.resultsSubmissions": "フォームの回答",
|
||||
"vote.resultsViewTexts": "テキスト回答を表示",
|
||||
"vote.resultsToggleHint": "クリックでテキスト回答の表示・非表示を切り替え",
|
||||
"vote.resultsOptions": "投票結果",
|
||||
"vote.resultsVotes": "票",
|
||||
"vote.export": "CSV エクスポート",
|
||||
"vote.resultsEmpty": "まだ参加者がいません。リンクを共有しましょう!",
|
||||
|
||||
// 投票参加ページ
|
||||
"vote.inlineTitle": "投票",
|
||||
"vote.page.by": "の投票",
|
||||
"vote.page.goVote": "投票する",
|
||||
"vote.page.notStarted": "未開始",
|
||||
"vote.page.notStartedHint": "この投票はまだ始まっていません。",
|
||||
"vote.page.ended": "終了",
|
||||
"vote.page.endedHint": "この投票は終了しました。",
|
||||
"vote.page.active": "進行中",
|
||||
"vote.page.participated": "参加済み",
|
||||
"vote.page.loginRequired": "この投票は登録ユーザーのみ参加できます。ログインしてください。",
|
||||
"vote.page.anonymousHint": "匿名での参加が可能で、あなたの身元は記録されません(同一端末で最大1回)。",
|
||||
"vote.page.submit": "投票する",
|
||||
"vote.page.alreadyVoted": "この投票にはすでに参加済みです。ありがとうございます!",
|
||||
"vote.page.resultsTitle": "投票結果",
|
||||
"vote.page.totalVotes": "総参加",
|
||||
"vote.page.avgRating": "平均点",
|
||||
"vote.page.avgRank": "平均順位",
|
||||
"vote.page.optionColumn": "選択肢",
|
||||
"vote.page.ratingLabel": "評価",
|
||||
"vote.page.ratingUnit": "点",
|
||||
"vote.page.rankHint": "各選択肢に 1-N の順位を入力してください(小さいほど上位、重複不可)",
|
||||
"vote.page.rankPlaceholder": "順位",
|
||||
"vote.page.multipleHint": "複数選択可",
|
||||
"vote.page.customOption": "カスタム選択肢(任意)",
|
||||
"vote.page.customPlaceholder": "あなたの選択肢を入力",
|
||||
"vote.page.customOther": "その他",
|
||||
"vote.page.customFieldPlaceholder": "カスタム選択肢を入力…",
|
||||
"vote.page.customStats": "カスタム選択肢",
|
||||
"vote.page.formCount": "回答受付数",
|
||||
"vote.page.ownerManage": "この投票を管理(結果は本人のみ閲覧可能)",
|
||||
|
||||
// 投票ごとの定量収集
|
||||
"vote.formQuotaLimit": "収集上限(件)",
|
||||
"vote.formQuotaHint": "0 は無制限。指定件数に達すると自動的に投票を終了します。",
|
||||
"vote.flash.notFound": "この投票は存在しないか、既に無効です",
|
||||
"vote.flash.notPublished": "この投票はまだ公開されていません",
|
||||
"vote.flash.archived": "この投票はアーカイブ済みのため参加できません",
|
||||
"vote.flash.ended": "この投票は終了しました",
|
||||
"vote.flash.notStarted": "この投票はまだ開始していません",
|
||||
"vote.flash.success": "投票が完了しました。ご参加ありがとうございます!",
|
||||
"vote.err.noChoice": "少なくとも 1 つの選択肢を選んでください",
|
||||
"vote.err.tooManyChoices": "選択できるのは最大 %d 個までです",
|
||||
"vote.err.pickOne": "選択肢を 1 つ選んでください",
|
||||
"vote.err.invalidOption": "無効な選択肢です",
|
||||
"vote.err.optionDuplicate": "選択肢は重複できません",
|
||||
"vote.err.ratingRequired": "1〜10 点の評価を入力してください",
|
||||
"vote.err.rankRequired": "すべての選択肢に 1〜%d の順位を入力してください",
|
||||
"vote.err.rankDuplicate": "順位が重複しています",
|
||||
"vote.err.fieldRequired": "「%s」を入力してください",
|
||||
"vote.err.fieldCustomRequired": "「%s」の自由記入欄を入力してください",
|
||||
"vote.err.fieldCustomTooLong": "「%s」の自由記入は %d 字以内にしてください",
|
||||
"vote.err.fieldInvalidOption": "「%s」の選択肢が無効です",
|
||||
"vote.err.fieldConfigError": "「%s」の選択肢の設定に誤りがあります",
|
||||
"vote.err.fieldRankIncomplete": "「%s」の順位をすべて入力してください",
|
||||
"vote.err.fieldRankRange": "「%s」の順位は 1〜%d の数字で入力してください",
|
||||
"vote.err.fieldRankDuplicate": "「%s」の順位が重複しています",
|
||||
"vote.err.fieldTooLong": "「%s」が文字数上限(最大 %d 字)を超えています",
|
||||
"vote.err.fieldNotNumber": "「%s」は数値で入力してください",
|
||||
"vote.err.fieldRating": "「%s」は 1〜10 点で評価してください",
|
||||
"vote.err.unknownType": "不明な投票タイプです",
|
||||
"vote.err.customTooLong": "自由記入オプションは %d 字以内にしてください",
|
||||
"vote.err.blockWords": "投稿内容に投票作成者が設定したブロックワードが含まれているため、送信できませんでした",
|
||||
"vote.err.serialize": "送信内容の保存に失敗しました",
|
||||
"captcha.error": "認証コードが正しくありません",
|
||||
"captcha.errEmpty": "認証コードを入力してください",
|
||||
"captcha.errFormat": "認証コードの形式が正しくありません。再読み込みしてお試しください",
|
||||
"captcha.errAnswerFormat": "認証コードの回答形式が正しくありません",
|
||||
"captcha.errExpired": "認証コードの有効期限が切れました。再読み込みしてお試しください",
|
||||
"captcha.errService": "認証コードサービスでエラーが発生しました。後ほどお試しください",
|
||||
"captcha.errAnswerWrong": "認証コードの回答が正しくありません",
|
||||
"censor.unavailable": "コンテンツ審査サービスが一時的に利用できません。後ほどお試しください",
|
||||
|
||||
// 機能管理:質問 / チャット / 投票 の ON・OFF、期間指定、定量収集
|
||||
"admin.tabAccount": "ユーザー設定",
|
||||
"admin.featuresHint": "「質問 / チャット / 投票」パネルで各機能の ON/OFF、公開期間、収集上限を管理します。上限に達すると対象機能は自動的に閉じられます。",
|
||||
"admin.featuresEntry": "設定",
|
||||
"admin.featureHint.question": "OFF にすると新しい質問を投稿できません。上限に達すると自動的に受付を停止します(非公開質問を含む)。",
|
||||
"admin.featureHint.chat": "OFF にすると新しいチャットを開始できません。既存の会話には影響しません。",
|
||||
"admin.featureHint.vote": "OFF にすると質問箱ページに投票が表示されず、回答もできなくなります。投票ごとの上限は編集ページで設定できます。",
|
||||
"admin.featureEnabled": "この機能を有効にする",
|
||||
"admin.featureOpenAt": "公開開始",
|
||||
"admin.featureCloseAt": "公開終了",
|
||||
"admin.featureTimeHint": "空欄は制限なし。開始前と終了後はその機能を利用できません。",
|
||||
"admin.featureSchedule": "定期公開(毎週)",
|
||||
"admin.featureScheduleStart": "毎日の開始",
|
||||
"admin.featureScheduleEnd": "毎日の終了",
|
||||
"admin.featureScheduleHint": "毎週の公開曜日と毎日の時間帯を設定すると、毎週繰り返し公開されます。すべて空欄で無効。曜日のみ(時間なし)は終日公開、時間のみ(曜日なし)は毎日その時間帯に公開。",
|
||||
"admin.featureMode": "収集モード",
|
||||
"admin.featureModeAlways": "常時開放",
|
||||
"admin.featureModeWindow": "期間限定",
|
||||
"admin.featureModeRecurring": "曜日スケジュール",
|
||||
"admin.featureModeHint": "常時開放:手動でオフにするまで開放し続けます。期間限定:一回限りの開始/終了時刻で開放します。曜日スケジュール:毎週の開放日と時間帯を繰り返し適用します。モードは保存時に排他となり、未選択モードの設定はクリアされます。",
|
||||
"admin.featureQuotaLimit": "収集上限(件)",
|
||||
"admin.featureQuotaHint": "0 は無制限。上限に達すると自動的に閉じられます。カウントをリセットすると次の回を開始できます。",
|
||||
"admin.featureQuotaCount": "収集済み",
|
||||
"admin.featureQuotaUnlimited": "無制限",
|
||||
"admin.featureQuotaResetAt": "最終リセット:",
|
||||
"admin.featureResetQuota": "カウントをリセット",
|
||||
"admin.featureSave": "この機能を保存",
|
||||
|
||||
// 機能管理:状態とメッセージ
|
||||
"feature.name.question": "質問",
|
||||
"feature.name.chat": "チャット",
|
||||
"feature.name.vote": "投票",
|
||||
"feature.statusOpen": "受付中",
|
||||
"feature.status.disabled": "停止中",
|
||||
"feature.status.not_started": "未開始",
|
||||
"feature.status.ended": "終了",
|
||||
"feature.status.quota_reached": "上限到達",
|
||||
"feature.saved": "機能設定を保存しました",
|
||||
"feature.errTime": "%s の日時形式が正しくありません。日時選択ツールを使用してください",
|
||||
"feature.errTimeRange": "%s の公開終了時刻は公開開始時刻より後にしてください",
|
||||
"feature.errQuota": "%s の収集上限は 0〜1000000 の整数で入力してください",
|
||||
"feature.errInvalid": "不明な機能です",
|
||||
"feature.quotaReset": "%s の収集カウントをリセットしました",
|
||||
"feature.errScheduleHalf": "%s の定期公開の開始時間と終了時間は両方入力してください",
|
||||
"feature.errScheduleTime": "%s の定期公開の時刻形式が正しくありません。時刻選択ツールを使用してください",
|
||||
"feature.errScheduleRange": "%s の定期公開の終了時刻は開始時刻より後にしてください",
|
||||
|
||||
// 機能が無効なときに訪問者へ表示するメッセージ
|
||||
"feature.disabled.question": "この質問箱の管理者は質問の受付を停止しています",
|
||||
"feature.disabled.chat": "この質問箱ではチャットを受け付けていません",
|
||||
"feature.disabled.vote": "この質問箱では投票を受け付けていません",
|
||||
"feature.not_started.question": "質問の受付はまだ開始していません",
|
||||
"feature.not_started.chat": "チャットの受付はまだ開始していません",
|
||||
"feature.not_started.vote": "投票の受付はまだ開始していません",
|
||||
"feature.ended.question": "質問の受付は終了しました",
|
||||
"feature.ended.chat": "チャットの受付は終了しました",
|
||||
"feature.ended.vote": "投票の受付は終了しました",
|
||||
"feature.quota_reached.question": "質問の収集上限に達しました",
|
||||
"feature.quota_reached.chat": "チャットの収集上限に達しました",
|
||||
"feature.quota_reached.vote": "投票の収集上限に達しました",
|
||||
|
||||
// 認証:訪問者に表示されるメッセージ(P0)
|
||||
"auth.errBadCredential": "メールアドレスまたはパスワードが正しくありません",
|
||||
"auth.errUserNotFound": "ユーザーが存在しません",
|
||||
"auth.errEmailFrequent": "メールの送信頻度が高すぎます。しばらくしてからお試しください",
|
||||
"auth.errEmailFailed": "メールの送信に失敗しました。しばらくしてからお試しください",
|
||||
"auth.errCodeExpired": "認証コードの有効期限が切れました",
|
||||
"auth.errPasswordChanged": "パスワードを変更しました",
|
||||
"auth.errLoginRequired": "ログインしてください",
|
||||
"auth.errDuplicateEmail": "このメールアドレスは既に登録されています",
|
||||
"auth.errDuplicateDomain": "このカスタムドメインは既に使用されています",
|
||||
|
||||
// 質問箱ページ:訪問者に表示(P0)
|
||||
"question.errWrongPassword": "パスワードが正しくありません",
|
||||
"question.errAskPasswordWrong": "質問用パスワードが正しくありません",
|
||||
"question.errLoginRequired": "質問箱の所有者は登録ユーザーのみ質問できるように設定しています。先にログインしてください。",
|
||||
"question.errSelfChat": "自分自身とのチャットは開始できません",
|
||||
"question.errBlockedChat": "相手にブロックされているため、チャットを開始できません",
|
||||
"question.errChatDailyLimit": "本日の送信上限(%d件)に達しました。明日お試しください",
|
||||
"question.errDuplicateSubmit": "重複送信が検出されました。しばらくしてからお試しください",
|
||||
"question.errImageTooLarge": "画像ファイルのサイズは 5Mb 以下である必要があります",
|
||||
"question.errUploadImageFailed": "画像のアップロードに失敗しました",
|
||||
"question.errBlockWords": "質問に所有者が設定したブロックワードが含まれているため、送信できませんでした",
|
||||
"question.errAnsweredLocked": "回答済みの質問は未読にできません",
|
||||
"question.flash.chatSent": "チャットリクエストを送信しました!以下のリンクから会話を確認できます:%s",
|
||||
"question.flash.answered": "回答を公開しました!",
|
||||
"question.flash.operated": "操作が完了しました",
|
||||
"question.flash.markedRead": "既読にしました",
|
||||
"question.flash.markedUnread": "未読にしました",
|
||||
|
||||
// 追加質問:訪問者/所有者に表示(P0)
|
||||
"followup.errNoPermission": "権限がありません",
|
||||
"followup.errNotAnswered": "この質問にはまだ回答がありません。追加質問はできません",
|
||||
"followup.errLimit": "各質問の追加質問は最大 %d 回までで、上限に達しました",
|
||||
"followup.errWaitReply": "前の追加質問への返信を待ってから続けてください",
|
||||
"followup.errNotFound": "追加質問が存在しません",
|
||||
"followup.flash.sent": "追加質問を送信しました!",
|
||||
"followup.flash.answered": "回答を投稿しました!",
|
||||
|
||||
// 管理設定:所有者に表示(P1)
|
||||
"admin.flash.profileUpdated": "プロフィールを更新しました",
|
||||
"admin.flash.chatUpdated": "チャット設定を更新しました",
|
||||
"admin.flash.pagePwdOff": "ページパスワード認証を無効にしました",
|
||||
"admin.flash.pagePwdUpdated": "ページアクセスパスワードを更新しました",
|
||||
"admin.flash.askPwdOff": "質問パスワードを無効にしました",
|
||||
"admin.flash.askPwdUpdated": "質問パスワードを更新しました",
|
||||
"admin.flash.tagsTooMany": "タグは最大 5 個までです",
|
||||
"admin.flash.tagsUpdated": "タグを更新しました",
|
||||
"admin.flash.tagTooLong": "各タグは 5 文字以内である必要があります:%s",
|
||||
"admin.flash.blockWordsTooMany": "ブロックワードは最大 10 個までです",
|
||||
"admin.flash.blockWordTooLong": "ブロックワードの長さは 10 文字以内である必要があります:%s",
|
||||
"admin.flash.harassmentUpdated": "迷惑行為対策を更新しました",
|
||||
"admin.flash.blockWordsUpdated": "ブロックワードを更新しました",
|
||||
"admin.flash.deactivated": "アカウントを停止しました。狼の質問箱をご利用いただきありがとうございます。またのお越しをお待ちしています 👋🏻",
|
||||
"admin.export.errUser": "エクスポート失敗:ユーザー情報の取得に失敗しました",
|
||||
"admin.export.errQuestion": "エクスポート失敗:質問情報の取得に失敗しました",
|
||||
|
||||
// 投票管理:所有者に表示(P1)
|
||||
"vote.err.invalidID": "無効な投票 ID",
|
||||
"vote.err.notExist": "投票が存在しません",
|
||||
"vote.err.noPermission": "この投票を操作する権限がありません",
|
||||
"vote.err.type": "不明な投票タイプです",
|
||||
"vote.err.titleRequired": "投票のタイトルを入力してください",
|
||||
"vote.err.titleTooLong": "投票のタイトルは 100 文字以内である必要があります",
|
||||
"vote.err.visibility": "不明な表示設定です",
|
||||
"vote.err.voterScope": "不明な投票範囲設定です",
|
||||
"vote.err.showResult": "不明な結果表示設定です",
|
||||
"vote.err.timeRange": "終了時刻は開始時刻より後にしてください",
|
||||
"vote.err.quota": "収集上限は 0〜1000000 の整数で入力してください",
|
||||
"vote.err.optionsTooFew": "選択肢を最低 2 つ追加してください",
|
||||
"vote.err.optionsFormat": "選択肢データの形式が正しくありません",
|
||||
"vote.err.optionTooLong": "1 つの選択肢は %d 文字以内である必要があります",
|
||||
"vote.err.maxChoicesExceed": "最大選択数は選択肢の総数を超えられません",
|
||||
"vote.err.fieldsTooFew": "フォーム項目を最低 1 つ追加してください",
|
||||
"vote.err.fieldsFormat": "フォーム項目データの形式が正しくありません",
|
||||
"vote.err.fieldsTooMany": "フォーム項目は最大 50 個までです",
|
||||
"vote.err.fieldType": "不明なフォーム項目タイプです",
|
||||
"vote.err.fieldLabelMissing": "%d 番目の項目にラベルがありません",
|
||||
"vote.err.fieldLabelTooLong": "%d 番目の項目のラベルは 100 文字以内である必要があります",
|
||||
"vote.err.fieldLabelDuplicate": "項目ラベル「%s」が重複しています。別のラベルを使用してください",
|
||||
"vote.err.fieldMaxLength": "%d 番目の項目の文字数上限は 0〜2000 の間である必要があります",
|
||||
"vote.err.fieldReservedOption": "%d 番目の項目(%s)の選択肢に予約値が含まれています。変更してください",
|
||||
"vote.err.fieldOptionsTooFew": "%d 番目の項目(%s)は選択肢を最低 1 つ入力してください",
|
||||
"vote.err.fieldRankTooFew": "%d 番目の項目(%s)の順位付けには最低 2 つの選択肢が必要です",
|
||||
"vote.err.fieldSerialize": "項目の選択肢のシリアライズに失敗しました",
|
||||
"vote.err.editClosed": "終了またはアーカイブされた投票は編集できません",
|
||||
"vote.err.publishDraftOnly": "草稿状態の投票のみ公開できます",
|
||||
"vote.err.closePublishedOnly": "進行中の投票のみ終了できます",
|
||||
"vote.err.publishTitleRequired": "公開前に投票のタイトルを入力してください",
|
||||
"vote.err.publishFormFieldsRequired": "フォーム型投票には最低 1 つの項目が必要です",
|
||||
"vote.err.publishOptionsRequired": "選択型投票には最低 2 つの選択肢が必要です",
|
||||
"vote.err.optionUpdateFailed": "選択肢の更新に失敗しました。再試行してください",
|
||||
"vote.err.fieldUpdateFailed": "フォーム項目の更新に失敗しました。再試行してください",
|
||||
"vote.flash.published": "投票を公開しました!共有リンク:%s",
|
||||
"vote.flash.updated": "投票情報を更新しました(進行中の投票はタイプと選択肢を変更できません)",
|
||||
"vote.flash.draftSaved": "下書きに保存しました",
|
||||
"vote.flash.closed": "投票を終了しました",
|
||||
"vote.flash.deleted": "投票を削除しました",
|
||||
"vote.err.timeFormat": "日時の形式が正しくありません。日時選択器を使用してください",
|
||||
"vote.err.maxChoicesLimit": "選択可能数は20を超えられません",
|
||||
"vote.err.descriptionTooLong": "投票の説明は5000文字を超えられません",
|
||||
"profile.err.avatarTooLarge": "アイコンファイルが大きすぎます。最大2MB",
|
||||
"profile.err.backgroundTooLarge": "背景画像が大きすぎます。最大2MB",
|
||||
"profile.err.newPasswordTooShort": "新しいパスワードは8文字以上である必要があります",
|
||||
"profile.err.badOldPassword": "古いパスワードが間違っています",
|
||||
"admin.export.errCreateExcel": "エクスポート失敗:Excelファイルの作成に失敗しました",
|
||||
"admin.export.errWriteExcel": "エクスポート失敗:Excelファイルの書き込みに失敗しました",
|
||||
|
||||
// プロフィール設定ページ UI リニューアル:カード区切り/アイコン・背景の切り取り/パスワード変更後の強制ログアウト
|
||||
"profile.card.basic": "基本情報",
|
||||
"profile.card.avatarBg": "アイコンと背景",
|
||||
"profile.card.qr": "QRコードのスタイル",
|
||||
"profile.card.password": "パスワード変更",
|
||||
"profile.avatarCropHint": "切り取り枠は 1:1(正方形)に固定されています",
|
||||
"profile.backgroundCropHint": "切り取り枠は 16:9 に固定されています",
|
||||
"profile.cropTitle": "画像を切り取る",
|
||||
"profile.cropConfirm": "切り取りを確定",
|
||||
"profile.err.avatarRatio": "アイコン画像は 1:1 の正方形である必要があります。切り取ってから再アップロードしてください",
|
||||
"profile.err.backgroundRatio": "背景画像は 16:9 の縦横比である必要があります。切り取ってから再アップロードしてください",
|
||||
"profile.flash.passwordChanged": "パスワードを変更しました。ログアウトしましたので、新しいパスワードで再度ログインしてください",
|
||||
"profile.pwdNote": "保存後、現在のセッションはすぐに無効になり、新しいパスワードで再ログインする必要があります",
|
||||
"profile.pickAvatar": "アイコンを変更",
|
||||
"profile.pickBackground": "背景を変更",
|
||||
"profile.saveBasic": "基本情報を保存",
|
||||
"profile.saveMedia": "アイコンと背景を保存",
|
||||
"profile.savePassword": "パスワードを更新",
|
||||
"profile.saveQR": "QRコードのスタイルを保存",
|
||||
"profile.saveSocial": "SNSリンクを保存",
|
||||
"profile.err.cropLibUnavailable": "画像切り取り機能の読み込みに失敗しました。ページを更新してもう一度お試しください",
|
||||
|
||||
// 認証コード JSON インターフェース:フロントエンドが消費(P2)
|
||||
"captcha.json.badRequest": "リクエスト形式が正しくありません",
|
||||
"captcha.json.idRequired": "認証コード ID を入力してください",
|
||||
"captcha.json.genFailed": "認証コードの生成に失敗しました",
|
||||
"chat.errDeletedByOwner": "このプライベート会話は相手によって削除されました。",
|
||||
"chat.errBlockedView": "あなたは相手にブロックされ、このチャットを表示できません",
|
||||
"chat.errEmpty": "メッセージを入力してください",
|
||||
"chat.errTooLong": "メッセージが長すぎます。%d文字以内でお願いします",
|
||||
"chat.errConvDeletedSend": "この会話は削除されたため、メッセージを送信できません",
|
||||
"chat.errBlockedSend": "あなたは相手にブロックされ、メッセージを送信できません",
|
||||
"chat.errBlockWords": "メッセージにボックス所有者が設定したブロックワードが含まれているため、送信できませんでした",
|
||||
"chat.errDailyLimit": "本日の送信上限(%d件)に達しました。明日再度お試しください",
|
||||
"chat.errLimitReached": "会話が上限に達したため、新しいメッセージを送信できません",
|
||||
"chat.errChatClosed": "箱の所有者がプライベートチャットを無効にしたため、メッセージを送信できません",
|
||||
"chat.errImageTooLarge": "画像サイズは%dMBを超えることはできません",
|
||||
"chat.errUploadFailed": "画像のアップロードに失敗しました。後でもう一度お試しください",
|
||||
"chat.errNoPermission": "この操作を実行する権限がありません",
|
||||
"chat.flash.sent": "メッセージを送信しました",
|
||||
"chat.flash.deleted": "プライベート会話を削除しました",
|
||||
"chat.flash.operated": "操作が完了しました",
|
||||
"image.errTooLarge": "画像が大きすぎます。最大%d×%dピクセルまで対応しています。圧縮して再アップロードしてください",
|
||||
"internal.errFlash": "サーバー内部エラーが発生しました。後でもう一度お試しください。",
|
||||
"internal.errServer": "サーバー内部エラー",
|
||||
"home.errStats": "統計情報の取得に失敗しました",
|
||||
"pixel.errPath": "不正なリクエストパス",
|
||||
"proxy.errNotFound": "ページが見つかりません",
|
||||
"proxy.errInternal": "サービスゲートウェイ内部エラー",
|
||||
"explore.errRandomUser": "ランダムユーザーの取得に失敗しました",
|
||||
// 表单校验
|
||||
"form.answer.content": "回答内容を入力してください",
|
||||
"form.answer.contentTooLong": "回答内容は%d文字以内にしてください",
|
||||
"form.email.required": "有効なメールアドレスを入力してください",
|
||||
"form.followup.answer": "フォローアップの回答を入力してください",
|
||||
"form.followup.answerTooLong": "フォローアップの回答は%d文字以内にしてください",
|
||||
"form.followup.content": "フォローアップ内容を入力してください",
|
||||
"form.followup.contentTooLong": "フォローアップ内容は%d文字以内にしてください",
|
||||
"form.login.password": "パスワードを入力してください",
|
||||
"form.profile.backgroundimagealpha": "QRコードの背景の不透明度を入力してください",
|
||||
"form.profile.colorHex": "7文字の16進数カラーコード(#を含む)を入力してください",
|
||||
"form.profile.dotscale": "QRコードの点の大きさを入力してください",
|
||||
"form.profile.intro": "自己紹介は必須で、100文字以内である必要があります",
|
||||
"form.profile.linkMax": "プロフィールリンクは30文字以内である必要があります",
|
||||
"form.profile.name": "ニックネームは必須で、20文字以内である必要があります",
|
||||
"form.profile.newPassword": "新しいパスワードは30文字以内である必要があります",
|
||||
"form.profile.passwordMax": "パスワードは30文字以内である必要があります",
|
||||
"form.question.content": "質問内容を入力してください",
|
||||
"form.question.contentTooLong": "質問内容は%d文字以内にしてください",
|
||||
"form.question.receiveReplyEmail": "返信を受け取るための有効なメールアドレスを入力してください",
|
||||
"form.recaptcha": "CAPTCHA認証を完了してください",
|
||||
"form.recover.newPassword": "8〜30文字の新しいパスワードを設定してください",
|
||||
"form.recover.repeatPassword": "入力した2つの新しいパスワードが一致しません",
|
||||
"form.register.domain": "カスタムドメインは半角英数字とアンダースコアのみ使用でき、3〜20文字である必要があります",
|
||||
"form.register.email": "有効なメールアドレスを入力してください(100文字以内)",
|
||||
"form.register.name": "ニックネームは必須で、20文字以内である必要があります",
|
||||
"form.register.password": "8〜30文字のパスワードを設定してください",
|
||||
"form.register.recaptcha": "CAPTCHAを読み込めません。ページを再読み込みするか、ネットワークを変更してお試しください",
|
||||
"form.register.repeatPassword": "入力した2つのパスワードが一致しません",
|
||||
}
|
||||
@@ -0,0 +1,842 @@
|
||||
// Copyright 2022 E99p1ant. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package i18n
|
||||
|
||||
// zhCNDict 简体中文文案。
|
||||
var zhCNDict = map[string]string{
|
||||
// 导航
|
||||
"nav.explore": "探索",
|
||||
"nav.mine": "我的",
|
||||
"nav.register": "注册",
|
||||
"nav.login": "登录",
|
||||
"nav.ask": "提问",
|
||||
"nav.settings": "设置",
|
||||
"nav.lang": "语言",
|
||||
|
||||
// 通用
|
||||
"common.login": "登录",
|
||||
"common.forgot": "忘记密码",
|
||||
"common.submit": "提交",
|
||||
"common.cancel": "取消",
|
||||
"common.save": "保存",
|
||||
"common.close": "关闭",
|
||||
"common.delete": "删除",
|
||||
"common.moveUp": "上移",
|
||||
"common.moveDown": "下移",
|
||||
"common.share": "分享",
|
||||
"common.verifying": "验证中...",
|
||||
"common.submitting": "提交中...",
|
||||
"common.uploading": "上传中...",
|
||||
"common.lang": "语言",
|
||||
"common.menu": "菜单",
|
||||
|
||||
"common.pleaseWait": "请稍候...",
|
||||
"common.backHome": "返回首页",
|
||||
"common.theme": "切换深色/浅色模式",
|
||||
|
||||
// 站点
|
||||
"site.title": "狼的提问箱 | 匿名提问箱",
|
||||
"site.description": "狼的提问箱——一个无需注册、可匿名提问的匿名提问箱,安全地倾诉与回应。",
|
||||
"site.keywords": "匿名提问箱,提问箱,匿名提问,狼的提问箱,匿名问答,匿名提问网站",
|
||||
"site.footer.visitor": "您是本站第 %s 位访客",
|
||||
"site.footer.pageview": "本页面已被访问 %s 次",
|
||||
"site.footer.runtime": "提问箱已成功存活",
|
||||
"site.footer.admin": "找站长",
|
||||
"site.footer.notice": "公告板",
|
||||
"site.footer.chat": "聊天室",
|
||||
"site.footer.drive": "盘",
|
||||
"site.footer.status": "监控板",
|
||||
"site.footer.nav": "导航页",
|
||||
"site.maintenance": "本站正在维护中,请稍后再来~",
|
||||
|
||||
// 认证
|
||||
"auth.login.title": "用户登录",
|
||||
"auth.login.email": "电子邮箱",
|
||||
"auth.login.password": "密码",
|
||||
"auth.login.submit": "登录",
|
||||
"auth.login.forgot": "忘记密码",
|
||||
"auth.register.title": "用户注册",
|
||||
"auth.register.name": "昵称",
|
||||
"auth.register.email": "电子邮箱",
|
||||
"auth.register.password": "密码",
|
||||
"auth.register.submit": "注册",
|
||||
"auth.forgot.title": "忘记密码",
|
||||
"auth.forgot.email": "电子邮箱",
|
||||
"auth.forgot.submit": "发送重置邮件",
|
||||
"auth.forgot.submitBtn": "找回密码",
|
||||
"auth.forgot.sent": "邮件已发送至 %s,请查收。",
|
||||
"auth.recover.title": "重置密码",
|
||||
"auth.recover.greeting": "%s,您正在重置您的密码:",
|
||||
"auth.recover.password": "新密码",
|
||||
"auth.recover.confirm": "确认密码",
|
||||
"auth.recover.submit": "重置密码",
|
||||
|
||||
// 探索页
|
||||
"explore.title": "探索用户标签",
|
||||
"explore.notice": "此处展示已开启<span class=\"uk-text-bold\">“在首页展示我的标签”</span>的用户。该功能默认关闭,若希望自己的提问箱在这里被发现,请前往 <a href=\"/user/profile\" class=\"uk-text-bold\">个人设置</a> 手动开启。",
|
||||
"explore.shuffle": "换一批",
|
||||
"explore.empty": "暂时没有发现可展示的用户,快去开启吧~",
|
||||
"explore.hotVotes": "热门投票",
|
||||
"explore.questionsTab": "提问",
|
||||
"explore.votesTab": "投票",
|
||||
"explore.votesTitle": "公开投票",
|
||||
"explore.votesDesc": "浏览正在进行的公开投票,选择你感兴趣的主题参与。",
|
||||
"explore.randomVote": "随机推荐",
|
||||
"explore.allVotes": "全部投票",
|
||||
"explore.noVotes": "暂时没有可参与的公开投票。",
|
||||
|
||||
// 提问页
|
||||
"ask.scan": "扫码向@%s提问",
|
||||
"ask.anonymous": "谁都可以以匿名的形式提问",
|
||||
"ask.registerOnly": "仅允许注册用户向TA提问",
|
||||
"ask.nextOpenAt": "下次开放时间:%s",
|
||||
"ask.lastCloseAt": "上次关闭时间:%s",
|
||||
"weekday.0": "周日",
|
||||
"weekday.1": "周一",
|
||||
"weekday.2": "周二",
|
||||
"weekday.3": "周三",
|
||||
"weekday.4": "周四",
|
||||
"weekday.5": "周五",
|
||||
"weekday.6": "周六",
|
||||
"ask.pinned": "已置顶",
|
||||
"ask.share": "分享提问箱",
|
||||
"ask.placeholder": "在此处撰写你的问题...",
|
||||
"ask.chatPlaceholder": "在此处撰写你的私聊消息...",
|
||||
"ask.addImage": "添加图片",
|
||||
"ask.private": "回复后不公开",
|
||||
"ask.notify": "接收通知",
|
||||
"ask.emailPlaceholder": "请输入你的邮箱地址",
|
||||
"ask.submit": "发送提问",
|
||||
"ask.chat": "发起私聊",
|
||||
"ask.chatDisabled": "该提问箱未开启私聊",
|
||||
"ask.chatLimit": "消息上限:%d条",
|
||||
"ask.history": "@%s 以前回答过的问题",
|
||||
"ask.loginRequired": "需要登录",
|
||||
"ask.loginRequiredChat": "发起私聊需要登录账号",
|
||||
"ask.goLogin": "去登录",
|
||||
"ask.needPassword": "此提问箱需要密码",
|
||||
"ask.needLogin": "提问箱的主人设置了仅注册用户才能提问,你需要先登录才能向他提问。",
|
||||
"ask.pleaseEmail": "请填写接收通知的邮箱地址",
|
||||
"ask.generating": "正在生成分享图…",
|
||||
"ask.genFailed": "生成分享图失败,请稍后重试",
|
||||
"ask.networkError": "网络错误",
|
||||
"ask.shareFilename": "share.png",
|
||||
|
||||
// 问题条目
|
||||
"qitem.answer": "回答",
|
||||
"qitem.delete": "删除",
|
||||
"qitem.private": "设为私密",
|
||||
"qitem.public": "设为公开",
|
||||
"qitem.asked": "提问",
|
||||
"qitem.pending": "等待回答",
|
||||
"qitem.answeredBy": "@%s 于 %s 的回答",
|
||||
"qitem.danger": "危险!",
|
||||
"qitem.deleteConfirm": "你确定要删除这个提问吗?该操作不可恢复,请谨慎操作。",
|
||||
"qitem.deleteConfirmBtn": "确认删除",
|
||||
"qitem.backToBox": "返回%s的提问箱",
|
||||
"qitem.answerTitle": "回答问题",
|
||||
"qitem.answerPlaceholder": "在此处撰写你的回答...",
|
||||
"qitem.emailNotifyHint": "提问人留下了自己的电子邮箱,在你第一次回复该问题后,提问人将会收到一封邮件通知。",
|
||||
"qitem.submitAnswer": "回答",
|
||||
"qitem.updateAnswer": "更新回答",
|
||||
"qitem.askMore": "再问点别的问题?",
|
||||
"qitem.markRead": "标记为已读",
|
||||
"qitem.markUnread": "标记为未读",
|
||||
"qitem.readLocked": "已回答,已锁定为已读",
|
||||
|
||||
// 个人设置页
|
||||
"admin.profile": "个人信息",
|
||||
"admin.lang": "界面语言",
|
||||
"admin.langHint": "选择访客访问你的提问箱时显示的语言(后台页面跟随此设置)",
|
||||
"admin.email": "电子邮箱",
|
||||
"admin.name": "昵称",
|
||||
"admin.nameColor": "昵称颜色",
|
||||
"admin.oldPassword": "旧密码",
|
||||
"admin.newPassword": "新密码",
|
||||
"admin.notify": "新提问通知",
|
||||
"admin.personalize": "个性化设置",
|
||||
"admin.intro": "提问箱介绍",
|
||||
"admin.introColor": "提问箱介绍颜色",
|
||||
"admin.qrBgColor": "二维码背景色(亮色部分)",
|
||||
"admin.qrPdColor": "二维码探测图形颜色(边角方形)",
|
||||
"admin.qrFgColor": "二维码前景色",
|
||||
"admin.qrDotSize": "二维码点大小 (←小 大→)",
|
||||
"admin.qrBgAlpha": "二维码背景透明度 (←不透明 很透明→)",
|
||||
"admin.avatar": "个人头像",
|
||||
"admin.background": "提问箱背景",
|
||||
"admin.qrBackground": "二维码背景图",
|
||||
"admin.social": "社交信息设置",
|
||||
"admin.harassment": "防骚扰设置",
|
||||
"admin.askLimit": "提问限制",
|
||||
"admin.blockWords": "屏蔽词设置(回车或逗号分隔,最多支持 10 个屏蔽词,每个屏蔽词最大长度为 10)",
|
||||
"admin.chat": "私聊设置",
|
||||
"admin.chatMaxMessages": "私聊消息条数上限",
|
||||
"admin.chatDailyLimit": "单用户每日私信条数上限",
|
||||
"admin.tags": "标签设置",
|
||||
"admin.tagsHint": "标签(最多5个,每个最多5字,回车或逗号分隔)",
|
||||
"admin.tagsPlaceholder": "例如:动漫,音乐,游戏",
|
||||
"admin.tagInputHint": "输入后按回车或逗号添加",
|
||||
"admin.tagInputDuplicate": "已存在,已忽略",
|
||||
"admin.pagePassword": "页面访问密码",
|
||||
"admin.pagePasswordHint": "设置访问密码(留空则关闭)",
|
||||
"admin.askPassword": "提问密码",
|
||||
"admin.askPasswordHint": "设置提问密码(留空则关闭)",
|
||||
"admin.saveProfile": "保存修改",
|
||||
"admin.updated": "更新个人信息成功",
|
||||
"admin.logout": "退出登录",
|
||||
"admin.export": "导出数据",
|
||||
|
||||
// 后台设置(补充)
|
||||
"admin.oldPasswordHint": "修改密码使用,留空则不修改",
|
||||
"admin.newPasswordHint": "6-64 位,留空则不修改",
|
||||
"admin.notifyEmail": "邮件",
|
||||
"admin.useCustomFg": "启用自定义前景色(否则自动匹配)",
|
||||
"admin.customFgHint": "仅在启用时生效,否则颜色由系统自动生成",
|
||||
"admin.avatarPlaceholder": "上传个人头像(头像比例不为1:1就扁了你哦)",
|
||||
"admin.backgroundPlaceholder": "上传提问箱背景",
|
||||
"admin.qrBackgroundPlaceholder": "上传二维码背景(颜色过深的背景会导致二维码无法识别)",
|
||||
"admin.qrPreviewHint": "选择图片后预览将即时更新",
|
||||
"admin.preview": "实时预览",
|
||||
"admin.themePreset": "预设主题",
|
||||
"admin.themeDefault": "默认",
|
||||
"admin.themeDark": "暗夜",
|
||||
"admin.themeOcean": "海洋",
|
||||
"admin.themeSunset": "日落",
|
||||
"admin.resetDefaults": "🔄 恢复默认值",
|
||||
"admin.previewHint": "调整仅用于预览,最终效果点击「保存修改」后生效",
|
||||
"admin.socialHint": "勾选后填写主页地址(无需 https://),未勾选的项将不会在前台显示。",
|
||||
"admin.enableAcfun": "启用 AcFun",
|
||||
"admin.enableBili": "启用 Bilibili",
|
||||
"admin.enableWeibo": "启用 微博",
|
||||
"admin.enableXiaohongshu": "启用 小红书",
|
||||
"admin.enableBlog": "启用 个人博客",
|
||||
"admin.registerOnly": "仅允许注册用户向我提问",
|
||||
"admin.updateHarassment": "更新防骚扰设置",
|
||||
"admin.globalBlockWords": "全局屏蔽词",
|
||||
"admin.globalBlockWordsHint": "屏蔽词对提问、私聊(对方发给你的消息)与投票提交内容生效;三个设置页同步显示同一份设置,任意一处修改即时生效。",
|
||||
"admin.updateBlockWords": "保存屏蔽词",
|
||||
"admin.allowChat": "允许注册用户向我发起私聊",
|
||||
"admin.dailyLimitHint": "0 表示不限制",
|
||||
"admin.updateChat": "更新私聊设置",
|
||||
"admin.showInHome": "在首页展示我的标签(允许其他用户通过标签搜索到我)",
|
||||
"admin.updateTags": "更新标签",
|
||||
"admin.updatePagePassword": "更新页面密码",
|
||||
"admin.pagePasswordPlaceholder": "输入页面访问密码",
|
||||
"admin.updateAskPassword": "更新提问密码",
|
||||
"admin.askPasswordPlaceholder": "输入提问密码",
|
||||
"admin.account": "账号设置",
|
||||
"admin.exportHint": "您可以导出您在 %s 中的所有个人数据,包括你的基本信息、收到的问题以及回答。",
|
||||
"admin.exportJSON": "导出全部数据(JSON)",
|
||||
"admin.exportJSONHint": "包含提问、回答、追问与私聊记录,可完整备份或迁移。",
|
||||
"admin.deactivate": "停用我的账号",
|
||||
"admin.deactivateHint": "您随时可以选择停用您的账号。停用后,您的账号将无法登录,您的提问箱页面以及提问将无法访问,其他人也无法再给您发送新的提问。<b>该操作无法撤销!请谨慎操作!</b>",
|
||||
"admin.socialRequired": "请填写链接或取消勾选",
|
||||
|
||||
// 问题管理页
|
||||
"qlist.title": "我的提问",
|
||||
"qlist.answered": "已回答",
|
||||
"qlist.pending": "待回答",
|
||||
"qlist.private": "私密",
|
||||
"qlist.empty": "还没有提问,快把提问箱分享出去吧~",
|
||||
"qlist.action": "操作",
|
||||
"qlist.answerNow": "去回答",
|
||||
"qlist.sort": "排序",
|
||||
"qlist.status": "状态",
|
||||
"qlist.type": "类型",
|
||||
"qlist.latest": "最新",
|
||||
"qlist.oldest": "最早",
|
||||
"qlist.all": "全部",
|
||||
"qlist.public": "一般提问",
|
||||
"qlist.privateQuestion": "私密提问",
|
||||
"qlist.received": "我收到的提问",
|
||||
"qlist.myChats": "我发起的私聊",
|
||||
"qlist.statsTotal": "总提问数",
|
||||
"qlist.statsAnswered": "已回答",
|
||||
"qlist.statsUnanswered": "未回答",
|
||||
"qlist.statsPrivate": "私密提问",
|
||||
"qlist.statsPinned": "置顶",
|
||||
"qlist.statsChats": "私聊会话",
|
||||
"qlist.searchPlaceholder": "搜索问题或回答内容...",
|
||||
"qlist.searchBtn": "搜索",
|
||||
"qlist.searchClear": "清除搜索",
|
||||
"qlist.questionsTab": "提问",
|
||||
"qlist.votesTab": "投票",
|
||||
"qlist.chatsTab": "私聊",
|
||||
"qlist.receivedChats": "我收到的私聊",
|
||||
"qlist.chatEmpty": "还没有私聊,把提问箱分享出去让大家来私聊吧~",
|
||||
"qlist.pinnedShort": "置顶",
|
||||
"qlist.privateShort": "私密",
|
||||
"qlist.chatStatsTotal": "总私聊",
|
||||
"qlist.chatStatsReceived": "我收到的",
|
||||
"qlist.chatStatsInitiated": "我发起的",
|
||||
"qlist.chatStatsClosed": "已关闭",
|
||||
"qlist.unansweredShort": "待答",
|
||||
"qlist.readShort": "已读",
|
||||
"qlist.unreadShort": "未读",
|
||||
"qitem.markReadShort": "标记",
|
||||
"qlist.pinShort": "置顶",
|
||||
"qlist.unpinShort": "取消置顶",
|
||||
"qlist.myVotes": "我创建的投票",
|
||||
"qlist.loadMore": "加载更多",
|
||||
"qlist.newVote": "新建投票",
|
||||
"qlist.edit": "编辑",
|
||||
"qlist.untitledVote": "未命名投票",
|
||||
"qlist.blocked": "已拉黑",
|
||||
"qlist.unanswered": "未回答",
|
||||
|
||||
// 站点 Logo 后缀(emoji 随机动物 + 后缀组成,如 🐺 的提问箱)
|
||||
"site.logoSuffix": "的提问箱",
|
||||
"site.stats": "提问箱信息统计",
|
||||
|
||||
// 验证码弹窗
|
||||
"captcha.title": "人机验证",
|
||||
"captcha.hint": "请计算下方的算术题以验证你不是机器人",
|
||||
"captcha.refresh": "换一题",
|
||||
"captcha.submit": "验证并提交",
|
||||
"captcha.loading": "加载中...",
|
||||
"captcha.loadFailed": "加载失败",
|
||||
"captcha.loadRetry": "加载失败,请重试",
|
||||
"captcha.inputAnswer": "请输入答案",
|
||||
"captcha.wrongAnswer": "答案错误,请重新计算",
|
||||
"captcha.verifyFailed": "验证失败,请重试",
|
||||
|
||||
// 注册页补充
|
||||
"auth.register.domain.prefix": "个性域名(你的问答箱网址将会是:%s + ",
|
||||
"auth.register.domain.suffix": " + 你在下面文本框中填写的内容)",
|
||||
"auth.register.confirm": "确认密码",
|
||||
"auth.register.language": "界面语言",
|
||||
"auth.register.languageDefault": "跟随站点默认",
|
||||
"auth.register.success": "注册成功,欢迎来到 狼的提问箱!",
|
||||
|
||||
// 探索页补充
|
||||
"explore.recommend": "随机推荐",
|
||||
"explore.search": "搜索标签...",
|
||||
"explore.sortLatest": "最新加入",
|
||||
"explore.sortOldest": "最早加入",
|
||||
"explore.noTags": "无标签",
|
||||
"explore.noRecommend": "暂无推荐用户",
|
||||
"explore.hotTags": "热门标签",
|
||||
"explore.hotQuestions": "热门问题",
|
||||
"explore.noResult": "暂无符合条件的用户。",
|
||||
"explore.lazy": "这个人很懒,什么都没写~",
|
||||
"explore.prevPage": "上一页",
|
||||
"explore.nextPage": "下一页",
|
||||
"explore.loading": "加载中...",
|
||||
"explore.loadFailed": "加载失败",
|
||||
|
||||
// 提问箱密码页
|
||||
"password.title": "此提问箱需要密码",
|
||||
"password.desc": "此提问箱已设置访问密码,请输入密码查看内容",
|
||||
"password.input": "请输入访问密码",
|
||||
"password.enter": "验证进入",
|
||||
"password.submit": "确认",
|
||||
|
||||
// 问题不存在
|
||||
"qitem.notFound": "问题不存在或已被删除",
|
||||
|
||||
// 聊天页
|
||||
"chat.title": "私聊",
|
||||
"chat.input": "输入消息...",
|
||||
"chat.send": "发送",
|
||||
"chat.delete": "删除对话",
|
||||
"chat.block": "拉黑对方",
|
||||
"chat.unblock": "取消拉黑",
|
||||
"chat.empty": "还没有消息,说点什么吧~",
|
||||
"chat.withAsker": "与提问者的私聊",
|
||||
"chat.withUser": "与 %s 的私聊",
|
||||
"chat.closed": "对话已关闭",
|
||||
"chat.closedNoSend": "对话已关闭,无法发送新消息",
|
||||
"chat.remaining": "消息剩余:%d 条(共 %d 条)",
|
||||
"chat.me": "我",
|
||||
"chat.other": "对方",
|
||||
"chat.userBlocked": "该用户已被拉黑",
|
||||
"chat.addImage": "添加图片(可选,最大5MB)",
|
||||
"chat.confirm": "确认",
|
||||
"chat.confirmBlock": "确定要拉黑该用户吗?他将无法再发送私信。",
|
||||
"chat.confirmUnblock": "确定要取消屏蔽该用户吗?他将可以再次发送私信。",
|
||||
"chat.deleteConfirm": "确定要删除这条私聊对话吗?对方将无法再看到此对话,且操作不可恢复。",
|
||||
"maintenance.title": "NekoBox 维护中...",
|
||||
"maintenance.desc": "NekoBox 正在进行维护,服务暂时不可用。过一会再来吧~",
|
||||
|
||||
// 单题分享(v4)
|
||||
"qitem.shareCard": "分享此提问",
|
||||
|
||||
// 追问(v4)
|
||||
"followup.title": "追问记录",
|
||||
"followup.content": "追问:",
|
||||
"followup.answerPlaceholder": "回答这条追问...",
|
||||
"followup.answerBtn": "回答追问",
|
||||
"followup.waiting": "等待回答中...",
|
||||
"followup.askMore": "继续追问",
|
||||
"followup.remaining": "还可追问 %d / %d 次",
|
||||
"followup.contentPlaceholder": "补充你的问题...",
|
||||
"followup.waitingReply": "你的追加提问已发出,等待提问箱主人回复中...",
|
||||
"followup.submit": "提交追问",
|
||||
|
||||
// 置顶(v4)
|
||||
"qlist.pinned": "置顶中",
|
||||
"qlist.pin": "置顶",
|
||||
"qlist.unpin": "取消置顶",
|
||||
"qlist.readStatus": "阅读状态",
|
||||
"qlist.read": "已读",
|
||||
"qlist.unread": "未读",
|
||||
"qlist.statsRead": "已读",
|
||||
"qlist.statsUnread": "未读",
|
||||
|
||||
// 提问成功页(v4)
|
||||
"success.title": "提问发送成功!",
|
||||
"success.yourQuestion": "你的提问:",
|
||||
"success.emailSent": "已向你的邮箱发送了该提问的私密链接,也可以使用下方链接随时查看提问、接收回答与继续追问。",
|
||||
"success.saveLink": "<strong>请务必保存下面的私密链接!</strong>由于你没有留下邮箱,此链接(含口令 Token)是你查看提问、接收回答与继续追问的<strong>唯一凭证</strong>,丢失后将无法找回。",
|
||||
"success.privateLink": "你的提问私密链接(点击复制保存)",
|
||||
"success.copy": "复制",
|
||||
"success.copied": "已复制 ✓",
|
||||
"success.copyFailed": "复制失败",
|
||||
"success.token": "口令 Token:%s(提问人凭 Token 访问私密链接)",
|
||||
"success.viewQuestion": "查看我的提问",
|
||||
"success.backToBox": "返回%s的提问箱",
|
||||
"success.pageTitle": "提问成功 - %s",
|
||||
|
||||
// 停用页
|
||||
"deactivate.title": "账号停用",
|
||||
"deactivate.desc": "停用后你的提问箱将无法访问,且所有数据将被删除,此操作不可恢复!",
|
||||
"deactivate.confirm": "我确认要停用账号",
|
||||
"deactivate.submit": "停用账号",
|
||||
|
||||
// 匿名投票
|
||||
"nav.votes": "投票",
|
||||
|
||||
"common.back": "返回",
|
||||
|
||||
"vote.listTitle": "投票管理",
|
||||
"vote.newTitle": "新建投票",
|
||||
"vote.editTitle": "编辑投票",
|
||||
"vote.resultsTitle": "投票结果",
|
||||
"vote.statsTotal": "投票总数",
|
||||
"vote.statsPublished": "进行中",
|
||||
"vote.createNew": "新建投票",
|
||||
"vote.typeSingle": "单选",
|
||||
"vote.typeMultiple": "多选",
|
||||
"vote.typeRating": "评分",
|
||||
"vote.typeRank": "排序",
|
||||
"vote.typeForm": "表单收集",
|
||||
"vote.statusNotStarted": "未开始",
|
||||
"vote.statusDraft": "草稿",
|
||||
"vote.statusPublished": "进行中",
|
||||
"vote.statusEnded": "已结束",
|
||||
"vote.statusArchived": "已归档",
|
||||
"vote.participants": "参与",
|
||||
"vote.remainLabel": "剩余",
|
||||
"vote.perpetual": "无限期",
|
||||
"vote.durationDay": "天",
|
||||
"vote.durationHour": "小时",
|
||||
"vote.durationMinute": "分钟",
|
||||
"vote.createdAt": "创建于",
|
||||
"vote.edit": "编辑",
|
||||
"vote.results": "结果",
|
||||
"vote.preview": "预览",
|
||||
"vote.page.mustComplete": "请完成",
|
||||
"vote.page.rankHintRequired": "排名 1-N(必填)",
|
||||
"vote.page.rankHintOptional": "排名 1-N(可选,可只排部分)",
|
||||
"vote.page.previewHint": "预览模式:这是发布前的页面样例,提交已禁用",
|
||||
"vote.page.previewSubmitHint": "预览模式,发布后即可提交",
|
||||
"vote.publish": "发布",
|
||||
"vote.close": "结束",
|
||||
"vote.share": "复制链接",
|
||||
"vote.copied": "已复制",
|
||||
"vote.shareURL": "投票分享链接",
|
||||
"vote.confirmPublish": "确定发布该投票吗?发布后即生成可分享链接。",
|
||||
"vote.confirmClose": "确定结束该投票吗?结束后参与者将无法再投票。",
|
||||
"vote.confirmDelete": "确定删除该投票吗?投票数据将一并删除,不可恢复!",
|
||||
"vote.manageEntry": "管理投票",
|
||||
|
||||
"vote.manageTitle": "管理投票",
|
||||
"vote.manageDesc": "创建与管理你的匿名投票", "vote.empty": "还没有投票,点击右上角\"新建投票\"开始吧~",
|
||||
"vote.formLockedHint": "该投票已发布,仅可修改基本信息;类型与选项已锁定(避免破坏已收集的投票数据)",
|
||||
"vote.formBasic": "基本设置",
|
||||
"vote.formTitle": "投票标题",
|
||||
"vote.formTitlePlaceholder": "例如:今天吃什么?",
|
||||
"vote.formDescription": "描述 / 说明",
|
||||
"vote.formDescriptionPlaceholder": "补充说明(可选)",
|
||||
"vote.formType": "投票类型",
|
||||
"vote.formVisibility": "展示方式",
|
||||
"vote.formVisibilityPublic": "公开展示(探索页 + 提问箱页)",
|
||||
"vote.formVisibilityLinkOnly": "仅链接分享",
|
||||
"vote.formVoterScope": "投票范围",
|
||||
"vote.formVoterScopeAnyone": "任何人(含匿名)",
|
||||
"vote.formVoterScopeRegistered": "仅注册用户",
|
||||
"vote.formShowResult": "结果可见时机",
|
||||
"vote.formShowResultAfterVote": "投票后立即可见",
|
||||
"vote.formShowResultAfterEnd": "结束后可见",
|
||||
"vote.formShowResultOwnerOnly": "仅我可见",
|
||||
"vote.formStartAt": "开始时间(留空立即开始)",
|
||||
"vote.formEndAt": "结束时间(留空不限制)",
|
||||
"vote.formMaxChoices": "最多可选数量",
|
||||
"vote.formMaxVotesPerFingerprint": "每个投票每个设备限 1 次,使用同一浏览器重复提交将被拦截。",
|
||||
"vote.formMaxVotesPerAccount": "每个投票每个注册账号限 1 次,使用同一账号重复提交将被拦截。",
|
||||
"vote.formAllowCustom": "允许参与者补充自定义选项",
|
||||
"vote.formRequireCaptcha": "匿名投票需通过验证码",
|
||||
"vote.formOptions": "投票选项",
|
||||
"vote.formRatingHint": "评分题无需配置选项(1-10 分)",
|
||||
"vote.addOption": "添加选项",
|
||||
"vote.optionPlaceholder": "选项内容",
|
||||
"vote.formFields": "表单字段",
|
||||
"vote.addField": "添加字段",
|
||||
"vote.field": "字段",
|
||||
"vote.formFieldType": "字段类型",
|
||||
"vote.fieldTypeText": "单行文本",
|
||||
"vote.fieldTypeTextarea": "多行文本",
|
||||
"vote.fieldTypeSelect": "下拉选择",
|
||||
"vote.fieldTypeRadio": "单选",
|
||||
"vote.fieldTypeCheckbox": "多选",
|
||||
"vote.fieldTypeNumber": "数字",
|
||||
"vote.fieldTypeRank": "排序",
|
||||
"vote.page.selectPlaceholder": "请选择",
|
||||
"vote.page.avgNumber": "平均",
|
||||
"vote.page.fieldFilled": "已填写",
|
||||
"vote.fieldTypeRating": "评分",
|
||||
"vote.formFieldLabel": "字段标签",
|
||||
"vote.formFieldRequired": "必填",
|
||||
"vote.formFieldMaxLength": "字数上限(0 不限制)",
|
||||
"vote.formFieldOptions": "选项",
|
||||
"vote.formFieldOptionsHint": "点击下方「添加选项」逐条添加,无需用逗号分隔",
|
||||
"vote.fieldAllowCustom": "允许补充自定义选项",
|
||||
"vote.formFieldOptionsPlaceholder": "如:满意,一般,不满意",
|
||||
"vote.createDraft": "保存草稿",
|
||||
"vote.builderHintOptions": "至少需要 2 个选项",
|
||||
"vote.builderHintFields": "请至少添加 1 个字段",
|
||||
"vote.builderHintFieldOptions": "选择题/排序题请填写选项(排序题至少 2 个)",
|
||||
"vote.resultsAnswered": "回答数",
|
||||
"vote.page.rankedTimes": "被排次数",
|
||||
"vote.resultsTotal": "总参与人数",
|
||||
"vote.resultsSubmissions": "表单回复",
|
||||
"vote.resultsViewTexts": "查看文本提交",
|
||||
"vote.resultsToggleHint": "点击展开或收起文本回复明细",
|
||||
"vote.resultsOptions": "投票结果",
|
||||
"vote.resultsVotes": "票",
|
||||
"vote.export": "导出 CSV",
|
||||
"vote.resultsEmpty": "还没有人参与,快来分享吧~",
|
||||
|
||||
// 匿名投票参与页
|
||||
"vote.inlineTitle": "投票",
|
||||
"vote.page.by": "发起的投票",
|
||||
"vote.page.goVote": "去投票",
|
||||
"vote.page.notStarted": "未开始",
|
||||
"vote.page.notStartedHint": "该投票尚未开始,敬请期待~",
|
||||
"vote.page.ended": "已结束",
|
||||
"vote.page.endedHint": "该投票已结束",
|
||||
"vote.page.active": "进行中",
|
||||
"vote.page.participated": "已参与",
|
||||
"vote.page.loginRequired": "该投票仅限注册用户参与,请先登录。",
|
||||
"vote.page.anonymousHint": "该投票允许匿名参与,你的身份不会被记录(同一设备最多可参与 1 次)。",
|
||||
"vote.page.submit": "提交投票",
|
||||
"vote.page.alreadyVoted": "你已参与过该投票,感谢参与!",
|
||||
"vote.page.resultsTitle": "投票结果",
|
||||
"vote.page.totalVotes": "总参与",
|
||||
"vote.page.avgRating": "平均分",
|
||||
"vote.page.avgRank": "平均排名",
|
||||
"vote.page.optionColumn": "选项",
|
||||
"vote.page.ratingLabel": "请评分",
|
||||
"vote.page.ratingUnit": "分",
|
||||
"vote.page.rankHint": "请为每个选项填写 1-N 的排名(数字越小越靠前,不可重复)",
|
||||
"vote.page.rankPlaceholder": "排名",
|
||||
"vote.page.multipleHint": "可多选",
|
||||
"vote.page.customOption": "补充选项(可选)",
|
||||
"vote.page.customPlaceholder": "填写你心中的其他选项",
|
||||
"vote.page.customOther": "其他",
|
||||
"vote.page.customFieldPlaceholder": "填写自定义选项…",
|
||||
"vote.page.customStats": "自定义补充选项",
|
||||
"vote.page.formCount": "已收到回复",
|
||||
"vote.page.ownerManage": "管理此投票(仅你可见结果)",
|
||||
|
||||
// 单份投票的定量收集
|
||||
"vote.formQuotaLimit": "收集上限(份)",
|
||||
"vote.formQuotaHint": "0 表示不限制;收集到指定份数后自动结束该投票。",
|
||||
"vote.flash.notFound": "投票不存在或已失效",
|
||||
"vote.flash.notPublished": "该投票尚未发布",
|
||||
"vote.flash.archived": "该投票已归档,无法参与",
|
||||
"vote.flash.ended": "该投票已结束",
|
||||
"vote.flash.notStarted": "该投票尚未开始",
|
||||
"vote.flash.success": "投票成功!感谢参与",
|
||||
"vote.err.noChoice": "请至少选择一个选项",
|
||||
"vote.err.tooManyChoices": "最多只能选择 %d 个选项",
|
||||
"vote.err.pickOne": "请选择一个选项",
|
||||
"vote.err.invalidOption": "存在无效的选项",
|
||||
"vote.err.optionDuplicate": "选项不能重复选择",
|
||||
"vote.err.ratingRequired": "请给出 1-10 分的评分",
|
||||
"vote.err.rankRequired": "请为每个选项填写 1-%d 的排名",
|
||||
"vote.err.rankDuplicate": "排名不能重复",
|
||||
"vote.err.fieldRequired": "请填写「%s」",
|
||||
"vote.err.fieldCustomRequired": "请填写「%s」的自定义选项",
|
||||
"vote.err.fieldCustomTooLong": "「%s」的自定义选项不能超过 %d 字",
|
||||
"vote.err.fieldInvalidOption": "「%s」的选项无效",
|
||||
"vote.err.fieldConfigError": "「%s」选项配置错误",
|
||||
"vote.err.fieldRankIncomplete": "请填写「%s」的完整排名",
|
||||
"vote.err.fieldRankRange": "「%s」排名必须是 1-%d 之间的数字",
|
||||
"vote.err.fieldRankDuplicate": "「%s」排名不能重复",
|
||||
"vote.err.fieldTooLong": "「%s」超出字数限制(最多 %d 字)",
|
||||
"vote.err.fieldNotNumber": "「%s」必须是数字",
|
||||
"vote.err.fieldRating": "「%s」请给出 1-10 分的评分",
|
||||
"vote.err.unknownType": "未知的投票类型",
|
||||
"vote.err.customTooLong": "自定义选项不能超过 %d 字",
|
||||
"vote.err.blockWords": "提交内容中包含了投票发起人设置的屏蔽词,无法提交",
|
||||
"vote.err.serialize": "提交内容序列化失败",
|
||||
"captcha.error": "验证码错误",
|
||||
"captcha.errEmpty": "验证码不能为空",
|
||||
"captcha.errFormat": "验证码格式错误,请刷新后重试",
|
||||
"captcha.errAnswerFormat": "验证码答案格式错误",
|
||||
"captcha.errExpired": "验证码已过期,请刷新后重试",
|
||||
"captcha.errService": "验证码服务异常,请稍后重试",
|
||||
"captcha.errAnswerWrong": "验证码答案错误",
|
||||
"censor.unavailable": "内容审核服务暂时不可用,请稍后再试",
|
||||
|
||||
// 功能管理:提问 / 私聊 / 投票 的开关、定时开关与定量收集
|
||||
"admin.tabAccount": "用户设置",
|
||||
"admin.featuresHint": "在「提问 / 私聊 / 投票」面板中管理各功能的开关、开放时段与收集上限;达到上限后对应功能自动关闭。",
|
||||
"admin.featuresEntry": "设置",
|
||||
"admin.featureHint.question": "关闭后访客无法提交新提问;达到收集上限后自动停止接收(含私密提问)。",
|
||||
"admin.featureHint.chat": "关闭后访客无法发起新的私聊;已有会话不受影响。",
|
||||
"admin.featureHint.vote": "关闭后提问箱页不再展示投票板块,访客也无法参与你的投票。单份投票可在编辑页单独设置收集上限。",
|
||||
"admin.featureEnabled": "开启该功能",
|
||||
"admin.featureOpenAt": "定时开放",
|
||||
"admin.featureCloseAt": "定时关闭",
|
||||
"admin.featureTimeHint": "留空表示不限制;开放时间之前、关闭时间之后该功能均不可用。",
|
||||
"admin.featureSchedule": "循环定时(每周循环)",
|
||||
"admin.featureScheduleStart": "每日开始",
|
||||
"admin.featureScheduleEnd": "每日结束",
|
||||
"admin.featureScheduleHint": "勾选每周固定开放日并设置每日时间段,按周循环生效;全部留空表示不启用。只填开放日(不填时间)表示该天全天开放;只填时间(不勾选任何日)表示每天该时段开放。",
|
||||
"admin.featureMode": "收集模式",
|
||||
"admin.featureModeAlways": "长期开放",
|
||||
"admin.featureModeWindow": "定时收集",
|
||||
"admin.featureModeRecurring": "循环定时",
|
||||
"admin.featureModeHint": "长期开放:不限时间,保持开放直到手动关闭;定时收集:一次性开放 / 关闭时间窗口;循环定时:每周固定开放日循环生效。三种模式互斥,保存时未选模式的设置将被清空。",
|
||||
"admin.featureQuotaLimit": "收集上限(条 / 份)",
|
||||
"admin.featureQuotaHint": "0 表示不限制;累计收集达到上限后自动关闭,重置计数后可开启下一轮。",
|
||||
"admin.featureQuotaCount": "已收集",
|
||||
"admin.featureQuotaUnlimited": "不限制",
|
||||
"admin.featureQuotaResetAt": "上次重置:",
|
||||
"admin.featureResetQuota": "重置计数",
|
||||
"admin.featureSave": "保存该功能设置",
|
||||
|
||||
// 功能管理:状态与提示
|
||||
"feature.name.question": "提问",
|
||||
"feature.name.chat": "私聊",
|
||||
"feature.name.vote": "投票",
|
||||
"feature.statusOpen": "进行中",
|
||||
"feature.status.disabled": "已关闭",
|
||||
"feature.status.not_started": "未开始",
|
||||
"feature.status.ended": "已结束",
|
||||
"feature.status.quota_reached": "已达上限",
|
||||
"feature.saved": "功能设置已保存",
|
||||
"feature.errTime": "%s 的时间格式不正确,请使用日期时间选择器",
|
||||
"feature.errTimeRange": "%s 的定时关闭时间必须晚于定时开放时间",
|
||||
"feature.errQuota": "%s 的收集上限需为 0 到 1000000 之间的整数",
|
||||
"feature.errInvalid": "未知的功能类型",
|
||||
"feature.quotaReset": "%s 的收集计数已重置",
|
||||
"feature.errScheduleHalf": "%s 的循环定时开始与结束时间必须同时填写",
|
||||
"feature.errScheduleTime": "%s 的循环定时时间格式不正确,请使用时间选择器",
|
||||
"feature.errScheduleRange": "%s 的循环定时结束时间必须晚于开始时间",
|
||||
|
||||
// 功能关闭时对访客的提示
|
||||
"feature.disabled.question": "提问箱主人已关闭提问功能",
|
||||
"feature.disabled.chat": "该提问箱未开启私聊功能",
|
||||
"feature.disabled.vote": "该提问箱已关闭投票功能",
|
||||
"feature.not_started.question": "提问功能尚未开放",
|
||||
"feature.not_started.chat": "私聊功能尚未开放",
|
||||
"feature.not_started.vote": "投票功能尚未开放",
|
||||
"feature.ended.question": "提问功能已结束收集",
|
||||
"feature.ended.chat": "私聊功能已结束",
|
||||
"feature.ended.vote": "投票功能已结束",
|
||||
"feature.quota_reached.question": "提问功能已达到收集上限",
|
||||
"feature.quota_reached.chat": "私聊功能已达到收集上限",
|
||||
"feature.quota_reached.vote": "投票功能已达到收集上限",
|
||||
|
||||
// 认证:访客可见的提示(P0)
|
||||
"auth.errBadCredential": "邮箱或密码错误",
|
||||
"auth.errUserNotFound": "用户不存在",
|
||||
"auth.errEmailFrequent": "邮件发送太频繁,请稍后再试",
|
||||
"auth.errEmailFailed": "邮件发送失败,请稍后再试",
|
||||
"auth.errCodeExpired": "验证码已过期",
|
||||
"auth.errPasswordChanged": "密码修改成功",
|
||||
"auth.errLoginRequired": "请先登录",
|
||||
"auth.errDuplicateEmail": "该邮箱已被注册",
|
||||
"auth.errDuplicateDomain": "该个性域名已被使用",
|
||||
|
||||
// 提问箱页:访客可见(P0)
|
||||
"question.errWrongPassword": "密码错误",
|
||||
"question.errAskPasswordWrong": "提问密码错误",
|
||||
"question.errLoginRequired": "提问箱的主人设置了仅注册用户才能提问,请先登录。",
|
||||
"question.errSelfChat": "不能给自己发起私聊",
|
||||
"question.errBlockedChat": "你已被对方拉黑,无法发起私聊",
|
||||
"question.errChatDailyLimit": "你今日已达发送上限(%d条),请明天再试",
|
||||
"question.errDuplicateSubmit": "检测到重复提交,请稍后再试",
|
||||
"question.errImageTooLarge": "图片文件大小不能大于 5Mb",
|
||||
"question.errUploadImageFailed": "上传图片失败",
|
||||
"question.errBlockWords": "提问内容中包含了提问箱主人设置的屏蔽词,发送失败",
|
||||
"question.errAnsweredLocked": "已回答的问题不能标记为未读",
|
||||
"question.flash.chatSent": "私聊请求已发送!你可以通过以下链接查看对话:%s",
|
||||
"question.flash.answered": "回答发布成功!",
|
||||
"question.flash.operated": "操作成功",
|
||||
"question.flash.markedRead": "已标记为已读",
|
||||
"question.flash.markedUnread": "已标记为未读",
|
||||
|
||||
// 追问:访客/箱主可见(P0)
|
||||
"followup.errNoPermission": "无权操作",
|
||||
"followup.errNotAnswered": "问题尚未被回答,暂时不能追问",
|
||||
"followup.errLimit": "每条提问最多追问 %d 次,已达上限",
|
||||
"followup.errWaitReply": "请等待主人回复上一条追问后再继续追问",
|
||||
"followup.errNotFound": "追问不存在",
|
||||
"followup.flash.sent": "追问发送成功!",
|
||||
"followup.flash.answered": "回答成功!",
|
||||
|
||||
// 后台设置:箱主可见(P1)
|
||||
"admin.flash.profileUpdated": "更新个人信息成功",
|
||||
"admin.flash.chatUpdated": "私聊设置更新成功",
|
||||
"admin.flash.pagePwdOff": "已关闭页面密码访问",
|
||||
"admin.flash.pagePwdUpdated": "页面访问密码已更新",
|
||||
"admin.flash.askPwdOff": "已关闭提问密码",
|
||||
"admin.flash.askPwdUpdated": "提问密码已更新",
|
||||
"admin.flash.tagsTooMany": "标签不能超过 5 个",
|
||||
"admin.flash.tagsUpdated": "更新标签成功",
|
||||
"admin.flash.tagTooLong": "每个标签不能超过 5 个字符:%s",
|
||||
"admin.flash.blockWordsTooMany": "屏蔽词不能超过 10 个",
|
||||
"admin.flash.blockWordTooLong": "屏蔽词长度不能超过 10 个字符:%s",
|
||||
"admin.flash.harassmentUpdated": "更新防骚扰设置成功",
|
||||
"admin.flash.blockWordsUpdated": "屏蔽词已更新",
|
||||
"admin.flash.deactivated": "您的账号已停用,感谢您使用 狼的提问箱。期待未来还能再见 👋🏻",
|
||||
"admin.export.errUser": "导出失败:获取用户信息失败",
|
||||
"admin.export.errQuestion": "导出失败:获取问题信息失败",
|
||||
|
||||
// 投票管理:箱主可见(P1)
|
||||
"vote.err.invalidID": "无效的投票 ID",
|
||||
"vote.err.notExist": "投票不存在",
|
||||
"vote.err.noPermission": "无权操作该投票",
|
||||
"vote.err.type": "未知的投票类型",
|
||||
"vote.err.titleRequired": "请填写投票标题",
|
||||
"vote.err.titleTooLong": "投票标题不能超过 100 字",
|
||||
"vote.err.visibility": "未知的可见性设置",
|
||||
"vote.err.voterScope": "未知的投票范围设置",
|
||||
"vote.err.showResult": "未知的结果展示设置",
|
||||
"vote.err.timeRange": "结束时间必须晚于开始时间",
|
||||
"vote.err.quota": "收集上限需为 0 到 1000000 之间的整数",
|
||||
"vote.err.optionsTooFew": "请至少添加 2 个选项",
|
||||
"vote.err.optionsFormat": "选项数据格式错误",
|
||||
"vote.err.optionTooLong": "单个选项内容不能超过 %d 字",
|
||||
"vote.err.maxChoicesExceed": "最多可选数量不能超过选项总数",
|
||||
"vote.err.fieldsTooFew": "请至少添加 1 个表单字段",
|
||||
"vote.err.fieldsFormat": "表单字段数据格式错误",
|
||||
"vote.err.fieldsTooMany": "表单字段不能超过 50 个",
|
||||
"vote.err.fieldType": "存在未知的表单字段类型",
|
||||
"vote.err.fieldLabelMissing": "第 %d 个字段缺少标签",
|
||||
"vote.err.fieldLabelTooLong": "第 %d 个字段的标签不能超过 100 字",
|
||||
"vote.err.fieldLabelDuplicate": "字段标签「%s」重复,请使用不同的标签",
|
||||
"vote.err.fieldMaxLength": "第 %d 个字段的字数上限需在 0-2000 之间",
|
||||
"vote.err.fieldReservedOption": "第 %d 个字段(%s)的选项内容包含保留值,请更换",
|
||||
"vote.err.fieldOptionsTooFew": "第 %d 个字段(%s)请至少填写 1 个选项",
|
||||
"vote.err.fieldRankTooFew": "第 %d 个字段(%s)排序题至少需要 2 个选项",
|
||||
"vote.err.fieldSerialize": "字段选项序列化失败",
|
||||
"vote.err.editClosed": "已结束或归档的投票不允许编辑",
|
||||
"vote.err.publishDraftOnly": "只有草稿状态的投票可以发布",
|
||||
"vote.err.closePublishedOnly": "只有进行中的投票可以结束",
|
||||
"vote.err.publishTitleRequired": "请先填写投票标题再发布",
|
||||
"vote.err.publishFormFieldsRequired": "表单类型投票至少需要 1 个字段",
|
||||
"vote.err.publishOptionsRequired": "选项投票至少需要 2 个选项",
|
||||
"vote.err.optionUpdateFailed": "选项更新失败,请重试",
|
||||
"vote.err.fieldUpdateFailed": "表单字段更新失败,请重试",
|
||||
"vote.flash.published": "投票已发布!分享链接:%s",
|
||||
"vote.flash.updated": "投票信息已更新(进行中的投票不可修改类型与选项)",
|
||||
"vote.flash.draftSaved": "已保存到草稿",
|
||||
"vote.flash.closed": "投票已结束",
|
||||
"vote.flash.deleted": "投票已删除",
|
||||
"vote.err.timeFormat": "时间格式不正确,请使用日期时间选择器",
|
||||
"vote.err.maxChoicesLimit": "最多可选数量不能超过 20",
|
||||
"vote.err.descriptionTooLong": "投票描述不能超过 5000 字",
|
||||
"profile.err.avatarTooLarge": "头像文件太大,最大支持 2MB",
|
||||
"profile.err.backgroundTooLarge": "背景图文件太大,最大支持 2MB",
|
||||
"profile.err.newPasswordTooShort": "新密码长度不能少于 8 位",
|
||||
"profile.err.badOldPassword": "旧密码输入错误",
|
||||
"admin.export.errCreateExcel": "导出失败:创建Excel文件失败",
|
||||
"admin.export.errWriteExcel": "导出失败:写入Excel文件失败",
|
||||
|
||||
// profile 设置页 UI 重构:卡片分区 / 头像背景裁剪 / 改密强制登出
|
||||
"profile.card.basic": "基础资料",
|
||||
"profile.card.avatarBg": "头像与背景",
|
||||
"profile.card.qr": "二维码样式",
|
||||
"profile.card.password": "修改密码",
|
||||
"profile.avatarCropHint": "裁剪框已锁定为 1:1 正方形",
|
||||
"profile.backgroundCropHint": "裁剪框已锁定为 16:9 宽屏",
|
||||
"profile.cropTitle": "裁剪图片",
|
||||
"profile.cropConfirm": "确认裁剪",
|
||||
"profile.err.avatarRatio": "头像图片必须为 1:1 正方形,请裁剪后再上传",
|
||||
"profile.err.backgroundRatio": "背景图片必须为 16:9 宽高比,请裁剪后再上传",
|
||||
"profile.flash.passwordChanged": "密码修改成功,已退出登录,请使用新密码重新登录",
|
||||
"profile.pwdNote": "保存后当前会话立即失效,需使用新密码重新登录",
|
||||
"profile.pickAvatar": "更换头像",
|
||||
"profile.pickBackground": "更换背景",
|
||||
"profile.saveBasic": "保存基础资料",
|
||||
"profile.saveMedia": "保存头像与背景",
|
||||
"profile.savePassword": "确认修改密码",
|
||||
"profile.saveQR": "保存二维码样式",
|
||||
"profile.saveSocial": "保存社交链接",
|
||||
"profile.err.cropLibUnavailable": "图片裁剪组件加载失败,请刷新页面后重试",
|
||||
|
||||
// 验证码 JSON 接口:前端消费(P2)
|
||||
"captcha.json.badRequest": "请求格式错误",
|
||||
"captcha.json.idRequired": "验证码 ID 不能为空",
|
||||
"captcha.json.genFailed": "生成验证码失败",
|
||||
"chat.errDeletedByOwner": "该私聊对话已被对方删除。",
|
||||
"chat.errBlockedView": "你已被对方拉黑,无法查看该私聊",
|
||||
"chat.errEmpty": "消息不能为空",
|
||||
"chat.errTooLong": "消息内容过长,请控制在 %d 字以内",
|
||||
"chat.errConvDeletedSend": "该对话已被删除,无法发送消息",
|
||||
"chat.errBlockedSend": "你已被对方拉黑,无法发送私信",
|
||||
"chat.errBlockWords": "消息中包含了提问箱主人设置的屏蔽词,无法发送",
|
||||
"chat.errDailyLimit": "你今日已达发送上限(%d条),请明天再试",
|
||||
"chat.errLimitReached": "对话已达到上限,无法发送新消息",
|
||||
"chat.errChatClosed": "该箱主已关闭私聊功能,无法发送消息",
|
||||
"chat.errImageTooLarge": "图片大小不能超过 %dMB",
|
||||
"chat.errUploadFailed": "图片上传失败,请稍后重试",
|
||||
"chat.errNoPermission": "无权执行此操作",
|
||||
"chat.flash.sent": "消息发送成功",
|
||||
"chat.flash.deleted": "私聊对话已删除",
|
||||
"chat.flash.operated": "操作成功",
|
||||
"image.errTooLarge": "图片尺寸过大,最大支持 %d×%d 像素,请压缩后重新上传",
|
||||
"internal.errFlash": "服务内部错误,请稍后重试。",
|
||||
"internal.errServer": "服务器内部错误",
|
||||
"home.errStats": "获取统计信息失败",
|
||||
"pixel.errPath": "非法的请求路径",
|
||||
"proxy.errNotFound": "页面不存在",
|
||||
"proxy.errInternal": "服务网关内部错误",
|
||||
"explore.errRandomUser": "获取随机用户失败",
|
||||
// 表单校验
|
||||
"form.answer.content": "回答内容不能为空",
|
||||
"form.answer.contentTooLong": "回答内容不能超过 %d 个字符",
|
||||
"form.email.required": "请填写有效的电子邮箱地址",
|
||||
"form.followup.answer": "追问回答不能为空",
|
||||
"form.followup.answerTooLong": "追问回答不能超过 %d 个字符",
|
||||
"form.followup.content": "追问内容不能为空",
|
||||
"form.followup.contentTooLong": "追问内容不能超过 %d 个字符",
|
||||
"form.login.password": "请输入密码",
|
||||
"form.profile.backgroundimagealpha": "请填写二维码背景透明度",
|
||||
"form.profile.colorHex": "请填写 7 位十六进制颜色代码(含 #)",
|
||||
"form.profile.dotscale": "请填写二维码点大小",
|
||||
"form.profile.intro": "个人介绍不能为空,且不超过 100 个字符",
|
||||
"form.profile.linkMax": "主页链接长度不能超过 30 个字符",
|
||||
"form.profile.name": "昵称不能为空,且不超过 20 个字符",
|
||||
"form.profile.newPassword": "新密码长度不能超过 30 个字符",
|
||||
"form.profile.passwordMax": "密码长度不能超过 30 个字符",
|
||||
"form.question.content": "问题内容不能为空",
|
||||
"form.question.contentTooLong": "问题内容不能超过 %d 个字符",
|
||||
"form.question.receiveReplyEmail": "请填写有效的电子邮箱地址以接收回复",
|
||||
"form.recaptcha": "请完成人机验证",
|
||||
"form.recover.newPassword": "请设置 8 至 30 位的新密码",
|
||||
"form.recover.repeatPassword": "两次输入的新密码不一致",
|
||||
"form.register.domain": "个性域名只能包含字母、数字和下划线,长度为 3 至 20 位",
|
||||
"form.register.email": "请填写有效的电子邮箱地址(不超过 100 个字符)",
|
||||
"form.register.name": "昵称不能为空,且不超过 20 个字符",
|
||||
"form.register.password": "请设置 8 至 30 位的密码",
|
||||
"form.register.recaptcha": "无法加载人机验证,请刷新页面或切换网络后重试",
|
||||
"form.register.repeatPassword": "两次输入的密码不一致",
|
||||
}
|
||||
@@ -0,0 +1,842 @@
|
||||
// Copyright 2022 E99p1ant. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package i18n
|
||||
|
||||
// zhTWDict 繁體中文文案。
|
||||
var zhTWDict = map[string]string{
|
||||
// 導覽
|
||||
"nav.explore": "探索",
|
||||
"nav.mine": "我的",
|
||||
"nav.register": "註冊",
|
||||
"nav.login": "登入",
|
||||
"nav.ask": "提問",
|
||||
"nav.settings": "設定",
|
||||
"nav.lang": "語言",
|
||||
|
||||
// 通用
|
||||
"common.login": "登入",
|
||||
"common.forgot": "忘記密碼",
|
||||
"common.submit": "送出",
|
||||
"common.cancel": "取消",
|
||||
"common.save": "儲存",
|
||||
"common.close": "關閉",
|
||||
"common.delete": "刪除",
|
||||
"common.moveUp": "上移",
|
||||
"common.moveDown": "下移",
|
||||
"common.share": "分享",
|
||||
"common.verifying": "驗證中...",
|
||||
"common.submitting": "提交中...",
|
||||
"common.uploading": "上傳中...",
|
||||
"common.lang": "語言",
|
||||
"common.menu": "選單",
|
||||
|
||||
"common.pleaseWait": "請稍候...",
|
||||
"common.backHome": "返回首頁",
|
||||
"common.theme": "切換深色/淺色模式",
|
||||
|
||||
// 站點
|
||||
"site.title": "狼的提問箱 | 匿名提問箱",
|
||||
"site.description": "狼的提問箱——一個無需註冊、可匿名提問的匿名提問箱,安全地傾訴與回應。",
|
||||
"site.keywords": "匿名提問箱,提問箱,匿名提問,狼的提問箱,匿名問答,匿名提問網站",
|
||||
"site.footer.visitor": "您是本站第 %s 位訪客",
|
||||
"site.footer.pageview": "本頁面已被訪問 %s 次",
|
||||
"site.footer.runtime": "提問箱已成功存活",
|
||||
"site.footer.admin": "找站長",
|
||||
"site.footer.notice": "公告板",
|
||||
"site.footer.chat": "聊天室",
|
||||
"site.footer.drive": "盤",
|
||||
"site.footer.status": "監控板",
|
||||
"site.footer.nav": "導航頁",
|
||||
"site.maintenance": "本站正在維護中,請稍後再來~",
|
||||
|
||||
// 認證
|
||||
"auth.login.title": "使用者登入",
|
||||
"auth.login.email": "電子郵件",
|
||||
"auth.login.password": "密碼",
|
||||
"auth.login.submit": "登入",
|
||||
"auth.login.forgot": "忘記密碼",
|
||||
"auth.register.title": "使用者註冊",
|
||||
"auth.register.name": "暱稱",
|
||||
"auth.register.email": "電子郵件",
|
||||
"auth.register.password": "密碼",
|
||||
"auth.register.submit": "註冊",
|
||||
"auth.forgot.title": "忘記密碼",
|
||||
"auth.forgot.email": "電子郵件",
|
||||
"auth.forgot.submit": "傳送重設郵件",
|
||||
"auth.forgot.submitBtn": "找回密碼",
|
||||
"auth.forgot.sent": "郵件已傳送至 %s,請查收。",
|
||||
"auth.recover.title": "重設密碼",
|
||||
"auth.recover.greeting": "%s,您正在重設您的密碼:",
|
||||
"auth.recover.password": "新密碼",
|
||||
"auth.recover.confirm": "確認密碼",
|
||||
"auth.recover.submit": "重設密碼",
|
||||
|
||||
// 探索頁
|
||||
"explore.title": "探索使用者標籤",
|
||||
"explore.notice": "此處展示已開啟<span class=\"uk-text-bold\">「在首頁展示我的標籤」</span>的使用者。該功能預設關閉,若希望自己的提問箱在這裡被發現,請前往 <a href=\"/user/profile\" class=\"uk-text-bold\">個人設定</a> 手動開啟。",
|
||||
"explore.shuffle": "換一批",
|
||||
"explore.empty": "暫時沒有可展示的使用者,快去開啟吧~",
|
||||
"explore.hotVotes": "熱門投票",
|
||||
"explore.questionsTab": "提問",
|
||||
"explore.votesTab": "投票",
|
||||
"explore.votesTitle": "公開投票",
|
||||
"explore.votesDesc": "瀏覽進行中的公開投票,選擇你感興趣的主題參與。",
|
||||
"explore.randomVote": "隨機推薦",
|
||||
"explore.allVotes": "全部投票",
|
||||
"explore.noVotes": "暫時沒有可參與的公開投票。",
|
||||
|
||||
// 提問頁
|
||||
"ask.scan": "掃碼向@%s提問",
|
||||
"ask.anonymous": "誰都可以以匿名的方式提問",
|
||||
"ask.registerOnly": "僅允許註冊使用者向TA提問",
|
||||
"ask.nextOpenAt": "下次開放時間:%s",
|
||||
"ask.lastCloseAt": "上次關閉時間:%s",
|
||||
"weekday.0": "週日",
|
||||
"weekday.1": "週一",
|
||||
"weekday.2": "週二",
|
||||
"weekday.3": "週三",
|
||||
"weekday.4": "週四",
|
||||
"weekday.5": "週五",
|
||||
"weekday.6": "週六",
|
||||
"ask.pinned": "已置頂",
|
||||
"ask.share": "分享提問箱",
|
||||
"ask.placeholder": "在此處撰寫你的問題...",
|
||||
"ask.chatPlaceholder": "在此處撰寫你的私聊訊息...",
|
||||
"ask.addImage": "新增圖片",
|
||||
"ask.private": "回覆後不公開",
|
||||
"ask.notify": "接收通知",
|
||||
"ask.emailPlaceholder": "請輸入你的信箱地址",
|
||||
"ask.submit": "傳送提問",
|
||||
"ask.chat": "發起私聊",
|
||||
"ask.chatDisabled": "該提問箱未開啟私聊",
|
||||
"ask.chatLimit": "訊息上限:%d則",
|
||||
"ask.history": "@%s 以前回答過的問題",
|
||||
"ask.loginRequired": "需要登入",
|
||||
"ask.loginRequiredChat": "發起私聊需要登入帳號",
|
||||
"ask.goLogin": "去登入",
|
||||
"ask.needPassword": "此提問箱需要密碼",
|
||||
"ask.needLogin": "提問箱的主人設定了僅註冊使用者才能提問,你需要先登入才能向他提問。",
|
||||
"ask.pleaseEmail": "請填寫接收通知的信箱地址",
|
||||
"ask.generating": "正在產生分享圖…",
|
||||
"ask.genFailed": "產生分享圖失敗,請稍後重試",
|
||||
"ask.networkError": "網路錯誤",
|
||||
"ask.shareFilename": "share.png",
|
||||
|
||||
// 問題條目
|
||||
"qitem.answer": "回答",
|
||||
"qitem.delete": "刪除",
|
||||
"qitem.private": "設為私密",
|
||||
"qitem.public": "設為公開",
|
||||
"qitem.asked": "提問",
|
||||
"qitem.pending": "等待回答",
|
||||
"qitem.answeredBy": "@%s 於 %s 的回答",
|
||||
"qitem.danger": "危險!",
|
||||
"qitem.deleteConfirm": "你確定要刪除這個提問嗎?該操作不可恢復,請謹慎操作。",
|
||||
"qitem.deleteConfirmBtn": "確認刪除",
|
||||
"qitem.backToBox": "返回%s的提問箱",
|
||||
"qitem.answerTitle": "回答問題",
|
||||
"qitem.answerPlaceholder": "在此處撰寫你的回答...",
|
||||
"qitem.emailNotifyHint": "提問人留下了自己的電子郵箱,在你第一次回覆該問題後,提問人將會收到一封郵件通知。",
|
||||
"qitem.submitAnswer": "回答",
|
||||
"qitem.updateAnswer": "更新回答",
|
||||
"qitem.askMore": "再問點別的問題?",
|
||||
"qitem.markRead": "標記為已讀",
|
||||
"qitem.markUnread": "標記為未讀",
|
||||
"qitem.readLocked": "已回答,已鎖定為已讀",
|
||||
|
||||
// 個人設定頁
|
||||
"admin.profile": "個人資訊",
|
||||
"admin.lang": "介面語言",
|
||||
"admin.langHint": "選擇訪客訪問你的提問箱時顯示的語言(後台頁面跟隨此設定)",
|
||||
"admin.email": "電子郵件",
|
||||
"admin.name": "暱稱",
|
||||
"admin.nameColor": "暱稱顏色",
|
||||
"admin.oldPassword": "舊密碼",
|
||||
"admin.newPassword": "新密碼",
|
||||
"admin.notify": "新提問通知",
|
||||
"admin.personalize": "個人化設定",
|
||||
"admin.intro": "提問箱介紹",
|
||||
"admin.introColor": "提問箱介紹顏色",
|
||||
"admin.qrBgColor": "QR Code 背景色(亮色部分)",
|
||||
"admin.qrPdColor": "QR Code 探測圖形顏色(邊角方形)",
|
||||
"admin.qrFgColor": "QR Code 前景色",
|
||||
"admin.qrDotSize": "QR Code 點大小 (←小 大→)",
|
||||
"admin.qrBgAlpha": "QR Code 背景透明度 (←不透明 很透明→)",
|
||||
"admin.avatar": "個人頭像",
|
||||
"admin.background": "提問箱背景",
|
||||
"admin.qrBackground": "QR Code 背景圖",
|
||||
"admin.social": "社交資訊設定",
|
||||
"admin.harassment": "防騷擾設定",
|
||||
"admin.askLimit": "提問限制",
|
||||
"admin.blockWords": "屏蔽詞設定(Enter 或逗號分隔,最多支援 10 個屏蔽詞,每個屏蔽詞最大長度為 10)",
|
||||
"admin.chat": "私聊設定",
|
||||
"admin.chatMaxMessages": "私聊訊息條數上限",
|
||||
"admin.chatDailyLimit": "單一使用者每日私訊條數上限",
|
||||
"admin.tags": "標籤設定",
|
||||
"admin.tagsHint": "標籤(最多5個,每個最多5字,Enter 或逗號分隔)",
|
||||
"admin.tagsPlaceholder": "例如:動漫,音樂,遊戲",
|
||||
"admin.tagInputHint": "輸入後按 Enter 或逗號新增",
|
||||
"admin.tagInputDuplicate": "已存在,已忽略",
|
||||
"admin.pagePassword": "頁面訪問密碼",
|
||||
"admin.pagePasswordHint": "設定訪問密碼(留空則關閉)",
|
||||
"admin.askPassword": "提問密碼",
|
||||
"admin.askPasswordHint": "設定提問密碼(留空則關閉)",
|
||||
"admin.saveProfile": "儲存修改",
|
||||
"admin.updated": "更新個人資訊成功",
|
||||
"admin.logout": "登出",
|
||||
"admin.export": "匯出資料",
|
||||
|
||||
// 後台設定(補充)
|
||||
"admin.oldPasswordHint": "修改密碼使用,留空則不修改",
|
||||
"admin.newPasswordHint": "6-64 位,留空則不修改",
|
||||
"admin.notifyEmail": "郵件",
|
||||
"admin.useCustomFg": "啟用自訂前景色(否則自動比對)",
|
||||
"admin.customFgHint": "僅在啟用時生效,否則顏色由系統自動產生",
|
||||
"admin.avatarPlaceholder": "上傳個人頭像(頭像比例不為1:1就扁了你哦)",
|
||||
"admin.backgroundPlaceholder": "上傳提問箱背景",
|
||||
"admin.qrBackgroundPlaceholder": "上傳QR Code背景(顏色過深的背景會導致QR Code無法辨識)",
|
||||
"admin.qrPreviewHint": "選擇圖片後預覽將即時更新",
|
||||
"admin.preview": "即時預覽",
|
||||
"admin.themePreset": "預設主題",
|
||||
"admin.themeDefault": "預設",
|
||||
"admin.themeDark": "暗夜",
|
||||
"admin.themeOcean": "海洋",
|
||||
"admin.themeSunset": "日落",
|
||||
"admin.resetDefaults": "🔄 恢復預設值",
|
||||
"admin.previewHint": "調整僅用於預覽,最終效果點擊「儲存修改」後生效",
|
||||
"admin.socialHint": "勾選後填寫主頁地址(無需 https://),未勾選的項目將不會在前台顯示。",
|
||||
"admin.enableAcfun": "啟用 AcFun",
|
||||
"admin.enableBili": "啟用 Bilibili",
|
||||
"admin.enableWeibo": "啟用 微博",
|
||||
"admin.enableXiaohongshu": "啟用 小紅書",
|
||||
"admin.enableBlog": "啟用 個人部落格",
|
||||
"admin.registerOnly": "僅允許註冊使用者向我提問",
|
||||
"admin.updateHarassment": "更新防騷擾設定",
|
||||
"admin.globalBlockWords": "全局屏蔽詞",
|
||||
"admin.globalBlockWordsHint": "屏蔽詞對提問、私聊(對方傳送給你的訊息)與投票提交內容生效;三個設定頁同步顯示同一份設定,任意一處修改即時生效。",
|
||||
"admin.updateBlockWords": "儲存屏蔽詞",
|
||||
"admin.allowChat": "允許註冊使用者向我發起私聊",
|
||||
"admin.dailyLimitHint": "0 表示不限制",
|
||||
"admin.updateChat": "更新私聊設定",
|
||||
"admin.showInHome": "在首頁展示我的標籤(允許其他使用者透過標籤搜尋到我)",
|
||||
"admin.updateTags": "更新標籤",
|
||||
"admin.updatePagePassword": "更新頁面密碼",
|
||||
"admin.pagePasswordPlaceholder": "輸入頁面訪問密碼",
|
||||
"admin.updateAskPassword": "更新提問密碼",
|
||||
"admin.askPasswordPlaceholder": "輸入提問密碼",
|
||||
"admin.account": "帳號設定",
|
||||
"admin.exportHint": "您可以匯出您在 %s 中的所有個人資料,包括你的基本資訊、收到的問題以及回答。",
|
||||
"admin.exportJSON": "導出全部資料(JSON)",
|
||||
"admin.exportJSONHint": "包含提問、回答、追問與私聊記錄,可完整備份或遷移。",
|
||||
"admin.deactivate": "停用我的帳號",
|
||||
"admin.deactivateHint": "您隨時可以選擇停用您的帳號。停用後,您的帳號將無法登入,您的提問箱頁面以及提問將無法訪問,其他人也無法再給您發送新的提問。<b>該操作無法撤銷!請謹慎操作!</b>",
|
||||
"admin.socialRequired": "請填寫連結或取消勾選",
|
||||
|
||||
// 問題管理頁
|
||||
"qlist.title": "我的提問",
|
||||
"qlist.answered": "已回答",
|
||||
"qlist.pending": "待回答",
|
||||
"qlist.private": "私密",
|
||||
"qlist.empty": "還沒有提問,快把提問箱分享出去吧~",
|
||||
"qlist.action": "操作",
|
||||
"qlist.answerNow": "去回答",
|
||||
"qlist.sort": "排序",
|
||||
"qlist.status": "狀態",
|
||||
"qlist.type": "類型",
|
||||
"qlist.latest": "最新",
|
||||
"qlist.oldest": "最早",
|
||||
"qlist.all": "全部",
|
||||
"qlist.public": "一般提問",
|
||||
"qlist.privateQuestion": "私密提問",
|
||||
"qlist.received": "我收到的提問",
|
||||
"qlist.myChats": "我發起的私聊",
|
||||
"qlist.statsTotal": "總提問數",
|
||||
"qlist.statsAnswered": "已回答",
|
||||
"qlist.statsUnanswered": "未回答",
|
||||
"qlist.statsPrivate": "私密提問",
|
||||
"qlist.statsPinned": "置頂",
|
||||
"qlist.statsChats": "私聊會話",
|
||||
"qlist.searchPlaceholder": "搜尋問題或回答內容...",
|
||||
"qlist.searchBtn": "搜尋",
|
||||
"qlist.searchClear": "清除搜尋",
|
||||
"qlist.questionsTab": "提問",
|
||||
"qlist.votesTab": "投票",
|
||||
"qlist.chatsTab": "私聊",
|
||||
"qlist.receivedChats": "我收到的私聊",
|
||||
"qlist.chatEmpty": "還沒有私聊,把提問箱分享出去讓大家來私聊吧~",
|
||||
"qlist.pinnedShort": "置頂",
|
||||
"qlist.privateShort": "私密",
|
||||
"qlist.chatStatsTotal": "總私聊",
|
||||
"qlist.chatStatsReceived": "我收到的",
|
||||
"qlist.chatStatsInitiated": "我發起的",
|
||||
"qlist.chatStatsClosed": "已關閉",
|
||||
"qlist.unansweredShort": "待答",
|
||||
"qlist.readShort": "已讀",
|
||||
"qlist.unreadShort": "未讀",
|
||||
"qitem.markReadShort": "標記",
|
||||
"qlist.pinShort": "置頂",
|
||||
"qlist.unpinShort": "取消置頂",
|
||||
"qlist.myVotes": "我建立的投票",
|
||||
"qlist.loadMore": "載入更多",
|
||||
"qlist.newVote": "新建投票",
|
||||
"qlist.edit": "編輯",
|
||||
"qlist.untitledVote": "未命名投票",
|
||||
"qlist.blocked": "已拉黑",
|
||||
"qlist.unanswered": "未回答",
|
||||
|
||||
// 站點 Logo 後綴
|
||||
"site.logoSuffix": "的提問箱",
|
||||
"site.stats": "提問箱資訊統計",
|
||||
|
||||
// 驗證碼彈窗
|
||||
"captcha.title": "人機驗證",
|
||||
"captcha.hint": "請計算下方的算術題以驗證你不是機器人",
|
||||
"captcha.refresh": "換一題",
|
||||
"captcha.submit": "驗證並送出",
|
||||
"captcha.loading": "載入中...",
|
||||
"captcha.loadFailed": "載入失敗",
|
||||
"captcha.loadRetry": "載入失敗,請重試",
|
||||
"captcha.inputAnswer": "請輸入答案",
|
||||
"captcha.wrongAnswer": "答案錯誤,請重新計算",
|
||||
"captcha.verifyFailed": "驗證失敗,請重試",
|
||||
|
||||
// 註冊頁補充
|
||||
"auth.register.domain.prefix": "個性網域(你的問答箱網址將會是:%s + ",
|
||||
"auth.register.domain.suffix": " + 你在下面文字框中填寫的內容)",
|
||||
"auth.register.confirm": "確認密碼",
|
||||
"auth.register.language": "介面語言",
|
||||
"auth.register.languageDefault": "跟隨站點預設",
|
||||
"auth.register.success": "註冊成功,歡迎來到 狼的提問箱!",
|
||||
|
||||
// 探索頁補充
|
||||
"explore.recommend": "隨機推薦",
|
||||
"explore.search": "搜尋標籤...",
|
||||
"explore.sortLatest": "最新加入",
|
||||
"explore.sortOldest": "最早加入",
|
||||
"explore.noTags": "無標籤",
|
||||
"explore.noRecommend": "暫無推薦用戶",
|
||||
"explore.hotTags": "熱門標籤",
|
||||
"explore.hotQuestions": "熱門問題",
|
||||
"explore.noResult": "暫無符合條件的用戶。",
|
||||
"explore.lazy": "這個人很懶,什麼都沒寫~",
|
||||
"explore.prevPage": "上一頁",
|
||||
"explore.nextPage": "下一頁",
|
||||
"explore.loading": "載入中...",
|
||||
"explore.loadFailed": "載入失敗",
|
||||
|
||||
// 提問箱密碼頁
|
||||
"password.title": "此提問箱需要密碼",
|
||||
"password.desc": "此提問箱已設定存取密碼,請輸入密碼查看內容",
|
||||
"password.input": "請輸入存取密碼",
|
||||
"password.enter": "驗證進入",
|
||||
"password.submit": "確認",
|
||||
|
||||
// 問題不存在
|
||||
"qitem.notFound": "問題不存在或已被刪除",
|
||||
|
||||
// 聊天頁
|
||||
"chat.title": "私聊",
|
||||
"chat.input": "輸入訊息...",
|
||||
"chat.send": "傳送",
|
||||
"chat.delete": "刪除對話",
|
||||
"chat.block": "封鎖對方",
|
||||
"chat.unblock": "取消封鎖",
|
||||
"chat.empty": "還沒有訊息,說點什麼吧~",
|
||||
"chat.withAsker": "與提問者的私聊",
|
||||
"chat.withUser": "與 %s 的私聊",
|
||||
"chat.closed": "對話已關閉",
|
||||
"chat.closedNoSend": "對話已關閉,無法發送新訊息",
|
||||
"chat.remaining": "訊息剩餘:%d 條(共 %d 條)",
|
||||
"chat.me": "我",
|
||||
"chat.other": "對方",
|
||||
"chat.userBlocked": "該使用者已被拉黑",
|
||||
"chat.addImage": "新增圖片(可選,最大5MB)",
|
||||
"chat.confirm": "確認",
|
||||
"chat.confirmBlock": "確定要拉黑該使用者嗎?他將無法再發送私訊。",
|
||||
"chat.confirmUnblock": "確定要取消封鎖該使用者嗎?他將可以再次發送私訊。",
|
||||
"chat.deleteConfirm": "確定要刪除這條私聊對話嗎?對方將無法再看到此對話,且操作不可恢復。",
|
||||
"maintenance.title": "NekoBox 維護中...",
|
||||
"maintenance.desc": "NekoBox 正在進行維護,服務暫時不可用。過一會再來吧~",
|
||||
|
||||
// 單題分享(v4)
|
||||
"qitem.shareCard": "分享此提問",
|
||||
|
||||
// 追問(v4)
|
||||
"followup.title": "追問記錄",
|
||||
"followup.content": "追問:",
|
||||
"followup.answerPlaceholder": "回答這條追問...",
|
||||
"followup.answerBtn": "回答追問",
|
||||
"followup.waiting": "等待回答中...",
|
||||
"followup.askMore": "繼續追問",
|
||||
"followup.remaining": "還可追問 %d / %d 次",
|
||||
"followup.contentPlaceholder": "補充你的問題...",
|
||||
"followup.waitingReply": "你的追加提問已發出,等待提問箱主人回覆中...",
|
||||
"followup.submit": "提交追問",
|
||||
|
||||
// 置頂(v4)
|
||||
"qlist.pinned": "置頂中",
|
||||
"qlist.pin": "置頂",
|
||||
"qlist.unpin": "取消置頂",
|
||||
"qlist.readStatus": "閱讀狀態",
|
||||
"qlist.read": "已讀",
|
||||
"qlist.unread": "未讀",
|
||||
"qlist.statsRead": "已讀",
|
||||
"qlist.statsUnread": "未讀",
|
||||
|
||||
// 提問成功頁(v4)
|
||||
"success.title": "提問發送成功!",
|
||||
"success.yourQuestion": "你的提問:",
|
||||
"success.emailSent": "已向你的信箱發送了該提問的私密連結,也可以使用下方連結隨時查看提問、接收回答與繼續追問。",
|
||||
"success.saveLink": "<strong>請務必保存下面的私密連結!</strong>由於你沒有留下信箱,此連結(含口令 Token)是你查看提問、接收回答與繼續追問的<strong>唯一憑證</strong>,遺失後將無法找回。",
|
||||
"success.privateLink": "你的提問私密連結(點擊複製保存)",
|
||||
"success.copy": "複製",
|
||||
"success.copied": "已複製 ✓",
|
||||
"success.copyFailed": "複製失敗",
|
||||
"success.token": "口令 Token:%s(提問人憑 Token 存取私密連結)",
|
||||
"success.viewQuestion": "查看我的提問",
|
||||
"success.backToBox": "返回%s的提問箱",
|
||||
"success.pageTitle": "提問成功 - %s",
|
||||
|
||||
// 停用頁
|
||||
"deactivate.title": "帳號停用",
|
||||
"deactivate.desc": "停用後你的提問箱將無法存取,且所有資料將被刪除,此操作不可恢復!",
|
||||
"deactivate.confirm": "我確認要停用帳號",
|
||||
"deactivate.submit": "停用帳號",
|
||||
|
||||
// 匿名投票
|
||||
"nav.votes": "投票",
|
||||
|
||||
"common.back": "返回",
|
||||
|
||||
"vote.listTitle": "投票管理",
|
||||
"vote.newTitle": "新建投票",
|
||||
"vote.editTitle": "編輯投票",
|
||||
"vote.resultsTitle": "投票結果",
|
||||
"vote.statsTotal": "投票總數",
|
||||
"vote.statsPublished": "進行中",
|
||||
"vote.createNew": "新建投票",
|
||||
"vote.typeSingle": "單選",
|
||||
"vote.typeMultiple": "多選",
|
||||
"vote.typeRating": "評分",
|
||||
"vote.typeRank": "排序",
|
||||
"vote.typeForm": "表單收集",
|
||||
"vote.statusNotStarted": "未開始",
|
||||
"vote.statusDraft": "草稿",
|
||||
"vote.statusPublished": "進行中",
|
||||
"vote.statusEnded": "已結束",
|
||||
"vote.statusArchived": "已歸檔",
|
||||
"vote.participants": "參與",
|
||||
"vote.remainLabel": "剩餘",
|
||||
"vote.perpetual": "無限期",
|
||||
"vote.durationDay": "天",
|
||||
"vote.durationHour": "小時",
|
||||
"vote.durationMinute": "分鐘",
|
||||
"vote.createdAt": "建立於",
|
||||
"vote.edit": "編輯",
|
||||
"vote.results": "結果",
|
||||
"vote.preview": "預覽",
|
||||
"vote.page.mustComplete": "請完成",
|
||||
"vote.page.rankHintRequired": "排名 1-N(必填)",
|
||||
"vote.page.rankHintOptional": "排名 1-N(可選,可只排部分)",
|
||||
"vote.page.previewHint": "預覽模式:這是發布前的頁面範例,提交已停用",
|
||||
"vote.page.previewSubmitHint": "預覽模式,發布後即可提交",
|
||||
"vote.publish": "發布",
|
||||
"vote.close": "結束",
|
||||
"vote.share": "複製連結",
|
||||
"vote.copied": "已複製",
|
||||
"vote.shareURL": "投票分享連結",
|
||||
"vote.confirmPublish": "確定發布該投票嗎?發布後即產生可分享連結。",
|
||||
"vote.confirmClose": "確定結束該投票嗎?結束後參與者將無法再投票。",
|
||||
"vote.confirmDelete": "確定刪除該投票嗎?投票資料將一併刪除,不可復原!",
|
||||
"vote.manageEntry": "管理投票",
|
||||
|
||||
"vote.manageTitle": "管理投票",
|
||||
"vote.manageDesc": "建立與管理你的匿名投票", "vote.empty": "還沒有投票,點擊右上角\"新建投票\"開始吧~",
|
||||
"vote.formLockedHint": "該投票已發布,僅可修改基本資訊;類型與選項已鎖定(避免破壞已收集的投票資料)",
|
||||
"vote.formBasic": "基本設定",
|
||||
"vote.formTitle": "投票標題",
|
||||
"vote.formTitlePlaceholder": "例如:今天吃什麼?",
|
||||
"vote.formDescription": "描述 / 說明",
|
||||
"vote.formDescriptionPlaceholder": "補充說明(可選)",
|
||||
"vote.formType": "投票類型",
|
||||
"vote.formVisibility": "展示方式",
|
||||
"vote.formVisibilityPublic": "公開展示(探索頁 + 提問箱頁)",
|
||||
"vote.formVisibilityLinkOnly": "僅連結分享",
|
||||
"vote.formVoterScope": "投票範圍",
|
||||
"vote.formVoterScopeAnyone": "任何人(含匿名)",
|
||||
"vote.formVoterScopeRegistered": "僅註冊用戶",
|
||||
"vote.formShowResult": "結果可見時機",
|
||||
"vote.formShowResultAfterVote": "投票後立即可見",
|
||||
"vote.formShowResultAfterEnd": "結束後可見",
|
||||
"vote.formShowResultOwnerOnly": "僅我可見",
|
||||
"vote.formStartAt": "開始時間(留空立即開始)",
|
||||
"vote.formEndAt": "結束時間(留空不限制)",
|
||||
"vote.formMaxChoices": "最多可選數量",
|
||||
"vote.formMaxVotesPerFingerprint": "每個投票每個裝置限 1 次,使用同一瀏覽器重複提交將被攔截。",
|
||||
"vote.formMaxVotesPerAccount": "每個投票每個註冊帳號限 1 次,使用同一帳號重複提交將被攔截。",
|
||||
"vote.formAllowCustom": "允許參與者補充自訂選項",
|
||||
"vote.formRequireCaptcha": "匿名投票需通過驗證碼",
|
||||
"vote.formOptions": "投票選項",
|
||||
"vote.formRatingHint": "評分題無需設定選項(1-10 分)",
|
||||
"vote.addOption": "新增選項",
|
||||
"vote.optionPlaceholder": "選項內容",
|
||||
"vote.formFields": "表單欄位",
|
||||
"vote.addField": "新增欄位",
|
||||
"vote.field": "欄位",
|
||||
"vote.formFieldType": "欄位類型",
|
||||
"vote.fieldTypeText": "單行文字",
|
||||
"vote.fieldTypeTextarea": "多行文字",
|
||||
"vote.fieldTypeSelect": "下拉選擇",
|
||||
"vote.fieldTypeRadio": "單選",
|
||||
"vote.fieldTypeCheckbox": "多選",
|
||||
"vote.fieldTypeNumber": "數字",
|
||||
"vote.fieldTypeRank": "排序",
|
||||
"vote.page.selectPlaceholder": "請選擇",
|
||||
"vote.page.avgNumber": "平均",
|
||||
"vote.page.fieldFilled": "已填寫",
|
||||
"vote.fieldTypeRating": "評分",
|
||||
"vote.formFieldLabel": "欄位標籤",
|
||||
"vote.formFieldRequired": "必填",
|
||||
"vote.formFieldMaxLength": "字數上限(0 不限制)",
|
||||
"vote.formFieldOptions": "選項",
|
||||
"vote.formFieldOptionsHint": "點擊下方「新增選項」逐條新增,不需用逗號分隔",
|
||||
"vote.fieldAllowCustom": "允許補充自訂選項",
|
||||
"vote.formFieldOptionsPlaceholder": "如:滿意,一般,不滿意",
|
||||
"vote.createDraft": "儲存草稿",
|
||||
"vote.builderHintOptions": "至少需要 2 個選項",
|
||||
"vote.builderHintFields": "請至少新增 1 個欄位",
|
||||
"vote.builderHintFieldOptions": "選擇題/排序題請填寫選項(排序題至少 2 個)",
|
||||
"vote.resultsAnswered": "回答數",
|
||||
"vote.page.rankedTimes": "被排次數",
|
||||
"vote.resultsTotal": "總參與人數",
|
||||
"vote.resultsSubmissions": "表單回覆",
|
||||
"vote.resultsViewTexts": "查看文字提交",
|
||||
"vote.resultsToggleHint": "點擊展開或收起文字回覆明細",
|
||||
"vote.resultsOptions": "投票結果",
|
||||
"vote.resultsVotes": "票",
|
||||
"vote.export": "匯出 CSV",
|
||||
"vote.resultsEmpty": "還沒有人參與,快來分享吧~",
|
||||
|
||||
// 匿名投票參與頁
|
||||
"vote.inlineTitle": "投票",
|
||||
"vote.page.by": "發起的投票",
|
||||
"vote.page.goVote": "去投票",
|
||||
"vote.page.notStarted": "未開始",
|
||||
"vote.page.notStartedHint": "該投票尚未開始,敬請期待~",
|
||||
"vote.page.ended": "已結束",
|
||||
"vote.page.endedHint": "該投票已結束",
|
||||
"vote.page.active": "進行中",
|
||||
"vote.page.participated": "已參與",
|
||||
"vote.page.loginRequired": "該投票僅限註冊用戶參與,請先登入。",
|
||||
"vote.page.anonymousHint": "該投票允許匿名參與,你的身分不會被記錄(同一裝置最多可參與 1 次)。",
|
||||
"vote.page.submit": "提交投票",
|
||||
"vote.page.alreadyVoted": "你已參與過該投票,感謝參與!",
|
||||
"vote.page.resultsTitle": "投票結果",
|
||||
"vote.page.totalVotes": "總參與",
|
||||
"vote.page.avgRating": "平均分",
|
||||
"vote.page.avgRank": "平均排名",
|
||||
"vote.page.optionColumn": "選項",
|
||||
"vote.page.ratingLabel": "請評分",
|
||||
"vote.page.ratingUnit": "分",
|
||||
"vote.page.rankHint": "請為每個選項填寫 1-N 的排名(數字越小越靠前,不可重複)",
|
||||
"vote.page.rankPlaceholder": "排名",
|
||||
"vote.page.multipleHint": "可多選",
|
||||
"vote.page.customOption": "補充選項(可選)",
|
||||
"vote.page.customPlaceholder": "填寫你心中的其他選項",
|
||||
"vote.page.customOther": "其他",
|
||||
"vote.page.customFieldPlaceholder": "填寫自訂選項…",
|
||||
"vote.page.customStats": "自訂補充選項",
|
||||
"vote.page.formCount": "已收到回覆",
|
||||
"vote.page.ownerManage": "管理此投票(僅你可見結果)",
|
||||
|
||||
// 單份投票的定量收集
|
||||
"vote.formQuotaLimit": "收集上限(份)",
|
||||
"vote.formQuotaHint": "0 表示不限制;收集到指定份數後自動結束該投票。",
|
||||
"vote.flash.notFound": "該投票不存在或已失效",
|
||||
"vote.flash.notPublished": "該投票尚未發布",
|
||||
"vote.flash.archived": "該投票已歸檔,無法參與",
|
||||
"vote.flash.ended": "該投票已結束",
|
||||
"vote.flash.notStarted": "該投票尚未開始",
|
||||
"vote.flash.success": "投票成功!感謝參與",
|
||||
"vote.err.noChoice": "請至少選擇一個選項",
|
||||
"vote.err.tooManyChoices": "最多只能選擇 %d 個選項",
|
||||
"vote.err.pickOne": "請選擇一個選項",
|
||||
"vote.err.invalidOption": "存在無效的選項",
|
||||
"vote.err.optionDuplicate": "選項不能重複選擇",
|
||||
"vote.err.ratingRequired": "請給出 1-10 分的評分",
|
||||
"vote.err.rankRequired": "請為每個選項填寫 1-%d 的排名",
|
||||
"vote.err.rankDuplicate": "排名不能重複",
|
||||
"vote.err.fieldRequired": "請填寫「%s」",
|
||||
"vote.err.fieldCustomRequired": "請填寫「%s」的自訂選項",
|
||||
"vote.err.fieldCustomTooLong": "「%s」的自訂選項不能超過 %d 字",
|
||||
"vote.err.fieldInvalidOption": "「%s」的選項無效",
|
||||
"vote.err.fieldConfigError": "「%s」選項配置錯誤",
|
||||
"vote.err.fieldRankIncomplete": "請填寫「%s」的完整排名",
|
||||
"vote.err.fieldRankRange": "「%s」排名必須是 1-%d 之間的數字",
|
||||
"vote.err.fieldRankDuplicate": "「%s」排名不能重複",
|
||||
"vote.err.fieldTooLong": "「%s」超出字數限制(最多 %d 字)",
|
||||
"vote.err.fieldNotNumber": "「%s」必須是數字",
|
||||
"vote.err.fieldRating": "「%s」請給出 1-10 分的評分",
|
||||
"vote.err.unknownType": "未知的投票類型",
|
||||
"vote.err.customTooLong": "自訂選項不能超過 %d 字",
|
||||
"vote.err.blockWords": "提交內容中包含了投票發起人設定的屏蔽詞,無法提交",
|
||||
"vote.err.serialize": "提交內容序列化失敗",
|
||||
"captcha.error": "驗證碼錯誤",
|
||||
"captcha.errEmpty": "驗證碼不能為空",
|
||||
"captcha.errFormat": "驗證碼格式錯誤,請重新整理後重試",
|
||||
"captcha.errAnswerFormat": "驗證碼答案格式錯誤",
|
||||
"captcha.errExpired": "驗證碼已過期,請重新整理後重試",
|
||||
"captcha.errService": "驗證碼服務異常,請稍後再試",
|
||||
"captcha.errAnswerWrong": "驗證碼答案錯誤",
|
||||
"censor.unavailable": "內容審核服務暫時不可用,請稍後再試",
|
||||
|
||||
// 功能管理:提問 / 私聊 / 投票 的開關、定時開關與定量收集
|
||||
"admin.tabAccount": "用戶設定",
|
||||
"admin.featuresHint": "在「提問 / 私聊 / 投票」面板中管理各功能的開關、開放時段與收集上限;達到上限後對應功能自動關閉。",
|
||||
"admin.featuresEntry": "設定",
|
||||
"admin.featureHint.question": "關閉後訪客無法提交新提問;達到收集上限後自動停止接收(含私密提問)。",
|
||||
"admin.featureHint.chat": "關閉後訪客無法發起新的私聊;已有會話不受影響。",
|
||||
"admin.featureHint.vote": "關閉後提問箱頁不再展示投票板塊,訪客也無法參與你的投票。單份投票可在編輯頁單獨設定收集上限。",
|
||||
"admin.featureEnabled": "啟用該功能",
|
||||
"admin.featureOpenAt": "定時開放",
|
||||
"admin.featureCloseAt": "定時關閉",
|
||||
"admin.featureTimeHint": "留空表示不限制;開放時間之前、關閉時間之後該功能均不可用。",
|
||||
"admin.featureSchedule": "循環定時(每週循環)",
|
||||
"admin.featureScheduleStart": "每日開始",
|
||||
"admin.featureScheduleEnd": "每日結束",
|
||||
"admin.featureScheduleHint": "勾選每週固定開放日並設定每日時間段,按週循環生效;全部留空表示不啟用。只填開放日(不填時間)表示該天全天開放;只填時間(不勾選任何日)表示每天該時段開放。",
|
||||
"admin.featureMode": "收集模式",
|
||||
"admin.featureModeAlways": "長期開放",
|
||||
"admin.featureModeWindow": "定時收集",
|
||||
"admin.featureModeRecurring": "循環定時",
|
||||
"admin.featureModeHint": "長期開放:不限時間,保持開放直到手動關閉;定時收集:一次性開放 / 關閉時間視窗;循環定時:每週固定開放日循環生效。三種模式互斥,儲存時未選模式的設定將被清空。",
|
||||
"admin.featureQuotaLimit": "收集上限(條 / 份)",
|
||||
"admin.featureQuotaHint": "0 表示不限制;累計收集達到上限後自動關閉,重設計數後可開啟下一輪。",
|
||||
"admin.featureQuotaCount": "已收集",
|
||||
"admin.featureQuotaUnlimited": "不限制",
|
||||
"admin.featureQuotaResetAt": "上次重設:",
|
||||
"admin.featureResetQuota": "重設計數",
|
||||
"admin.featureSave": "儲存該功能設定",
|
||||
|
||||
// 功能管理:狀態與提示
|
||||
"feature.name.question": "提問",
|
||||
"feature.name.chat": "私聊",
|
||||
"feature.name.vote": "投票",
|
||||
"feature.statusOpen": "進行中",
|
||||
"feature.status.disabled": "已關閉",
|
||||
"feature.status.not_started": "未開始",
|
||||
"feature.status.ended": "已結束",
|
||||
"feature.status.quota_reached": "已達上限",
|
||||
"feature.saved": "功能設定已儲存",
|
||||
"feature.errTime": "%s 的時間格式不正確,請使用日期時間選擇器",
|
||||
"feature.errTimeRange": "%s 的定時關閉時間必須晚於定時開放時間",
|
||||
"feature.errQuota": "%s 的收集上限需為 0 到 1000000 之間的整數",
|
||||
"feature.errInvalid": "未知的功能類型",
|
||||
"feature.quotaReset": "%s 的收集計數已重設",
|
||||
"feature.errScheduleHalf": "%s 的循環定時開始與結束時間必須同時填寫",
|
||||
"feature.errScheduleTime": "%s 的循環定時時間格式不正確,請使用時間選擇器",
|
||||
"feature.errScheduleRange": "%s 的循環定時結束時間必須晚於開始時間",
|
||||
|
||||
// 功能關閉時對訪客的提示
|
||||
"feature.disabled.question": "提問箱主人已關閉提問功能",
|
||||
"feature.disabled.chat": "該提問箱未開啟私聊功能",
|
||||
"feature.disabled.vote": "該提問箱已關閉投票功能",
|
||||
"feature.not_started.question": "提問功能尚未開放",
|
||||
"feature.not_started.chat": "私聊功能尚未開放",
|
||||
"feature.not_started.vote": "投票功能尚未開放",
|
||||
"feature.ended.question": "提問功能已結束收集",
|
||||
"feature.ended.chat": "私聊功能已結束",
|
||||
"feature.ended.vote": "投票功能已結束",
|
||||
"feature.quota_reached.question": "提問功能已達到收集上限",
|
||||
"feature.quota_reached.chat": "私聊功能已達到收集上限",
|
||||
"feature.quota_reached.vote": "投票功能已達到收集上限",
|
||||
|
||||
// 認證:訪客可見的提示(P0)
|
||||
"auth.errBadCredential": "郵箱或密碼錯誤",
|
||||
"auth.errUserNotFound": "使用者不存在",
|
||||
"auth.errEmailFrequent": "郵件發送太頻繁,請稍後再試",
|
||||
"auth.errEmailFailed": "郵件發送失敗,請稍後再試",
|
||||
"auth.errCodeExpired": "驗證碼已過期",
|
||||
"auth.errPasswordChanged": "密碼修改成功",
|
||||
"auth.errLoginRequired": "請先登入",
|
||||
"auth.errDuplicateEmail": "該郵箱已被註冊",
|
||||
"auth.errDuplicateDomain": "該個性網域已被使用",
|
||||
|
||||
// 提問箱頁:訪客可見(P0)
|
||||
"question.errWrongPassword": "密碼錯誤",
|
||||
"question.errAskPasswordWrong": "提問密碼錯誤",
|
||||
"question.errLoginRequired": "提問箱的主人設定了僅註冊使用者才能提問,請先登入。",
|
||||
"question.errSelfChat": "不能給自己發起私聊",
|
||||
"question.errBlockedChat": "你已被對方封鎖,無法發起私聊",
|
||||
"question.errChatDailyLimit": "你今日已達發送上限(%d則),請明天再試",
|
||||
"question.errDuplicateSubmit": "偵測到重複提交,請稍後再試",
|
||||
"question.errImageTooLarge": "圖片檔案大小不能大於 5Mb",
|
||||
"question.errUploadImageFailed": "上傳圖片失敗",
|
||||
"question.errBlockWords": "提問內容包含了提問箱主人設定的屏蔽詞,發送失敗",
|
||||
"question.errAnsweredLocked": "已回答的問題不能標記為未讀",
|
||||
"question.flash.chatSent": "私聊請求已發送!你可以透過以下連結查看對話:%s",
|
||||
"question.flash.answered": "回答發布成功!",
|
||||
"question.flash.operated": "操作成功",
|
||||
"question.flash.markedRead": "已標記為已讀",
|
||||
"question.flash.markedUnread": "已標記為未讀",
|
||||
|
||||
// 追問:訪客/箱主可見(P0)
|
||||
"followup.errNoPermission": "無權操作",
|
||||
"followup.errNotAnswered": "問題尚未被回答,暫時不能追問",
|
||||
"followup.errLimit": "每條提問最多追問 %d 次,已達上限",
|
||||
"followup.errWaitReply": "請等待主人回覆上一條追問後再繼續追問",
|
||||
"followup.errNotFound": "追問不存在",
|
||||
"followup.flash.sent": "追問發送成功!",
|
||||
"followup.flash.answered": "回答成功!",
|
||||
|
||||
// 後台設定:箱主可見(P1)
|
||||
"admin.flash.profileUpdated": "更新個人資訊成功",
|
||||
"admin.flash.chatUpdated": "私聊設定更新成功",
|
||||
"admin.flash.pagePwdOff": "已關閉頁面密碼存取",
|
||||
"admin.flash.pagePwdUpdated": "頁面存取密碼已更新",
|
||||
"admin.flash.askPwdOff": "已關閉提問密碼",
|
||||
"admin.flash.askPwdUpdated": "提問密碼已更新",
|
||||
"admin.flash.tagsTooMany": "標籤不能超過 5 個",
|
||||
"admin.flash.tagsUpdated": "更新標籤成功",
|
||||
"admin.flash.tagTooLong": "每個標籤不能超過 5 個字元:%s",
|
||||
"admin.flash.blockWordsTooMany": "屏蔽詞不能超過 10 個",
|
||||
"admin.flash.blockWordTooLong": "屏蔽詞長度不能超過 10 個字元:%s",
|
||||
"admin.flash.harassmentUpdated": "更新防騷擾設定成功",
|
||||
"admin.flash.blockWordsUpdated": "屏蔽詞已更新",
|
||||
"admin.flash.deactivated": "您的帳號已停用,感謝您使用 狼的提問箱。期待未來還能再見 👋🏻",
|
||||
"admin.export.errUser": "匯出失敗:獲取使用者資訊失敗",
|
||||
"admin.export.errQuestion": "匯出失敗:獲取問題資訊失敗",
|
||||
|
||||
// 投票管理:箱主可見(P1)
|
||||
"vote.err.invalidID": "無效的投票 ID",
|
||||
"vote.err.notExist": "投票不存在",
|
||||
"vote.err.noPermission": "無權操作該投票",
|
||||
"vote.err.type": "未知的投票類型",
|
||||
"vote.err.titleRequired": "請填寫投票標題",
|
||||
"vote.err.titleTooLong": "投票標題不能超過 100 字",
|
||||
"vote.err.visibility": "未知的可見性設定",
|
||||
"vote.err.voterScope": "未知的投票範圍設定",
|
||||
"vote.err.showResult": "未知的結果展示設定",
|
||||
"vote.err.timeRange": "結束時間必須晚於開始時間",
|
||||
"vote.err.quota": "收集上限需為 0 到 1000000 之間的整數",
|
||||
"vote.err.optionsTooFew": "請至少新增 2 個選項",
|
||||
"vote.err.optionsFormat": "選項資料格式錯誤",
|
||||
"vote.err.optionTooLong": "單個選項內容不能超過 %d 字",
|
||||
"vote.err.maxChoicesExceed": "最多可選數量不能超過選項總數",
|
||||
"vote.err.fieldsTooFew": "請至少新增 1 個表單欄位",
|
||||
"vote.err.fieldsFormat": "表單欄位資料格式錯誤",
|
||||
"vote.err.fieldsTooMany": "表單欄位不能超過 50 個",
|
||||
"vote.err.fieldType": "存在未知的表單欄位類型",
|
||||
"vote.err.fieldLabelMissing": "第 %d 個欄位缺少標籤",
|
||||
"vote.err.fieldLabelTooLong": "第 %d 個欄位的標籤不能超過 100 字",
|
||||
"vote.err.fieldLabelDuplicate": "欄位標籤「%s」重複,請使用不同的標籤",
|
||||
"vote.err.fieldMaxLength": "第 %d 個欄位的字數上限需在 0-2000 之間",
|
||||
"vote.err.fieldReservedOption": "第 %d 個欄位(%s)的選項內容包含保留值,請更換",
|
||||
"vote.err.fieldOptionsTooFew": "第 %d 個欄位(%s)請至少填寫 1 個選項",
|
||||
"vote.err.fieldRankTooFew": "第 %d 個欄位(%s)排序題至少需要 2 個選項",
|
||||
"vote.err.fieldSerialize": "欄位選項序列化失敗",
|
||||
"vote.err.editClosed": "已結束或歸檔的投票不允許編輯",
|
||||
"vote.err.publishDraftOnly": "只有草稿狀態的投票可以發布",
|
||||
"vote.err.closePublishedOnly": "只有進行中的投票可以結束",
|
||||
"vote.err.publishTitleRequired": "請先填寫投票標題再發布",
|
||||
"vote.err.publishFormFieldsRequired": "表單類型投票至少需要 1 個欄位",
|
||||
"vote.err.publishOptionsRequired": "選項投票至少需要 2 個選項",
|
||||
"vote.err.optionUpdateFailed": "選項更新失敗,請重試",
|
||||
"vote.err.fieldUpdateFailed": "表單欄位更新失敗,請重試",
|
||||
"vote.flash.published": "投票已發布!分享連結:%s",
|
||||
"vote.flash.updated": "投票資訊已更新(進行中的投票不可修改類型與選項)",
|
||||
"vote.flash.draftSaved": "已儲存到草稿",
|
||||
"vote.flash.closed": "投票已結束",
|
||||
"vote.flash.deleted": "投票已刪除",
|
||||
"vote.err.timeFormat": "時間格式不正確,請使用日期時間選擇器",
|
||||
"vote.err.maxChoicesLimit": "最多可選數量不能超過 20",
|
||||
"vote.err.descriptionTooLong": "投票描述不能超過 5000 字",
|
||||
"profile.err.avatarTooLarge": "頭像檔案太大,最大支援 2MB",
|
||||
"profile.err.backgroundTooLarge": "背景圖檔案太大,最大支援 2MB",
|
||||
"profile.err.newPasswordTooShort": "新密碼長度不能少於 8 位",
|
||||
"profile.err.badOldPassword": "舊密碼輸入錯誤",
|
||||
"admin.export.errCreateExcel": "匯出失敗:建立Excel檔案失敗",
|
||||
"admin.export.errWriteExcel": "匯出失敗:寫入Excel檔案失敗",
|
||||
|
||||
// profile 設定頁 UI 重構:卡片分區 / 頭像背景裁切 / 改密強制登出
|
||||
"profile.card.basic": "基本資料",
|
||||
"profile.card.avatarBg": "頭像與背景",
|
||||
"profile.card.qr": "二維碼樣式",
|
||||
"profile.card.password": "修改密碼",
|
||||
"profile.avatarCropHint": "裁切框已鎖定為 1:1 正方形",
|
||||
"profile.backgroundCropHint": "裁切框已鎖定為 16:9 寬螢幕",
|
||||
"profile.cropTitle": "裁切圖片",
|
||||
"profile.cropConfirm": "確認裁切",
|
||||
"profile.err.avatarRatio": "頭像圖片必須為 1:1 正方形,請裁切後再上傳",
|
||||
"profile.err.backgroundRatio": "背景圖片必須為 16:9 寬高比,請裁切後再上傳",
|
||||
"profile.flash.passwordChanged": "密碼修改成功,已登出,請使用新密碼重新登入",
|
||||
"profile.pwdNote": "儲存後目前工作階段立即失效,需使用新密碼重新登入",
|
||||
"profile.pickAvatar": "更換頭像",
|
||||
"profile.pickBackground": "更換背景",
|
||||
"profile.saveBasic": "儲存基本資料",
|
||||
"profile.saveMedia": "儲存頭像與背景",
|
||||
"profile.savePassword": "確認修改密碼",
|
||||
"profile.saveQR": "儲存 QR Code 樣式",
|
||||
"profile.saveSocial": "儲存社交連結",
|
||||
"profile.err.cropLibUnavailable": "圖片裁切元件載入失敗,請重新整理頁面後重試",
|
||||
|
||||
// 驗證碼 JSON 介面:前端消費(P2)
|
||||
"captcha.json.badRequest": "請求格式錯誤",
|
||||
"captcha.json.idRequired": "驗證碼 ID 不能為空",
|
||||
"captcha.json.genFailed": "生成驗證碼失敗",
|
||||
"chat.errDeletedByOwner": "該私聊對話已被對方刪除。",
|
||||
"chat.errBlockedView": "你已被對方拉黑,無法查看該私聊",
|
||||
"chat.errEmpty": "消息不能為空",
|
||||
"chat.errTooLong": "消息內容過長,請控制在 %d 字以內",
|
||||
"chat.errConvDeletedSend": "該對話已被刪除,無法發送消息",
|
||||
"chat.errBlockedSend": "你已被對方拉黑,無法發送私信",
|
||||
"chat.errBlockWords": "訊息中包含了提問箱主人設定的屏蔽詞,無法傳送",
|
||||
"chat.errDailyLimit": "你今日已達發送上限(%d條),請明天再試",
|
||||
"chat.errLimitReached": "對話已達到上限,無法發送新消息",
|
||||
"chat.errChatClosed": "該箱主已關閉私聊功能,無法發送消息",
|
||||
"chat.errImageTooLarge": "圖片大小不能超過 %dMB",
|
||||
"chat.errUploadFailed": "圖片上傳失敗,請稍後重試",
|
||||
"chat.errNoPermission": "無權執行此操作",
|
||||
"chat.flash.sent": "消息發送成功",
|
||||
"chat.flash.deleted": "私聊對話已刪除",
|
||||
"chat.flash.operated": "操作成功",
|
||||
"image.errTooLarge": "圖片尺寸過大,最大支援 %d×%d 像素,請壓縮後重新上傳",
|
||||
"internal.errFlash": "服務內部錯誤,請稍後重試。",
|
||||
"internal.errServer": "伺服器內部錯誤",
|
||||
"home.errStats": "獲取統計資訊失敗",
|
||||
"pixel.errPath": "非法的請求路徑",
|
||||
"proxy.errNotFound": "頁面不存在",
|
||||
"proxy.errInternal": "服務網關內部錯誤",
|
||||
"explore.errRandomUser": "獲取隨機用戶失敗",
|
||||
// 表单校验
|
||||
"form.answer.content": "回答內容不能為空",
|
||||
"form.answer.contentTooLong": "回答內容不能超過 %d 個字元",
|
||||
"form.email.required": "請填寫有效的電子郵件地址",
|
||||
"form.followup.answer": "追問回答不能為空",
|
||||
"form.followup.answerTooLong": "追問回答不能超過 %d 個字元",
|
||||
"form.followup.content": "追問內容不能為空",
|
||||
"form.followup.contentTooLong": "追問內容不能超過 %d 個字元",
|
||||
"form.login.password": "請輸入密碼",
|
||||
"form.profile.backgroundimagealpha": "請填寫 QR Code 背景透明度",
|
||||
"form.profile.colorHex": "請填寫 7 位十六進制顏色代碼(含 #)",
|
||||
"form.profile.dotscale": "請填寫 QR Code 點大小",
|
||||
"form.profile.intro": "個人介紹不能為空,且不超過 100 個字元",
|
||||
"form.profile.linkMax": "主頁連結長度不能超過 30 個字元",
|
||||
"form.profile.name": "暱稱不能為空,且不超過 20 個字元",
|
||||
"form.profile.newPassword": "新密碼長度不能超過 30 個字元",
|
||||
"form.profile.passwordMax": "密碼長度不能超過 30 個字元",
|
||||
"form.question.content": "問題內容不能為空",
|
||||
"form.question.contentTooLong": "問題內容不能超過 %d 個字元",
|
||||
"form.question.receiveReplyEmail": "請填寫有效的電子郵件地址以接收回覆",
|
||||
"form.recaptcha": "請完成人機驗證",
|
||||
"form.recover.newPassword": "請設定 8 至 30 位的新密碼",
|
||||
"form.recover.repeatPassword": "兩次輸入的新密碼不一致",
|
||||
"form.register.domain": "個性網域只能包含字母、數字與底線,長度為 3 至 20 位",
|
||||
"form.register.email": "請填寫有效的電子郵件地址(不超過 100 個字元)",
|
||||
"form.register.name": "暱稱不能為空,且不超過 20 個字元",
|
||||
"form.register.password": "請設定 8 至 30 位的密碼",
|
||||
"form.register.recaptcha": "無法人機驗證,請重新整理頁面或更換網路後重試",
|
||||
"form.register.repeatPassword": "兩次輸入的密碼不一致",
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<p class="{{ if .IsPixel }}uk-container{{end}} uk-text-right uk-text-muted uk-text-small">
|
||||
{{t .LangCode "site.footer.visitor" `<span id="busuanzi_value_site_uv"><span class="tb-spinner"></span></span>` | safe}} | {{t .LangCode "site.footer.pageview" `<span id="busuanzi_value_page_pv"><span class="tb-spinner"></span></span>` | safe}}
|
||||
<br>Powered by NekoBox | {{ ICP }}<br>{{t .LangCode "site.footer.runtime"}}:<span id="box_runtime"></span>
|
||||
<br>
|
||||
<!--<a href="/pixel">画板</a> | -->
|
||||
<a href="https://box.tama.guru/_/tamakyi" target="_blank">{{t .LangCode "site.footer.admin"}}</a>
|
||||
| <a href="https://blog.tama.guru" target="_blank">{{t .LangCode "site.footer.notice"}}</a>
|
||||
| <a href="https://chat.tama.guru" target="_blank">{{t .LangCode "site.footer.chat"}}</a>
|
||||
| <a href="https://share.tama.guru" target="_blank">{{t .LangCode "site.footer.drive"}}</a>
|
||||
| <a href="https://status.tama.guru" target="_blank">{{t .LangCode "site.footer.status"}}</a>
|
||||
| <a href="https://tama.guru" target="_blank">{{t .LangCode "site.footer.nav"}}</a>
|
||||
</p>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 提交反馈(P0):点击任意表单的提交按钮后,立即把触发按钮变成「转圈 + 本地化文字」,
|
||||
// 并禁用表单内全部按钮,物理阻止在上传/网络慢时的重复点击与重复提交。
|
||||
// 浏览器前进/后退(bfcache)回到本页时自动复位,避免停留在禁用或转圈状态。
|
||||
// 纯内联反馈,不使用全屏遮罩。
|
||||
var SUBMIT_I18N = {
|
||||
submitting: '{{t .LangCode "common.submitting"}}',
|
||||
uploading: '{{t .LangCode "common.uploading"}}'
|
||||
};
|
||||
|
||||
function tbResetSubmitButtons() {
|
||||
document.querySelectorAll('button[data-tb-submitting]').forEach(function(b) {
|
||||
b.disabled = false;
|
||||
b.removeAttribute('data-tb-submitting');
|
||||
var orig = b.getAttribute('data-tb-restore');
|
||||
if (orig !== null) {
|
||||
b.innerHTML = orig;
|
||||
b.removeAttribute('data-tb-restore');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('submit', function(e) {
|
||||
var form = e.target;
|
||||
if (!form || form.tagName !== 'FORM') return;
|
||||
|
||||
// 页面级提交反馈必须尊重前置校验:投票编辑页等 onsubmit 返回 false 时,
|
||||
// submit 事件仍可能继续到达此监听器;此时绝不能切换到“提交中”状态。
|
||||
if (e.defaultPrevented || form.getAttribute('data-tb-skip-submit-feedback') === '1') {
|
||||
form.removeAttribute('data-tb-skip-submit-feedback');
|
||||
return;
|
||||
}
|
||||
|
||||
// 下载 / 新窗口类表单(target="_blank",如导出):当前页不发生导航,也没有 bfcache
|
||||
// 复位机会,进入“提交中”状态后按钮会永远卡在转圈 + 禁用。这类表单直接跳过提交反馈。
|
||||
if (form.getAttribute('target') === '_blank') return;
|
||||
|
||||
// 触发提交的按钮(programmatic submit 时 e.submitter 为 null,回退到首个 submit 按钮)
|
||||
var trigger = e.submitter || form.querySelector('button[type="submit"]');
|
||||
|
||||
// 表单含已选中的文件 → 提示“上传中”,否则“提交中”
|
||||
var hasFile = false;
|
||||
form.querySelectorAll('input[type="file"]').forEach(function(f) {
|
||||
if (f.files && f.files.length > 0) hasFile = true;
|
||||
});
|
||||
var label = hasFile ? SUBMIT_I18N.uploading : SUBMIT_I18N.submitting;
|
||||
|
||||
if (trigger && trigger.tagName === 'BUTTON') {
|
||||
trigger.setAttribute('data-tb-restore', trigger.innerHTML);
|
||||
trigger.innerHTML = '<span uk-spinner="ratio: 0.6"></span> ' + label;
|
||||
}
|
||||
|
||||
// 禁用表单内所有按钮,防止重复提交
|
||||
form.querySelectorAll('button').forEach(function(b) {
|
||||
b.disabled = true;
|
||||
b.setAttribute('data-tb-submitting', '1');
|
||||
});
|
||||
});
|
||||
|
||||
// bfcache 还原时复位按钮
|
||||
window.addEventListener('pageshow', tbResetSubmitButtons);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,76 @@
|
||||
// Copyright 2022 E99p1ant. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package i18n
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestDictionaryComplete 校验四种语言的字典 key 完全一致,防止漏翻译。
|
||||
func TestDictionaryComplete(t *testing.T) {
|
||||
ref := dictionary[LangZhCN]
|
||||
langs := []string{LangZhTW, LangEn, LangJa}
|
||||
|
||||
for _, lang := range langs {
|
||||
dict := dictionary[lang]
|
||||
if len(dict) != len(ref) {
|
||||
t.Errorf("%s: 词条数量 %d != 简体中文 %d", lang, len(dict), len(ref))
|
||||
}
|
||||
for key := range ref {
|
||||
if _, ok := dict[key]; !ok {
|
||||
t.Errorf("%s: 缺少词条 %q", lang, key)
|
||||
}
|
||||
}
|
||||
for key := range dict {
|
||||
if _, ok := ref[key]; !ok {
|
||||
t.Errorf("%s: 多出简体中文没有的词条 %q", lang, key)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolve(t *testing.T) {
|
||||
cases := map[string]string{
|
||||
"": LangZhCN,
|
||||
"zh-cn": LangZhCN,
|
||||
"zh": LangZhCN,
|
||||
"zh-TW": LangZhTW,
|
||||
"zh-Hant": LangZhTW,
|
||||
"en": LangEn,
|
||||
"en-US": LangEn,
|
||||
"ja": LangJa,
|
||||
"ja-JP": LangJa,
|
||||
"fr": LangZhCN, // 未知回退
|
||||
" En ": LangEn, // 自动去除首尾空白
|
||||
"zh_cn": LangZhCN,
|
||||
"zh_tw": LangZhTW,
|
||||
"zh_hk": LangZhTW, // 香港繁体(下划线变体)
|
||||
}
|
||||
for in, want := range cases {
|
||||
if got := Resolve(in); got != want {
|
||||
t.Errorf("Resolve(%q) = %q, want %q", in, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestT(t *testing.T) {
|
||||
if got := T(LangZhCN, "nav.explore"); got != "探索" {
|
||||
t.Errorf("zh-CN nav.explore = %q", got)
|
||||
}
|
||||
if got := T(LangEn, "nav.explore"); got != "Explore" {
|
||||
t.Errorf("en nav.explore = %q", got)
|
||||
}
|
||||
if got := T(LangJa, "nav.explore"); got != "探索" {
|
||||
t.Errorf("ja nav.explore = %q", got)
|
||||
}
|
||||
// 参数填充
|
||||
if got := T(LangEn, "site.footer.visitor", "42"); got != "You are visitor #42" {
|
||||
t.Errorf("en site.footer.visitor with arg = %q", got)
|
||||
}
|
||||
// 未知 key 回退返回 key 本身
|
||||
if got := T(LangEn, "no.such.key"); got != "no.such.key" {
|
||||
t.Errorf("unknown key = %q", got)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"page": 1,
|
||||
"perPage": 3,
|
||||
"totalItems": 3,
|
||||
"totalPages": 1,
|
||||
"items": [
|
||||
{
|
||||
"collectionId": "tamabox",
|
||||
"collectionName": "tamabox-changelogs",
|
||||
"content": "新增:用户私信功能上线,可在「我的」页查看匿名来信。<br>\n修复:移动端问题列表间距过窄的问题。<br>\n优化:首页加载速度提升约 30%。",
|
||||
"created": "2024-03-04 21:45:55.000Z",
|
||||
"id": "none",
|
||||
"published_at": "2024-03-04 21:45:55.000Z",
|
||||
"updated": "2024-03-04 21:45:55.000Z"
|
||||
},
|
||||
{
|
||||
"collectionId": "tamabox",
|
||||
"collectionName": "tamabox-changelogs",
|
||||
"content": "修复:部分旧浏览器下时间显示异常。<br>\n新增:修改记录页(本页),将完整更新历史从首页挪出,保持首页简洁。",
|
||||
"created": "2024-02-29 00:00:55.000Z",
|
||||
"id": "none",
|
||||
"published_at": "2024-02-29 00:00:55.000Z",
|
||||
"updated": "2024-02-29 00:00:55.000Z"
|
||||
},
|
||||
{
|
||||
"collectionId": "tamabox",
|
||||
"collectionName": "tamabox-changelogs",
|
||||
"content": "项目初始化:匿名提问 / 回答的基础流程跑通。",
|
||||
"created": "2023-06-03 13:11:55.000Z",
|
||||
"id": "none",
|
||||
"published_at": "2023-06-03 13:11:55.000Z",
|
||||
"updated": "2023-06-03 13:11:55.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,78 @@
|
||||
<p class="{{ if .IsPixel }}uk-container{{end}} uk-text-right uk-text-muted uk-text-small">
|
||||
<br>Powered by NekoBox | {{ ICP }}<br>{{t .LangCode "site.footer.runtime"}}:<span id="box_runtime"></span>
|
||||
<br>
|
||||
<!--<a href="/pixel">画板</a> | -->
|
||||
<a href="https://box.tama.guru/_/tamakyi" target="_blank">{{t .LangCode "site.footer.admin"}}</a>
|
||||
| <a href="https://blog.tama.guru" target="_blank">{{t .LangCode "site.footer.notice"}}</a>
|
||||
| <a href="https://chat.tama.guru" target="_blank">{{t .LangCode "site.footer.chat"}}</a>
|
||||
| <a href="https://share.tama.guru" target="_blank">{{t .LangCode "site.footer.drive"}}</a>
|
||||
| <a href="https://status.tama.guru" target="_blank">{{t .LangCode "site.footer.status"}}</a>
|
||||
| <a href="https://tama.guru" target="_blank">{{t .LangCode "site.footer.nav"}}</a>
|
||||
</p>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 提交反馈(P0):点击任意表单的提交按钮后,立即把触发按钮变成「转圈 + 本地化文字」,
|
||||
// 并禁用表单内全部按钮,物理阻止在上传/网络慢时的重复点击与重复提交。
|
||||
// 浏览器前进/后退(bfcache)回到本页时自动复位,避免停留在禁用或转圈状态。
|
||||
// 纯内联反馈,不使用全屏遮罩。
|
||||
var SUBMIT_I18N = {
|
||||
submitting: '{{t .LangCode "common.submitting"}}',
|
||||
uploading: '{{t .LangCode "common.uploading"}}'
|
||||
};
|
||||
|
||||
function tbResetSubmitButtons() {
|
||||
document.querySelectorAll('button[data-tb-submitting]').forEach(function(b) {
|
||||
b.disabled = false;
|
||||
b.removeAttribute('data-tb-submitting');
|
||||
var orig = b.getAttribute('data-tb-restore');
|
||||
if (orig !== null) {
|
||||
b.innerHTML = orig;
|
||||
b.removeAttribute('data-tb-restore');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('submit', function(e) {
|
||||
var form = e.target;
|
||||
if (!form || form.tagName !== 'FORM') return;
|
||||
|
||||
// 页面级提交反馈必须尊重前置校验:投票编辑页等 onsubmit 返回 false 时,
|
||||
// submit 事件仍可能继续到达此监听器;此时绝不能切换到“提交中”状态。
|
||||
if (e.defaultPrevented || form.getAttribute('data-tb-skip-submit-feedback') === '1') {
|
||||
form.removeAttribute('data-tb-skip-submit-feedback');
|
||||
return;
|
||||
}
|
||||
|
||||
// 下载 / 新窗口类表单(target="_blank",如导出):当前页不发生导航,也没有 bfcache
|
||||
// 复位机会,进入“提交中”状态后按钮会永远卡在转圈 + 禁用。这类表单直接跳过提交反馈。
|
||||
if (form.getAttribute('target') === '_blank') return;
|
||||
|
||||
// 触发提交的按钮(programmatic submit 时 e.submitter 为 null,回退到首个 submit 按钮)
|
||||
var trigger = e.submitter || form.querySelector('button[type="submit"]');
|
||||
|
||||
// 表单含已选中的文件 → 提示“上传中”,否则“提交中”
|
||||
var hasFile = false;
|
||||
form.querySelectorAll('input[type="file"]').forEach(function(f) {
|
||||
if (f.files && f.files.length > 0) hasFile = true;
|
||||
});
|
||||
var label = hasFile ? SUBMIT_I18N.uploading : SUBMIT_I18N.submitting;
|
||||
|
||||
if (trigger && trigger.tagName === 'BUTTON') {
|
||||
trigger.setAttribute('data-tb-restore', trigger.innerHTML);
|
||||
trigger.innerHTML = '<span uk-spinner="ratio: 0.6"></span> ' + label;
|
||||
}
|
||||
|
||||
// 禁用表单内所有按钮,防止重复提交
|
||||
form.querySelectorAll('button').forEach(function(b) {
|
||||
b.disabled = true;
|
||||
b.setAttribute('data-tb-submitting', '1');
|
||||
});
|
||||
});
|
||||
|
||||
// bfcache 还原时复位按钮
|
||||
window.addEventListener('pageshow', tbResetSubmitButtons);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,277 @@
|
||||
// Package autoban 提供 fail2ban 风格的自动临时封禁:检测批量扫描/探测特征后
|
||||
// 临时封禁来源 IP,并可回调发送告警。纯标准库实现,便于独立测试与复用。
|
||||
package autoban
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 探测事件类型
|
||||
const (
|
||||
KindNone = 0 // 无探测特征
|
||||
KindSensitive = 1 // 命中敏感路径
|
||||
KindNotFound = 2 // 404 响应(未命中敏感路径)
|
||||
)
|
||||
|
||||
// 默认阈值/窗口(Options 未配置或为 0 时兜底)。
|
||||
const (
|
||||
DefaultWindowSeconds = 60
|
||||
DefaultDurationMinutes = 15
|
||||
DefaultThresholdSensitive = 10
|
||||
DefaultThreshold404 = 20
|
||||
pathSampleMax = 6
|
||||
)
|
||||
|
||||
// Options 自动封禁配置。
|
||||
type Options struct {
|
||||
Enabled bool
|
||||
// TrackNotFound 是否把 KindNotFound(未注册路径的 404)计入封禁统计。
|
||||
// 默认 false:正常业务路径一律放行,仅敏感扫描特征路径参与计数封禁,
|
||||
// 避免共享出口下正常访问被 404 探测连坐误伤(详见 conf.Security.BanTrackNotFound)。
|
||||
TrackNotFound bool
|
||||
ThresholdSensitive int // 窗口内敏感路径命中次数
|
||||
Threshold404 int // 窗口内 404 次数
|
||||
Window time.Duration // 统计窗口
|
||||
Duration time.Duration // 封禁时长
|
||||
AlertEmail string // 告警收件人(留空不发送)
|
||||
SendAlert func(ip string, paths []string, durationMinutes int) error // 告警发送函数(nil 则不发送)
|
||||
}
|
||||
|
||||
// sensitivePaths 常见后台/配置/漏洞探测路径特征(忽略大小写,前缀匹配)。
|
||||
var sensitivePaths = []string{
|
||||
"/admin", "/wp-admin", "/wp-login.php", "/wp-content", "/wordpress",
|
||||
"/administrator", "/manager", "/cpanel", "/plesk",
|
||||
"/.env", "/.git", "/.aws", "/.ssh", "/.svn", "/.hg", "/.htaccess",
|
||||
"/config", "/configuration", "/backup", "/database", "/db",
|
||||
"/actuator", "/swagger", "/api-docs", "/openapi", "/v2/api-docs",
|
||||
"/phpmyadmin", "/pma", "/mysql", "/server-status", "/server-info",
|
||||
"/shell", "/webshell", "/cmd", "/eval", "/hack", "/shell.php",
|
||||
"/login.php", "/admin.php", "/index.php", "/console", "/vendor",
|
||||
}
|
||||
|
||||
type probeEvent struct {
|
||||
at time.Time
|
||||
kind int
|
||||
}
|
||||
|
||||
type probeStat struct {
|
||||
events []probeEvent
|
||||
sensitive int
|
||||
notFound int
|
||||
paths []string // 命中路径样本(告警用)
|
||||
}
|
||||
|
||||
// Banner 自动封禁器。方法并发安全。
|
||||
type Banner struct {
|
||||
mu sync.Mutex
|
||||
|
||||
probes map[string]*probeStat
|
||||
banned map[string]time.Time
|
||||
alerted map[string]bool
|
||||
|
||||
thresholdSensitive int
|
||||
threshold404 int
|
||||
trackNotFound bool
|
||||
window time.Duration
|
||||
duration time.Duration
|
||||
alertEmail string
|
||||
sendAlert func(ip string, paths []string, durationMinutes int) error
|
||||
enabled bool
|
||||
}
|
||||
|
||||
// New 按配置创建封禁器并注册全局清理。
|
||||
func New(opts Options) *Banner {
|
||||
window := opts.Window
|
||||
if window <= 0 {
|
||||
window = DefaultWindowSeconds * time.Second
|
||||
}
|
||||
duration := opts.Duration
|
||||
if duration <= 0 {
|
||||
duration = DefaultDurationMinutes * time.Minute
|
||||
}
|
||||
sensitive := opts.ThresholdSensitive
|
||||
if sensitive <= 0 {
|
||||
sensitive = DefaultThresholdSensitive
|
||||
}
|
||||
notFound := opts.Threshold404
|
||||
if notFound <= 0 {
|
||||
notFound = DefaultThreshold404
|
||||
}
|
||||
b := &Banner{
|
||||
probes: make(map[string]*probeStat),
|
||||
banned: make(map[string]time.Time),
|
||||
alerted: make(map[string]bool),
|
||||
thresholdSensitive: sensitive,
|
||||
threshold404: notFound,
|
||||
trackNotFound: opts.TrackNotFound,
|
||||
window: window,
|
||||
duration: duration,
|
||||
alertEmail: strings.TrimSpace(opts.AlertEmail),
|
||||
sendAlert: opts.SendAlert,
|
||||
enabled: opts.Enabled,
|
||||
}
|
||||
register(b)
|
||||
return b
|
||||
}
|
||||
|
||||
// Record 记录一次探测事件,达到阈值时封禁 IP 并触发一次告警。
|
||||
func (b *Banner) Record(ip, path string, kind int) {
|
||||
if !b.enabled || ip == "" || kind == KindNone {
|
||||
return
|
||||
}
|
||||
// 404 计数默认关闭(正常业务路径一律放行,仅敏感扫描特征参与封禁):
|
||||
// 只有显式开启 TrackNotFound 时才把未注册路径的 404 计入统计。
|
||||
if kind == KindNotFound && !b.trackNotFound {
|
||||
return
|
||||
}
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
|
||||
now := time.Now()
|
||||
cutoff := now.Add(-b.window)
|
||||
|
||||
st := b.probes[ip]
|
||||
if st == nil {
|
||||
st = &probeStat{}
|
||||
b.probes[ip] = st
|
||||
}
|
||||
|
||||
// 滚动清理过期事件并重算计数
|
||||
valid := st.events[:0]
|
||||
sensitive, notFound := 0, 0
|
||||
for _, e := range st.events {
|
||||
if e.at.After(cutoff) {
|
||||
valid = append(valid, e)
|
||||
if e.kind == KindSensitive {
|
||||
sensitive++
|
||||
} else if e.kind == KindNotFound {
|
||||
notFound++
|
||||
}
|
||||
}
|
||||
}
|
||||
valid = append(valid, probeEvent{at: now, kind: kind})
|
||||
if kind == KindSensitive {
|
||||
sensitive++
|
||||
} else {
|
||||
notFound++
|
||||
}
|
||||
st.events = valid
|
||||
st.sensitive = sensitive
|
||||
st.notFound = notFound
|
||||
if len(st.paths) < pathSampleMax && path != "" {
|
||||
st.paths = append(st.paths, path)
|
||||
}
|
||||
|
||||
if sensitive < b.thresholdSensitive && notFound < b.threshold404 {
|
||||
return
|
||||
}
|
||||
|
||||
// 已达阈值:封禁(已在封禁中则跳过)
|
||||
if until, ok := b.banned[ip]; ok && until.After(now) {
|
||||
return
|
||||
}
|
||||
until := now.Add(b.duration)
|
||||
b.banned[ip] = until
|
||||
|
||||
// 告警(每 IP 仅一次)
|
||||
if b.alertEmail != "" && b.sendAlert != nil && !b.alerted[ip] {
|
||||
b.alerted[ip] = true
|
||||
sample := append([]string{}, st.paths...)
|
||||
dur := int(b.duration.Minutes())
|
||||
go func() {
|
||||
_ = b.sendAlert(ip, sample, dur)
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
// IsBanned 判断 IP 是否处于封禁期;到期自动解除。
|
||||
func (b *Banner) IsBanned(ip string) bool {
|
||||
if !b.enabled || ip == "" {
|
||||
return false
|
||||
}
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
if until, ok := b.banned[ip]; ok {
|
||||
if until.After(time.Now()) {
|
||||
return true
|
||||
}
|
||||
delete(b.banned, ip)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsSensitivePath 判断路径是否命中敏感探测特征(忽略大小写,完整段前缀匹配)。
|
||||
func IsSensitivePath(p string) bool {
|
||||
lower := strings.ToLower(p)
|
||||
for _, s := range sensitivePaths {
|
||||
if lower == s || strings.HasPrefix(lower, s+"/") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// ---------- 全局注册与清理 ----------
|
||||
|
||||
var (
|
||||
bannersMu sync.Mutex
|
||||
banners = make(map[*Banner]struct{})
|
||||
bannersOnce sync.Once
|
||||
)
|
||||
|
||||
func register(b *Banner) {
|
||||
bannersMu.Lock()
|
||||
banners[b] = struct{}{}
|
||||
bannersMu.Unlock()
|
||||
|
||||
bannersOnce.Do(func() {
|
||||
go func() {
|
||||
for {
|
||||
time.Sleep(2 * time.Minute)
|
||||
bannersMu.Lock()
|
||||
for b := range banners {
|
||||
b.cleanup()
|
||||
}
|
||||
bannersMu.Unlock()
|
||||
}
|
||||
}()
|
||||
})
|
||||
}
|
||||
|
||||
// cleanup 定期清理过期探测记录与已到期封禁(防止内存膨胀)。
|
||||
func (b *Banner) cleanup() {
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
|
||||
now := time.Now()
|
||||
cutoff := now.Add(-b.window)
|
||||
|
||||
for ip, st := range b.probes {
|
||||
if len(st.events) == 0 || st.events[len(st.events)-1].at.Before(cutoff) {
|
||||
delete(b.probes, ip)
|
||||
continue
|
||||
}
|
||||
valid := st.events[:0]
|
||||
sensitive, notFound := 0, 0
|
||||
for _, e := range st.events {
|
||||
if e.at.After(cutoff) {
|
||||
valid = append(valid, e)
|
||||
if e.kind == KindSensitive {
|
||||
sensitive++
|
||||
} else if e.kind == KindNotFound {
|
||||
notFound++
|
||||
}
|
||||
}
|
||||
}
|
||||
st.events = valid
|
||||
st.sensitive = sensitive
|
||||
st.notFound = notFound
|
||||
}
|
||||
for ip, until := range b.banned {
|
||||
if !until.After(now) {
|
||||
delete(b.banned, ip)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package autoban
|
||||
|
||||
import (
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func newTestBanner(thresholdSensitive, threshold404 int, window, duration time.Duration, alertEmail string, alertCalls *int64) *Banner {
|
||||
return New(Options{
|
||||
Enabled: true,
|
||||
TrackNotFound: true, // 测试 helper 显式开启 404 跟踪,覆盖两种计数的既有用例
|
||||
ThresholdSensitive: thresholdSensitive,
|
||||
Threshold404: threshold404,
|
||||
Window: window,
|
||||
Duration: duration,
|
||||
AlertEmail: alertEmail,
|
||||
SendAlert: func(ip string, paths []string, dur int) error {
|
||||
if alertCalls != nil {
|
||||
atomic.AddInt64(alertCalls, 1)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestSensitiveThreshold(t *testing.T) {
|
||||
b := newTestBanner(2, 5, time.Minute, time.Minute, "", nil)
|
||||
b.Record("1.2.3.4", "/admin", KindSensitive)
|
||||
if b.IsBanned("1.2.3.4") {
|
||||
t.Fatal("should not be banned before reaching threshold")
|
||||
}
|
||||
b.Record("1.2.3.4", "/.env", KindSensitive)
|
||||
if !b.IsBanned("1.2.3.4") {
|
||||
t.Fatal("expected ban after reaching sensitive threshold")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNotFoundThreshold(t *testing.T) {
|
||||
b := newTestBanner(10, 3, time.Minute, time.Minute, "", nil)
|
||||
for i := 0; i < 3; i++ {
|
||||
b.Record("5.6.7.8", "/random-"+string(rune('a'+i)), KindNotFound)
|
||||
}
|
||||
if !b.IsBanned("5.6.7.8") {
|
||||
t.Fatal("expected ban after reaching 404 threshold")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNotFoundTrackDisabledByDefault(t *testing.T) {
|
||||
// 默认(TrackNotFound=false)下 404 不参与统计:正常业务路径一律放行,
|
||||
// 仅敏感扫描路径仍计数封禁——防止共享出口下正常访问被 404 探测连坐误伤。
|
||||
b := New(Options{Enabled: true, ThresholdSensitive: 1, Threshold404: 1, Window: time.Minute, Duration: time.Minute})
|
||||
for i := 0; i < 5; i++ {
|
||||
b.Record("7.7.7.7", "/random-"+string(rune('a'+i)), KindNotFound)
|
||||
}
|
||||
if b.IsBanned("7.7.7.7") {
|
||||
t.Fatal("404 events must not accumulate when TrackNotFound is false")
|
||||
}
|
||||
b.Record("7.7.7.7", "/.env", KindSensitive)
|
||||
if !b.IsBanned("7.7.7.7") {
|
||||
t.Fatal("sensitive events must still ban even when 404 tracking is off")
|
||||
}
|
||||
}
|
||||
|
||||
func TestWindowExpiry(t *testing.T) {
|
||||
b := newTestBanner(2, 5, 50*time.Millisecond, time.Minute, "", nil)
|
||||
b.Record("1.1.1.1", "/admin", KindSensitive)
|
||||
time.Sleep(80 * time.Millisecond) // 事件滑出窗口
|
||||
b.Record("1.1.1.1", "/.env", KindSensitive)
|
||||
if b.IsBanned("1.1.1.1") {
|
||||
t.Fatal("events outside the window must not accumulate")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDurationExpiry(t *testing.T) {
|
||||
b := newTestBanner(1, 5, time.Minute, 60*time.Millisecond, "", nil)
|
||||
b.Record("2.2.2.2", "/admin", KindSensitive)
|
||||
if !b.IsBanned("2.2.2.2") {
|
||||
t.Fatal("expected ban")
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond) // 封禁到期
|
||||
if b.IsBanned("2.2.2.2") {
|
||||
t.Fatal("ban should expire after duration")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAlertOncePerIP(t *testing.T) {
|
||||
var calls int64
|
||||
b := newTestBanner(1, 5, time.Minute, time.Minute, "[email protected]", &calls)
|
||||
b.Record("9.9.9.9", "/wp-admin", KindSensitive)
|
||||
b.Record("9.9.9.9", "/.git", KindSensitive) // 已在封禁中,不应重复告警
|
||||
b.Record("9.9.9.9", "/config", KindSensitive)
|
||||
|
||||
// sendAlert 异步调用,轮询等待最多 500ms
|
||||
deadline := time.Now().Add(500 * time.Millisecond)
|
||||
for atomic.LoadInt64(&calls) == 0 && time.Now().Before(deadline) {
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
if got := atomic.LoadInt64(&calls); got != 1 {
|
||||
t.Fatalf("expected exactly 1 alert, got %d", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDisabled(t *testing.T) {
|
||||
b := New(Options{Enabled: false})
|
||||
b.Record("3.3.3.3", "/admin", KindSensitive)
|
||||
if b.IsBanned("3.3.3.3") {
|
||||
t.Fatal("disabled auto-ban must not ban")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaults(t *testing.T) {
|
||||
b := New(Options{Enabled: true}) // 全部走默认值
|
||||
if b.thresholdSensitive != DefaultThresholdSensitive || b.threshold404 != DefaultThreshold404 {
|
||||
t.Fatalf("default thresholds wrong: %d/%d", b.thresholdSensitive, b.threshold404)
|
||||
}
|
||||
if b.window != DefaultWindowSeconds*time.Second || b.duration != DefaultDurationMinutes*time.Minute {
|
||||
t.Fatalf("default window/duration wrong: %v/%v", b.window, b.duration)
|
||||
}
|
||||
if b.trackNotFound {
|
||||
t.Fatal("404 tracking must be disabled by default")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsSensitivePath(t *testing.T) {
|
||||
cases := []struct {
|
||||
path string
|
||||
want bool
|
||||
}{
|
||||
{"/admin", true},
|
||||
{"/admin/panel", true},
|
||||
{"/WP-ADMIN", true},
|
||||
{"/.env", true},
|
||||
{"/user/questions", false},
|
||||
{"/vote/abc123", false},
|
||||
{"/administratorx", false}, // 前缀必须完整段匹配,避免误伤
|
||||
}
|
||||
for _, c := range cases {
|
||||
if got := IsSensitivePath(c.path); got != c.want {
|
||||
t.Errorf("IsSensitivePath(%q) = %v, want %v", c.path, got, c.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user