Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Prejudice-Studio/Twilight
/ functions
Functions
2,686 in github.com/Prejudice-Studio/Twilight
⨍
Functions
2,686
◇
Types & classes
267
↓ 2 callers
Function
uniqueInt64s
(values []int64)
internal/api/batch_helpers.go:23
↓ 2 callers
Function
update
(props: ToasterToast)
webui/src/hooks/use-toast.ts:166
↓ 2 callers
Function
updateRow
(idx: number, patch: Partial<{ command: string; reply: string }>)
webui/src/app/(main)/admin/config/page.tsx:416
↓ 2 callers
Function
uploadRefKey
(kind, filename string)
internal/api/admin_jobs.go:383
↓ 2 callers
Function
uploadedTicketImageFilename
uploadedTicketImageFilename 上传一张图片并从响应里取回服务端落盘后的文件名。
internal/api/ticket_handlers_test.go:271
↓ 2 callers
Function
upstreamIsTrustedProxy
upstreamIsTrustedProxy 判断 r.RemoteAddr 的对端是否落在 cfg.TrustedProxyCIDRs 列表里。返回 true 时,clientIP 才会消费 X-Forwarded-For / X-Real-IP / CF-* 这 些可被任意调用方伪造的代理头;否
internal/api/app.go:1173
↓ 2 callers
Function
useBindCodeStatus
(options: UseBindCodeStatusOptions)
webui/src/hooks/use-bind-code-status.ts:60
↓ 2 callers
Method
useCode
(regCode: string, options?: { embyUsername?: string; embyPassword?: string; checkOnly?: boolean })
webui/src/lib/api.ts:675
↓ 2 callers
Function
userHaystack
(u: EmbyAuditUser)
webui/src/components/admin/emby-device-audit-panel.tsx:100
↓ 2 callers
Function
userMatchesCategory
(u: EmbyAuditUser, category: CategoryKey)
webui/src/components/admin/emby-device-audit-panel.tsx:125
↓ 2 callers
Function
usersBatchFilterParams
(state: UsersListState)
webui/src/app/(main)/admin/users/admin-users-helpers.ts:54
↓ 2 callers
Function
validTicketPriority
(priority string)
internal/api/ticket_handlers.go:618
↓ 2 callers
Function
validTicketType
(types []string, input string)
internal/api/ticket_handlers.go:626
↓ 2 callers
Function
validateAccount
()
webui/src/app/(auth)/setup/page.tsx:142
↓ 2 callers
Function
validateCORSOriginsStartup
validateCORSOriginsStartup 在启动 / reload 时对 CORS 配置做静态体检: - 显式 `*` 与 Allow-Credentials: true 是浏览器规范禁止的组合, applyCORS 已运行期跳过 `*`,但管理员看不到任何反馈, 因此这里强制 zap.
internal/api/app.go:940
↓ 2 callers
Function
validateDeveloperJSPresetCode
(w http.ResponseWriter, code string)
internal/api/developer_handlers.go:214
↓ 2 callers
Function
validateEmailOptional
(email: string)
webui/src/lib/validators.ts:72
↓ 2 callers
Function
validateEmbyURL
validateEmbyURL 拆出来便于单测;返回 trim 右斜杠的 base URL。 现在转调通用 validateOutboundBaseURL,与 Bangumi/Telegram/TMDB 共享同一套 scheme / host / link-local / 元数据 IP / que
internal/api/emby_client.go:70
↓ 2 callers
Function
validateSetupHTTPURL
(value, label string)
internal/api/setup_handlers.go:294
↓ 2 callers
Function
validateTrustedProxyStartup
validateTrustedProxyStartup 在启动 / reload 时核验"信任代理头 + 上游 CIDR" 这对配置: - TrustProxyHeaders=true 但 TrustedProxyCIDRs 为空:打 Error 提醒—— upstreamIsTrustedProx
internal/api/app.go:1002
↓ 2 callers
Function
validateUpdateBranch
(branch string)
internal/api/system_update.go:41
↓ 2 callers
Method
verifyEmailCode
(data: { verification_id: string; code: string })
webui/src/lib/api.ts:542
↓ 2 callers
Function
verifyPasswordThrottled
verifyPasswordThrottled 在并发上限信号量下执行 security.VerifyPassword。 信号量满时阻塞等待槽位(而非拒绝),配合上游限流把 PBKDF2 的总 CPU 占用约束住。
internal/api/password_verify.go:34
↓ 2 callers
Function
webSocketOriginFromHTTPOrigin
(origin: string)
webui/src/middleware.ts:50
↓ 2 callers
Function
withTimeoutSignal
* 把"调用方 signal"与"超时 signal"合并成一个:任一触发都 abort。 * 走 AbortSignal.timeout + AbortSignal.any 优先(现代浏览器/Node 18+), * 退化路径手写同样语义,保证 SSR / 老浏览器也能跑。 * * tim
webui/src/lib/api-request.ts:118
↓ 2 callers
Function
writeCommand
(w io.Writer, args ...string)
internal/redis/redis.go:246
↓ 2 callers
Function
writeTelegramBindCodeState
(w http.ResponseWriter, state telegramBindCodeState)
internal/api/telegram_bind_status.go:99
↓ 2 callers
Function
writeWebSocketText
(conn net.Conn, payload []byte)
internal/api/websocket.go:45
↓ 1 callers
Method
ActiveMediaRequestCount
(uid int64)
internal/store/store.go:2659
↓ 1 callers
Method
ActiveMediaRequestCountTotal
ActiveMediaRequestCountTotal 统计全站正在处理(未完成 / 未拒绝)的求片数。 用于配置里 max_concurrent_requests_global 全局并发上限的判定。 不区分用户 / Telegram ID,单纯按 Status 是否仍是活跃流程内(pending
internal/store/store.go:2676
↓ 1 callers
Method
AddTicketAttachment
AddTicketAttachment 给工单追加一张图片元数据。返回更新后的工单。
internal/store/store.go:3130
↓ 1 callers
Method
AddTicketType
AddTicketType 添加工单类型,已存在则返回 ErrConflict。
internal/store/store.go:3243
↓ 1 callers
Method
ApplyTelegramRosterUpdates
(updates []TelegramRosterUpdate)
internal/store/store.go:4021
↓ 1 callers
Function
CheckPostgresTarget
(ctx context.Context, dsn string)
internal/store/store.go:739
↓ 1 callers
Method
CleanupExpired
CleanupExpired removes expired sessions from all layers. 接受 caller ctx:scheduler 已提供 runCtx,被 admin 终止时能立刻取消。 不接 ctx 的旧版本若 PG DELETE 卡住,scheduler 永远等
internal/api/session.go:270
↓ 1 callers
Method
CleanupExpiredBindCodes
(now int64)
internal/store/store.go:2839
↓ 1 callers
Method
CleanupUnverifiedEmailsByAge
CleanupUnverifiedEmailsByAge 清除所有未验证邮箱中,用户账号创建时间早于 cutoff 的记录。 避免 ClearUnverifiedEmails 那种"注册不到 5 分钟就清掉邮箱"的激进行为, 给用户留足验证时间(默认 cutoff=24h)。
internal/store/email_verification.go:215
↓ 1 callers
Method
ClearAuditLogs
ClearAuditLogs 清空全部审计日志。
internal/store/store.go:4268
↓ 1 callers
Method
ClearUnverifiedEmails
ClearUnverifiedEmails 清空所有 EmailVerified=false 的用户的 Email 字段。
internal/store/email_verification.go:195
↓ 1 callers
Method
ClearUserEmails
()
internal/store/store.go:1908
↓ 1 callers
Method
ClearViolationLogs
ClearViolationLogs removes all violation logs.
internal/store/store.go:4208
↓ 1 callers
Method
CountOpenTickets
CountOpenTickets 统计全局处于待处理 / 处理中的工单数量。
internal/store/store.go:3117
↓ 1 callers
Method
CountUserOpenTickets
CountUserOpenTickets 统计某用户当前处于待处理 / 处理中的工单数量。
internal/store/store.go:3104
↓ 1 callers
Function
CreatePostgresDatabase
(ctx context.Context, dsn string)
internal/store/store.go:571
↓ 1 callers
Method
CreateUserForRegistration
(u User, regCode, telegramBindCode string, now int64, fn func(*User, RegCode, BindCode) error)
internal/store/store.go:1743
↓ 1 callers
Method
DeleteAPIKey
(uid, id int64)
internal/store/store.go:2587
↓ 1 callers
Method
DeleteAnnouncement
(id int64)
internal/store/store.go:2911
↓ 1 callers
Method
DeleteAuditLog
DeleteAuditLog 按 ID 删除单条审计日志。
internal/store/store.go:4253
↓ 1 callers
Method
DeleteDeveloperJSPreset
(id int64)
internal/store/store.go:2975
↓ 1 callers
Method
DeleteInviteCode
(uid int64, code string)
internal/store/store.go:3388
↓ 1 callers
Method
DeleteTicket
(id int64)
internal/store/store.go:3081
↓ 1 callers
Method
DeleteTicketType
DeleteTicketType 删除工单类型,不允许删除最后一个。
internal/store/store.go:3258
↓ 1 callers
Method
DeleteUser
DeleteUser 删除用户并级联清理所有 UID-键控的衍生数据。 级联策略: 删除(GDPR right-to-erasure,含个人指纹/设备/行为): Users / APIKeys / InviteCodes / InviteRelations / MediaRequests
internal/store/store.go:2299
↓ 1 callers
Method
FindUserByEmail
(email string)
internal/store/store.go:1852
↓ 1 callers
Method
Get
(ctx context.Context, key string)
internal/redis/redis.go:95
↓ 1 callers
Method
Hijack
()
internal/api/app.go:199
↓ 1 callers
Method
IncrExpire
(ctx context.Context, key string, seconds int)
internal/redis/redis.go:133
↓ 1 callers
Method
ListAPIKeys
(uid int64)
internal/store/store.go:2510
↓ 1 callers
Method
LockEmbyGrantForBoundUsers
LockEmbyGrantForBoundUsers sets EmbyGrantLocked=true for bound users in one store write. Users without Emby are returned as skipped instead of being t
internal/store/store.go:1932
↓ 1 callers
Function
NeedsRehash
NeedsRehash 在以下情况返回 true: - 哈希格式为 legacy("salt$sha256")。 - 当前哈希迭代数低于 MinAcceptablePBKDF2Iterations。 调用方(auth_handlers.go 登录路径)应在 VerifyPassword 通过后检查
internal/security/password.go:74
↓ 1 callers
Function
New
(rawURL string, poolSize int)
internal/redis/redis.go:40
↓ 1 callers
Method
Path
()
internal/store/store.go:893
↓ 1 callers
Method
Path
()
internal/config/reader.go:13
↓ 1 callers
Method
Ping
(ctx context.Context)
internal/redis/redis.go:87
↓ 1 callers
Method
RecordAPIKeyUse
(id int64)
internal/store/store.go:2572
↓ 1 callers
Method
RemoveTicketAttachment
RemoveTicketAttachment 从工单移除指定文件名的图片元数据。返回更新后的工单。
internal/store/store.go:3155
↓ 1 callers
Method
RenameTicketType
RenameTicketType 重命名工单类型。
internal/store/store.go:3281
↓ 1 callers
Method
ResetTelegramBotOffset
ResetTelegramBotOffset 主动清零,bot 在检测到 username 变更(不同 bot 实例)时调用,避免错把旧 bot 的 offset 套到新 bot 上。
internal/store/store.go:4425
↓ 1 callers
Method
RevokeApprovedRebindRequests
RevokeApprovedRebindRequests 把所有 status=="approved"(尚未被解绑消费的换绑 许可)批量置为 "revoked",让持有者立即失去解绑权限,但保留再次申请的能力 (CreateRebindRequest 只拦截 pending;revoked 不影响)
internal/store/store.go:3943
↓ 1 callers
Method
SetTelegramBotOffset
SetTelegramBotOffset 持久化 offset。仅当传入值大于当前值才写入:getUpdates 是单调推进的,倒退(极少见,仅 token 切换 / 测试场景)应当走显式 ResetTelegramBotOffset,不通过常规写路径意外覆盖。
internal/store/store.go:4409
↓ 1 callers
Method
SpendSigninPointsAndUpdateUser
(uid int64, cost int, fn func(*User) error)
internal/store/signin.go:62
↓ 1 callers
Method
TelegramBotOffset
TelegramBotOffset 读取持久化的 getUpdates offset。新部署 / 历史 state 没有该字段时返回 0,调用方按"未设置"处理。
internal/store/store.go:4397
↓ 1 callers
Method
TelegramRosterStats
(chatID string)
internal/store/store.go:4076
↓ 1 callers
Method
UpsertBindCode
(code BindCode)
internal/store/store.go:2754
↓ 1 callers
Method
UpsertRegCodes
UpsertRegCodes 在一次状态写入中批量插入/更新注册码。批量生成注册码时用它替代 逐条 UpsertRegCode,避免每条都触发一次全量状态落盘(saveLocked 每次序列化整个 state,逐条写入时磁盘开销随数量线性放大)。单条字段默认值与 UpsertRegCode 保持一致
internal/store/store.go:3646
↓ 1 callers
Function
absInt
(value int)
internal/api/emby_inventory.go:284
↓ 1 callers
Function
acquireStateLock
(path string)
internal/store/flock_unix.go:26
↓ 1 callers
Method
activateDeveloperMode
(payload: { code: string; password: string })
webui/src/lib/api.ts:1819
↓ 1 callers
Function
addPreset
(preset: string)
webui/src/app/(main)/admin/config/page.tsx:332
↓ 1 callers
Method
adminAddTicketType
(name: string)
webui/src/lib/api.ts:2573
↓ 1 callers
Method
adminBangumiClearLogs
(uid: number)
webui/src/lib/api.ts:375
↓ 1 callers
Method
adminBangumiRecords
(uid: number, limit = 100)
webui/src/lib/api.ts:363
↓ 1 callers
Method
adminBangumiSyncLogs
(uid: number, limit = 100)
webui/src/lib/api.ts:371
↓ 1 callers
Method
adminBangumiSyncUser
(uid: number)
webui/src/lib/api.ts:367
↓ 1 callers
Method
adminBangumiUsers
(page = 1, perPage = 20, search = "")
webui/src/lib/api.ts:356
↓ 1 callers
Method
adminBindEmbyToUser
(uid: number, payload: { emby_username?: string; emby_id?: string; force?: boolean })
webui/src/lib/api.ts:1003
↓ 1 callers
Method
adminBindTelegramToUser
(uid: number, telegramId: number)
webui/src/lib/api.ts:852
↓ 1 callers
Method
adminBindUserEmail
(uid: number, data: { email: string; mark_verified?: boolean; force?: boolean })
webui/src/lib/api.ts:566
↓ 1 callers
Method
adminBulkEnableDisabledUsers
按当前筛选或指定 UID 批量启用已禁用账号。
webui/src/lib/api.ts:1598
↓ 1 callers
Method
adminBulkSetExpire
* 批量一键调控用户到期时间(按筛选条件覆盖普通用户)。 * 后端需要 confirm="BULK_EXPIRE_OK";前端这里强制带上。
webui/src/lib/api.ts:1570
↓ 1 callers
Method
adminCleanupEmailVerifications
()
webui/src/lib/api.ts:594
↓ 1 callers
Method
adminClearUnverifiedEmails
()
webui/src/lib/api.ts:601
↓ 1 callers
Method
adminCreateAnnouncement
(payload: { title?: string; content: string; level?: 'info' | 'notice' | 'warning' | 'critical';
webui/src/lib/api.ts:2320
↓ 1 callers
Method
adminCreateStandaloneEmby
(payload: { username: string; password: string; email?: string })
webui/src/lib/api.ts:996
↓ 1 callers
Method
adminCreateUser
(payload: { username: string; password?: string; email?: string; role?: number; expired_at?: number; days?: nu
webui/src/lib/api.ts:825
↓ 1 callers
Method
adminDeleteAnnouncement
(id: number)
webui/src/lib/api.ts:2350
↓ 1 callers
Method
adminDeleteTicket
(id: number)
webui/src/lib/api.ts:2564
↓ 1 callers
Method
adminDeleteTicketType
(name: string)
webui/src/lib/api.ts:2580
↓ 1 callers
Method
adminDetachInviteUser
(uid: number)
webui/src/lib/api.ts:2426
↓ 1 callers
Method
adminForceSetEmbyPassword
* 管理员凭 Emby 用户名强制重置 Emby 密码(即使没有绑定本地账号)。 * @param embyUsername 目标 Emby 用户名 * @param newPassword 可选;省略时后端生成 12 位强密码并在响应里返回
webui/src/lib/api.ts:1160
← previous
next →
1,001–1,100 of 2,686, ranked by callers