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
TestDatabaseAdminBackupRestoreAndAuth
(t *testing.T)
internal/api/app_test.go:3428
Function
TestDecodeMapEnforcesSizeAndDepthLimits
TestDecodeMapEnforcesSizeAndDepthLimits 验证 decodeMap 在 256KB / 32 层 边界外都返回空 map,避免攻击者通过超大 payload / 深嵌套 JSON 让单次解码 吃光内存或拖慢后续遍历。
internal/api/app_test.go:5454
Function
TestDefaultErrorCodeCoversAPIStatuses
(t *testing.T)
internal/api/response_test.go:8
Function
TestDefaultsIncludeUsablePostgresParts
(t *testing.T)
internal/config/config_test.go:285
Function
TestDeleteRegCodePhysicallyDeletesUsedCode
(t *testing.T)
internal/store/store_test.go:21
Function
TestDeleteTicketRemovesAttachments
TestDeleteTicketRemovesAttachments 验证删除工单时同步清除其图片目录 (子需求 F)。
internal/api/ticket_handlers_test.go:219
Function
TestDeleteUserCascadesAllDerivedData
防回归:DeleteUser 必须级联清理所有 UID-键控派生数据。 旧实现仅清 5 个域,留下幽灵关联:复用 UID 创建的新用户会继承旧设备 / 旧 邀请关系 / 旧签到积分。这条测试覆盖每个域至少一条记录。
internal/store/delete_user_test.go:11
Function
TestDescribePostgresConnectionError
(t *testing.T)
internal/store/postgres_test.go:43
Function
TestDeveloperJSAdminUserSearchAndControlledUpdate
(t *testing.T)
internal/api/developer_sandbox_test.go:202
Function
TestDeveloperJSConvenienceObjectsAndHelpers
(t *testing.T)
internal/api/developer_sandbox_test.go:331
Function
TestDeveloperJSCreateAnnouncement
(t *testing.T)
internal/api/developer_sandbox_test.go:945
Function
TestDeveloperJSDocsEndpointRequiresAdminAndDescribesGoja
(t *testing.T)
internal/api/developer_sandbox_test.go:18
Function
TestDeveloperJSExitAndAssertStopWithoutRuntimeError
(t *testing.T)
internal/api/developer_sandbox_test.go:400
Function
TestDeveloperJSGenerateInviteCodeRespectsFeatureGate
(t *testing.T)
internal/api/developer_sandbox_test.go:902
Function
TestDeveloperJSGenerateRegcodeCreatesRetrievableCode
(t *testing.T)
internal/api/developer_sandbox_test.go:870
Function
TestDeveloperJSGenerateRegcodePreviewDoesNotWrite
(t *testing.T)
internal/api/developer_sandbox_test.go:841
Function
TestDeveloperJSGenerateRegcodeRequiresAdmin
(t *testing.T)
internal/api/developer_sandbox_test.go:817
Function
TestDeveloperJSGetUserByUIDIsSanitizedAndAdminScoped
(t *testing.T)
internal/api/developer_sandbox_test.go:135
Function
TestDeveloperJSInlineCallbackOwnerAndEdit
(t *testing.T)
internal/api/developer_sandbox_test.go:495
Function
TestDeveloperJSInteractionSurvivesSlowNetwork
TestDeveloperJSInteractionSurvivesSlowNetwork guards against the regression where the script execution timeout (formerly 200ms) was shorter than the t
internal/api/developer_sandbox_test.go:646
Function
TestDeveloperJSPresetReferenceUsesLatestPresetCode
(t *testing.T)
internal/api/developer_sandbox_test.go:679
Function
TestDeveloperJSPrivateIPBlocksSSRFTargets
TestDeveloperJSPrivateIPBlocksSSRFTargets 锁定 fetch 沙箱的 IP 黑名单, 防止开发者 JS 通过 DNS rebinding / IPv4-mapped IPv6 等手段访问内网、 回环、链路本地(云元数据 169.254.169.254)等敏感目
internal/api/developer_sandbox_test.go:769
Function
TestDeveloperJSQuickGeneratorsMatchOptionForm
(t *testing.T)
internal/api/developer_sandbox_test.go:990
Function
TestDeveloperJSRiskTokensWarnButDoNotReject
(t *testing.T)
internal/api/developer_sandbox_test.go:626
Function
TestDeveloperJSSetLoginNotifyDryRunAndRuntimeMutation
(t *testing.T)
internal/api/developer_sandbox_test.go:441
Function
TestDeveloperJSSimplifiedUserHelpers
(t *testing.T)
internal/api/developer_sandbox_test.go:254
Function
TestDeveloperJSUsersAPISanitizesCurrentUser
(t *testing.T)
internal/api/developer_sandbox_test.go:103
Function
TestDeveloperJSWaitTextConsumesSameUserPlainText
(t *testing.T)
internal/api/developer_sandbox_test.go:571
Function
TestDeveloperModeDisabledBlocksJSButKeepsPlainTextCommands
(t *testing.T)
internal/api/developer_sandbox_test.go:723
Function
TestDeviceLifecycleDefaultsSortsAndDeletes
(t *testing.T)
internal/store/device_test.go:8
Function
TestDirectEmbyRegistrationRecordsRegcodeEquivalentGrant
(t *testing.T)
internal/api/app_test.go:4229
Function
TestDisabledFeatureFlagsAreExposedAndEnforced
(t *testing.T)
internal/api/app_test.go:1087
Function
TestEmailGateActiveByRole
(t *testing.T)
internal/api/email_verify_service_test.go:98
Function
TestEmailGateInactiveWhenForceBindOff
(t *testing.T)
internal/api/email_verify_service_test.go:124
Function
TestEmailVerificationConsumeOKThenGone
(t *testing.T)
internal/store/email_verification_test.go:5
Function
TestEmailVerificationDTOSanitizes
TestEmailVerificationDTOSanitizes 锁定管理员审查 DTO 的安全约定:永不外泄 CodeHash, 正确解析关联本地账号用户名,并按 ExpiresAt 标注过期状态。
internal/api/email_admin_test.go:12
Function
TestEmailVerificationExpiredConsumed
(t *testing.T)
internal/store/email_verification_test.go:34
Function
TestEmailVerificationTooManyAttempts
(t *testing.T)
internal/store/email_verification_test.go:50
Function
TestEmbyCapacityCountsPendingEntitlementsSeparatelyFromSystemLimit
(t *testing.T)
internal/api/app_test.go:3748
Function
TestEmbyRetryOn5xxSkips4xx
TestEmbyRetryOn5xxSkips4xx 直接覆盖 retry helper 的"4xx 不重试"分支, 避免被错误的"什么错都重试"实现悄悄回归。
internal/api/app_test.go:2031
Function
TestEmbySyncDoesNotRestoreRemoteWhenWebIsActive
(t *testing.T)
internal/api/app_test.go:4463
Function
TestEmbyURLsDoNotFallbackToInternalServerURL
(t *testing.T)
internal/api/app_test.go:1229
Function
TestEnforceDeviceLimitEvictsOldestUntrusted
(t *testing.T)
internal/store/device_limit_test.go:5
Function
TestEnforceDeviceLimitNoopWhenUnderLimit
(t *testing.T)
internal/store/device_limit_test.go:34
Function
TestEnsureTicketDefaultsPreservesStringList
TestEnsureTicketDefaultsPreservesStringList 回归测试历史 bug: ensureTicketDefaults 早期只对 types 做 []any 类型断言,而 configValues 由 cfg.TicketTypes 产出的是 []string,断言
internal/api/ticket_type_repro_test.go:15
Function
TestExpiredInviteCannotBeUsedOrConsumed
(t *testing.T)
internal/api/app_test.go:4952
Function
TestExportUsersCSVSanitizesMaliciousUsername
TestExportUsersCSVSanitizesMaliciousUsername 端到端验证:注册一个公式注入 用户名后,管理员导出的 users.csv 对应单元格被前置单引号中和。
internal/api/security_fixes_test.go:47
Function
TestFailedRegCodeSaveRollsBackMemory
(t *testing.T)
internal/store/store_test.go:249
Function
TestFillDeviceIPsFromHistory
TestFillDeviceIPsFromHistory 覆盖离线设备 IP 回填的三条分支: 唯一 IP 全量回填、多 IP 时间相关回填、超窗口不猜;并确认已有 IP 不被覆盖。
internal/api/emby_device_audit_test.go:57
Function
TestFindUserByEmailVerifiedRequiresVerified
(t *testing.T)
internal/store/email_verification_test.go:124
Function
TestFirstRegisterWithoutAdminConfigStaysNormalUser
(t *testing.T)
internal/api/setup_handlers_test.go:175
Function
TestFirstRegistrantIsNotAutoAdmin
TestFirstRegistrantIsNotAutoAdmin 防回归:已移除"空数据库首注册者无条件 成为 Admin"通道。管理员身份只能来自配置文件 admin_uids / admin_usernames。 本测试用一个不含任何 admin 配置的 App,确认首个注册用户只是普通用户。
internal/api/security_fixes_test.go:168
Function
TestForceBindUnbindConsumesApprovedRebindAndPreservesAudit
TestForceBindUnbindConsumesApprovedRebindAndPreservesAudit 覆盖强制绑定下 "换绑"完整链路的两条关键不变量: 1. 普通用户在 force_bind_telegram 开启时,只有持有 admin 批准的 rebind 请求才能解绑——批准
internal/api/app_test.go:6151
Function
TestForgotPasswordRejectsExpiredAccount
TestForgotPasswordRejectsExpiredAccount 锁定 R62-7 不变量: emby 鉴权通过但面板侧账号 entitlement 已过期(Active=true & ExpiredAt<now) 时不应进入密码重置 + emby 写新密码流程。否则 1. embyS
internal/api/app_test.go:5907
Function
TestFrontendRouteCompatibilityDoesNot404
(t *testing.T)
internal/api/app_test.go:589
Function
TestHashEmailCodeDeterministicAndScoped
(t *testing.T)
internal/api/email_verify_service_test.go:55
Function
TestIPBlacklistLifecycleExpiryAndSorting
(t *testing.T)
internal/store/ip_blacklist_test.go:9
Function
TestInventoryCheckUsesEmbyProviderAndSeasons
(t *testing.T)
internal/api/app_test.go:1135
Function
TestInviteCodeFormatAndDTOUserRecords
(t *testing.T)
internal/api/app_test.go:3863
Function
TestInviteDisabledStillAllowsExistingChildRenewCodesButBlocksNewInvites
(t *testing.T)
internal/api/app_test.go:5035
Function
TestInviteMeDoesNotLeakSensitiveFields
TestInviteMeDoesNotLeakSensitiveFields 防回归:invite/me 的 parent / children 不得包含 email / telegram_id / telegram_username / emby_id 等敏感字段(旧实现 直接复用 publicU
internal/api/security_fixes_test.go:73
Function
TestInviteMeReturnsStableTreeShape
(t *testing.T)
internal/api/app_test.go:933
Function
TestInviteParentCanDetachDisabledChildWithoutReactivatingWeb
(t *testing.T)
internal/api/app_test.go:4737
Function
TestInviteParentCanDetachExpiredChildAndKeepWebAccountActive
(t *testing.T)
internal/api/app_test.go:4691
Function
TestInviteRenewCodeCreatesTargetedRegCode
(t *testing.T)
internal/api/app_test.go:4982
Function
TestInviteUseRejectsExpiredInviterAndRootLimit
(t *testing.T)
internal/api/app_test.go:5136
Function
TestInviteUseRevalidatesTreeAndBoundsExpiry
(t *testing.T)
internal/api/app_test.go:5090
Function
TestLastSchedulerRunByTypeBypassesRecentWindow
TestLastSchedulerRunByTypeBypassesRecentWindow 锁定 LastSchedulerRunByType 不被 SchedulerRuns(20) 的滑动窗口影响:先记一条 auto run,再压入 25 条 manual run,最新 auto 必须仍能被
internal/store/scheduler_test.go:56
Function
TestLoadDefaultPathIgnoresEnvWhenConfigTomlMissing
(t *testing.T)
internal/config/config_test.go:214
Function
TestLoadDefaultPathPrefersConfigTomlOverEnv
(t *testing.T)
internal/config/config_test.go:193
Function
TestLoadEmailCleanupConfigAndEnvOverride
(t *testing.T)
internal/config/config_test.go:46
Function
TestLoadMultilineArraysAndPostgresConfig
(t *testing.T)
internal/config/config_test.go:113
Function
TestLoadSetupModeFromAnySection
(t *testing.T)
internal/config/config_test.go:73
Function
TestLoadSplitCodeFormatsAndEnvOverrides
(t *testing.T)
internal/config/config_test.go:90
Function
TestLoadTOMLAndEnvOverrides
(t *testing.T)
internal/config/config_test.go:11
Function
TestLogConfigSupportsLegacyNumericLevels
(t *testing.T)
internal/config/config_test.go:301
Function
TestLoginByAPIKeyRejectsDisabledAccount
TestLoginByAPIKeyRejectsDisabledAccount 锁定与 handleLogin 同一不变量: 禁用账号无法用 API Key 重新拿到 session。修复前 /auth/login/apikey 只查 API Key 命中即建会话,admin 把 Active=fa
internal/api/app_test.go:5755
Function
TestLoginDistinguishesExpiredFromDisabled
TestLoginDistinguishesExpiredFromDisabled 锁定 R62-6 不变量: "管理员手动禁用"和"check_expired 触发的到期"两种 Active=false 状态在 api/v1/auth/login 必须返回不同的 error_code,让 webu
internal/api/app_test.go:5792
Function
TestLoginHistoryFiltersAndLimits
(t *testing.T)
internal/store/login_log_test.go:8
Function
TestLoginLogDefaultsAndPrunes
(t *testing.T)
internal/store/login_log_test.go:43
Function
TestMediaDetailSanitizesPathPartsBeforeUpstreamCall
(t *testing.T)
internal/api/app_test.go:1306
Function
TestMediaRequestGlobalLimitBlocksNonAdmins
TestMediaRequestGlobalLimitBlocksNonAdmins 验证 max_concurrent_requests_global 上限:达到后普通用户的新求片返回 MEDIA_REQUEST_GLOBAL_LIMIT,admin 仍可继续。
internal/api/app_test.go:4644
Function
TestMediaRequestIgnoresUserSkipInventoryCheck
(t *testing.T)
internal/api/app_test.go:1168
Function
TestMediaRequestInventoryIssueBypassesDuplicateGuard
(t *testing.T)
internal/api/app_test.go:3776
Function
TestMediaRequestStatusUpdatesRequireExplicitStatus
(t *testing.T)
internal/api/app_test.go:1201
Function
TestOpenAPIOnlyExposesPublicRoutes
TestOpenAPIOnlyExposesPublicRoutes 防回归:未鉴权的 openapi.json 不得枚举 admin 攻击面(旧实现列出全部路由,含 /admin/* 与 system/admin/*)。
internal/api/security_fixes_test.go:140
Function
TestOtherDangerousActionsRequireConfirm
(t *testing.T)
internal/api/app_test.go:5353
Function
TestParseEmbyTime
(t *testing.T)
internal/api/emby_device_audit_test.go:33
Function
TestParseRemoteIP
(t *testing.T)
internal/api/emby_device_audit_test.go:9
Function
TestPasswordHashRoundTripAndLegacy
(t *testing.T)
internal/security/password_test.go:9
Function
TestPendingEmbyUserCanReplaceEntitlementWithRegisterCode
(t *testing.T)
internal/api/app_test.go:4820
Function
TestPermanentExpiryNormalizesForPublicAPIAndAdminRenew
(t *testing.T)
internal/api/app_test.go:4527
Function
TestPlaybackRecordsFiltersDefaultsAndLimits
(t *testing.T)
internal/store/playback_test.go:8
Function
TestPlaybackRecordsPruneToMax
(t *testing.T)
internal/store/playback_test.go:46
Function
TestPostJSONWithTimeoutReturnsMarshalError
(t *testing.T)
internal/api/app_test.go:627
Function
TestPostgresEnvOverridesAndIPv6DSN
(t *testing.T)
internal/config/config_test.go:248
Function
TestPostgresErrorClassifiersAndIdentifierQuoting
(t *testing.T)
internal/store/postgres_test.go:31
Function
TestProductionTemplateIncludesPostgresDatabaseSection
(t *testing.T)
internal/config/config_test.go:359
Function
TestProtectedAdminConfigHiddenPreservedAndApplied
(t *testing.T)
internal/api/app_test.go:771
Function
TestPublicRegcodeCheckHidesTargetedCodes
(t *testing.T)
internal/api/app_test.go:5079
← previous
next →
2,001–2,100 of 2,686, ranked by callers