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
↓ 3 callers
Function
splitPath
(p string)
internal/api/app.go:706
↓ 3 callers
Method
startSchedulerRun
schedulerProcessLocks 已迁移到 App.schedulerLocks(app.go)。原本是 package 级 sync.Map,单进程 prod 没问题,但测试 setup 反复 New() 出多个 App 时 该表跨实例共享,会让一个 case 的 cancel 影响另一
internal/api/scheduler_daemon.go:467
↓ 3 callers
Method
stats
()
internal/api/runtime_logs.go:123
↓ 3 callers
Function
telegramActiveLabel
(active bool)
internal/api/telegram_bot.go:1162
↓ 3 callers
Method
telegramBindRequirementMissing
(ctx context.Context, telegramID int64)
internal/api/telegram.go:262
↓ 3 callers
Function
telegramBotUrl
(username?: string | null, url?: string | null)
webui/src/lib/safe-url.ts:27
↓ 3 callers
Method
telegramConfirmBindCode
(ctx context.Context, chatID, telegramID int64, username, code string)
internal/api/telegram_bot.go:317
↓ 3 callers
Function
telegramEmbyLabel
(u store.User)
internal/api/telegram_bot.go:1190
↓ 3 callers
Method
telegramEndpoint
(method string)
internal/api/telegram.go:43
↓ 3 callers
Method
telegramExecuteDelAccount
telegramExecuteDelAccount 执行账号删除操作(从本地删除 + 远端 Emby 解绑 + 清除会话)。 reason 为可选的删除原因,会记入审计日志。
internal/api/telegram_bot.go:743
↓ 3 callers
Method
telegramExpirePanel
(token string)
internal/api/telegram_inline.go:170
↓ 3 callers
Method
telegramGetMe
(ctx context.Context)
internal/api/telegram.go:153
↓ 3 callers
Method
telegramGroupUserPanelText
(ctx context.Context, u store.User)
internal/api/telegram_inline.go:501
↓ 3 callers
Method
telegramHandleCallback
(ctx context.Context, callback map[string]any)
internal/api/telegram_inline.go:244
↓ 3 callers
Method
telegramKickChatMember
(ctx context.Context, chatID string, userID int64)
internal/api/telegram.go:246
↓ 3 callers
Method
telegramPanel
(token string)
internal/api/telegram_inline.go:200
↓ 3 callers
Function
telegramPanelSafeError
(err error)
internal/api/telegram_inline.go:819
↓ 3 callers
Function
telegramPendingEmbyDaysLabel
(days *int)
internal/api/telegram_inline.go:859
↓ 3 callers
Method
telegramPostWithTimeout
(ctx context.Context, method string, body map[string]any, dst any, timeout time.Duration)
internal/api/telegram.go:100
↓ 3 callers
Function
telegramRandomToken
()
internal/api/telegram_inline.go:1012
↓ 3 callers
Function
telegramRateLimitPauseContext
(ctx context.Context, err error)
internal/api/telegram.go:503
↓ 3 callers
Function
telegramRosterKey
(chatID string, telegramID int64)
internal/store/store.go:4152
↓ 3 callers
Function
telegramUnixTimeLabel
(ts int64)
internal/api/telegram_inline.go:876
↓ 3 callers
Function
throttleCooldownSeconds
(code: string | undefined)
webui/src/lib/validators.ts:367
↓ 3 callers
Method
ticketAccessible
ticketAccessible 校验当前用户能否访问该工单(本人或管理员)。
internal/api/ticket_handlers.go:319
↓ 3 callers
Function
ticketAttachmentDTOs
(ticketID int64, atts []store.TicketAttachment)
internal/api/ticket_handlers.go:558
↓ 3 callers
Function
toEditorList
(value: unknown)
webui/src/components/admin/config-section-editor.tsx:18
↓ 3 callers
Function
toEditorList
(value: unknown)
webui/src/app/(main)/admin/config/page.tsx:110
↓ 3 callers
Function
toHex
(value: number)
webui/src/components/theme-customizer.tsx:43
↓ 3 callers
Function
toHex
(n: number)
webui/src/lib/theme-custom.ts:62
↓ 3 callers
Function
toggleSetMember
(values: Set<T>, value: T)
webui/src/app/(main)/admin/users/admin-users-helpers.ts:70
↓ 3 callers
Method
toggleUserActive
* 邀请树级联的禁用/启用。 * cascadeDepth:1=仅本人;N=本人+下 N-1 层;0=整棵子树。 * - 不会翻动其他管理员账号 * - 不会改邀请关系,只改 ACTIVE_STATUS + 同步 Emby
webui/src/lib/api.ts:2438
↓ 3 callers
Function
truncateConfigPreview
(value: string, emptyLabel: string)
webui/src/app/(main)/admin/config/page.tsx:197
↓ 3 callers
Function
typeLabelFor
(value: string)
webui/src/app/(main)/admin/tickets/page.tsx:158
↓ 3 callers
Method
updateConfigBySchema
(sections: Record<string, Record<string, unknown>>)
webui/src/lib/api.ts:1303
↓ 3 callers
Method
updateRegcode
( code: string, data: { note?: string; active?: boolean; validity_time?: number; days?: number; use_co
webui/src/lib/api.ts:2125
↓ 3 callers
Function
useRegionRefresh
(region: string, handler: (payload?: unknown) => void)
webui/src/hooks/use-region-refresh.ts:4
↓ 3 callers
Method
usernameExistsLocked
(username string)
internal/store/store.go:1674
↓ 3 callers
Function
usersListParams
(state: UsersListState)
webui/src/app/(main)/admin/users/admin-users-helpers.ts:40
↓ 3 callers
Function
validateConfigContent
(configFile string, content []byte)
internal/api/config_admin.go:635
↓ 3 callers
Function
validateStrongPassword
(password, label string)
internal/api/emby.go:429
↓ 3 callers
Function
validateUpdateRepoURL
(repoURL string)
internal/api/system_update.go:20
↓ 3 callers
Function
walk
(dir, out = [])
webui/scan_hardcoded.mjs:4
↓ 3 callers
Function
writeConfigBackupBytes
(configFile, backupDir string, content []byte)
internal/api/config_admin.go:784
↓ 3 callers
Function
writeJSON
(w http.ResponseWriter, status int, success bool, message string, data any)
internal/api/response.go:18
↓ 3 callers
Function
zapFieldValueString
(field zapcore.Field)
internal/api/runtime_logs.go:422
↓ 2 callers
Method
AddAuditLog
--------------------------------------------------------------------------- AuditLog — 操作审计日志 --------------------------------------------------------
internal/store/store.go:4223
↓ 2 callers
Method
AddPlaybackRecordIdempotent
AddPlaybackRecordIdempotent 在 (UID, ItemID, PlayedAt) 已经存在时跳过写入, 返回 inserted=false。bangumi webhook 没有 timestamp + nonce 强签名, 攻击者重放同一份合法请求体本来会让 Playbac
internal/store/playback.go:24
↓ 2 callers
Method
Allow
(ctx context.Context, key string, limit int, window time.Duration)
internal/api/ratelimit.go:42
↓ 2 callers
Method
BatchSchedulerRunSnapshots
BatchSchedulerRunSnapshots 一次性获取多个 jobID 的 snapshot,只加一次读锁。 handleSchedulerJobs 之前对每个 job 单独调用 SchedulerRunSnapshot → 13 个 job 就要 13 次 RLock/RUnlock +
internal/store/scheduler.go:126
↓ 2 callers
Method
BindUserEmbyAtomic
BindUserEmbyAtomic 同把锁内做 EmbyID 唯一性 + force rebind。 force=true 时若 EmbyID 已绑在另一用户身上,会先把对方解绑再绑给目标, 一次写入完成;非 force 模式下冲突直接 ErrConflict。 解决 handleAdminBin
internal/store/store.go:2239
↓ 2 callers
Method
BindUserTelegramAtomic
BindUserTelegramAtomic 同把锁内:唯一性校验 + admin 自保 + 写入。 解决 handleAdminBindTelegram 闭包外 FindUserByTelegramID 与 UpdateUser 闭包写之间的 TOCTOU。
internal/store/store.go:2200
↓ 2 callers
Method
ClearBangumiSyncLogs
(uid int64)
internal/store/store.go:4376
↓ 2 callers
Method
ClearEmbyGrantForUnboundUsers
ClearEmbyGrantForUnboundUsers 清理"没有 Emby 账号"用户的注册码/邀请码使用记录, 让他们重新可以使用注册码 / 邀请码。专门针对历史迁移(refreshLocked 里把 PendingEmby/RegistrationSource/RegistrationCo
internal/store/store.go:1998
↓ 2 callers
Method
ClearTicketAttachments
ClearTicketAttachments 清空某工单的图片元数据(用于保留期清理后同步状态)。
internal/store/store.go:3201
↓ 2 callers
Function
ConfigureRuntimeLoggingStore
(st *store.Store, level zapcore.Level, limit int)
internal/api/runtime_logs.go:320
↓ 2 callers
Method
ConsumeInviteCodeAndUpdateUser
(code string, childUID int64, maxDepth int, maxRootUsers int, fn func(*User, InviteCode) error)
internal/store/store.go:3450
↓ 2 callers
Method
ConsumeRegCodeAndUpdateUser
(code string, uid, telegramID int64, fn func(*User, RegCode) error)
internal/store/store.go:3696
↓ 2 callers
Method
CountInviteCodes
()
internal/store/store.go:3382
↓ 2 callers
Method
DB
DB returns the underlying *sql.DB when using PostgreSQL backend, or nil otherwise.
internal/store/store.go:865
↓ 2 callers
Method
DeleteDevice
(uid int64, deviceID string)
internal/store/device.go:54
↓ 2 callers
Method
DeleteEmailVerification
(id string)
internal/store/email_verification.go:162
↓ 2 callers
Method
DeleteMediaRequest
(id int64)
internal/store/store.go:2742
↓ 2 callers
Method
DeleteRegCode
(code string)
internal/store/store.go:3784
↓ 2 callers
Method
DeleteRegCodes
(codes []string)
internal/store/store.go:3796
↓ 2 callers
Method
DeleteViolationLog
DeleteViolationLog removes a single violation log entry by ID.
internal/store/store.go:4193
↓ 2 callers
Method
DetachInvite
(uid int64)
internal/store/store.go:3602
↓ 2 callers
Method
EmailAlreadyUsed
EmailAlreadyUsed 检查邮箱是否已被任何账号使用(已验证或未验证均算占用)。 用于注册时防止两个用户填写同一个邮箱。
internal/store/email_verification.go:254
↓ 2 callers
Method
EmailVerifiedOwner
EmailVerifiedOwner 返回已把 email 标记为"已验证"的其它账号(excludeUID 之外), 用于绑定 / 管理员强制绑定时的占用冲突判定。
internal/store/email_verification.go:234
↓ 2 callers
Method
FindAPIKeyByHash
(hash string)
internal/store/store.go:2523
↓ 2 callers
Method
InviteRelations
()
internal/store/store.go:3517
↓ 2 callers
Function
ListBackups
(dir string)
internal/store/store.go:1450
↓ 2 callers
Method
ListEmailVerifications
ListEmailVerifications 返回当前所有在用验证码记录的拷贝(含已过期但尚未被调度 清理的),供管理员审查。记录里仍带 CodeHash,api 层负责脱敏后再下发。
internal/store/email_verification.go:145
↓ 2 callers
Method
ListIPBlacklist
()
internal/store/ip_blacklist.go:28
↓ 2 callers
Method
MarkInterruptedSchedulerRuns
(jobID string, beforeUnix int64, nowUnix int64)
internal/store/scheduler.go:216
↓ 2 callers
Method
PruneAuditLogs
PruneAuditLogs 保留最新的 keep 条审计日志,超出部分从尾部裁剪。
internal/store/store.go:4278
↓ 2 callers
Method
PruneAuditLogsByAge
PruneAuditLogsByAge 删除早于 cutoff 的审计日志。preserveAdmin 为 true 时保留管理员操作。
internal/store/store.go:4293
↓ 2 callers
Method
PruneRuntimeLogs
(limit int)
internal/store/runtime_log.go:196
↓ 2 callers
Function
RandomHex
(bytesLen int)
internal/security/password.go:31
↓ 2 callers
Function
ReadBackupNote
(path string)
internal/store/store.go:1490
↓ 2 callers
Method
RemoveIPBlacklist
(ip string)
internal/store/ip_blacklist.go:18
↓ 2 callers
Method
RunScheduler
(ctx context.Context)
internal/api/scheduler_daemon.go:20
↓ 2 callers
Method
RunTelegramBot
(ctx context.Context)
internal/api/telegram_bot.go:76
↓ 2 callers
Method
SetSchedulerScheduleWithParams
(jobID string, spec map[string]any, params map[string]any, custom bool)
internal/store/scheduler.go:201
↓ 2 callers
Method
SyncTicketTypesFromConfig
SyncTicketTypesFromConfig 从配置同步类型(首次启动或配置变更时调用), 配置中的类型会覆盖 store 中的类型。
internal/store/store.go:3300
↓ 2 callers
Method
TelegramRoster
(chatID string, activeOnly bool)
internal/store/store.go:4054
↓ 2 callers
Method
UpdateMediaRequest
(id int64, fn func(*MediaRequest) error)
internal/store/store.go:2719
↓ 2 callers
Method
UpdateSchedulerRun
(id int64, fn func(*SchedulerRun) error)
internal/store/scheduler.go:46
↓ 2 callers
Function
ValidatePasswordLegacy
ValidatePasswordLegacy 仅校验最小长度,用于不强制强度的旧路径 (如系统首次初始化、忘记密码自动生成、向后兼容场景)。新代码请使用 ValidatePasswordStrength。
internal/validate/validate.go:87
↓ 2 callers
Function
acceptWebSocket
(w http.ResponseWriter, r *http.Request)
internal/api/websocket.go:15
↓ 2 callers
Function
activityEntryIPs
activityEntryIPs 从一条 Emby 活动日志的 ShortOverview 中提取所有合法 IP。 登录类事件(如 AuthenticationSucceeded)会把客户端 IP 写进 ShortOverview, 不同 Emby 版本可能是裸 IP、"IP:port" 或带前缀文
internal/api/emby_device_audit.go:65
↓ 2 callers
Function
addToRemoveQueue
(toastId: string)
webui/src/hooks/use-toast.ts:71
↓ 2 callers
Function
addUploadReference
(refs map[string]bool, raw string)
internal/api/admin_jobs.go:321
↓ 2 callers
Method
adminGetTicketTypes
()
webui/src/lib/api.ts:2569
↓ 2 callers
Function
adminMediaStatus
(status string)
internal/api/business.go:408
↓ 2 callers
Method
adminUpdateTicket
(id: number, payload: { status?: string; priority?: string; type?: string; admin_note?: string })
webui/src/lib/api.ts:2557
↓ 2 callers
Function
appendUniqueInt64
(values []int64, value int64)
internal/store/store.go:4140
↓ 2 callers
Function
appendUniqueRegcodeInt64
(values []int64, value int64)
internal/api/business.go:635
↓ 2 callers
Function
applyConfiguredAdmins
(cfg config.Config, st *store.Store)
cmd/twilight/main.go:372
↓ 2 callers
Method
applyConfiguredAdmins
()
internal/api/configured_admins.go:10
← previous
next →
601–700 of 2,686, ranked by callers