Documentation
¶
Index ¶
- Constants
- Variables
- type AbuseForwarder
- type AvatarDecorationCacheInvalidator
- type BroadcastPublisher
- type CaptchaVerifierFactory
- type DatabaseHealthReader
- type DeleteAccountEnqueuer
- type DeliveryBreakerAdmin
- type DeliveryHealthProvider
- type DriveBulkDeleter
- type DriveStorageMigrator
- type DriveUsageProvider
- type EmojiImageFetcher
- type EmojiImageFetcherImpl
- func (f *EmojiImageFetcherImpl) CopyToSystemFile(ctx context.Context, src *model.DriveFile, name string, sensitive bool) (*model.DriveFile, error)
- func (f *EmojiImageFetcherImpl) DeleteSystemFile(_ context.Context, fileID string) error
- func (f *EmojiImageFetcherImpl) FetchAndStore(ctx context.Context, imageURL string, user *model.User, name string) (*model.DriveFile, error)
- type EmojiImportEnqueuer
- type FederationRuleManager
- type GoneInstanceCleaner
- type Handler
- func (h *Handler) AbuseReportNotificationRecipientCreate(c *echo.Context) error
- func (h *Handler) AbuseReportNotificationRecipientDelete(c *echo.Context) error
- func (h *Handler) AbuseReportNotificationRecipientList(c *echo.Context) error
- func (h *Handler) AbuseReportNotificationRecipientShow(c *echo.Context) error
- func (h *Handler) AbuseReportNotificationRecipientUpdate(c *echo.Context) error
- func (h *Handler) AbuseReports(c *echo.Context) error
- func (h *Handler) AccountsCreate(c *echo.Context) error
- func (h *Handler) AccountsDelete(c *echo.Context) error
- func (h *Handler) AccountsFindByEmail(c *echo.Context) error
- func (h *Handler) AdCreate(c *echo.Context) error
- func (h *Handler) AdDelete(c *echo.Context) error
- func (h *Handler) AdList(c *echo.Context) error
- func (h *Handler) AdUpdate(c *echo.Context) error
- func (h *Handler) AdminMeta(c *echo.Context) error
- func (h *Handler) AvatarDecorationsCreate(c *echo.Context) error
- func (h *Handler) AvatarDecorationsDelete(c *echo.Context) error
- func (h *Handler) AvatarDecorationsList(c *echo.Context) error
- func (h *Handler) AvatarDecorationsUpdate(c *echo.Context) error
- func (h *Handler) CaptchaCurrent(c *echo.Context) error
- func (h *Handler) CaptchaSave(c *echo.Context) error
- func (h *Handler) CreateFromApplication(ctx context.Context, app *model.EmojiApplication) (emojiapplication.CreatedEmoji, error)
- func (h *Handler) DatabaseHealth(c *echo.Context) error
- func (h *Handler) DeleteAccount(c *echo.Context) error
- func (h *Handler) DeleteAllFilesOfUser(c *echo.Context) error
- func (h *Handler) DeleteCreatedEmoji(ctx context.Context, created emojiapplication.CreatedEmoji) error
- func (h *Handler) DeleteMigratedAccount(user *model.User) error
- func (h *Handler) DeletePluginManagedAccount(user *model.User) error
- func (h *Handler) DriveCleanRemoteFiles(c *echo.Context) error
- func (h *Handler) DriveCleanup(c *echo.Context) error
- func (h *Handler) DriveFiles(c *echo.Context) error
- func (h *Handler) DriveShowFile(c *echo.Context) error
- func (h *Handler) DriveStorageMigrationCleanupCopies(c *echo.Context) error
- func (h *Handler) DriveStorageMigrationPurgeLocal(c *echo.Context) error
- func (h *Handler) DriveStorageMigrationRestore(c *echo.Context) error
- func (h *Handler) DriveStorageMigrationStart(c *echo.Context) error
- func (h *Handler) DriveStorageMigrationStatus(c *echo.Context) error
- func (h *Handler) DriveStorageMigrationVerify(c *echo.Context) error
- func (h *Handler) DriveUsage(c *echo.Context) error
- func (h *Handler) EmojiAdd(c *echo.Context) error
- func (h *Handler) EmojiAddAliasesBulk(c *echo.Context) error
- func (h *Handler) EmojiApplicationApprove(c *echo.Context) error
- func (h *Handler) EmojiApplicationList(c *echo.Context) error
- func (h *Handler) EmojiApplicationListByUser(c *echo.Context) error
- func (h *Handler) EmojiApplicationReject(c *echo.Context) error
- func (h *Handler) EmojiApplicationRelated(c *echo.Context) error
- func (h *Handler) EmojiApplicationResetUserQuota(c *echo.Context) error
- func (h *Handler) EmojiApplicationUserSummary(c *echo.Context) error
- func (h *Handler) EmojiCopy(c *echo.Context) error
- func (h *Handler) EmojiDelete(c *echo.Context) error
- func (h *Handler) EmojiDeleteBulk(c *echo.Context) error
- func (h *Handler) EmojiFetchRemoteMeta(c *echo.Context) error
- func (h *Handler) EmojiImportZip(c *echo.Context) error
- func (h *Handler) EmojiList(c *echo.Context) error
- func (h *Handler) EmojiListRemote(c *echo.Context) error
- func (h *Handler) EmojiListV2(c *echo.Context) error
- func (h *Handler) EmojiRemoveAliasesBulk(c *echo.Context) error
- func (h *Handler) EmojiSetAliasesBulk(c *echo.Context) error
- func (h *Handler) EmojiSetCategoryBulk(c *echo.Context) error
- func (h *Handler) EmojiSetLicenseBulk(c *echo.Context) error
- func (h *Handler) EmojiUpdate(c *echo.Context) error
- func (h *Handler) FederationCheckHost(c *echo.Context) error
- func (h *Handler) FederationCleanGoneInstance(c *echo.Context) error
- func (h *Handler) FederationCloseDeliveryBreaker(c *echo.Context) error
- func (h *Handler) FederationDeleteAllFiles(c *echo.Context) error
- func (h *Handler) FederationDeliveryHealth(c *echo.Context) error
- func (h *Handler) FederationGoneInstances(c *echo.Context) error
- func (h *Handler) FederationInboxHealth(c *echo.Context) error
- func (h *Handler) FederationRefreshRemoteInstanceMetadata(c *echo.Context) error
- func (h *Handler) FederationRemoveAllFollowing(c *echo.Context) error
- func (h *Handler) FederationRuleCreate(c *echo.Context) error
- func (h *Handler) FederationRuleDelete(c *echo.Context) error
- func (h *Handler) FederationRuleHits(c *echo.Context) error
- func (h *Handler) FederationRuleUpdate(c *echo.Context) error
- func (h *Handler) FederationRules(c *echo.Context) error
- func (h *Handler) FederationUpdateInstance(c *echo.Context) error
- func (h *Handler) ForwardAbuseUserReport(c *echo.Context) error
- func (h *Handler) GetIndexStats(c *echo.Context) error
- func (h *Handler) GetTableStats(c *echo.Context) error
- func (h *Handler) GetUserIPs(c *echo.Context) error
- func (h *Handler) IPAccounts(c *echo.Context) error
- func (h *Handler) IPLookupLog(c *echo.Context) error
- func (h *Handler) IPRelatedAccounts(c *echo.Context) error
- func (h *Handler) InviteCreate(c *echo.Context) error
- func (h *Handler) InviteList(c *echo.Context) error
- func (h *Handler) PromoCreate(c *echo.Context) error
- func (h *Handler) QueueClear(c *echo.Context) error
- func (h *Handler) QueueDeliverDelayed(c *echo.Context) error
- func (h *Handler) QueueInboxDelayed(c *echo.Context) error
- func (h *Handler) QueueJobs(c *echo.Context) error
- func (h *Handler) QueuePause(c *echo.Context) error
- func (h *Handler) QueuePromoteJobs(c *echo.Context) error
- func (h *Handler) QueueQueueStats(c *echo.Context) error
- func (h *Handler) QueueQueues(c *echo.Context) error
- func (h *Handler) QueueRemoveJob(c *echo.Context) error
- func (h *Handler) QueueResume(c *echo.Context) error
- func (h *Handler) QueueRetryJob(c *echo.Context) error
- func (h *Handler) QueueShowJob(c *echo.Context) error
- func (h *Handler) QueueShowJobLogs(c *echo.Context) error
- func (h *Handler) QueueStats(c *echo.Context) error
- func (h *Handler) RelaysAdd(c *echo.Context) error
- func (h *Handler) RelaysList(c *echo.Context) error
- func (h *Handler) RelaysRemove(c *echo.Context) error
- func (h *Handler) ResetPassword(c *echo.Context) error
- func (h *Handler) ResolveAbuseReport(c *echo.Context) error
- func (h *Handler) RolesAssign(c *echo.Context) error
- func (h *Handler) RolesAssignmentShow(c *echo.Context) error
- func (h *Handler) RolesCreate(c *echo.Context) error
- func (h *Handler) RolesDelete(c *echo.Context) error
- func (h *Handler) RolesList(c *echo.Context) error
- func (h *Handler) RolesShow(c *echo.Context) error
- func (h *Handler) RolesUnassign(c *echo.Context) error
- func (h *Handler) RolesUpdate(c *echo.Context) error
- func (h *Handler) RolesUpdateDefaultPolicies(c *echo.Context) error
- func (h *Handler) RolesUsers(c *echo.Context) error
- func (h *Handler) SelfCheck(c *echo.Context) error
- func (h *Handler) SendEmail(c *echo.Context) error
- func (h *Handler) ServerInfo(c *echo.Context) error
- func (h *Handler) ServerMetrics(c *echo.Context) error
- func (h *Handler) ServerPlugins(c *echo.Context) error
- func (h *Handler) SetAbuseForwarder(f AbuseForwarder)
- func (h *Handler) SetAbuseRepo(r repository.AbuseReportRepository)
- func (h *Handler) SetAdRepo(r repository.AdRepository)
- func (h *Handler) SetAdminDB(db *gorm.DB)
- func (h *Handler) SetAvatarDecorationInvalidator(inv AvatarDecorationCacheInvalidator)
- func (h *Handler) SetAvatarDecorationRepo(r repository.AvatarDecorationRepository)
- func (h *Handler) SetBroadcastPublisher(p BroadcastPublisher)
- func (h *Handler) SetCaptchaVerifierFactory(f CaptchaVerifierFactory)
- func (h *Handler) SetConfigSetupPassword(pw string)
- func (h *Handler) SetDatabaseHealth(r DatabaseHealthReader)
- func (h *Handler) SetDeleteAccountEnqueuer(e DeleteAccountEnqueuer)
- func (h *Handler) SetDeliveryBreaker(b DeliveryBreakerAdmin)
- func (h *Handler) SetDeliveryHealthProvider(p DeliveryHealthProvider)
- func (h *Handler) SetDriveBulkDeleter(d DriveBulkDeleter)
- func (h *Handler) SetDriveFileRepo(r repository.DriveFileRepository)
- func (h *Handler) SetDriveStorageMigrationVerifier(v *strongauth.Verifier)
- func (h *Handler) SetDriveStorageMigrator(m DriveStorageMigrator)
- func (h *Handler) SetDriveUsageProvider(p DriveUsageProvider)
- func (h *Handler) SetEmojiApplicationRepo(r repository.EmojiApplicationRepository)
- func (h *Handler) SetEmojiApplicationReviewer(r emojiApplicationReviewer)
- func (h *Handler) SetEmojiDecorationInvalidator(inv AvatarDecorationCacheInvalidator)
- func (h *Handler) SetEmojiImportEnqueuer(e EmojiImportEnqueuer)
- func (h *Handler) SetEmojiRepo(r repository.EmojiRepository)
- func (h *Handler) SetFederationRuleManager(m FederationRuleManager)
- func (h *Handler) SetFollowRequestRepo(r repository.FollowRequestRepository)
- func (h *Handler) SetFollowingRepo(r repository.FollowingRepository)
- func (h *Handler) SetGoneInstanceCleaner(c GoneInstanceCleaner)
- func (h *Handler) SetIPLookupLogRepo(r repository.IPLookupLogRepository)
- func (h *Handler) SetIPSearchRepo(r repository.UserIPSearchRepository)
- func (h *Handler) SetInboxHealthProvider(p DeliveryHealthProvider)
- func (h *Handler) SetInstanceMetadataFetcher(f InstanceMetadataFetcher)
- func (h *Handler) SetInstanceRepo(r repository.InstanceRepository)
- func (h *Handler) SetInstanceSuspendCacheInvalidator(inv InstanceSuspendCacheInvalidator)
- func (h *Handler) SetInviteRepo(r repository.RegistrationTicketRepository)
- func (h *Handler) SetLocalStorageDeleter(s StorageDeleter)
- func (h *Handler) SetMetaResponseInvalidator(inv MetaResponseCacheInvalidator)
- func (h *Handler) SetModLogService(s *moderationlog.Service)
- func (h *Handler) SetNoteFinder(r NoteFinder)
- func (h *Handler) SetObjectStorageEnqueuer(e ObjectStorageEnqueuer)
- func (h *Handler) SetPasswordHasher(hasher password.Hasher)
- func (h *Handler) SetPluginOrphanSchemas(fn PluginOrphanSchemaLister)
- func (h *Handler) SetProcStatsDeps(deps procstats.Deps)
- func (h *Handler) SetPromoNoteRepo(r repository.PromoNoteRepository)
- func (h *Handler) SetQueueInspector(qi QueueInspector)
- func (h *Handler) SetQueueRedis(p QueueRedisInfoProvider)
- func (h *Handler) SetQueueRuntimeProvider(p QueueRuntimeProvider)
- func (h *Handler) SetRecipientRepo(r repository.AbuseReportNotificationRecipientRepository)
- func (h *Handler) SetRelayService(s RelayService)
- func (h *Handler) SetRemoteChecker(r RemoteChecker, selfHost string)
- func (h *Handler) SetRemoteEmojiMetaFetcher(f RemoteEmojiMetaFetcher)
- func (h *Handler) SetRestoredCopyReleaser(r RestoredCopyReleaser)
- func (h *Handler) SetSMTPProxyURL(u string)
- func (h *Handler) SetSecurityKeyRepo(r repository.UserSecurityKeyRepository)
- func (h *Handler) SetSelfCheckRunner(r SelfCheckRunner)
- func (h *Handler) SetSelfPacker(p *meself.Packer)
- func (h *Handler) SetServerPlugins(infos []ServerPluginInfo)
- func (h *Handler) SetServerURL(u string)
- func (h *Handler) SetSigninRepo(r repository.SigninRepository)
- func (h *Handler) SetSignupApplicationReviewer(r SignupApplicationReviewer)
- func (h *Handler) SetStorageDeleter(s StorageDeleter)
- func (h *Handler) SetSystemAccountFetcher(f SystemAccountFetcher)
- func (h *Handler) SetSystemWebhookDispatcher(d SystemWebhookDispatcher)
- func (h *Handler) SetSystemWebhookRepo(r repository.SystemWebhookRepository)
- func (h *Handler) SetUnfollowEnqueuer(e UnfollowEnqueuer)
- func (h *Handler) SetUserIPRepo(r repository.UserIPRepository)
- func (h *Handler) SetUserModerationFederationHook(hook UserModerationFederationHook)
- func (h *Handler) ShowModerationLogs(c *echo.Context) error
- func (h *Handler) ShowUser(c *echo.Context) error
- func (h *Handler) ShowUsers(c *echo.Context) error
- func (h *Handler) SignupApplicationApprove(c *echo.Context) error
- func (h *Handler) SignupApplicationList(c *echo.Context) error
- func (h *Handler) SignupApplicationReject(c *echo.Context) error
- func (h *Handler) SuspendUser(c *echo.Context) error
- func (h *Handler) SystemWebhookCreate(c *echo.Context) error
- func (h *Handler) SystemWebhookDelete(c *echo.Context) error
- func (h *Handler) SystemWebhookList(c *echo.Context) error
- func (h *Handler) SystemWebhookShow(c *echo.Context) error
- func (h *Handler) SystemWebhookTest(c *echo.Context) error
- func (h *Handler) SystemWebhookUpdate(c *echo.Context) error
- func (h *Handler) UnsetMfa(c *echo.Context) error
- func (h *Handler) UnsetUserAvatar(c *echo.Context) error
- func (h *Handler) UnsetUserBanner(c *echo.Context) error
- func (h *Handler) UnsuspendUser(c *echo.Context) error
- func (h *Handler) UpdateAbuseUserReport(c *echo.Context) error
- func (h *Handler) UpdateMeta(c *echo.Context) error
- func (h *Handler) UpdateProxyAccount(c *echo.Context) error
- func (h *Handler) UpdateUserNote(c *echo.Context) error
- type InstanceMetadataFetcher
- type InstanceSuspendCacheInvalidator
- type MetaResponseCacheInvalidator
- type NoteFinder
- type ObjectStorageEnqueuer
- type PluginOrphanSchemaLister
- type Quantiles
- type QueueInfoResult
- type QueueInspector
- type QueueMetricsResult
- type QueueRedisInfoProvider
- type QueueRuntime
- type QueueRuntimeProvider
- type QueueScaleEvent
- type QueueTaskSummary
- type RelayService
- type RemoteChecker
- type RemoteEmojiMetaFetcher
- type RestoredCopyReleaser
- type SelfCheckRunner
- type ServerPluginInfo
- type SignupApplicationReviewer
- type StorageDeleter
- type SystemAccountFetcher
- type SystemWebhookDispatcher
- type UnfollowEnqueuer
- type UserModerationFederationHook
- type UserStreamRevoker
- type UserTokenInvalidator
Constants ¶
const DefaultEmojiCopyAccept = "image/*, */*"
DefaultEmojiCopyAccept matches the headers Misskey TS sends when fetching emoji images via DriveService.uploadFromUrl. */* fallback is required since some CDN-fronted emoji use generic image/* responses.
const MaxEmojiCopyBytes = emojiapplication.MaxEmojiCopyBytes
MaxEmojiCopyBytes caps the local drive file duplicated on approval (#2966).
**定義は core に 1 つだけ置く (2 周目レビュー M2)。** 申請側 (`checkFile`) と 承認側でこの値が食い違うと、「申請はできたのに承認だけが恒久的に失敗する」 サイズ帯が生まれる。別名にして、片方だけ動かせないようにする。
const MaxEmojiImageBytes int64 = 8 << 20
MaxEmojiImageBytes caps the response read from a remote emoji image so a hostile / misconfigured server cannot drown the drive backend in arbitrary bytes. Real-world custom emoji rarely exceed a few hundred KB; 8 MiB leaves generous headroom for animated PNG / APNG / WebP.
const SystemUserIDToken = "@system"
SystemUserIDToken は `/api/admin/drive/files` の `userId` パラメータで 「local な system 所有 (userId IS NULL かつ userHost IS NULL) の drive file」を一覧する特殊値。custom emoji の copy / import zip 経路で蓄積される system file (#670 で導入) を admin UI から可視化する経路 (#686)。 `@` 接頭辞は実 user ID と衝突しない (aidx ID は英数字のみ) ため安全。
**リモートの owner 無し行は含まない (#2753)。** それらは origin=remote を 渡せば通常の一覧に出る。
Variables ¶
var ErrCascadeNotQueued = errors.New("admin: the account is flagged deleted, but its cleanup was not queued; delete it again from the admin page")
ErrCascadeNotQueued is returned by DeleteMigratedAccount when the account was flagged deleted but its cascade deletion could not be queued. 管理画面から もう一度消すと積み直せる。
var ErrIDGenMissing = errors.New("admin: idGen not configured")
ErrIDGenMissing is returned when aidxCreatedAtString is called with a nil generator. Distinguishing this from a parse error lets callers decide whether to log (parse failure on a non-aidx ID is debug-worthy, missing generator usually means the handler was wired without an idGen and the log noise would be redundant).
Functions ¶
This section is empty.
Types ¶
type AbuseForwarder ¶
AbuseForwarder encapsulates the full "render a Flag activity for the report and deliver it to the target user's origin inbox" flow used by admin/forward-abuse-user-report. Kept as an interface so the handler stays testable without dragging in the full activitypub + queue stack.
type AvatarDecorationCacheInvalidator ¶
type AvatarDecorationCacheInvalidator interface {
Invalidate()
}
AvatarDecorationCacheInvalidator drops the process-wide avatar decoration catalog cache used by (*entity.Packer).PackUserLite. Implemented by core/avatardecoration.Resolver.
type BroadcastPublisher ¶
BroadcastPublisher emits an instance-wide stream event to every connected client. Implemented by *stream.BroadcastPublisher (#2046)。
type CaptchaVerifierFactory ¶
CaptchaVerifierFactory builds a captcha.Verifier for the given provider and the request-supplied secret / sitekey / instanceUrl. Used by admin/captcha/save to verify the captchaResult before persisting settings.
type DatabaseHealthReader ¶
DatabaseHealthReader reads PostgreSQL's statistics (#3095).
type DeleteAccountEnqueuer ¶
type DeleteAccountEnqueuer interface {
EnqueueDeleteAccount(payload queue.DeleteAccountPayload) error
}
DeleteAccountEnqueuer schedules the background cascade deletion of a user's related rows (notes / drive files / follow graph) after the admin/accounts/delete flag flip. narrow interface to keep admin handler tests decoupled from the full queue stack.
type DeliveryBreakerAdmin ¶
type DeliveryBreakerAdmin interface {
List(ctx context.Context) ([]deliveryhealth.BreakerState, error)
Close(ctx context.Context, host string) error
}
DeliveryBreakerAdmin exposes the per-host delivery breaker to admins (#3048)。実装は core/deliveryhealth.Breaker。
type DeliveryHealthProvider ¶
type DeliveryHealthProvider interface {
Query(ctx context.Context, window time.Duration) ([]deliveryhealth.HostHealth, error)
EvictedHosts() int64
}
DeliveryHealthProvider exposes the aggregated per-host delivery view. 循環依存を避けるため interface で受け取る。実装は core/deliveryhealth.Service。
type DriveBulkDeleter ¶
FederationDeleteAllFiles handles POST /api/admin/federation/delete-all-files.
指定ホストの DriveFile (= リモート user の上げた添付) を一括削除する。 DriveBulkDeleter physically deletes all drive files of a remote host (storage objects + drive usage decrement + row delete). Implemented by *core/drive.Service (DeleteAllByHost). 循環依存回避のため interface で受ける。
type DriveStorageMigrator ¶
type DriveStorageMigrator interface {
Start(ctx context.Context) error
StartVerify(ctx context.Context) error
StartPurge(ctx context.Context) error
StartRestore(ctx context.Context) error
StartCleanup(ctx context.Context) error
Status(ctx context.Context) (coredrive.StorageMigrationStatus, error)
}
DriveStorageMigrator copies locally stored drive files to object storage (coredrive.StorageMigrator, #4180).
type DriveUsageProvider ¶
type DriveUsageProvider interface {
Breakdown(forceRecalc bool) (*driveusage.Result, error)
}
DriveUsageProvider serves instance-wide drive usage snapshots. 実装は core/driveusage.Service。interface で受け取るのは handler のテストから 集計を差し替えられるようにするため (依存自体は `driveusage` を import している)。
type EmojiImageFetcher ¶
type EmojiImageFetcher interface {
FetchAndStore(ctx context.Context, url string, user *model.User, name string) (*model.DriveFile, error)
// CopyToSystemFile duplicates an existing drive file as a system-owned one
// (#2966。`admin/emoji/add` も同じ複製を通す、#2999)。
//
// **HTTP を経由しない。** 自分の公開 URL を叩くと SSRF ガードと衝突し、
// 非公開 URL の構成では取れず、DB 上の行と実体の対応も確かめられない。
// ストレージから直に読む。
//
// **元のファイルは触らない** — 申請者はノートの添付やプロフィールで
// 使っている可能性があり、所有権を移すと drive から突然消える。
CopyToSystemFile(ctx context.Context, src *model.DriveFile, name string, sensitive bool) (*model.DriveFile, error)
// DeleteSystemFile removes a system-owned file created by CopyToSystemFile
// when the approval then failed (#2966).
DeleteSystemFile(ctx context.Context, fileID string) error
}
EmojiImageFetcher downloads a remote image and stores it in the local drive, returning the resulting drive file. Used by admin/emoji/copy to detach a copied emoji from its source server (#670). 小さい interface に 切り出すことで http client / drive.Service への直接依存を持たずに済み、 handler 単体テストで fake を差し込める。
type EmojiImageFetcherImpl ¶
type EmojiImageFetcherImpl struct {
// contains filtered or unexported fields
}
EmojiImageFetcherImpl is the default EmojiImageFetcher used by router.go. httpClient must be wired with safehttp.NewSSRFSafeTransport(...) so private IPs and non-http(s) schemes never leak through this fetch path.
func NewEmojiImageFetcher ¶
func NewEmojiImageFetcher(httpClient *http.Client, driveSvc *drive.Service, userAgent string) *EmojiImageFetcherImpl
NewEmojiImageFetcher builds a fetcher bound to an SSRF-safe HTTP client and the local drive service. userAgent should normally be cfg.UserAgent so feed servers see the same `Elythia/<ver>` identification used everywhere else.
func (*EmojiImageFetcherImpl) CopyToSystemFile ¶
func (f *EmojiImageFetcherImpl) CopyToSystemFile(ctx context.Context, src *model.DriveFile, name string, sensitive bool) (*model.DriveFile, error)
CopyToSystemFile implements EmojiImageFetcher (#2966).
承認した絵文字が申請者の drive ファイルに依存し続けるのを断つための複製。 申請者がファイルを消しても、アカウントを消しても、絵文字は生き残る。
**実体は `drive.Service` が持つ。** 既存データを直すバッチ (#2990) が `cmd/` から同じ複製を回すので、ここに置いたままだと api 層を import させるか、 同じ処理をもう 1 つ書くことになる。後者は「片方だけ直して気付かない」形。
func (*EmojiImageFetcherImpl) DeleteSystemFile ¶
func (f *EmojiImageFetcherImpl) DeleteSystemFile(_ context.Context, fileID string) error
DeleteSystemFile implements EmojiImageFetcher (#2966).
func (*EmojiImageFetcherImpl) FetchAndStore ¶
func (f *EmojiImageFetcherImpl) FetchAndStore(ctx context.Context, imageURL string, user *model.User, name string) (*model.DriveFile, error)
FetchAndStore downloads the image at imageURL and stores it as a drive file. Errors are wrapped so the caller can log a redacted reason while returning a generic INTERNAL_ERROR to the client. SSRF / dial / parse / oversized failures all collapse into a single error here — the SSRF-safe transport blocks redirects to private IPs as well, so this layer does not need its own redirect handling.
type EmojiImportEnqueuer ¶
type EmojiImportEnqueuer interface {
EnqueueImportCustomEmojis(payload queue.ImportCustomEmojisPayload) error
}
EmojiImportEnqueuer is the subset of queue.Enqueuer needed to schedule admin/emoji/import-zip jobs. 小さいインターフェースにすることで handler の テストが容易になる。
type FederationRuleManager ¶
type FederationRuleManager interface {
List() ([]*model.FederationRule, error)
Counts(ctx context.Context) (map[string]int64, error)
Samples(ctx context.Context, ruleID string, limit int) ([]fedrule.Hit, error)
Create(rule *model.FederationRule) (*model.FederationRule, error)
Update(rule *model.FederationRule) (before, after *model.FederationRule, err error)
Delete(ruleID string) (*model.FederationRule, error)
}
FederationRuleManager edits the federation rules (#3090). 実装は fedrule.Manager。
type GoneInstanceCleaner ¶
type GoneInstanceCleaner interface {
List() ([]repository.GoneInstanceSummary, error)
Clean(host string) (gonecleanup.Result, error)
}
GoneInstanceCleaner lists goneSuspended instances and removes the follow relations left with them (#3067).
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles admin API endpoints.
func NewHandler ¶
func NewHandler( signupService *signup.Service, roleService *role.Service, metaRepo repository.MetaRepository, userRepo repository.UserRepository, idGen id.Generator, background *bgwork.Group, entityPacker *entity.Packer, detailExtras userpack.DetailExtras, listPacker userpack.ListPacker, suspensionOriginRepo repository.UserSuspensionOriginRepository, userTokenInvalidator UserTokenInvalidator, userStreamRevoker UserStreamRevoker, ipLookupAudit *iplookuplog.Service, emojiImageFetcher EmojiImageFetcher, ) *Handler
NewHandler creates a new admin Handler.
The remaining arguments are the dependencies whose absence would degrade behaviour silently (#3823):
- background is the group the work after a response (the test mail) runs in, so stopping the server generation waits for it (#3661)
- entityPacker is the Packer this handler packs entities with (#3792)
- detailExtras fills pinnedNotes / pinnedPage / movedTo / alsoKnownAs for admin/accounts/find-by-email and admin/update-proxy-account (#3330)
- listPacker packs the users embedded in admin/show-users, admin/roles/users, admin/abuse-user-reports and admin/show-moderation-logs, and the instance / emojis of admin/accounts/find-by-email (#3330)
- suspensionOriginRepo records that a moderator decided the suspension state, so the next actor refresh does not undo it (#2973)
- userTokenInvalidator drops the target user's cached auth entries on admin/suspend-user / admin/unsuspend-user / admin/accounts/delete (#965)
- userStreamRevoker closes the /streaming connections of suspended and deleted users
- ipLookupAudit records the admin/ip/* lookups (#3106)
- emojiImageFetcher takes emoji images into system-owned drive files for admin/emoji/copy, admin/emoji/add, admin/emoji/update and emoji application approval (#2966 / #670 / #2999)
func (*Handler) AbuseReportNotificationRecipientCreate ¶
AbuseReportNotificationRecipientCreate handles POST /api/admin/abuse-report/notification-recipient/create.
func (*Handler) AbuseReportNotificationRecipientDelete ¶
AbuseReportNotificationRecipientDelete handles POST /api/admin/abuse-report/notification-recipient/delete.
func (*Handler) AbuseReportNotificationRecipientList ¶
AbuseReportNotificationRecipientList handles POST /api/admin/abuse-report/notification-recipient/list.
func (*Handler) AbuseReportNotificationRecipientShow ¶
AbuseReportNotificationRecipientShow handles POST /api/admin/abuse-report/notification-recipient/show.
func (*Handler) AbuseReportNotificationRecipientUpdate ¶
AbuseReportNotificationRecipientUpdate handles POST /api/admin/abuse-report/notification-recipient/update.
upstream paramDef は method を `enum: ['email', 'webhook']` で制約し、 method='email' なら userId 必須、'webhook' なら systemWebhookId 必須の correlation check を持つ (#1108 sweep)。旧 mk-go は Update で method を 素通し + correlation check を一切しておらず、admin が無効な method に silent 書き換えできた。本 fix で Create と同等の enum / correlation validation を追加。
func (*Handler) AbuseReports ¶
AbuseReports handles POST /api/admin/abuse-user-reports.
upstream paramDef (= packages/backend/src/server/api/endpoints/admin/ abuse-user-reports.ts) で受ける主要 field を frontend (= MkPagination + pages/admin/abuses.vue) と互換にする:
- sinceId / untilId — cursor pagination (#1114 root cause)
- state — 'all' | 'unresolved' | 'resolved'。他の値は全件
- reporterOrigin — 'combined' | 'local' | 'remote'
- targetUserOrigin — 'combined' | 'local' | 'remote'
- limit — default 10 / max 100
旧 mk-go は `resolved` boolean / `limit` / `offset` しか受けず、frontend が 送る untilId を無視して同じ first page を返し続けて MkPagination が末尾 検知できず無限ロードになっていた (= 過去 #487 / #488 / #491 / #493 / #520 / #712 と完全に同 pattern)。
後方互換: 旧 `resolved` boolean field は引き続き受け付ける (= 旧 client / 既存 e2e 互換)。`state` と `resolved` の両方が来た場合は `state` を優先 する (= upstream paramDef での enum 優先 pattern と同じ)。`state` が 'all'・ 空文字・null のときだけ `resolved` を見る。
func (*Handler) AccountsCreate ¶
AccountsCreate handles POST /api/admin/accounts/create. 初回セットアップ (rootUserId未設定) の場合は認証不要。 それ以外はadmin権限が必要。
func (*Handler) AccountsDelete ¶
AccountsDelete handles POST /api/admin/accounts/delete.
func (*Handler) AccountsFindByEmail ¶
AccountsFindByEmail handles POST /api/admin/accounts/find-by-email. user_profile.email 列を検索して、紐づく user を返す。本家 Misskey の admin/accounts/find-by-email と同等。
func (*Handler) AvatarDecorationsCreate ¶
AvatarDecorationsCreate handles POST /api/admin/avatar-decorations/create.
func (*Handler) AvatarDecorationsDelete ¶
AvatarDecorationsDelete handles POST /api/admin/avatar-decorations/delete.
func (*Handler) AvatarDecorationsList ¶
AvatarDecorationsList handles POST /api/admin/avatar-decorations/list.
func (*Handler) AvatarDecorationsUpdate ¶
AvatarDecorationsUpdate handles POST /api/admin/avatar-decorations/update.
func (*Handler) CaptchaCurrent ¶
CaptchaCurrent handles POST /api/admin/captcha/current.
Returns the currently enabled provider plus every provider's site/secret keys in the nested shape upstream `CaptchaService.get` produces (current.ts res). 旧実装は flat な {provider, siteKey} のみで、frontend が res.hcaptcha.siteKey 等を読むと undefined になっていた。
func (*Handler) CaptchaSave ¶
CaptchaSave handles POST /api/admin/captcha/save.
upstream paramDef は generic な {provider(required), captchaResult, sitekey, secret, instanceUrl}。選択 provider の captchaResult を検証し、pass した場合 のみ per-provider の sitekey/secret/instanceUrl を保存する (CaptchaService.save)。 旧実装は per-provider key (hcaptchaSiteKey 等) を期待しており frontend の保存 値が DB に書かれず、captchaResult の検証も無かった。
func (*Handler) CreateFromApplication ¶
func (h *Handler) CreateFromApplication(ctx context.Context, app *model.EmojiApplication) (emojiapplication.CreatedEmoji, error)
CreateFromApplication implements emojiapplication.EmojiCreator.
**EmojiAdd と同じ検証・同じ導出を通す。** 独自に emoji 行を組むと、MIME の allowlist や webpublic variant の優先が申請経路だけ抜け、承認が「検証を 迂回して絵文字を登録する方法」になる。共有しているのは isAllowedEmojiImageType / preferWebpublicURL / preferWebpublicType の 3 つで、 これは EmojiAdd がそのまま使っているものと同一。
func (*Handler) DatabaseHealth ¶
DatabaseHealth handles POST /api/admin/database-health.
**mk-go 独自 endpoint** (#3095)。使われていないインデックス、テーブルごとの dead tuple と VACUUM / ANALYZE の最終実行を返す。判断材料を出すだけで、 何も消さない。upstream に対応物は無い (`get-index-stats` は pg_indexes の 一覧を返すだけ)。
func (*Handler) DeleteAccount ¶
DeleteAccount handles POST /api/admin/delete-account. AccountsDelete と 機能的には同じだが、本家 Misskey が両 endpoint を持つので互換性のため 別 handler として保持する。
func (*Handler) DeleteAllFilesOfUser ¶
DeleteAllFilesOfUser handles POST /api/admin/delete-all-files-of-a-user.
upstream delete-all-files-of-a-user.ts は対象ユーザーの全 drive file を findBy({userId}) で回し driveService.deleteFile で物理ストレージごと削除する (dbQueue 'deleteDriveFiles' processor は upstream でも未使用の vestigial)。 storage backend が配線されていれば list→object storage 削除→DB 行削除を バッチで回し orphan を残さない。未配線時は DB 行のみ一括削除。
func (*Handler) DeleteCreatedEmoji ¶
func (h *Handler) DeleteCreatedEmoji(ctx context.Context, created emojiapplication.CreatedEmoji) error
DeleteCreatedEmoji implements emojiapplication.EmojiCreator.
承認が競合に負けたときだけ呼ばれる。**broadcast も出す** — 作成時に emojiAdded を流しているので、消したことも伝えないとピッカーに残る。
func (*Handler) DeleteMigratedAccount ¶
DeleteMigratedAccount deletes a local account that "elythia cherrypick convert" was told to delete (#4248), with the same effects as admin/delete-account. The root account and system accounts are refused.
管理画面からの削除と同じ流れを通す (DeletePluginManagedAccount と同じ理由)。 モデレーションログには残さない。操作したのは移行のコマンドを流した運営者で、 モデレーターのアカウントが無いので、slog に残す。
func (*Handler) DeletePluginManagedAccount ¶
DeletePluginManagedAccount deletes an account that a plugin manages (#3468), with the same effects as admin/delete-account: the account is flagged deleted, its tokens and streams are dropped, Delete(actor) is delivered, and the cascade deletion is queued.
**管理画面からの削除と同じ流れを通す。** プラグインの経路だけ別に書くと、 片方だけ直したときに「この経路で消したアカウントだけ連合に Delete が届かない」 類のずれが生まれる。
モデレーションログには残さない。操作したのはモデレーターではなく、 プラグイン (=運営者が組み込んだコード) なので、誰の判断として記録するかが 無い。代わりに slog に残す。
管理していないアカウントを渡されたら何もせずエラーを返す。呼び出し側 (core/pluginaccount) が所有を確かめてから呼ぶが、root や普通の利用者を この経路で消せないことを、ここでも保証する。
func (*Handler) DriveCleanRemoteFiles ¶
DriveCleanRemoteFiles handles POST /api/admin/drive/clean-remote-files.
upstream CleanRemoteFilesProcessorService はキャッシュ済みリモートファイル (userHost IS NOT NULL AND isLink=false) を物理オブジェクトごと削除する。 endpoint 自体は job を 1 本積んで即座に返し、実際のバッチ削除は objectStorage queue の worker が回す (#2325)。
queue 未配線時のみ、従来どおり handler 内で同期削除する。storage backend も 未配線なら DB 行のみ削除 (条件は修正済 = isLink=false)。
func (*Handler) DriveCleanup ¶
DriveCleanup handles POST /api/admin/drive/cleanup.
upstream の cleanup は orphan file (userId IS NULL) を 1 件ずつ driveService.deleteFile で消すので object storage の実体も削除される。 storage backend が配線されていれば list→object storage 削除→DB 行削除を バッチで回す。未配線時は DB 行のみ削除する。DriveCleanRemoteFiles と同じ 二系統構造 (#1724)。
**対象行の選び方は両経路で同じ。** どちらも DriveFileRepository の DeleteOrphans / ListOrphans が返す集合で、選択条件は同 interface の doc を 参照。
func (*Handler) DriveFiles ¶
DriveFiles handles POST /api/admin/drive/files.
func (*Handler) DriveShowFile ¶
DriveShowFile handles POST /api/admin/drive/show-file. Accepts either a fileId or a url as identifier (Misskey 本家互換)。 レスポンス shape は upstream admin/drive/show-file.ts の custom 28-field 形に揃え、`requestIp` / `requestHeaders` を含む (frontend admin-file の IP タブで参照、それ以外は PackDriveFile + admin only field の合成、#1148)。
func (*Handler) DriveStorageMigrationCleanupCopies ¶
DriveStorageMigrationCleanupCopies handles POST /api/admin/drive/object-storage-migration/cleanup-copies.
**Elythia 独自 endpoint** (#4197)。ローカルへ戻したファイル (#4183) がオブジェクト ストレージに残した写しを消すジョブを積んで、すぐに 204 を返す。消すのは戻したときに 記録した写しだけで、初めからオブジェクトストレージへアップロードしたファイルと、戻せ なかったファイルの実体には触れない。進み具合は status で読む。他の処理と同時には 走らない。
ローカルを消す口と違い、再認証は求めない。消すのはローカルへ戻した後の写しで、 実体はローカルにある。
func (*Handler) DriveStorageMigrationPurgeLocal ¶
DriveStorageMigrationPurgeLocal handles POST /api/admin/drive/object-storage-migration/purge-local.
**Elythia 独自 endpoint** (#4182)。確かめたファイルについて、消す直前にもう一度 確かめてから、ローカルの実体を消すジョブを積んで、すぐに 204 を返す。進み具合は status で読む。移す処理・確かめる処理と同時には走らない。
取り消せない操作なので、DB のバックアップ (admin/backup/*) と同じ再認証を課す (#4184)。再認証は route の middleware でなく、ここ (引数の検証の後) で行う。 前に置くと、形の誤った本文でも TOTP のコードを使い切ってから 400 になる (#3878)。
func (*Handler) DriveStorageMigrationRestore ¶
DriveStorageMigrationRestore handles POST /api/admin/drive/object-storage-migration/restore.
**Elythia 独自 endpoint** (#4183)。移す処理で移したファイルを、オブジェクト ストレージからローカルへ戻すジョブを積んで、すぐに 204 を返す。初めから オブジェクトストレージへアップロードしたファイルは戻さない。進み具合は status で 読む。他の処理と同時には走らない。
func (*Handler) DriveStorageMigrationStart ¶
DriveStorageMigrationStart handles POST /api/admin/drive/object-storage-migration/start.
**Elythia 独自 endpoint** (#4180)。ローカルに置いたファイルを、オブジェクト ストレージへ写すジョブを積んで、すぐに 204 を返す。進み具合は status で読む。
func (*Handler) DriveStorageMigrationStatus ¶
DriveStorageMigrationStatus handles POST /api/admin/drive/object-storage-migration/status (#4180).
func (*Handler) DriveStorageMigrationVerify ¶
DriveStorageMigrationVerify handles POST /api/admin/drive/object-storage-migration/verify.
**Elythia 独自 endpoint** (#4181)。オブジェクトストレージへ写したファイルを読み、 大きさと md5 が記録と一致するかを確かめるジョブを積んで、すぐに 204 を返す。 結果は status で読む。移す処理と同時には走らない。
func (*Handler) DriveUsage ¶
DriveUsage handles POST /api/admin/drive/usage.
**mk-go 独自 endpoint** (#3053)。upstream はインスタンス全体のストレージ 使用量を出す口を持たない (per-user の `driveCapacityMb` だけ)。
集計は都度走らせて短い TTL のスナップショットを使い回す。**未配線なら 500 を 返す** — 0 バイトを返すと「使っていない」という誤った事実を管理画面に出す ことになるため。
func (*Handler) EmojiAdd ¶
EmojiAdd handles POST /api/admin/emoji/add.
upstream Misskey TS と同じく `fileId` を必須とし、drive_file から URL を resolve して保存する。以前は `fileId` 無しで `url` だけを保存する独自の経路 (#867) もあったが、同梱の frontend は使っておらず、本家の paramDef が拒否する 入力なので #3865 で消した。
画像は**system 所有の drive ファイルへ複製してから**参照する (#2999)。 upstream は操作者のファイルをそのまま指すので意図的な乖離 (docs/divergence/security.md §7)。
func (*Handler) EmojiAddAliasesBulk ¶
EmojiAddAliasesBulk handles POST /api/admin/emoji/add-aliases-bulk.
旧実装は id ごとに FindByID→UpdateFields を直列に呼んでいたが、件数が多いと DB 往復が線形に増える。FindManyByIDs で一括取得 → 個別に alias を merge → UpdateFields で書き戻す (alias はレコード毎に異なるため UpdateFieldsMany では一括化できない)。
func (*Handler) EmojiApplicationApprove ¶
EmojiApplicationApprove handles POST /api/admin/emoji-application/approve.
func (*Handler) EmojiApplicationList ¶
EmojiApplicationList handles POST /api/admin/emoji-application/list.
func (*Handler) EmojiApplicationListByUser ¶
EmojiApplicationListByUser handles POST /api/admin/emoji-application/list-by-user.
ユーザーモデレーション画面の申請履歴 (#2961)。**一般ユーザー向けには公開 しない** — 却下理由とモデレーターへの補足が載る。
func (*Handler) EmojiApplicationReject ¶
EmojiApplicationReject handles POST /api/admin/emoji-application/reject.
func (*Handler) EmojiApplicationRelated ¶
EmojiApplicationRelated handles POST /api/admin/emoji-application/related (#2960).
**一覧には埋め込まない。** 全行ぶん履歴を引くと N+1 になるので、申請の詳細を 開いたときだけ呼ぶ。
**過去に却下されていたことを理由に自動拒否はしない。** ライセンスの変更・ 画像の修正・運用方針の変更がありうるので、これは審査を補助する情報。
func (*Handler) EmojiApplicationResetUserQuota ¶
EmojiApplicationResetUserQuota handles POST /api/admin/emoji-application/reset-user-quota (#2962).
**申請の行は触らない。** 履歴を消して枠を空けると、過去の判断 (#2960 が 審査の材料として出している却下理由や同じ画像かどうか) も同時に消える。
func (*Handler) EmojiApplicationUserSummary ¶
EmojiApplicationUserSummary handles POST /api/admin/emoji-application/user-summary.
件数の内訳と、期間上限の使用状況 (#2961)。
func (*Handler) EmojiCopy ¶
EmojiCopy handles POST /api/admin/emoji/copy.
Misskey TS 本家 (admin/emoji/copy.ts) は元の name のまま local emoji を 追加し、同名の local emoji が既に存在する場合のみ DUPLICATE_NAME を 返す。以前の mk-go 実装は `_copy` suffix を勝手に付与していたが、 これは TS 仕様違反 (#650 問題 1) なのでサフィックスを除去した。
画像については upstream の driveService.uploadFromUrl 相当に対応するため、 emojiImageFetcher が wire 済みなら src.OriginalURL を local drive に 保存し、新 emoji の OriginalURL/PublicURL を drive 経由の URL に差し替える (#670)。fetcher 未配線時は src の URL をそのまま継承する legacy 挙動を 維持する (テスト容易性 + 未配線環境での graceful degradation 用)。
ref: 本家の packages/backend/src/server/api/endpoints/admin/emoji/copy.ts
func (*Handler) EmojiDelete ¶
EmojiDelete handles POST /api/admin/emoji/delete.
func (*Handler) EmojiDeleteBulk ¶
EmojiDeleteBulk handles POST /api/admin/emoji/delete-bulk.
Misskey TS の CustomEmojiService.deleteBulk() は削除対象を for ループで 一件ずつ処理し、絵文字ごとに deleteCustomEmoji moderation log を書く。 互換性のため mk-go も削除前の snapshot を取得して per-emoji log を出力 する。bulk 削除自体は 1 SQL (DeleteMany) で完結。
func (*Handler) EmojiFetchRemoteMeta ¶
EmojiFetchRemoteMeta handles POST /api/admin/emoji/fetch-remote-meta.
**mk-go 独自 endpoint** (#2698)。リモート絵文字をインポートするとき、AP では 運ばれないカテゴリ・エイリアス・センシティブを相手の REST API から取ってくる。 本番の実測では、リモート絵文字 19,129 件のうちそれらは **1 件も** 連合で 入っていない。
**作成はしない。** ここは取得だけで、確認・編集を経てから `admin/emoji/copy` が 作る。作成まで一気にやると「値を埋めた状態で確認してから取り込む」ができない。
**失敗を 5xx にしない。** 相手が落ちている / per-name endpoint を持たない、は どちらも正常な結果なので、`fetched: false` を返して手入力に倒す。
func (*Handler) EmojiImportZip ¶
EmojiImportZip handles POST /api/admin/emoji/import-zip.
fileId で Drive にアップロード済みの ZIP を指定し、非同期ジョブで展開して ローカルカスタム絵文字として登録する。本家 Misskey 互換 (QueueService.createImportCustomEmojisJob 相当)。
func (*Handler) EmojiListRemote ¶
EmojiListRemote handles POST /api/admin/emoji/list-remote.
func (*Handler) EmojiListV2 ¶
EmojiListV2 handles POST /api/v2/admin/emoji/list. Returns an object with pagination info (allCount, allPages) instead of a plain array.
func (*Handler) EmojiRemoveAliasesBulk ¶
EmojiRemoveAliasesBulk handles POST /api/admin/emoji/remove-aliases-bulk.
func (*Handler) EmojiSetAliasesBulk ¶
EmojiSetAliasesBulk handles POST /api/admin/emoji/set-aliases-bulk.
全 id で同じ aliases 値を設定するため UpdateFieldsMany (WHERE IN UPDATE) で 1 文に集約できる。
func (*Handler) EmojiSetCategoryBulk ¶
EmojiSetCategoryBulk handles POST /api/admin/emoji/set-category-bulk.
func (*Handler) EmojiSetLicenseBulk ¶
EmojiSetLicenseBulk handles POST /api/admin/emoji/set-license-bulk.
func (*Handler) EmojiUpdate ¶
EmojiUpdate handles POST /api/admin/emoji/update.
Misskey TS の admin/emoji/update は name/category/aliases に加え license/ isSensitive/localOnly も受け付ける。フロントの編集ダイアログがこれら全部 送信するため Request struct を Misskey 互換に拡張する (#650 問題 2)。
`fileId` 経路は**画像を system 所有の drive ファイルへ複製してから**参照する (#3014)。upstream は渡された drive ファイルの URL をそのまま入れるので、意図的な 乖離 (docs/divergence/security.md §7)。`admin/emoji/add` の #2999 と同じ形。
Aliases は []string なので nil (省略) と [] (空配列) が型で区別できない。 Misskey TS 側も optional `?` で undefined と空配列を区別しないため、 nil != 空配列でない場合に "aliases を全削除" として扱う。実装上は `req.Aliases != nil` で「フロントが aliases フィールドを明示送信した」 と判定しており、空配列送信なら全削除、フィールド欠落なら現状維持。
func (*Handler) FederationCheckHost ¶
FederationCheckHost handles POST /api/admin/federation/check-host.
**mk-go 独自 endpoint** (#3055)。upstream に対応物は無い。管理者が指定した ホストとの疎通を 1 回だけ能動的に検査する。
**自ホストは断る。** 自ホストの検査 (admin/self-check) は、自分が loopback / private IP に解決されうるため SSRF ガードを通さない client を使い、宛先を config に固定することを安全性の前提にしている。こちらは宛先を外から受け取る ので、あちらの経路へ分岐させない (入力によってガードの無い経路に入る口になる)。
func (*Handler) FederationCleanGoneInstance ¶
FederationCleanGoneInstance handles POST /api/admin/federation/clean-gone-instance.
**mk-go 独自 endpoint** (#3067)。goneSuspended のホストとローカルの利用者の間の フォロー関係 (両方向) とフォローリクエストを消す。**取り返しがつかない**ので 自動では実行せず、管理者がこの口から明示的に実行する。
upstream の `admin/federation/remove-all-following` と違い、**ローカルの利用者の フォローも消す**。相手はもう存在しないので、残しておいても意味の無い行になる。
func (*Handler) FederationCloseDeliveryBreaker ¶
FederationCloseDeliveryBreaker handles POST /api/admin/federation/close-delivery-breaker.
**mk-go 独自 endpoint** (#3048)。ブレーカーを閉じ、429 の停止と予約も消して、 遅延させていたジョブを次に起きたとき (最大 5 分後。試す間隔が 1 時間に達した 相手は次に試す時刻で、最大 66 分後、#4222) に送らせる。**429 の予約も 消す** — 予約の列は溜まった件数 x 間隔まで伸びるので、残すと手で解けない。 相手がまだ 429 を返せば、また止まり直すだけ。
func (*Handler) FederationDeleteAllFiles ¶
FederationDeleteAllFiles handles POST /api/admin/federation/delete-all-files.
upstream delete-all-files.ts は host の各 file に driveService.deleteFile を 呼び、物理ストレージ (S3 / internal) 削除 + drive 使用量減算 + row 削除を行う。 mk-go も driveBulkDeleter (= core/drive.Service.DeleteAllByHost) 経由で同等の 物理削除を行う (#1772。以前は row のみ削除で S3 オブジェクトが orphan 化 + 使用量カウンタが未減算だった)。driveBulkDeleter 未配線時は row のみ削除に degrade。host 空 / repo 未配線は no-op 204。
func (*Handler) FederationDeliveryHealth ¶
FederationDeliveryHealth handles POST /api/admin/federation/delivery-health.
**mk-go 独自 endpoint** (#2461)。upstream は配送結果を `instance.isNotResponding` の真偽値にしか残さないため、対応物が無い。
観測値に加えて、配送を止めているホスト (ブレーカー / 429 の間隔、#3048) を `breakers` に出す。「開いたまま戻らない」が最悪の失敗形なので、見えて、 手で閉じられる (close-delivery-breaker) ようにする。
func (*Handler) FederationGoneInstances ¶
FederationGoneInstances handles POST /api/admin/federation/gone-instances.
**mk-go 独自 endpoint** (#3067)。goneSuspended のホストと、そのホストとの間に 残っているフォロー関係の件数を返す。upstream に対応物は無い。
func (*Handler) FederationInboxHealth ¶
FederationInboxHealth handles POST /api/admin/federation/inbox-health.
**mk-go 独自 endpoint** (#2471)。送信側 (delivery-health) の対。upstream は 受信結果を一切残さないため対応物が無い。
inbox processor は活動を捨てる分岐を 5 つ持ち、うち「ブロック済みホスト」は ログすら出さない。ここが唯一の観測点になる。
func (*Handler) FederationRefreshRemoteInstanceMetadata ¶
FederationRefreshRemoteInstanceMetadata handles POST /api/admin/federation/refresh-remote-instance-metadata. InstanceMetadataFetcher (= coreinstance.FetchMetadataService) 経由で指定ホストの nodeinfo + iconUrl / faviconUrl を再取得する。fetcher 未設定または host 未指定 の場合は no-op で 204 を返す (本家 TS も失敗時エラーコードは返さない挙動)。
func (*Handler) FederationRemoveAllFollowing ¶
func (*Handler) FederationRuleCreate ¶
FederationRuleCreate handles POST /api/admin/federation/rules/create.
**mk-go 独自 endpoint** (#3090)。
func (*Handler) FederationRuleDelete ¶
FederationRuleDelete handles POST /api/admin/federation/rules/delete.
**mk-go 独自 endpoint** (#3090)。
func (*Handler) FederationRuleHits ¶
FederationRuleHits handles POST /api/admin/federation/rules/hits.
**mk-go 独自 endpoint** (#3090)。ルールに当たった直近の投稿 / activity を 新しい順に返す。record のルールで誤爆していないかを確かめるためのもの。
func (*Handler) FederationRuleUpdate ¶
FederationRuleUpdate handles POST /api/admin/federation/rules/update.
**mk-go 独自 endpoint** (#3090)。ルール全体を置き換える (部分更新はしない)。 条件を変えると、それまでに当たった記録は捨てる。
func (*Handler) FederationRules ¶
FederationRules handles POST /api/admin/federation/rules/list.
**mk-go 独自 endpoint** (#3090)。連合のルールを評価順に、直近 24 時間に 当たった件数を付けて返す。upstream に対応物は無い。
func (*Handler) FederationUpdateInstance ¶
FederationUpdateInstance handles POST /api/admin/federation/update-instance.
Misskey TS 互換 (admin/federation/update-instance.ts) で `isSuspended` 変更時に `suspendRemoteInstance` / `unsuspendRemoteInstance`、`moderationNote` 変更時に `updateRemoteInstanceNote` の moderation_log を **個別に** 出力する。1 リクエ ストで両方変更されれば 2 ログ。`isBlocked` / `isSilenced` は TS 仕様に該当 type が無いので skip。
instance 行の lookup / 更新は `InstanceRepository` (#676 で DI 化) を経由する。 未配線時は no-op で 204 を返す (元の挙動と一貫)。
func (*Handler) ForwardAbuseUserReport ¶
ForwardAbuseUserReport handles POST /api/admin/forward-abuse-user-report.
It delivers an ActivityPub Flag signed by the system actor to the inbox of the target user's origin instance and sets forwarded=true. Reports against a local user, or reports that have already been forwarded, are rejected with 400 INVALID_PARAM (upstream answers 500; see docs/divergence.md).
func (*Handler) GetIndexStats ¶
GetIndexStats handles POST /api/admin/get-index-stats.
Returns per-index row counts from pg_stat_user_indexes so the admin UI can spot hot or unused indexes.
func (*Handler) GetTableStats ¶
GetTableStats handles POST /api/admin/get-table-stats.
Returns per-table size and row estimate via pg_stat_user_tables joined with pg_relation_size for quick capacity planning.
func (*Handler) GetUserIPs ¶
GetUserIPs handles POST /api/admin/get-user-ips.
func (*Handler) IPAccounts ¶
IPAccounts handles POST /api/admin/ip/accounts.
**mk-go 独自 endpoint** (#3104、親 #3066)。指定した IP を使用したローカル アカウントを返す。upstream は逆向き (`admin/get-user-ips`、利用者 → IP) しか持たない。
**同じ IP を使ったことは同一人物であることを意味しない。** 家庭・会社・学校・ 共有 Wi-Fi・携帯回線の CGNAT・VPN で IP は共有される。返すのは調査の候補と その根拠で、自動判定や自動処分には使わない (#3066)。
func (*Handler) IPLookupLog ¶
IPLookupLog handles POST /api/admin/ip/lookup-log.
**mk-go 独自 endpoint** (#3106、親 #3066)。誰がいつどの IP / 利用者を照会したかを 返す。upstream に対応物は無い (照会の機能そのものが無い)。
**この応答自体が機密。** 照会に使った IP がそのまま入るので、照会と同じ 3 段の 権限で守り、`Cache-Control: no-store` を付ける。
func (*Handler) IPRelatedAccounts ¶
IPRelatedAccounts handles POST /api/admin/ip/related-accounts.
**mk-go 独自 endpoint** (#3105、親 #3066)。対象ユーザーが期間内に使った IP を 起点に、同じ IP を使った**他の**ローカルアカウントを関連候補として返す。 upstream にはこの向きの機能が無い。
**同じ IP を使ったことは同一人物であることを意味しない。** 家庭・会社・学校・ 共有 Wi-Fi・携帯回線の CGNAT・VPN で IP は共有される。返すのは調査の候補と **その根拠**で、自動判定や自動処分には使わない (#3066)。
func (*Handler) InviteCreate ¶
InviteCreate handles POST /api/admin/invite/create.
func (*Handler) InviteList ¶
InviteList handles POST /api/admin/invite/list.
func (*Handler) PromoCreate ¶
PromoCreate handles POST /api/admin/promo/create.
func (*Handler) QueueClear ¶
QueueClear handles POST /api/admin/queue/clear.
func (*Handler) QueueDeliverDelayed ¶
QueueDeliverDelayed handles POST /api/admin/queue/deliver-delayed.
Response shape: `[[host, count], ...]` の tuple 配列 (count desc で sort)。 host は recipient inbox URL (`DeliverPayload.Inbox`) から抽出する。 upstream Misskey TS spec (`admin/queue/deliver-delayed.ts`) と互換。
admin/control panel の "Errored Instances" panel は b[1] で count に アクセスするので、object 配列 (旧 mk-go shape) では NaN 表示になる (#1179)。
func (*Handler) QueueInboxDelayed ¶
QueueInboxDelayed handles POST /api/admin/queue/inbox-delayed.
Response shape: `[[host, count], ...]` の tuple 配列 (count desc で sort)。 host は HTTP Signature header の `keyId` (絶対 URL) から抽出する。 upstream Misskey TS は `new URL(job.data.signature.keyId).host` と 同等の処理。mk-go の `InboxPayload.Host` は enqueue 時に未設定なので signature header 経由でしか引けない (#1179)。
func (*Handler) QueueJobs ¶
QueueJobs handles POST /api/admin/queue/jobs.
frontend admin/job-queue.vue は state を Bull の state 名配列で送る (`['completed', 'failed', 'active', 'delayed', 'wait']` など)。 mk-go は Bull state 名を driver の list 呼び出しにマッピングする。 合計 limit を超えないよう走査中に切り詰める。
func (*Handler) QueuePause ¶
QueuePause handles POST /api/admin/queue/pause (upstream #17436)。
func (*Handler) QueuePromoteJobs ¶
QueuePromoteJobs handles POST /api/admin/queue/promote-jobs.
func (*Handler) QueueQueueStats ¶
QueueQueueStats handles POST /api/admin/queue/queue-stats. frontend admin/job-queue.vue の `fetchCurrentQueue` は単一 queue 名を 受けて 1 queue の shape を返す設計になっているので、req.Queue が来たら その queue だけ、来なければ全 queue を返すという両対応にする。
frontend は Misskey Bull の queue 名を hardcode (`Misskey.queueTypes`) で 列挙しており、mk-go の queue 名 (deliver/push/maintenance/webhook/ export) と完全には一致しない。存在しない queue を叩かれたときは 500 で はなくゼロ埋めの shape を返して、フロント側の queueInfo が stale に ならないようにする。
func (*Handler) QueueQueues ¶
QueueQueues handles POST /api/admin/queue/queues.
func (*Handler) QueueRemoveJob ¶
QueueRemoveJob handles POST /api/admin/queue/remove-job.
func (*Handler) QueueResume ¶
QueueResume handles POST /api/admin/queue/resume (upstream #17436)。
func (*Handler) QueueRetryJob ¶
QueueRetryJob handles POST /api/admin/queue/retry-job.
func (*Handler) QueueShowJob ¶
QueueShowJob handles POST /api/admin/queue/show-job.
func (*Handler) QueueShowJobLogs ¶
QueueShowJobLogs handles POST /api/admin/queue/show-job-logs.
upstream は `queue.getJobLogs(jobId).logs` をそのまま返す。mk-go 自身は 現状 log を書かないが、**drop-in で TS が書いた job** や、将来 processor が Job.Log を使った場合にそのまま読める (#2689)。持たない driver は空を 返す。存在しない job と log 0 件の job は BullMQ 同様に区別しない。
func (*Handler) QueueStats ¶
QueueStats handles POST /api/admin/queue/stats.
upstream res は {deliver, inbox, db, objectStorage} の 4 キーで、各値は QueueCount = {waiting, active, completed, failed, delayed} (全 required)。 mk-go は db / objectStorage を独立 queue として運用しないため、その 2 つは ゼロ埋め QueueCount を返して shape parity を満たす。deliver / inbox は実値。
func (*Handler) RelaysAdd ¶
RelaysAdd handles POST /api/admin/relays/add. Routes through the relay Service so that a Follow activity is actually dispatched to the relay's inbox (#161). Falls back to raw DB insertion when the service is not wired (tests or early boot).
func (*Handler) RelaysList ¶
RelaysList handles POST /api/admin/relays/list.
func (*Handler) RelaysRemove ¶
RelaysRemove handles POST /api/admin/relays/remove. It looks the relay up by inbox, like upstream. When the relay service is configured, it sends an Undo(Follow) to the relay inbox before deleting the row.
以前は Elythia 独自の id でも引いた (inbox より優先) が、本家の paramDef は inbox を必須にしていて (#3861 から拒否に使う)、id だけの入力は既に 400 だった。 同梱の frontend も inbox だけを送るので、#3867 で消した。
func (*Handler) ResetPassword ¶
ResetPassword handles POST /api/admin/reset-password.
upstream reset-password.ts は常に secureRndstr(8) で 8 文字の英数字パスワードを 生成し、その場で対象ユーザーの password を更新して {"password": "..."} を返す (res schema は minLength/maxLength=8)。標準管理 UI (admin-user.vue) は返却を `const {password} = ...` で分割代入して表示するため、mk-go もこれに揃える (#1825)。
旧 #186 の verified-email 経路 ({"sent": true} を返し reset link を送る) は標準 UI で password が undefined になり drop-in を壊すため撤去した。ユーザー自身が行う パスワードリセット (/request-reset-password → /reset-password) は別経路で存続する。
func (*Handler) ResolveAbuseReport ¶
ResolveAbuseReport handles POST /api/admin/resolve-abuse-user-report.
upstream paramDef:
reportId: string (required) resolvedAs: enum ['accept', 'reject', null], nullable
旧 mk-go は `resolvedAs` を `"accept"` 固定にしていたため、admin が reject (= 「報告は不適切」判定) を選んでも accept として記録され、 abuse handling の判定結果が反映されない drop-in regression があった (PR #1108 sweep)。本 fix で upstream paramDef 通り `resolvedAs` を accept し enum 検証する。
func (*Handler) RolesAssign ¶
RolesAssign handles POST /api/admin/roles/assign.
func (*Handler) RolesAssignmentShow ¶
RolesAssignmentShow handles POST /api/admin/roles/assignment-show.
**見るのは role_assignment 行だけで、conditional role の condFormula は評価しない** (#2633)。conditional role は行を持たないので、条件を満たしている user にも assigned=false を返す。既存の admin/roles/users も ListByRole で同じテーブルを 引くので挙動は揃っている。呼び出し側が判別できるよう role.target を返す。 effective 判定へ差し替えないこと (理由は roles.AssignmentShow の doc comment)。
func (*Handler) RolesCreate ¶
RolesCreate handles POST /api/admin/roles/create.
upstream Misskey TS の paramDef は 14 field を required (一部 nullable) で 受け取る (name / description / color / iconUrl / target / condFormula / isPublic / isModerator / isAdministrator / isExplorable / asBadge / canEditMembersByModerator / displayOrder / policies)。mk-go も drop-in 互換のため同 field を accept する (#889)。
model.Role の全 column を実際に persist する (PR #1102 で配線完了)。 旧版は policies / condFormula / color / iconUrl / target / canEdit MembersByModerator を request で受け取りつつ /dev/null に流していた ため、admin UI から policy / 色 / アイコン等を設定しても DB に書かれず 「ロール設定が反映されない」現象になっていた。
func (*Handler) RolesDelete ¶
RolesDelete handles POST /api/admin/roles/delete.
func (*Handler) RolesUnassign ¶
RolesUnassign handles POST /api/admin/roles/unassign.
func (*Handler) RolesUpdate ¶
RolesUpdate handles POST /api/admin/roles/update.
upstream Misskey TS の paramDef は 15 field を accept (roleId 以外はすべて optional partial update)。旧 mk-go は 5 field しか accept しておらず、 admin UI で **policies / color / iconUrl / target / condFormula / asBadge / isExplorable / displayOrder / canEditMembersByModerator / preserveAssignment OnMoveAccount** を変えても DB に書かれず「ロール設定が反映されない」現象 になっていた (PR #1102)。特に policies field の欠落は「canPublicNote 等の ポリシーが UI 上で trueに見えても実際は default 値のまま」という drop-in regression 重大度高めの bug。本 fix で upstream 15 field 全部を pipe する。
func (*Handler) RolesUpdateDefaultPolicies ¶
RolesUpdateDefaultPolicies handles POST /api/admin/roles/update-default-policies.
func (*Handler) RolesUsers ¶
RolesUsers handles POST /api/admin/roles/users.
func (*Handler) SelfCheck ¶
SelfCheck handles POST /api/admin/self-check.
**mk-go 独自 endpoint** (#2463)。upstream に対応物は無い。
検査の宛先は config の `url` に固定されており、**リクエストから指定できない**。 自ホストは loopback / private IP に解決されうるため検査用の client は SSRF ガードを通さないので、宛先を外から与えられる口を作らないことが安全性の前提。
func (*Handler) SendEmail ¶
SendEmail handles POST /api/admin/send-email.
内部で smtp.SubjectBodySenderFromMeta を経由することで、router.go の他 3 経路 (signup / reset / i/update-email) と SMTP 設定読み出しロジック (= per-call 再 Fetch + smtpSecure 反映 + 未設定時 no-op) を共有する。 goroutine 内で送信して呼び出し元に 204 を即返すのは admin UI 既存挙動。
func (*Handler) ServerInfo ¶
ServerInfo handles POST /api/admin/server-info.
upstream admin/server-info.ts は enableServerMachineStats gate を持たず、 moderator には常に live な machine 情報を返す (gate は公開 server-info.ts 側 のみ)。psql / redis のバージョンは system info に含まれないため DB / Redis から best-effort で埋める (upstream は SHOW server_version / redis INFO を引く)。
func (*Handler) ServerMetrics ¶
ServerMetrics handles POST /api/admin/server-metrics.
mk-go プロセス自身の状態 (稼働時間 uptimeMs / 版 version / Go ランタイムの 統計 go) を返す mk-go 独自エンドポイント。upstream には無い。DB や Redis の 接続プールの統計は返していない (procstats.Stats を参照)。
admin/server-info の additive 拡張にしなかったのは、あちらが upstream にも同名で 存在し misskey-js の型に載っているため。本家互換のレスポンスと mk-go 固有の運用 情報を同じ器に入れると、後からどちらの都合で触ってよいか分からなくなる。別 endpoint なら shape drift の対象にもならない。
Prometheus /metrics を admin から読ませる案は採っていない。無認証公開のまま ブラウザへ晒すことになるうえ、production では reverse proxy の ACL で塞がって いて到達できない。
func (*Handler) ServerPlugins ¶
ServerPlugins handles POST /api/admin/server-plugins.
func (*Handler) SetAbuseForwarder ¶
func (h *Handler) SetAbuseForwarder(f AbuseForwarder)
SetAbuseForwarder wires a forwarder for admin/forward-abuse-user-report. When nil the handler falls back to just flipping the DB forwarded flag (pre-P4-5 behaviour).
func (*Handler) SetAbuseRepo ¶
func (h *Handler) SetAbuseRepo(r repository.AbuseReportRepository)
SetAbuseRepo attaches the abuse report repository.
func (*Handler) SetAdRepo ¶
func (h *Handler) SetAdRepo(r repository.AdRepository)
SetAdRepo attaches an AdRepository for admin/ad/*.
func (*Handler) SetAdminDB ¶
SetAdminDB attaches a DB connection for ad/invite/relay operations.
func (*Handler) SetAvatarDecorationInvalidator ¶
func (h *Handler) SetAvatarDecorationInvalidator(inv AvatarDecorationCacheInvalidator)
SetAvatarDecorationInvalidator wires the catalog cache invalidator so that admin-side catalog mutations are visible to user packing immediately instead of after the resolver TTL (#2258).
func (*Handler) SetAvatarDecorationRepo ¶
func (h *Handler) SetAvatarDecorationRepo(r repository.AvatarDecorationRepository)
SetAvatarDecorationRepo attaches an AvatarDecorationRepository for admin/avatar-decorations/*.
func (*Handler) SetBroadcastPublisher ¶
func (h *Handler) SetBroadcastPublisher(p BroadcastPublisher)
SetBroadcastPublisher wires the broadcast stream publisher used to emit emojiAdded / emojiUpdated / emojiDeleted (#2046)。nil disables emission.
func (*Handler) SetCaptchaVerifierFactory ¶
func (h *Handler) SetCaptchaVerifierFactory(f CaptchaVerifierFactory)
SetCaptchaVerifierFactory overrides the captcha verifier construction used by admin/captcha/save (tests inject a stub to avoid external HTTP).
func (*Handler) SetConfigSetupPassword ¶
SetConfigSetupPassword sets the initial setup password from config. TS互換: 初回セットアップ時にクライアントが送るsetupPasswordとconfig値を照合する。
func (*Handler) SetDatabaseHealth ¶
func (h *Handler) SetDatabaseHealth(r DatabaseHealthReader)
SetDatabaseHealth wires the database health reader.
func (*Handler) SetDeleteAccountEnqueuer ¶
func (h *Handler) SetDeleteAccountEnqueuer(e DeleteAccountEnqueuer)
SetDeleteAccountEnqueuer wires the enqueuer that schedules cascade deletion of related rows for admin/accounts/delete and admin/delete-account. When nil the handlers still flip the soft-delete flags but no background cleanup runs — useful in tests.
func (*Handler) SetDeliveryBreaker ¶
func (h *Handler) SetDeliveryBreaker(b DeliveryBreakerAdmin)
SetDeliveryBreaker wires the delivery breaker (#3048)。
func (*Handler) SetDeliveryHealthProvider ¶
func (h *Handler) SetDeliveryHealthProvider(p DeliveryHealthProvider)
SetDeliveryHealthProvider wires the delivery health source (#2461)。
func (*Handler) SetDriveBulkDeleter ¶
func (h *Handler) SetDriveBulkDeleter(d DriveBulkDeleter)
SetDriveBulkDeleter wires the physical drive purge used by federation/delete-all-files (#1772).
func (*Handler) SetDriveFileRepo ¶
func (h *Handler) SetDriveFileRepo(r repository.DriveFileRepository)
SetDriveFileRepo attaches a DriveFileRepository for admin drive operations.
func (*Handler) SetDriveStorageMigrationVerifier ¶
func (h *Handler) SetDriveStorageMigrationVerifier(v *strongauth.Verifier)
SetDriveStorageMigrationVerifier wires the strong authentication that admin/drive/object-storage-migration/purge-local requires (#4184). It is the verifier of admin/backup/*.
func (*Handler) SetDriveStorageMigrator ¶
func (h *Handler) SetDriveStorageMigrator(m DriveStorageMigrator)
SetDriveStorageMigrator wires the local-to-object-storage migration (#4180).
func (*Handler) SetDriveUsageProvider ¶
func (h *Handler) SetDriveUsageProvider(p DriveUsageProvider)
SetDriveUsageProvider wires the drive usage aggregator (#3053)。
func (*Handler) SetEmojiApplicationRepo ¶
func (h *Handler) SetEmojiApplicationRepo(r repository.EmojiApplicationRepository)
SetEmojiApplicationRepo wires the read half of #2934.
func (*Handler) SetEmojiApplicationReviewer ¶
func (h *Handler) SetEmojiApplicationReviewer(r emojiApplicationReviewer)
SetEmojiApplicationReviewer wires the review half of #2934.
func (*Handler) SetEmojiDecorationInvalidator ¶
func (h *Handler) SetEmojiDecorationInvalidator(inv AvatarDecorationCacheInvalidator)
SetEmojiDecorationInvalidator wires the cache used to resolve emoji-backed avatar decorations (#2975). 絵文字を作った直後にそれを装着すると、キャッシュが 古い間は**保存されているのに API が `avatarDecorations: []` を返す** — #2258 が catalog 側で踏んだのと同じ形なので、同じように mutation で捨てる。
func (*Handler) SetEmojiImportEnqueuer ¶
func (h *Handler) SetEmojiImportEnqueuer(e EmojiImportEnqueuer)
SetEmojiImportEnqueuer attaches an EmojiImportEnqueuer for the admin/emoji/ import-zip endpoint.
func (*Handler) SetEmojiRepo ¶
func (h *Handler) SetEmojiRepo(r repository.EmojiRepository)
SetEmojiRepo attaches the emoji repository.
func (*Handler) SetFederationRuleManager ¶
func (h *Handler) SetFederationRuleManager(m FederationRuleManager)
SetFederationRuleManager wires the federation rules.
func (*Handler) SetFollowRequestRepo ¶
func (h *Handler) SetFollowRequestRepo(r repository.FollowRequestRepository)
SetFollowRequestRepo wires the follow-request repository so SuspendUser can delete the target's pending follow requests (both directions, #1759).
func (*Handler) SetFollowingRepo ¶
func (h *Handler) SetFollowingRepo(r repository.FollowingRepository)
SetFollowingRepo attaches a FollowingRepository for admin endpoints that need to enumerate Following rows by host (e.g. admin/federation/remove-all-following).
func (*Handler) SetGoneInstanceCleaner ¶
func (h *Handler) SetGoneInstanceCleaner(c GoneInstanceCleaner)
SetGoneInstanceCleaner wires the gone-instance cleanup.
func (*Handler) SetIPLookupLogRepo ¶
func (h *Handler) SetIPLookupLogRepo(r repository.IPLookupLogRepository)
SetIPLookupLogRepo wires the audit trail read path (#3106).
func (*Handler) SetIPSearchRepo ¶
func (h *Handler) SetIPSearchRepo(r repository.UserIPSearchRepository)
SetIPSearchRepo wires the IP → accounts lookup (#3104)。
func (*Handler) SetInboxHealthProvider ¶
func (h *Handler) SetInboxHealthProvider(p DeliveryHealthProvider)
SetInboxHealthProvider wires the inbox health source (#2471)。
func (*Handler) SetInstanceMetadataFetcher ¶
func (h *Handler) SetInstanceMetadataFetcher(f InstanceMetadataFetcher)
SetInstanceMetadataFetcher attaches the fetcher used by admin/federation/refresh-remote-instance-metadata to re-fetch nodeinfo + icon for a specific host on demand.
func (*Handler) SetInstanceRepo ¶
func (h *Handler) SetInstanceRepo(r repository.InstanceRepository)
SetInstanceRepo wires an InstanceRepository for admin/federation handlers to use when reading/updating instance rows. Without it, FederationUpdateInstance early-returns 204 (#676)。
func (*Handler) SetInstanceSuspendCacheInvalidator ¶
func (h *Handler) SetInstanceSuspendCacheInvalidator(inv InstanceSuspendCacheInvalidator)
SetInstanceSuspendCacheInvalidator wires the instance Service so admin/federation/update-instance flushes the deliver suspend cache for the affected host immediately. production では wire 推奨 (未配線時は最大 5min stale window が残るが、issue #1407 が許容する範囲)。
func (*Handler) SetInviteRepo ¶
func (h *Handler) SetInviteRepo(r repository.RegistrationTicketRepository)
SetInviteRepo attaches a RegistrationTicketRepository for admin/invite/*.
func (*Handler) SetLocalStorageDeleter ¶
func (h *Handler) SetLocalStorageDeleter(s StorageDeleter)
SetLocalStorageDeleter wires the always-local backend used to delete rows whose `storedInternal` is true while object storage is the active backend (#2315). Optional — nil falls back to the primary deleter.
func (*Handler) SetMetaResponseInvalidator ¶
func (h *Handler) SetMetaResponseInvalidator(inv MetaResponseCacheInvalidator)
SetMetaResponseInvalidator wires the /api/meta response cache invalidator so ad mutations are reflected immediately in the worker that handled them.
func (*Handler) SetModLogService ¶
func (h *Handler) SetModLogService(s *moderationlog.Service)
SetModLogService attaches the moderation log service. Both the read endpoint (admin/show-moderation-logs → Service.List) and the write path (admin handlers → Service.Log) go through this single object so wiring cannot drift out of sync.
func (*Handler) SetNoteFinder ¶
func (h *Handler) SetNoteFinder(r NoteFinder)
SetNoteFinder attaches a NoteFinder used to validate noteId inputs.
func (*Handler) SetObjectStorageEnqueuer ¶
func (h *Handler) SetObjectStorageEnqueuer(e ObjectStorageEnqueuer)
SetObjectStorageEnqueuer wires the queue client used to offload drive cleanup work to the `objectStorage` queue (#2325). Optional — nil keeps the synchronous in-request deletion.
func (*Handler) SetPasswordHasher ¶
SetPasswordHasher sets the Hasher that admin/reset-password hashes the generated password with. Unset, the default cost is used.
func (*Handler) SetPluginOrphanSchemas ¶
func (h *Handler) SetPluginOrphanSchemas(fn PluginOrphanSchemaLister)
SetPluginOrphanSchemas injects the orphan schema lister.
func (*Handler) SetProcStatsDeps ¶
SetProcStatsDeps wires the process start time used by admin/server-metrics (#2395). 未配線でも endpoint は動く。起動時刻が無いと uptimeMs が 0 になるだけで、 version と go は常に返る。
func (*Handler) SetPromoNoteRepo ¶
func (h *Handler) SetPromoNoteRepo(r repository.PromoNoteRepository)
SetPromoNoteRepo attaches a PromoNoteRepository for admin/promo/*.
func (*Handler) SetQueueInspector ¶
func (h *Handler) SetQueueInspector(qi QueueInspector)
SetQueueInspector attaches a queue inspector for admin queue endpoints.
func (*Handler) SetQueueRedis ¶
func (h *Handler) SetQueueRedis(p QueueRedisInfoProvider)
SetQueueRedis wires the job-queue Redis INFO provider used to populate the per-queue `db` (memory / clients / uptime) block returned by queue-stats / queues. nil leaves the zero-stub behaviour intact.
func (*Handler) SetQueueRuntimeProvider ¶
func (h *Handler) SetQueueRuntimeProvider(p QueueRuntimeProvider)
SetQueueRuntimeProvider wires the runtime view (#2277).
func (*Handler) SetRecipientRepo ¶
func (h *Handler) SetRecipientRepo(r repository.AbuseReportNotificationRecipientRepository)
SetRecipientRepo attaches an AbuseReportNotificationRecipientRepository for admin/abuse-report/notification-recipient/*.
func (*Handler) SetRelayService ¶
func (h *Handler) SetRelayService(s RelayService)
SetRelayService wires the relay service used by admin/relays endpoints. nil を渡せば Admin API が DB fallback (create/update/delete のみ) に戻る。
func (*Handler) SetRemoteChecker ¶
func (h *Handler) SetRemoteChecker(r RemoteChecker, selfHost string)
SetRemoteChecker wires the remote diagnosis. selfHost is this server's host (normalized like the request), which is refused.
func (*Handler) SetRemoteEmojiMetaFetcher ¶
func (h *Handler) SetRemoteEmojiMetaFetcher(f RemoteEmojiMetaFetcher)
SetRemoteEmojiMetaFetcher attaches the fetcher used by admin/emoji/fetch-remote-meta. nil のままだと endpoint は「取得できなかった」を 返す (未配線環境で 5xx にしない)。
func (*Handler) SetRestoredCopyReleaser ¶
func (h *Handler) SetRestoredCopyReleaser(r RestoredCopyReleaser)
SetRestoredCopyReleaser wires what deletes the copies a deleted file left in object storage when it was moved back (#4197). Optional — nil leaves the copies to the cleanup of the migration.
func (*Handler) SetSMTPProxyURL ¶
SetSMTPProxyURL forwards admin/send-email TCP connections through the configured proxy (cfg.ProxySMTP). Empty string disables the proxy and falls back to direct dial. See internal/misc/smtp.SendWithOptions.
func (*Handler) SetSecurityKeyRepo ¶
func (h *Handler) SetSecurityKeyRepo(r repository.UserSecurityKeyRepository)
SetSecurityKeyRepo attaches a UserSecurityKeyRepository for admin/unset-mfa (passkey bulk deletion). 未配線のまま unset-mfa を呼ぶと 500 になる (パスキーを消さずに成功を返すと危険な中間状態が残るため)。
func (*Handler) SetSelfCheckRunner ¶
func (h *Handler) SetSelfCheckRunner(r SelfCheckRunner)
SetSelfCheckRunner wires the self-check source (#2463)。
func (*Handler) SetSelfPacker ¶
SetSelfPacker wires the Packer that promotes the viewer's own entry into MeDetailed. Unset promotes without the handler-only fields.
func (*Handler) SetServerPlugins ¶
func (h *Handler) SetServerPlugins(infos []ServerPluginInfo)
SetServerPlugins injects the compiled-in plugin snapshot.
func (*Handler) SetServerURL ¶
SetServerURL sets the base URL used inside password-reset email bodies.
func (*Handler) SetSigninRepo ¶
func (h *Handler) SetSigninRepo(r repository.SigninRepository)
SetSigninRepo wires a SigninRepository so admin/show-user can populate the target user's signin history. Without it the `signins` field falls back to an empty array (#1198).
func (*Handler) SetSignupApplicationReviewer ¶
func (h *Handler) SetSignupApplicationReviewer(r SignupApplicationReviewer)
SetSignupApplicationReviewer wires the signup application service (#2555). 未配線なら承認制の管理 endpoint は 503 を返す。
func (*Handler) SetStorageDeleter ¶
func (h *Handler) SetStorageDeleter(s StorageDeleter)
SetStorageDeleter wires the object-storage backend so bulk drive cleanups can remove physical objects (not just DB rows). nil keeps the DB-only behaviour.
func (*Handler) SetSystemAccountFetcher ¶
func (h *Handler) SetSystemAccountFetcher(f SystemAccountFetcher)
SetSystemAccountFetcher attaches the system account service used by admin/meta and admin/update-proxy-account to materialize the built-in proxy account.
func (*Handler) SetSystemWebhookDispatcher ¶
func (h *Handler) SetSystemWebhookDispatcher(d SystemWebhookDispatcher)
SetSystemWebhookDispatcher wires the system webhook dispatcher used to emit abuseReportResolved. nil disables firing (DB update still happens).
func (*Handler) SetSystemWebhookRepo ¶
func (h *Handler) SetSystemWebhookRepo(r repository.SystemWebhookRepository)
SetSystemWebhookRepo attaches a SystemWebhookRepository for admin/system-webhook/*.
func (*Handler) SetUnfollowEnqueuer ¶
func (h *Handler) SetUnfollowEnqueuer(e UnfollowEnqueuer)
SetUnfollowEnqueuer attaches the queue client used by admin/federation/remove-all-following to schedule per-pair Unfollow background jobs. Typically wired with the project-wide queue client.
func (*Handler) SetUserIPRepo ¶
func (h *Handler) SetUserIPRepo(r repository.UserIPRepository)
SetUserIPRepo attaches a UserIPRepository for admin/get-user-ips.
func (*Handler) SetUserModerationFederationHook ¶
func (h *Handler) SetUserModerationFederationHook(hook UserModerationFederationHook)
SetUserModerationFederationHook wires the AP delivery hook used on suspend / delete-account / unsuspend (#1759). nil disables federation.
func (*Handler) ShowModerationLogs ¶
ShowModerationLogs handles POST /api/admin/show-moderation-logs.
model.ModerationLog は createdAt 列を持たず aidx ID 先頭 8 文字に timestamp を埋め込んでいる。frontend (modlog.ModLog.vue) は `<MkTime :time="log.createdAt"/>` を直接読むため、handler 側で aidx から派生した createdAt 文字列を response に注入する。invite/users 系 と同じく "2006-01-02T15:04:05.000Z" 形式 (Misskey の標準)。
func (*Handler) SignupApplicationApprove ¶
SignupApplicationApprove handles POST /api/admin/signup-application/approve.
承認は状態を変えるだけで、registration_ticket はここでは発行しない (#2555)。
func (*Handler) SignupApplicationList ¶
SignupApplicationList handles POST /api/admin/signup-application/list.
**mk-go 独自 endpoint** (#2555)。upstream に承認制が無いため対応物は無い。 scope は `read:admin:invite-codes` を再利用する — 承認はメール確認の経路で registration_ticket の発行につながるので管轄が同じで、`internal/misc/permissions` は upstream misskey-js と完全一致させる契約があり mk-go 固有 scope を足せない (admin/federation/delivery-health が `read:admin:server-info` を再利用するのと 同じ判断)。
func (*Handler) SignupApplicationReject ¶
SignupApplicationReject handles POST /api/admin/signup-application/reject.
func (*Handler) SuspendUser ¶
SuspendUser handles POST /api/admin/suspend-user.
func (*Handler) SystemWebhookCreate ¶
SystemWebhookCreate handles POST /api/admin/system-webhook/create.
func (*Handler) SystemWebhookDelete ¶
SystemWebhookDelete handles POST /api/admin/system-webhook/delete.
func (*Handler) SystemWebhookList ¶
SystemWebhookList handles POST /api/admin/system-webhook/list.
func (*Handler) SystemWebhookShow ¶
SystemWebhookShow handles POST /api/admin/system-webhook/show.
func (*Handler) SystemWebhookTest ¶
SystemWebhookTest handles POST /api/admin/system-webhook/test.
upstream test.ts: webhook 不在なら NO_SUCH_WEBHOOK、override.url/secret を受け、 配送 processor 経由で type 別 dummy payload を送る。mk-go も DispatchSystemTest で real delivery (queue) を経由させ、header/envelope を本配送と一致させる (#1542)。
func (*Handler) SystemWebhookUpdate ¶
SystemWebhookUpdate handles POST /api/admin/system-webhook/update.
配送 processor が並行して latestSentAt/latestStatus を書き換えるため、 FindByID→Save で全列上書きすると配送ステータスを古い値で踏み潰す。partial update (UpdateAdminFields) を使い admin 編集可能列のみ触る。
func (*Handler) UnsetMfa ¶
UnsetMfa handles POST /api/admin/unset-mfa (upstream 2026.7.0 #17614).
Removes every registered security key (passkey) of the target user and disables TOTP / password-less login. Targets that are administrators can only be reset by themselves (ACCESS_DENIED otherwise), mirroring the upstream fork-merge authorization fix.
func (*Handler) UnsetUserAvatar ¶
UnsetUserAvatar handles POST /api/admin/unset-user-avatar.
upstream unset-user-avatar.ts: avatarId が既に null なら no-op (log も書かない)、 それ以外は解除して moderation log に fileId: 旧 avatarId を含めて記録する (#1539)。
func (*Handler) UnsetUserBanner ¶
UnsetUserBanner handles POST /api/admin/unset-user-banner.
upstream unset-user-banner.ts: bannerId 解除版の UnsetUserAvatar 相当 (#1539)。
func (*Handler) UnsuspendUser ¶
UnsuspendUser handles POST /api/admin/unsuspend-user.
func (*Handler) UpdateAbuseUserReport ¶
UpdateAbuseUserReport handles POST /api/admin/update-abuse-user-report.
upstream AbuseReportService.update は `moderationNote` 列のみを更新し、 resolved は触らない (resolve は resolve-abuse-user-report 側の責務)。旧 mk-go は moderationNote param を無視して resolved=true を立て、log type も resolveAbuseReport にしていた (= resolve-abuse-user-report との取り違え)。 本 fix で moderationNote を受け取り、変化時のみ updateAbuseReportNote を log する (upstream update-abuse-user-report.ts / AbuseReportService.ts:154)。
func (*Handler) UpdateMeta ¶
UpdateMeta handles POST /api/admin/update-meta.
func (*Handler) UpdateProxyAccount ¶
UpdateProxyAccount handles POST /api/admin/update-proxy-account.
本家 update-proxy-account.ts と同じく proxy system user の profile.description を更新する handler (旧 stub は誤って meta.proxyAccountId を書き換えていた、#348)。 frontend admin/settings 画面の proxyAccountForm が `{ description }` 形式で 呼び出すのでこれに合わせる。Response は upstream update-proxy-account.ts と同じく MeDetailed schema で返す (#1539)。
type InstanceMetadataFetcher ¶
InstanceMetadataFetcher refreshes remote instance metadata (nodeinfo + iconUrl/faviconUrl) for the given host. Narrow interface that matches coreinstance.FetchMetadataService.Fetch so admin handler tests don't have to pull in the full federation stack.
type InstanceSuspendCacheInvalidator ¶
type InstanceSuspendCacheInvalidator interface {
InvalidateSuspendCache(host string)
}
InstanceSuspendCacheInvalidator drops the cached delivery-suspend decision for a host so the next ShouldSkipDelivery re-reads it from the DB. Implemented by core/instance.Service. Used by admin/federation/update-instance which writes suspensionState through instanceRepo directly (bypassing instance.Service.Suspend) — see #1407 review.
type MetaResponseCacheInvalidator ¶
type MetaResponseCacheInvalidator interface {
InvalidateResponseCache()
}
MetaResponseCacheInvalidator drops the cached /api/meta response bodies. Implemented by api/meta.Handler (#2649). `ads` は /api/meta にそのまま載るので、 admin 側で ad を作り替えたら落とす必要がある。
**これは process-local。** meta 行には internal:metaUpdated の cross-worker 経路がある (#1740) が、ads には無いので、複数プロセス構成では mutation を 処理した worker 以外は最大 TTL 分だけ古い ads を返す。TTL が数秒なので そこで頭打ちになる。
type NoteFinder ¶
NoteFinder is the minimal subset of repository.NoteRepository that admin handlers need to validate a noteId. Kept narrow so tests can supply a tiny fake without implementing the full NoteRepository surface.
type ObjectStorageEnqueuer ¶
type ObjectStorageEnqueuer interface {
// EnqueueDeleteObjectStorageFile queues the removal of one object.
EnqueueDeleteObjectStorageFile(key string) error
// EnqueueCleanRemoteFiles queues the bulk remote-cache sweep.
EnqueueCleanRemoteFiles() error
}
ObjectStorageEnqueuer schedules object storage housekeeping on the `objectStorage` queue (#2325). Implemented by queue.Client; admin handlers take the narrow interface so tests stay decoupled from the queue stack.
type PluginOrphanSchemaLister ¶
PluginOrphanSchemaLister returns plugin schemas that no compiled-in plugin owns. 起動時 WARN と同じ情報を管理画面からも見られるようにする。
type Quantiles ¶
type Quantiles struct {
Count int `json:"count"`
P50 float64 `json:"p50"`
P95 float64 `json:"p95"`
Max float64 `json:"max"`
}
Quantiles summarises a latency window. Count is the number of samples the window currently holds (bounded ring buffer), not a lifetime total.
type QueueInfoResult ¶
type QueueInfoResult struct {
Queue string
Size int
Active int
Pending int
Completed int
Failed int
// Delayed は未来実行予定と失敗後の再試行待ちの合計 (Bull の delayed、#3962)。
Delayed int
IsPaused bool
// QualifiedName is BullMQ's `<keyPrefix>:<name>`。空なら Queue で代替する。
QualifiedName string
}
QueueInfoResult holds basic queue statistics.
type QueueInspector ¶
type QueueInspector interface {
Queues() ([]string, error)
GetQueueInfo(qname string) (*QueueInfoResult, error)
DeleteTask(qname, taskID string) error
DeleteAllPendingTasks(qname string) (int, error)
RunTask(qname, taskID string) error
// PauseQueue / UnpauseQueue pause and resume a queue (#17436)。
PauseQueue(qname string) error
UnpauseQueue(qname string) error
// Task listing APIs. page is 1-indexed.
ListPendingTasks(qname string, page, pageSize int) ([]*QueueTaskSummary, error)
ListActiveTasks(qname string, page, pageSize int) ([]*QueueTaskSummary, error)
ListScheduledTasks(qname string, page, pageSize int) ([]*QueueTaskSummary, error)
ListRetryTasks(qname string, page, pageSize int) ([]*QueueTaskSummary, error)
// ListDelayedTasks は delayed バケット全体 (scheduled + retry) を新しい順に返す (#3167)。
ListDelayedTasks(qname string, page, pageSize int) ([]*QueueTaskSummary, error)
ListCompletedTasks(qname string, page, pageSize int) ([]*QueueTaskSummary, error)
ListFailedTasks(qname string, page, pageSize int) ([]*QueueTaskSummary, error)
GetTaskInfo(qname, taskID string) (*QueueTaskSummary, error)
// GetTaskLogs returns the job's log lines (oldest first) and the total
// number stored. upstream の show-job-logs は queue.getJobLogs(jobId).logs
// をそのまま返す (#2689)。
GetTaskLogs(qname, taskID string, start, end int64) ([]string, int64, error)
QueueMetrics(qname, kind string) (*QueueMetricsResult, error)
}
QueueInspector abstracts the driver inspector for queue management endpoints.
type QueueMetricsResult ¶
QueueMetricsResult is the per-queue completed / failed time-series snapshot returned by QueueInspector.QueueMetrics. Mirrors driver.MetricsResult — duplicated here to keep the admin package free of internal/queue/driver imports.
type QueueRedisInfoProvider ¶
QueueRedisInfoProvider exposes the job-queue Redis `INFO` output. Implemented by a thin adapter over the go-redis client in server wiring so that this package stays free of a go-redis import. Mirrors upstream Misskey TS `QueueService.queueGetQueue`, which builds the `db` block from `parseRedisInfo(await queue.client.info())`.
type QueueRuntime ¶
type QueueRuntime struct {
Workers int `json:"workers"`
MinWorkers int `json:"minWorkers"`
MaxWorkers int `json:"maxWorkers"`
AutoScale bool `json:"autoScale"`
DispatchWaitMs Quantiles `json:"dispatchWaitMs"`
ProcessingMs Quantiles `json:"processingMs"`
RecentFailures int `json:"recentFailures"`
ScaleEvents []QueueScaleEvent `json:"scaleEvents"`
}
QueueRuntime is the per-queue runtime view. Durations are milliseconds so the JSON stays language-neutral.
type QueueRuntimeProvider ¶
type QueueRuntimeProvider interface {
// QueueRuntime returns the runtime view for qname. ok=false when the
// queue is unknown to the provider (= no block emitted).
QueueRuntime(qname string) (QueueRuntime, bool)
}
QueueRuntimeProvider exposes the mk-go-only worker runtime view backing the `runtime` block on admin/queue responses (#2277): how many workers a queue currently has, the configured auto-scale bounds, recent latency quantiles and the recent scale events.
Workers は「仕事を取れる worker 数」であって goroutine 数ではない。mkq driver では handler が閾値を超えて戻ってこない worker が除かれるので、 job を処理している最中でも minWorkers を下回ることがある (#2657)。 放棄した handler が予算を食って roster ごと縮んでいることもある (#2658)。 どちらなのかは `mk_job_workers_quarantined` と `mk_job_handlers_abandoned` を見比べて判断する (`enableMetrics: true` のときだけ expose される)。
upstream Misskey は worker 数を静的な config でしか持たないので該当情報が 無い。additive block なので純正 frontend は無視する。
type QueueScaleEvent ¶
type QueueScaleEvent struct {
At string `json:"at"`
Direction string `json:"direction"`
From int `json:"from"`
To int `json:"to"`
}
QueueScaleEvent is one committed auto-scale decision, newest first.
type QueueTaskSummary ¶
type QueueTaskSummary struct {
ID string
Queue string
Type string
State string
Payload []byte
Retried int
MaxRetry int
LastErr string
LastFailedAt time.Time
NextProcessAt time.Time
EnqueuedAt time.Time
ProcessedAt time.Time
CompletedAt time.Time
// ProcessedBy is the worker name that last dequeued the job (BullMQ
// job.processedBy). Output as the upstream optional QueueJob.processedBy.
ProcessedBy string
// 以下は BullMQ の job HASH をそのまま運ぶ (#2689)。upstream の
// packJobData と同じく**保存されている値をそのまま出す**。持たない
// driver は空のまま。
Opts json.RawMessage
Delay int64
Stacktrace []string
ReturnValue json.RawMessage
Progress json.RawMessage
// AttemptsAt は試行ごとの開始時刻 (unix ミリ秒、古い順)。mkq の拡張で、
// upstream には対応物が無い (#2692)。
AttemptsAt []int64
}
QueueTaskSummary mirrors queue.TaskSummary for handler responses without taking a compile-time dependency on the queue package.
type RelayService ¶
type RelayService interface {
Add(ctx context.Context, inbox string) (*model.Relay, error)
Remove(ctx context.Context, id string) error
List(ctx context.Context) ([]*model.Relay, error)
}
RelayService is the subset of core/relay.Service needed by the admin/relays endpoints. Kept as an interface so tests can inject a fake without the rest of the federation pipeline.
type RemoteChecker ¶
type RemoteChecker interface {
CheckRemoteHost(ctx context.Context, req remotecheck.Request) remotecheck.Report
}
RemoteChecker diagnoses federation with one remote host (#3055). 実装は server の adapter (SSRF-safe な client と観測を束ねる)。
type RemoteEmojiMetaFetcher ¶
type RemoteEmojiMetaFetcher interface {
Fetch(ctx context.Context, host, name, softwareName string) (*emojimeta.Meta, error)
}
RemoteEmojiMetaFetcher retrieves emoji metadata from the origin server. handler 単体テストで fake を差し込めるよう interface で受ける (`EmojiImageFetcher` と同じ形)。
type RestoredCopyReleaser ¶
RestoredCopyReleaser deletes the copies a drive file moved back to the local storage left in object storage (coredrive.StorageMigrator, #4197).
type SelfCheckRunner ¶
SelfCheckRunner runs the federation / dependency self-checks. 循環依存を避けるため interface で受け取る。実装は server の adapter。
type ServerPluginInfo ¶
type ServerPluginInfo struct {
Name string `json:"name"`
Version string `json:"version"`
APIVersion int `json:"apiVersion"`
// Enabled reflects the runtime config (plugins.<name>.enabled), not the
// build-time state. ビルドから外れたプラグインはそもそもこの一覧に出ない。
Enabled bool `json:"enabled"`
// Routes / Jobs / EffectivePolicies reflect what the plugin declares, not
// what this process wired. ロール分割 (#2459) で片方しか動かないプロセスでも、
// プラグインの構成としては同じものを見せる。
Routes bool `json:"routes"`
Jobs bool `json:"jobs"`
EffectivePolicies bool `json:"effectivePolicies"`
Migrations int `json:"migrations"`
Schema string `json:"schema"`
// ConfigKeys lists the setting keys only. **値は返さない** — どのキーが
// 秘密かを mk-go は判別できないので、`elythia config-dump` と同じく既定で全部
// マスクする方針に合わせる。
ConfigKeys []string `json:"configKeys"`
// Secrets lists the secret names the plugin declares (#3470). **値も
// 設定済みかどうかも返さない** — この一覧はモデレーターにも見えるので、
// 状態は管理者だけが叩ける `plugin/<name>/_secrets` で返す。
Secrets []string `json:"secrets"`
}
ServerPluginInfo describes one compiled-in server plugin (#2497).
mk-go 独自の additive エンドポイント用。upstream の「プラグイン」(AiScript クライアントプラグイン) とは別物なので、名前空間を server-plugins に分けて 衝突の芽を残さない。
type SignupApplicationReviewer ¶
type SignupApplicationReviewer interface {
List(filter string, limit, offset int) ([]*model.SignupApplication, error)
Count(filter string) (int, error)
Approve(applicationID, moderatorID string) error
Reject(applicationID, moderatorID string) error
ExpireStale() (int, error)
}
SignupApplicationReviewer is the review-side surface of the signup application state machine (#2555). 循環依存を避けるため interface で受け取る。 実装は core/signupapplication.Service。
type StorageDeleter ¶
StorageDeleter removes a stored object by its access key (drive.Storage の Delete に対応)。admin/drive/clean-remote-files と delete-all-files-of-a-user で DB 行削除前に object storage の物理オブジェクトを消すために使う。
type SystemAccountFetcher ¶
SystemAccountFetcher returns (and lazily creates) the built-in proxy / relay / instance actor users. Narrow interface matching coresystemaccount.Service.Fetch so admin handler tests stay decoupled.
type SystemWebhookDispatcher ¶
type SystemWebhookDispatcher interface {
DispatchSystemExcluding(eventType string, body any, excludes []string)
// DispatchSystemTest enqueues a single test delivery to a system webhook
// (admin/system-webhook/test, #1542). overrideURL/Secret が非空ならそちらへ。
DispatchSystemTest(webhookID, eventType string, body any, overrideURL, overrideSecret string)
}
SystemWebhookDispatcher fans a system-level event out to subscribed system webhooks, optionally excluding specific webhook IDs. Implemented by *core/webhook.Service. Used to fire abuseReportResolved on report resolution (#1723).
type UnfollowEnqueuer ¶
type UnfollowEnqueuer interface {
EnqueueUnfollow(payload queue.UnfollowPayload) error
}
UnfollowEnqueuer schedules per-pair Unfollow background jobs, used by admin/federation/remove-all-following to detach all incoming follows from a host without blocking the HTTP request. The job is consumed by processors.UnfollowProcessor which calls core/following.Service.Unfollow (= Following row 削除 + Reject(Follow) 配送)。Misskey TS の queueService.createUnfollowJob 相当。
type UserModerationFederationHook ¶
type UserModerationFederationHook interface {
// OnUserDeleted は suspend / delete-account で Delete(actor) を配信する。
OnUserDeleted(user *model.User)
// OnUserRestored は unsuspend で Undo(Delete) を配信する。
OnUserRestored(user *model.User)
}
UserModerationFederationHook delivers AP Delete / Undo(Delete) for a local user's actor to remote instances when the account is suspended, deleted, or unsuspended (#1759). Implemented by core/federation.UserModerationDeliveryHook. nil disables the federation side-effect.
type UserStreamRevoker ¶
type UserStreamRevoker interface {
RevokeUserStreams(userID string)
}
UserStreamRevoker closes every live /streaming connection of a user. Implemented by stream.StreamRevokePublisher (pubsub fan-out so connections held by other processes close too).
type UserTokenInvalidator ¶
type UserTokenInvalidator interface {
InvalidateTokensForUser(userID string)
}
UserTokenInvalidator drops every cached auth entry for the given userID (= all sessions / API tokens belonging to that user) so the next authenticated request from any of those tokens re-resolves through the DB. Implemented by middleware.AuthMiddleware. Used by admin actions that change a user's middleware-relevant fields (isSuspended / isDeleted) — see #965.
Source Files
¶
- abuse_report_log.go
- abuse_report_notification.go
- abuse_reports.go
- accounts.go
- ad.go
- aidx_helpers.go
- avatar_decorations.go
- captcha.go
- credential_takeover.go
- database_health.go
- delivery_health.go
- detail_extras.go
- drive.go
- drive_storage_migration.go
- drive_usage.go
- email.go
- emoji.go
- emoji_application.go
- emoji_handlers.go
- emoji_image_fetcher.go
- emoji_remote_meta.go
- federation_admin.go
- federation_rules.go
- forward_abuse_report.go
- gone_instance.go
- handler.go
- invite.go
- ip_lookup_log.go
- ip_related.go
- ip_search.go
- meta.go
- meta_secrets.go
- moderation.go
- moderation_logs.go
- modlog_helpers.go
- password_reset.go
- promo.go
- proxy_account.go
- queue.go
- queue_dbstats.go
- relays.go
- remote_check.go
- role_assignment_show.go
- roles.go
- self_check.go
- server_metrics.go
- server_plugins.go
- server_stats.go
- signup_application.go
- system_webhook.go
- unset_mfa.go
- update_meta_columns.go
- users.go