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
Function
TestPutEmailVerificationReplacesSamePurposeEmail
(t *testing.T)
internal/store/email_verification_test.go:69
Function
TestRefreshTelegramUsername
TestRefreshTelegramUsername 覆盖被动刷新的三种情形:用户名变化写库、空用户名 保留旧值、未绑定 telegram id 安全 no-op。
internal/api/telegram_username_refresh_test.go:11
Function
TestRegCodeRandomAlgorithmsAndFormatFallback
(t *testing.T)
internal/api/app_test.go:3796
Function
TestRegCodesPersistAcrossStoreReopen
(t *testing.T)
internal/store/store_test.go:186
Function
TestRegcodeDTOAndUsersExposeLegacyUsedBy
(t *testing.T)
internal/api/app_test.go:4786
Function
TestRegcodeFormatsAreSeparatedWithLegacyFallback
(t *testing.T)
internal/api/app_test.go:3822
Function
TestRegcodeGrantHistoryBlocksSelfUnbindAndRepeatRegistrationGrant
(t *testing.T)
internal/api/app_test.go:4147
Function
TestRegcodeInviteMediaAndSecurityFlows
(t *testing.T)
internal/api/app_test.go:845
Function
TestRegcodeUsageRecordsDoNotBlockSelfUnbindWithoutUserGrantLock
(t *testing.T)
internal/api/app_test.go:4192
Function
TestRegcodeWritesBlockedWhenRuntimeDatabaseMismatchesConfig
(t *testing.T)
internal/api/app_test.go:119
Function
TestRegcodesPersistAcrossAppRestartButBindCodesDoNot
(t *testing.T)
internal/api/app_test.go:251
Function
TestRegisterCodeCapacityExcludesCodeBeingConsumedAndRejectsBoundUser
(t *testing.T)
internal/api/app_test.go:4858
Function
TestRegisterCodeLimitConsumesRegcodeAtomically
(t *testing.T)
internal/api/app_test.go:4097
Function
TestRegisterCodeLimitHonorsTelegramTarget
(t *testing.T)
internal/api/app_test.go:4059
Function
TestRegisterConsumesConfirmedTelegramBindCode
(t *testing.T)
internal/api/app_test.go:2139
Function
TestRegisterRejectsMalformedTelegramBindCodeBeforeLookup
(t *testing.T)
internal/api/app_test.go:2233
Function
TestRegisterRejectsUserSceneTelegramBindCode
(t *testing.T)
internal/api/app_test.go:2217
Function
TestRegisterWithTelegramBindCodeAllowsBootstrapAdminUIDOnlyConfig
(t *testing.T)
internal/api/app_test.go:2180
Function
TestReloadConfigSurfacesLiveAppliedFields
TestReloadConfigSurfacesLiveAppliedFields 锁定 reload 响应里的 `live_applied` 列表必须列出本次实际生效的 cookie 配置(session_cookie / cookie_secure / cookie_samesite / coo
internal/api/app_test.go:1479
Function
TestRenewEndpointHonorsPermanentRegcode
(t *testing.T)
internal/api/app_test.go:4620
Function
TestRenewReactivatesDisabledNonInvitedUser
TestRenewReactivatesDisabledNonInvitedUser 锁定 R62-2 不变量: check_expired 把"非邀请"过期账号设成 Active=false 后,任何续费路径都 必须把 Active 同步复位到 true,否则用户续完照样登不上,admin 续完看
internal/api/app_test.go:5655
Function
TestRepoURLCannotBeChangedViaWebConfig
TestRepoURLCannotBeChangedViaWebConfig 防回归:[SystemUpdate].repo_url 不得经 网页配置接口改写。被盗管理员会话若能把 origin 指向攻击者 fork,再触发 git 自动 更新即可在服务器上 RCE。saveConfigConten
internal/api/security_fixes_test.go:243
Function
TestResolveLeafFile
(t *testing.T)
internal/api/safepath_test.go:39
Function
TestResolveWithinRoot
(t *testing.T)
internal/api/safepath_test.go:11
Function
TestRevokeAllRebindApprovalsClearsExistingPermissions
TestRevokeAllRebindApprovalsClearsExistingPermissions 锁定一键撤销换绑权限: 把所有 approved 申请置为 revoked,持有者立即失去解绑权限(解绑 403),但仍可 重新提交申请;不影响 pending / used。
internal/api/app_test.go:6243
Function
TestRewritePostgresDatabaseInKeywordDSN
(t *testing.T)
internal/store/postgres_test.go:21
Function
TestRewritePostgresDatabaseInURLDSN
(t *testing.T)
internal/store/postgres_test.go:11
Function
TestRuntimeConfigPathFixedToWorkingDirectory
(t *testing.T)
cmd/twilight/main_test.go:9
Function
TestRuntimeLogBufferSnapshotCursorOrdering
(t *testing.T)
internal/api/runtime_logs_test.go:5
Function
TestRuntimeLoggerAppliesLevelAndCapturesStdLog
(t *testing.T)
internal/api/app_test.go:1391
Function
TestRuntimeLogsJSONBackendCursorAndPrune
(t *testing.T)
internal/store/runtime_log_test.go:8
Function
TestRuntimeLogsRequireAdminAndRedactSecrets
(t *testing.T)
internal/api/app_test.go:1344
Function
TestSaveLockedBackupCopyDoesNotLeaveBakTmp
TestSaveLockedBackupCopyDoesNotLeaveBakTmp 锁定 saveLocked 写 .bak 影子副 本时复用 writeFileAtomicSync:tmp 文件必须在 rename 后消失(O_EXCL 保证下 一次写入会因为残留 tmp 直接失败),且 .ba
internal/store/store_test.go:298
Function
TestSchedulerAutoRunRecordVisibleBeforeReturn
TestSchedulerAutoRunRecordVisibleBeforeReturn 复现 R56-1:之前 daemon 用 `go a.runScheduledJob` 异步起动,AddSchedulerRunReturning 还没落库 daemon 主循环就推进到下一轮 tick,sc
internal/api/app_test.go:3055
Function
TestSchedulerCleanupBindCodesJobRemoved
(t *testing.T)
internal/api/app_test.go:1767
Function
TestSchedulerCleanupNoEmbySkipsPendingEntitlements
(t *testing.T)
internal/api/app_test.go:1775
Function
TestSchedulerCleanupPendingEmbyEntitlementsKeepsWebAccount
(t *testing.T)
internal/api/app_test.go:1813
Function
TestSchedulerEmbySyncRepairsPlaceholderAndMissingIDs
(t *testing.T)
internal/api/app_test.go:1849
Function
TestSchedulerEmbySyncRetriesTransient5xx
TestSchedulerEmbySyncRetriesTransient5xx 验证 R61-5 的核心承诺:emby 反代偶发 502 不应让 emby_sync 把用户记成 failed_sync。第一次拉 /Users 返回 502,第二次 才返回正常 JSON——重试 helper 必须把
internal/api/app_test.go:1920
Function
TestSchedulerEmbySyncSkipsPolicyUpdateWhenRemoteStateMatches
(t *testing.T)
internal/api/app_test.go:1991
Function
TestSchedulerFinishedRunRedactsPersistentFields
(t *testing.T)
internal/api/app_test.go:3159
Function
TestSchedulerJobsPreservesFreshExternalRunningHistory
(t *testing.T)
internal/api/app_test.go:3121
Function
TestSchedulerJobsReconcileStaleRunningHistory
(t *testing.T)
internal/api/app_test.go:3100
Function
TestSchedulerManualRunUpdatesSingleHistoryEntry
(t *testing.T)
internal/api/app_test.go:3027
Function
TestSchedulerManualTriggerSpecDisablesAutoRun
(t *testing.T)
internal/api/app_test.go:3083
Function
TestSchedulerRunSnapshotAndInterruptedMarking
(t *testing.T)
internal/store/scheduler_test.go:102
Function
TestSchedulerRuntimeParamsPersistInStoreAndDriveRunner
(t *testing.T)
internal/api/app_test.go:3258
Function
TestSchedulerTerminateIsIdempotentWhenJobAlreadyStopped
(t *testing.T)
internal/api/app_test.go:3187
Function
TestSchedulerTerminateMarksRunningRunImmediately
(t *testing.T)
internal/api/app_test.go:3200
Function
TestSchedulerTerminatedRunNotOverwrittenByLateCompletion
(t *testing.T)
internal/api/app_test.go:3232
Function
TestSelfUnbindDisablesRemoteEmbyBeforeClearingLocalBinding
(t *testing.T)
internal/api/app_test.go:4276
Function
TestSelfUnbindKeepsLocalBindingWhenRemoteDisableFails
(t *testing.T)
internal/api/app_test.go:4316
Function
TestSendExpiryRemindersAbortsOnConsecutiveRateLimits
TestSendExpiryRemindersAbortsOnConsecutiveRateLimits 锁定 R61-4 不变量: 提醒批触发连续 5 次 429 后必须 break、把已发送条数 commit 到 result,并在 summary 中暴露 aborted=rate_limite
internal/api/app_test.go:2447
Function
TestSessionCookieOmitsDomainWhenUnset
TestSessionCookieOmitsDomainWhenUnset 守住单 origin 部署的旧行为:未配置 CookieDomain 时 Set-Cookie 不应写出 Domain= 属性,让浏览器把 cookie 锁回 设置时的精确 host —— 这是单 origin 部署里更窄的
internal/api/app_test.go:6015
Function
TestSessionCookieRespectsConfiguredDomain
TestSessionCookieRespectsConfiguredDomain 锁住 R62-cookie-domain 修复: 双子域部署(webui = twilight.example.com / API = twilightapi.example.com) 必须把 session coo
internal/api/app_test.go:5967
Function
TestSetSchedulerScheduleDeletesCustomWhenDefault
(t *testing.T)
internal/store/scheduler_test.go:31
Function
TestSetUserEmailVerifiedConflictAndForce
(t *testing.T)
internal/store/email_verification_test.go:97
Function
TestSetupCompleteCreatesAdminWritesConfigAndCloses
(t *testing.T)
internal/api/setup_handlers_test.go:105
Function
TestSetupCompleteRequiresWebIntent
(t *testing.T)
internal/api/setup_handlers_test.go:93
Function
TestSetupStatusAvailableOnEmptySystem
(t *testing.T)
internal/api/setup_handlers_test.go:73
Function
TestSetupUnavailableWithoutSetupMode
(t *testing.T)
internal/api/setup_handlers_test.go:157
Function
TestSharedHTTPClientFollowsSameHostRedirect
TestSharedHTTPClientFollowsSameHostRedirect 锁定同主机 302 仍然能正常 follow, 避免 CheckRedirect 把合理的 trailing-slash / index 重定向也禁掉。
internal/api/app_test.go:5543
Function
TestSharedHTTPClientRefusesCrossHostRedirect
TestSharedHTTPClientRefusesCrossHostRedirect 锁定 sharedHTTPClient 的 CheckRedirect 策略:跨主机 302 必须被拒绝,调用方拿到 redirect 错误而非 让 token / api_key 等自定义凭据被 Go 默认
internal/api/app_test.go:5502
Function
TestSigninRenewalSpendsPointsWhenEnabled
(t *testing.T)
internal/api/app_test.go:1008
Function
TestSigninResponsesMatchFrontendContract
(t *testing.T)
internal/api/app_test.go:965
Function
TestStaleStoreWriteDoesNotDropRegCodes
(t *testing.T)
internal/store/store_test.go:208
Function
TestStatusResponseWriterForwardsFlush
(t *testing.T)
internal/api/app_test.go:615
Function
TestSystemUpdateRejectsUnsafeRepoURL
(t *testing.T)
internal/api/app_test.go:1333
Function
TestSystemUpdateValidationHelpers
(t *testing.T)
internal/api/app_test.go:1691
Function
TestTargetedRegcodesAreCreatedListedAndEnforced
(t *testing.T)
internal/api/app_test.go:3906
Function
TestTelegramAnonymousGroupUserAuthDeletesCommandMessageAfterPanel
(t *testing.T)
internal/api/app_test.go:2714
Function
TestTelegramAnonymousGroupUserRequiresInlineAuth
(t *testing.T)
internal/api/app_test.go:2622
Function
TestTelegramBindConfirmLoopbackOnly
TestTelegramBindConfirmLoopbackOnly 锁定 bind-confirm 的新鉴权模型:不再校验 共享密钥,改为“同机回环直连 + 无反代转发头”才放行,外部一律拒绝。覆盖三种来源: - 外部 IP(默认 RemoteAddr)→ 拒; - 回环直连、无代理头(= 独立
internal/api/app_test.go:2252
Function
TestTelegramBindRequirementSplitsGroupAndChannel
(t *testing.T)
internal/api/app_test.go:2523
Function
TestTelegramCustomCommandsParseReplies
(t *testing.T)
internal/config/config_test.go:332
Function
TestTelegramEndpointAcceptsCommonBaseURLs
(t *testing.T)
internal/api/app_test.go:2353
Function
TestTelegramEndpointRejectsUnsafeBaseURLs
TestTelegramEndpointRejectsUnsafeBaseURLs 验证 telegramEndpoint 现在会 否决 link-local / 元数据 IP / 非 http(s) scheme 的 base URL,避免 bot token 在拼出 /bot<TOKEN>/me
internal/api/app_test.go:2377
Function
TestTelegramErrorRedactsBotToken
(t *testing.T)
internal/api/app_test.go:2395
Function
TestTelegramForceBindGroupAndChannelConfig
(t *testing.T)
internal/config/config_test.go:158
Function
TestTelegramGetUpdatesAllowsCallbacks
(t *testing.T)
internal/api/app_test.go:2492
Function
TestTelegramGrantRegisterActionSetsPendingEntitlement
(t *testing.T)
internal/api/app_test.go:5192
Function
TestTelegramGroupUserPanelCustomTemplatePlaceholders
(t *testing.T)
internal/api/app_test.go:2828
Function
TestTelegramGroupUserPanelDeletesCommandMessageAfterSend
(t *testing.T)
internal/api/app_test.go:2667
Function
TestTelegramGroupUserPanelShowsEmbyInfoAndActions
(t *testing.T)
internal/api/app_test.go:2793
Function
TestTelegramMembershipEnforcementUsesConfiguredConcurrency
(t *testing.T)
internal/api/app_test.go:2092
Function
TestTelegramMembershipRejoinManualReviewAndAutoEnable
(t *testing.T)
internal/api/app_test.go:2045
Function
TestTelegramPanelCloseRequiresAdminAndDeletesPanel
(t *testing.T)
internal/api/app_test.go:2855
Function
TestTelegramPanelEmbyDeleteRequiresConfirmAndClearsLocalBinding
(t *testing.T)
internal/api/app_test.go:2919
Function
TestTelegramProtectedTargetUsesUnifiedProtectedUsers
(t *testing.T)
internal/api/app_test.go:2988
Function
TestTelegramRetryAfterFromError
TestTelegramRetryAfterFromError 锁定 R61-3 不变量:telegramPost 在 OK=false + parameters.retry_after>0 时必须把秒数编进错误字符串, telegramRetryAfterFromError 反解出来后调用方才能
internal/api/app_test.go:2415
Function
TestTelegramRosterStatsUsesObservedMembers
(t *testing.T)
internal/api/app_test.go:5220
Function
TestTelegramTargetedRegcodesAreCreatedListedAndEnforced
(t *testing.T)
internal/api/app_test.go:3979
Function
TestTelegramTouchPanelReusesSingleTimer
TestTelegramTouchPanelReusesSingleTimer 锁定 R52-2:多次 touch 同一个 panel 不应累积 *time.Timer 实例。历史实现每次 touch 调 AfterFunc 新建 一个 closure,旧定时器从不取消,admin 高频按钮场景下单
internal/api/app_test.go:2588
Function
TestTicketGlobalOpenLimitEnforced
TestTicketGlobalOpenLimitEnforced 验证「管理员全局工单数量上限」服务端硬门 (子需求 B)。
internal/api/ticket_handlers_test.go:113
Function
TestTicketImageTooLarge
TestTicketImageTooLarge 验证单张图片大小上限 (子需求 C)。
internal/api/ticket_handlers_test.go:196
Function
TestTicketImageUploadAndValidation
TestTicketImageUploadAndValidation 验证图片上传成功 + 类型校验 + 数量上限 (子需求 C/D)。
internal/api/ticket_handlers_test.go:137
Function
TestTicketTypeAddPersistsToConfigFile
TestTicketTypeAddPersistsToConfigFile 通过 HTTP 入口新增工单类型,断言它真正 落盘到 config.toml(这是重启 / 热重载后仍保留的唯一持久化来源)。
internal/api/ticket_type_repro_test.go:45
Function
TestTicketUserOpenLimitEnforced
TestTicketUserOpenLimitEnforced 验证「每人同时处理中/待处理工单上限」服务端硬门 (子需求 A)。
internal/api/ticket_handlers_test.go:89
Function
TestUnbindAlwaysRequiresApprovalEvenWithoutForceBind
TestUnbindAlwaysRequiresApprovalEvenWithoutForceBind 锁定用户反馈:关闭 force_bind_telegram 时,非管理员解绑同样必须先拿到 approved 换绑申请(用过即 作废),杜绝"自助无限解绑/重绑"。每次更换都需管理员批准一次。
internal/api/app_test.go:6316
Function
TestUpdateDevicePreservesFlagsOnRelogin
TestUpdateDevicePreservesFlagsOnRelogin 锁定登录改用 UpdateDevice 后的不变量: 再次「登录」(更新 UA/IP/LastSeen)不得清掉 FirstSeen / Trusted / Blocked。
internal/store/device_limit_test.go:55
← previous
next →
2,101–2,200 of 2,686, ranked by callers