MCPcopy Create free account

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

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

FunctionMediaPage
()
webui/src/app/(main)/media/page.tsx:63
FunctionMetricCard
({ icon: Icon, label, value, hint, tone = "default", }: { icon: LucideIcon; label: string; val
webui/src/app/(main)/admin/scheduler/page.tsx:563
FunctionNoEmbyKickDialog
({ open, onOpenChange, minDays, onMinDaysChange, minDaysParsed, preserveDirect, onPreserveDirect
webui/src/app/(main)/admin/users/admin-users-dialogs.tsx:1400
FunctionPageError
({ message, onRetry, }: { message: string; onRetry?: () => void; })
webui/src/components/layout/page-state.tsx:19
FunctionPageLoading
({ message }: { message?: string })
webui/src/components/layout/page-state.tsx:7
FunctionRateInput
({ value, onChange }: { value: number; onChange: (v: number) => void })
webui/src/app/(main)/bangumi/page.tsx:36
FunctionRebindGuard
()
webui/src/components/rebind-guard.tsx:17
FunctionRegisterPage
()
webui/src/app/(auth)/register/page.tsx:46
MethodRelease
()
internal/store/flock_other.go:20
FunctionRenewUserDialog
({ open, onOpenChange, user, mode, days, onDaysChange, permanent, onPermanentChange, onSubmi
webui/src/app/(main)/admin/users/admin-users-dialogs.tsx:457
FunctionRequestStatusBadge
({ status }: { status?: string })
webui/src/app/(main)/dashboard/page.tsx:1464
FunctionResetPasswordDialog
({ open, onOpenChange, user, scope, onScopeChange, auto, onAutoChange, custom, onCustomChang
webui/src/app/(main)/admin/users/admin-users-dialogs.tsx:1580
MethodRestoreFrom
(path string)
internal/store/store.go:1442
FunctionRootLayout
({ children, }: Readonly<{ children: React.ReactNode; }>)
webui/src/app/layout.tsx:51
MethodRoutes
()
internal/api/app.go:325
FunctionRow
({ label, value, mono, }: { label: string; value: React.ReactNode; mono?: boolean; })
webui/src/components/admin/emby-device-audit-panel.tsx:1149
FunctionRuntimeStat
({ icon: Icon, label, value, }: { icon: ComponentType<{ className?: string }>; label: string; valu
webui/src/app/(main)/admin/logs/page.tsx:65
FunctionSafeAnnouncementContent
({ content, mode }: { content: string; mode?: Mode | null })
webui/src/lib/safe-render.tsx:300
FunctionScheduleEditor
({ job, open, onOpenChange, onSaved }: ScheduleEditorProps)
webui/src/app/(main)/admin/scheduler/page.tsx:212
FunctionScorePage
()
webui/src/app/(main)/score/page.tsx:41
FunctionSecretField
({ value, onChange, }: { value: string; onChange: (v: string) => void; })
webui/src/app/(main)/admin/config/page.tsx:259
FunctionSecretInput
({ value, onChange }: { value: string; onChange: (value: string) => void })
webui/src/components/admin/config-section-editor.tsx:44
FunctionSectionCard
({ section, values, originalValues, changedCount, onFieldChange, onResetField, searchText, mat
webui/src/app/(main)/admin/config/page.tsx:694
FunctionSectionNav
({ sections, categories, activeSection, changedCounts, onSelect, }: { sections: ConfigSection[];
webui/src/app/(main)/admin/config/page.tsx:893
MethodSetTicketTypes
SetTicketTypes 原子替换工单类型列表。
internal/store/store.go:3229
FunctionSettingsPage
()
webui/src/app/(main)/settings/page.tsx:76
FunctionSetupPage
()
webui/src/app/(auth)/setup/page.tsx:38
FunctionSheet
({ onClose, children }: { onClose: () => void; children: ReactNode })
webui/src/app/(main)/admin/invite/sheet-mini.tsx:15
FunctionSheetClose
()
webui/src/app/(main)/admin/invite/sheet-mini.tsx:54
FunctionSidebar
()
webui/src/components/layout/sidebar.tsx:145
FunctionSkeleton
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>)
webui/src/components/ui/skeleton.tsx:3
FunctionStandaloneEmbyCreateDialog
({ open, onOpenChange, form, onFormChange, onSubmit, isSubmitting, }: { open: boolean; onOpenC
webui/src/app/(main)/admin/users/admin-users-dialogs.tsx:230
FunctionStarRating
({ value }: { value: number })
webui/src/app/(main)/bangumi/page.tsx:26
FunctionStatPill
({ icon: Icon, tone, label, value, }: { icon: React.ComponentType<{ className?: string }>; tone: "
webui/src/app/(main)/dashboard/page.tsx:1435
FunctionStatusBadge
({ t, job, isRunning }: { t: TFunc; job: SchedulerJobItem; isRunning?: boolean })
webui/src/app/(main)/admin/scheduler/page.tsx:529
FunctionStatusCell
({ online, t }: { online: boolean; t: TFunc })
webui/src/components/admin/emby-device-audit-panel.tsx:1139
FunctionStatusPill
({ ok, label }: { ok: boolean; label: string })
webui/src/app/(main)/admin/database/page.tsx:66
FunctionTestAPIKeyAuthSources
TestAPIKeyAuthSources 锁定 authenticateAPIKey 的三条入口(X-API-Key 头 / Authorization Bearer/ApiKey / ?apikey= 查询串)以及 AllowQuery 门禁的回归 行为:query 路径在 AllowQuery
internal/api/app_test.go:387
FunctionTestAPIKeyDisableAccountKillsSessions
TestAPIKeyDisableAccountKillsSessions 锁定 disable-account 的两个不变量: 1) cookie session 立即失效(不依赖 SessionTTL 自然过期);2) 同账号下既 存的 API key 被 authenticateAPIKey:
internal/api/app_test.go:463
FunctionTestAPIKeyFlow
(t *testing.T)
internal/api/app_test.go:337
FunctionTestAPIKeyLoginIsRateLimited
(t *testing.T)
internal/api/app_test.go:366
FunctionTestActivityEntryIPs
(t *testing.T)
internal/api/emby_device_audit_test.go:112
FunctionTestAddSchedulerRunNormalizesDefaultsAndLegacyEndedAt
(t *testing.T)
internal/store/scheduler_test.go:9
FunctionTestAddSigninContinuesStreakFromYesterday
(t *testing.T)
internal/store/signin_test.go:44
FunctionTestAddSigninDoesNotCreateDuplicateForSameDay
(t *testing.T)
internal/store/signin_test.go:79
FunctionTestAddSigninResetsStreakAfterMissedDay
(t *testing.T)
internal/store/signin_test.go:9
FunctionTestAddSigninTrimsExcessRecords
(t *testing.T)
internal/store/signin_test.go:112
FunctionTestAdminBulkExpireDisablesEmby
TestAdminBulkExpireDisablesEmby 验证批量改到期时间到「过去」时,被影响用户的 Emby 账号会被同步关停——堵住「Web 已过期、Emby 仍可登录」的越权窗口。
internal/api/admin_user_refresh_test.go:108
FunctionTestAdminClearUserEmails
(t *testing.T)
internal/api/app_test.go:1054
FunctionTestAdminEmbyUserToggleByIdBlocksEmbyAdmin
TestAdminEmbyUserToggleByIdBlocksEmbyAdmin 验证按 emby_user_id 操作时,远端是 Emby 管理员的账号会被拒绝(403),且不会发出任何 Policy 写入。
internal/api/admin_emby_user_actions_test.go:71
FunctionTestAdminEmbyUserToggleByIdLinked
TestAdminEmbyUserToggleByIdLinked 验证设备审查页按 emby_user_id 单独禁用 Emby: 已关联本地用户时 Emby 被关停、本地 EmbyDisabled 镜像置真、Web 账号不变;Policy 回 204 空 body 也能成功(回归 unexpec
internal/api/admin_emby_user_actions_test.go:16
FunctionTestAdminRefreshScopeTelegramSkipsEmby
TestAdminRefreshScopeTelegramSkipsEmby 验证 scope=telegram 时只刷新 Telegram 用户名, 完全不触碰 Emby(Emby 端任何请求都视为错误)。
internal/api/admin_emby_user_actions_test.go:99
FunctionTestAdminRefreshUserStatusSyncsTelegramAndEmby
TestAdminRefreshUserStatusSyncsTelegramAndEmby 验证强制刷新接口会: - 用 getChat 拉取并回写最新的 Telegram 用户名; - 对「Web 已禁用但 Emby 仍启用」的越权漂移强制关停远端 Emby; - 在响应 refresh 摘要里
internal/api/admin_user_refresh_test.go:17
FunctionTestAdminRoutesRequireAdminAuth
(t *testing.T)
internal/api/developer_sandbox_test.go:70
FunctionTestAdminServerIconUploadUpdatesConfig
(t *testing.T)
internal/api/app_test.go:671
FunctionTestAdminSetUserExpiryAbsolute
TestAdminSetUserExpiryAbsolute 锁定 Task 2 的核心修复: - cancel-permanent 必须把永久号真正改成「现在起 N 天后」,而不是因为 base=max(now, ExpiredAt) 在永久哨兵上叠加而保持永久(旧 bug)。 - set-exp
internal/api/app_test.go:4559
FunctionTestAdminToggleEmbyEnableBlockedForInactiveWeb
TestAdminToggleEmbyEnableBlockedForInactiveWeb 验证启用方向不绕过有效期:Web 账号 已禁用时单独启用 Emby 必须在校验阶段被拒,且根本不应发起任何 Emby 请求。
internal/api/admin_user_refresh_test.go:231
FunctionTestAdminToggleEmbyOnly
TestAdminToggleEmbyOnly 验证「单独禁用 Emby(保留 Web)」:Emby 被关停、Web 账号 仍 active。Policy 回 204 空 body,顺带回归 unexpected end of JSON input 的修复。
internal/api/admin_user_refresh_test.go:176
FunctionTestAuthFlowWithoutCSRF
(t *testing.T)
internal/api/app_test.go:147
FunctionTestBackgroundConfigIsSanitized
(t *testing.T)
internal/api/app_test.go:816
FunctionTestBangumiSearchErrorIsVisibleForBangumiSource
(t *testing.T)
internal/api/app_test.go:1289
FunctionTestBangumiSearchUsesV0EndpointAndReturnsResults
(t *testing.T)
internal/api/app_test.go:1248
FunctionTestBangumiWebhookConstantTimeStringEqual
TestBangumiWebhookConstantTimeStringEqual 锁定 R58-1 timing oracle 收紧: length-mismatch 不能再通过 ConstantTimeCompare 提前 return 触发。直接调 用 helper 验证逻辑等价性(timin
internal/api/app_test.go:3409
FunctionTestBangumiWebhookIdempotentReplay
TestBangumiWebhookIdempotentReplay 锁定 R58-1 idempotency:同一份合法 请求被重放也只产生一条 PlaybackRecord,而不是无限堆积。即使时间戳 header 通过校验,store 层的 (uid, item_id, played_at)
internal/api/app_test.go:3363
FunctionTestBangumiWebhookRejectsStaleTimestamp
TestBangumiWebhookRejectsStaleTimestamp 锁定 R58-1 replay window:带 X-Twilight-Bangumi-Timestamp 但落在 ±300s 之外的请求必须 410 拒绝,即使 secret 正确。窗口内 / 不带 header 仍应
internal/api/app_test.go:3325
FunctionTestBangumiWebhookRequiresSecretWhenEnabled
(t *testing.T)
internal/api/app_test.go:3308
FunctionTestBatchDeleteRegCodesPhysicallyDeletesUsedAndUnused
(t *testing.T)
internal/store/store_test.go:36
FunctionTestBatchLockEmbyUnbindSupportsSelectedFilter
(t *testing.T)
internal/api/app_test.go:5303
FunctionTestBatchUserDangerousActionsRequireConfirm
(t *testing.T)
internal/api/app_test.go:5261
FunctionTestBatchUserOutcomesCarryStableErrorCodes
TestBatchUserOutcomesCarryStableErrorCodes 锁住 R64-8 的契约:批量响应里 每条失败 outcome 都附带 errors[].code(一个稳定的 ErrCode 字符串),前端 用它做 UI 分支("用户不存在" / "受保护账号" / "命中自己
internal/api/app_test.go:6045
FunctionTestBindCodeCreationGETRequiresWebUIIntent
(t *testing.T)
internal/api/app_test.go:223
FunctionTestBindCodeWebSocketRejectsMalformedCodeBeforeUpgrade
(t *testing.T)
internal/api/app_test.go:324
FunctionTestBindCodesAreMemoryOnly
(t *testing.T)
internal/api/app_test.go:1706
FunctionTestCSVSafeNeutralizesFormulaInjection
TestCSVSafeNeutralizesFormulaInjection 验证导出列经过 csvSafe 中和后, 以 = + - @ / Tab / CR / LF 开头的值会被前置单引号,普通文本与空串原样保留。 防回归点:handleExportUsers / handleExportPl
internal/api/security_fixes_test.go:21
FunctionTestChangeEmbyPasswordAcceptsEmptyEmbyResponses
(t *testing.T)
internal/api/app_test.go:2294
FunctionTestCheckExpiredKillsInvitedUserSessions
TestCheckExpiredKillsInvitedUserSessions 锁定 R60-1 整改后的不变量: check_expired job 处理 invited 用户时,即便保留 Active=true 让用户能重 新登录续期,已经过期的时刻必须立刻让现有 cookie session
internal/api/app_test.go:520
FunctionTestCheckExpiredSkipsAdminAndWhitelist
TestCheckExpiredSkipsAdminAndWhitelist 锁定 R62-3 不变量: check_expired 调度看到 RoleAdmin / RoleWhitelist 用户即便 ExpiredAt 撞过 期限也必须跳过——demote-then-repromote / 手
internal/api/app_test.go:5701
FunctionTestClampRuntimeLogLimits
(t *testing.T)
internal/store/runtime_log_test.go:55
FunctionTestCleanupExpiredBindCodesDoesNotDeleteSameValueRegCode
(t *testing.T)
internal/store/store_test.go:269
FunctionTestCleanupExpiredBindCodesKeepsValidCodes
(t *testing.T)
internal/api/app_test.go:1746
FunctionTestCleanupExpiredEmailVerifications
(t *testing.T)
internal/store/email_verification_test.go:83
FunctionTestCleanupInvalidUsersDefaultsToDryRunAndRequiresConfirm
(t *testing.T)
internal/api/app_test.go:5364
FunctionTestClearEmbyGrantForUnboundUsers
ClearEmbyGrantForUnboundUsers 必须只解锁"无 Emby 账号"用户的注册资格,并回退其 占用的注册码/邀请码使用记录;已绑定 Emby 与 PendingEmby 在飞的用户保持不动。
internal/store/store_test.go:62
FunctionTestClosedTicketBlocksUserImageDelete
TestClosedTicketBlocksUserImageDelete 验证工单关闭后普通用户不能删除自己的图片, 但管理员仍可删除 (TASK#2)。
internal/api/ticket_handlers_test.go:295
FunctionTestClosedTicketRejectsImageUpload
TestClosedTicketRejectsImageUpload 验证已关闭工单不再接受图片上传 (子需求 C/G)。
internal/api/ticket_handlers_test.go:250
FunctionTestClosedTicketsWithAttachmentsBefore
TestClosedTicketsWithAttachmentsBefore 验证清理任务的查询基础 (子需求 E)。
internal/api/ticket_handlers_test.go:334
FunctionTestConfigAdminBackupRestoreAndDelete
(t *testing.T)
internal/api/app_test.go:3540
FunctionTestConfigFileChangeHotReloadsRuntimeLogLevel
(t *testing.T)
internal/api/app_test.go:1423
FunctionTestConfigSaveMigratesLegacyTelegramForceSubscribe
(t *testing.T)
internal/api/app_test.go:3707
FunctionTestConfigSchemaExposesRegcodeDecoyAction
(t *testing.T)
internal/api/app_test.go:1581
FunctionTestConfigSchemaRendersTelegramNewlines
(t *testing.T)
internal/api/app_test.go:1554
FunctionTestConfigSchemaRoundTripsEmailLists
email 黑白名单 + 验证模式必须能完整 round-trip:configValues 暴露 → 渲染 TOML → config.Load 读回,三段都不能丢。
internal/api/app_test.go:1653
FunctionTestConfigTOMLGetMasksSecretsAndPUTPreserves
TestConfigTOMLGetMasksSecretsAndPUTPreserves 验证: - GET /system/admin/config/toml 不在 content / raw_content 中回传任何 真实密钥(Emby Token / Bot Token / BotInter
internal/api/app_test.go:3639
FunctionTestConfigTOMLGetReturnsCompletedConfig
(t *testing.T)
internal/api/app_test.go:3603
FunctionTestConfigValuesCoversEverySchemaField
防回归:configValues 必须为 configSectionDefs 里的每个字段提供取值来源。 漏一个字段 → handleConfigSchemaFull 返回 null(前端显示空)+ renderConfigTOML 写出 "<nil>" 或被清空,等于该字段"存不住 / 读不到"。
internal/api/app_test.go:1635
FunctionTestConfiguredUsernameIsPromotedToAdmin
TestConfiguredUsernameIsPromotedToAdmin 正向:配置了 admin_usernames 时, 用该用户名注册的账户会被提升为管理员(且仅该用户名)。
internal/api/security_fixes_test.go:219
FunctionTestConfirmedRegisterBindCodeHonorsTTL
(t *testing.T)
internal/api/app_test.go:1721
FunctionTestConsumeRebindRequestOnlyConsumesApproved
TestConsumeRebindRequestOnlyConsumesApproved 锁定 ConsumeRebindRequest 的状态 守卫:仅 approved 请求会被翻成 used;pending / rejected 请求不受影响,避免 "解绑接口在非批准态下误把请求标记成 use
internal/store/rebind_test.go:67
FunctionTestConsumeRebindRequestPreservesAuditTrail
TestConsumeRebindRequestPreservesAuditTrail 锁定换绑审计链路的关键不变量: 用户用"已批准"的换绑请求解绑 Telegram 后,请求必须翻成 used 以防二次复用, 但管理员的审核元数据(ReviewerUID / AdminNote / Review
internal/store/rebind_test.go:16
FunctionTestCredentialedCORSRequiresExplicitOrigin
(t *testing.T)
internal/api/app_test.go:184
← previousnext →1,901–2,000 of 2,686, ranked by callers