MCPcopy Create free account

hub / github.com/Prejudice-Studio/Twilight / functions

Functions2,686 in github.com/Prejudice-Studio/Twilight

↓ 13 callersMethodtelegramPost
(ctx context.Context, method string, body map[string]any, dst any)
internal/api/telegram.go:96
↓ 13 callersMethodtelegramProtectedTarget
(u store.User)
internal/api/telegram_inline.go:796
↓ 12 callersMethodInviteCode
(code string)
internal/store/store.go:3351
↓ 12 callersMethodListAnnouncements
(includeHidden bool)
internal/store/store.go:2891
↓ 12 callersMethodPlaybackRecords
(uid int64, since int64, limit int)
internal/store/playback.go:52
↓ 12 callersMethodRead
()
internal/config/reader.go:20
↓ 12 callersMethodSchedulerRuns
(jobID string, limit int)
internal/store/scheduler.go:70
↓ 12 callersFunctiondescribePostgresConnectionError
(info postgresInfo, err error)
internal/store/store.go:695
↓ 12 callersFunctiondeveloperJSOptionString
developerJSOptionString reads the first matching key as a trimmed-free string (no trim, callers trim where needed), returning "" when none are present
internal/api/telegram_js_generators.go:466
↓ 12 callersFunctiondeveloperJSUserSnapshot
(user store.User)
internal/api/telegram_js_commands.go:346
↓ 12 callersFunctionemailConfigured
emailConfigured 判定邮箱子系统是否可用:总开关开启 + 有 SMTP 主机 + 有可用的 发件地址(from_address 或回退 smtp_username)。前端入口展示、后端发码守卫都以 此为准,避免 force_bind=true 却没配 SMTP 把用户锁死在仪表盘外。
internal/api/email_client.go:21
↓ 12 callersMethodembyDelete
(ctx context.Context, apiPath string)
internal/api/emby_client.go:112
↓ 12 callersFunctionemptyNil
(value string)
internal/api/business.go:1366
↓ 12 callersMethodensure
()
internal/store/store.go:905
↓ 12 callersFunctionnormalizeEmailKey
(email string)
internal/store/email_verification.go:48
↓ 12 callersFunctionnormalizeRegCodeDays
normalizeRegCodeDays 规范化卡码天数的历史哨兵语义,必须与 addDaysToExpiry / expiryFromDays 的口径一致: - days == 0(或字段未设):历史默认值,按 30 天处理; - days < 0:永久(-1 是唯一的"永久"哨兵); - day
internal/api/business.go:219
↓ 12 callersFunctionsanitizeImageUrl
(url?: string | null)
webui/src/lib/safe-url.ts:7
↓ 12 callersMethodstringListValue
(fallback []string, keys ...string)
internal/config/config.go:1278
↓ 11 callersMethodPostgresDSN
()
internal/config/config.go:1678
↓ 11 callersFunctionaddBatchOutcome
addBatchOutcome 累加单条 outcome 到批量响应里。code 可空字符串,表示"未携 带结构化码"——这种调用点应当尽快迁移到具名 ErrCode(参见 R64-8)。前端约 定按 errors[].code 做 switch,errors[].error 仅作运维日志用文案。
internal/api/business.go:1401
↓ 11 callersFunctiondailySpec
(value string, fallbackHour, fallbackMinute int)
internal/api/scheduler_daemon.go:437
↓ 11 callersFunctionmax
(a, b int)
internal/api/business.go:36
↓ 11 callersMethodrawValue
(keys ...string)
internal/config/config.go:1112
↓ 11 callersMethodrecordRegisterBindFailure
(bind store.BindCode, code string, status string, errorCode ErrCode, httpStatus int, message string)
internal/api/telegram_bind_status.go:108
↓ 11 callersMethodrejectRegcodeWriteIfStorageMismatch
(w http.ResponseWriter)
internal/api/storage_guard.go:51
↓ 11 callersMethodrunSchedulerJob
(r *http.Request, jobID string)
internal/api/scheduler_runner.go:98
↓ 11 callersMethodtelegramAnswerCallbackQuery
(ctx context.Context, callbackID, text string, showAlert bool)
internal/api/telegram.go:219
↓ 11 callersMethodupsertBindCode
(bind store.BindCode)
internal/api/telegram_bind_status.go:129
↓ 10 callersMethodDo
(ctx context.Context, args ...string)
internal/redis/redis.go:145
↓ 10 callersMethodPutEmailVerification
PutEmailVerification 原子地清掉同一 (purpose,email) 下的旧记录再写入新记录, 保证每个用途+邮箱最多只有一份在用验证码(重复发码不累积,最新码生效)。
internal/store/email_verification.go:54
↓ 10 callersMethodconfigFilePath
()
internal/api/config_admin.go:604
↓ 10 callersFunctioncreated
(w http.ResponseWriter, message string, data any)
internal/api/response.go:89
↓ 10 callersMethodembyApplyEnabledState
embyApplyEnabledState 启停 Emby 后把状态镜像回本地 EmbyDisabled,让用户列表无需逐行 查 Emby 即可展示真实的 Emby 启停。uid 已知时走 O(1) 的 UpdateUser,刻意不用按 EmbyID 的线性扫描,避免在批量/调度场景退化成 O(n^
internal/api/emby.go:359
↓ 10 callersMethodembyPost
(ctx context.Context, apiPath string, body any, dst any)
internal/api/emby_client.go:100
↓ 10 callersMethodhandleRenew
(w http.ResponseWriter, r *http.Request, _ Params)
internal/api/handlers.go:457
↓ 10 callersMethodhandleUseCode
(w http.ResponseWriter, r *http.Request, _ Params)
internal/api/code_use_handlers.go:13
↓ 10 callersFunctioninventoryResult
(exists bool, message string, item map[string]any, seasons []int, season int)
internal/api/emby_inventory.go:195
↓ 10 callersMethodprotectedUserReason
(u store.User)
internal/api/business.go:158
↓ 10 callersFunctionrandomFromAlphabet
(alphabet string, length int)
internal/api/business.go:783
↓ 10 callersFunctionrenderConfigTOML
(values map[string]map[string]any)
internal/api/config_admin.go:1277
↓ 10 callersFunctiontelegramChatIDs
(values []string)
internal/api/telegram.go:450
↓ 10 callersMethodtelegramRenderText
(text string)
internal/api/telegram_bot.go:1097
↓ 9 callersMethodConsumeInviteCode
(code string, childUID int64)
internal/store/store.go:3406
↓ 9 callersMethodListDevices
(uid int64)
internal/store/device.go:24
↓ 9 callersMethodListMediaRequests
(uid int64, all bool)
internal/store/store.go:2695
↓ 9 callersFunctionNew
(cfg config.Config, st *store.Store)
internal/api/app.go:221
↓ 9 callersMethodSetUserActiveAtomic
SetUserActiveAtomic 与 SetUserRoleAtomic 同理,处理"禁用最后一个 active admin"。 解决 handleAdminToggleUser 把"是否最后 admin"放在闭包外快照读取的问题。
internal/store/store.go:2166
↓ 9 callersMethodTicket
(id int64)
internal/store/store.go:3074
↓ 9 callersMethodTicketTypes
TicketTypes 返回当前工单类型列表。
internal/store/store.go:3220
↓ 9 callersFunctionValidateEmailFormat
(email string)
internal/validate/validate.go:99
↓ 9 callersMethodclear
(code string)
internal/api/bind_status_hub.go:184
↓ 9 callersFunctioncreateTicket
(t *testing.T, app *App, title, content string, cookies []*http.Cookie)
internal/api/ticket_handlers_test.go:70
↓ 9 callersFunctionformatSeconds
(seconds int64)
internal/api/business.go:1420
↓ 9 callersFunctionformatTimestamp
(seconds: number | null | undefined)
webui/src/app/(main)/admin/scheduler/page.tsx:56
↓ 9 callersMethodhandleTelegramUpdate
(ctx context.Context, update map[string]any)
internal/api/telegram_bot.go:184
↓ 9 callersFunctionmarkRegistrationGrant
(u *store.User, source, code string)
internal/api/business.go:229
↓ 9 callersMethodmaxCodeDays
(user store.User)
internal/api/business.go:1120
↓ 9 callersFunctionnormalizeBindStatusCode
(code string)
internal/api/bind_status_hub.go:229
↓ 9 callersMethodnotifyLocked
(code string)
internal/api/bind_status_hub.go:220
↓ 9 callersFunctionrenewExpiryAndReactivate
renewExpiryAndReactivate 把"续期"语义统一成一个动作:bump ExpiredAt 同时 在新到期时刻仍然有效(> now)的前提下复位 Active=true。 历史背景:check_expired 调度对**非邀请**用户会直接 `Active=false`(参见 s
internal/api/business.go:322
↓ 9 callersFunctionroleName
(role int)
internal/api/app.go:1431
↓ 9 callersMethodsaveConfigContent
(content string)
internal/api/config_admin.go:388
↓ 9 callersMethodtelegramAdminID
(telegramID int64)
internal/api/telegram_bot.go:974
↓ 9 callersMethodtelegramTouchPanel
(panel telegramPanelContext)
internal/api/telegram_inline.go:216
↓ 9 callersMethodtoAbsoluteAssetUrl
(url?: string | null)
webui/src/lib/api.ts:131
↓ 9 callersFunctionuploadTicketImage
uploadTicketImage 通过 multipart 上传一张图片,返回响应记录。
internal/api/ticket_handlers_test.go:47
↓ 9 callersFunctionvalidatePasswordStrength
( password: string, label = "新密码" )
webui/src/lib/password.ts:11
↓ 8 callersMethodConsumeEmailVerificationAtomic
ConsumeEmailVerificationAtomic 校验候选哈希并按结果原子更新状态: - 过期:删除记录,返回 Expired; - 命中:删除记录(消费),返回 OK; - 不命中且尝试未达上限:Attempts+1 落盘,返回 Mismatch; - 不命中且达上限:删除记录,返回
internal/store/email_verification.go:101
↓ 8 callersFunctionInstallRuntimeLogger
(w io.Writer, level zapcore.Level)
internal/api/runtime_logs.go:295
↓ 8 callersMethodListAllInviteCodes
()
internal/store/store.go:3358
↓ 8 callersMethodWriteHeader
(status int)
internal/api/app.go:169
↓ 8 callersMethodappend
(entry RuntimeLogEntry)
internal/api/runtime_logs.go:100
↓ 8 callersFunctionbangumiEndpoint
(base, path string, values url.Values)
internal/api/bangumi_client.go:62
↓ 8 callersFunctioncleanupSchedulerRuntimeConfig
(t: TFunc, jobID: string)
webui/src/app/(main)/admin/scheduler/page.tsx:169
↓ 8 callersFunctionconfigSectionDefs
()
internal/api/config_admin.go:917
↓ 8 callersFunctiondeveloperJSOptionInt
developerJSOptionInt reads the first matching key from an exported JS options object as an int, falling back to the supplied default when absent.
internal/api/telegram_js_generators.go:455
↓ 8 callersMethodembyShouldEnableUser
(u store.User)
internal/api/emby.go:421
↓ 8 callersFunctionenableTicketSystem
enableTicketSystem 在运行时打开工单系统并按需覆盖并发上限 / 图片限制。 直接走 runtime.Store 替换 cfg,原因同 TestSessionCookieRespectsConfiguredDomain: New() 之后 cfg 副本存在 runtimeState
internal/api/ticket_handlers_test.go:19
↓ 8 callersFunctiongetJSON
(ctx context.Context, endpoint string, headers map[string]string, dst any)
internal/api/http_json_client.go:74
↓ 8 callersMethodhashEmailCode
hashEmailCode 用服务端密钥对 (id|code) 做 HMAC-SHA256,返回 hex。store 只存这个 哈希并做定长常量时间比较;即使 state 泄露也读不出明文码,配合短码 + 尝试上限 + 短 TTL,离线爆破窗口受限。
internal/api/email_verify_service.go:71
↓ 8 callersFunctionmustDevice
(t *testing.T, st *Store, d Device)
internal/store/device_limit_test.go:82
↓ 8 callersFunctionnormalizeMediaStatus
(status string)
internal/api/business.go:391
↓ 8 callersFunctionpasswordStrengthLabel
(score: number)
webui/src/lib/password.ts:55
↓ 8 callersFunctionpngBytes
pngBytes 返回一段最小可被 http.DetectContentType 识别为 image/png 的字节。
internal/api/ticket_handlers_test.go:42
↓ 8 callersFunctionpublicExpiryUnix
(expiredAt int64)
internal/api/business.go:189
↓ 8 callersFunctionrequireAdmin
requireAdmin 是 admin-only handler 的入口断言。AuthAdmin 路由已在 dispatcher(app.go:611)处把非 admin 阻挡在外,但 handler 自身再确认一次 caller 角色,避免: 1. 路由表手抖把 admin handler 挂
internal/api/app.go:1484
↓ 8 callersMethodrequireEmbyConfigured
requireEmbyConfigured 把"Emby URL 或 Token 未配置 → 写一致的 400 响应"的样板收敛 到一处。同时校验 URL 和 Token:仅配置 URL 而 Token 为空时,所有 Emby API 调用 都会以未鉴权身份发出,可能导致数据泄露或被 Emby 拒绝
internal/api/business.go:334
↓ 8 callersMethodrequireNonEmbyAdmin
(w http.ResponseWriter, r *http.Request, user store.User)
internal/api/emby.go:178
↓ 8 callersMethodschedulerJobRunning
(jobID string)
internal/api/scheduler_daemon.go:485
↓ 8 callersMethodsnapshot
(limit int, after int64)
internal/api/runtime_logs.go:136
↓ 8 callersFunctionstop
()
webui/src/hooks/use-bind-code-status.ts:86
↓ 8 callersFunctiontelegramCommand
(raw string)
internal/api/telegram_bot.go:994
↓ 8 callersFunctiontelegramYesNoLabel
(ok bool)
internal/api/telegram_bot.go:1183
↓ 8 callersFunctionwriteWebSocketClose
(conn net.Conn)
internal/api/websocket.go:66
↓ 7 callersFunctionConfigureRuntimeLogging
(level zapcore.Level, limit int)
internal/api/runtime_logs.go:313
↓ 7 callersMethodCreate
(ctx context.Context, uid int64)
internal/api/session.go:111
↓ 7 callersMethodSetUserEmailVerifiedAtomic
SetUserEmailVerifiedAtomic 绑定邮箱并设置验证状态。约定: - email 非空则更新 User.Email;为空则保留现有邮箱(用于仅切换验证态)。 - verified=true 且 force=false 时做占用冲突校验(其它已验证账号占用 → ErrConflic
internal/store/email_verification.go:291
↓ 7 callersMethodUserCount
()
internal/store/store.go:1636
↓ 7 callersMethodUserLatestRebindRequest
UserLatestRebindRequest returns the most recent rebind request for a user, regardless of status. Returns (request, true) if found, or (zero, false) if
internal/store/store.go:3898
↓ 7 callersFunctionValidateUsername
ValidateUsername 校验用户名。
internal/validate/validate.go:42
← previousnext →101–200 of 2,686, ranked by callers