Documentation
¶
Overview ¶
Package federation provides /api/federation/* endpoints.
Index ¶
- type ActorResolver
- type Handler
- func (h *Handler) Followers(c *echo.Context) error
- func (h *Handler) Following(c *echo.Context) error
- func (h *Handler) Instances(c *echo.Context) error
- func (h *Handler) Peers(c *echo.Context) error
- func (h *Handler) SetFollowingRepo(r repository.FollowingRepository)
- func (h *Handler) SetIDGen(g id.Generator)
- func (h *Handler) SetModeratorChecker(m ModeratorChecker)
- func (h *Handler) SetResolver(r ActorResolver)
- func (h *Handler) SetSelfPacker(p *meself.Packer)
- func (h *Handler) SetSignatureCapabilityLookup(l SignatureCapabilityLookup)
- func (h *Handler) SetUserRepo(r repository.UserRepository)
- func (h *Handler) ShowInstance(c *echo.Context) error
- func (h *Handler) Stats(c *echo.Context) error
- func (h *Handler) UpdateRemoteUser(c *echo.Context) error
- func (h *Handler) Users(c *echo.Context) error
- type InstancesRequest
- type ModeratorChecker
- type ShowInstanceRequest
- type SignatureCapabilityLookup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActorResolver ¶
ActorResolver is the narrow subset of core/federation.Resolver that federation/update-remote-user needs. Kept as an interface so unit tests can swap in a fake without pulling in HTTP transports.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles federation-related API endpoints.
func NewHandler ¶
func NewHandler(svc *coreinstance.Service, entityPacker *entity.Packer, packer userpack.ListPacker) *Handler
NewHandler creates a new federation Handler. entityPacker is the Packer this handler packs entities with (#3792); packer packs the users embedded in federation/users, federation/followers and federation/following (#1957-a, #3330).
func (*Handler) Followers ¶
Followers handles POST /api/federation/followers.
指定リモートホストに属するユーザーが、このインスタンスのローカルユーザーを フォローしている関係の一覧を返す。Misskey 本家互換。
func (*Handler) Following ¶
Following handles POST /api/federation/following.
このインスタンスのローカルユーザーが、指定リモートホストに属するユーザーを フォローしている関係の一覧を返す。
func (*Handler) Instances ¶
Instances handles POST /api/federation/instances.
frontend Paginator (cursor mode) は untilId / sinceId を forward する (#493)。
func (*Handler) Peers ¶
Peers handles GET /api/v1/instance/peers.
Mastodon-compatible peer listing: a flat JSON array of the hosts this instance knows about, excluding suspended ones. Used by fediverse crawlers and statistics sites (fediverse.observer など) to map federation topology.
upstream Misskey は endpoints/ 配下ではなく ApiServerService.ts で fastify に 直接登録している (#2245)。実装も `select: {host: true}` / `where: {suspensionState: 'none'}` の全件走査のみで、blocked / silenced や isNotResponding では絞らず limit も持たない。ここで独自のフィルタを足すと 統計サイトから見たピア一覧が TS 実装と食い違うので、同じ条件のままにする。
federation/instances (Misskey 独自 API) とは別物で、あちらは instance オブジェクトの詳細を返す。こちらは host 文字列のみ。
func (*Handler) SetFollowingRepo ¶
func (h *Handler) SetFollowingRepo(r repository.FollowingRepository)
SetFollowingRepo attaches a FollowingRepository for followers/following lookup.
func (*Handler) SetIDGen ¶
SetIDGen wires an id.Generator so federation/followers / federation/following can derive Following.createdAt from aidx-encoded row IDs.
func (*Handler) SetModeratorChecker ¶
func (h *Handler) SetModeratorChecker(m ModeratorChecker)
SetModeratorChecker attaches a ModeratorChecker so moderationNote is only surfaced to moderators on the public instance-listing endpoints.
func (*Handler) SetResolver ¶
func (h *Handler) SetResolver(r ActorResolver)
SetResolver attaches an ActorResolver for update-remote-user.
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) SetSignatureCapabilityLookup ¶
func (h *Handler) SetSignatureCapabilityLookup(l SignatureCapabilityLookup)
SetSignatureCapabilityLookup wires the store that reports which signature scheme each remote host uses (#2393).
func (*Handler) SetUserRepo ¶
func (h *Handler) SetUserRepo(r repository.UserRepository)
SetUserRepo attaches a UserRepository for the users-per-host listing.
func (*Handler) ShowInstance ¶
ShowInstance handles POST /api/federation/show-instance.
func (*Handler) Stats ¶
Stats handles POST /api/federation/stats.
連合統計: followers / following がもっとも多いリモートインスタンス上位 N 件と、そのほかのインスタンスをまとめた残り総計を返す。
func (*Handler) UpdateRemoteUser ¶
UpdateRemoteUser handles POST /api/federation/update-remote-user.
対象のリモートユーザーを ActivityPub actor fetch で強制更新する。管理者用。
type InstancesRequest ¶
type InstancesRequest struct {
Host string `json:"host" query:"host"`
Suspended *bool `json:"suspended" query:"suspended"`
NotResponding *bool `json:"notResponding" query:"notResponding"`
Blocked *bool `json:"blocked" query:"blocked"`
Silenced *bool `json:"silenced" query:"silenced"`
Federating *bool `json:"federating" query:"federating"`
Subscribing *bool `json:"subscribing" query:"subscribing"`
Publishing *bool `json:"publishing" query:"publishing"`
Sort string `json:"sort" query:"sort"`
Limit *jsnum.Int `json:"limit" query:"limit"`
Offset *jsnum.Int `json:"offset" query:"offset"`
SinceID string `json:"sinceId" query:"sinceId"`
UntilID string `json:"untilId" query:"untilId"`
SinceDate *jsnum.Int `json:"sinceDate" query:"sinceDate"`
UntilDate *jsnum.Int `json:"untilDate" query:"untilDate"`
}
InstancesRequest is the request body for federation/instances.
query タグは upstream instances.ts の allowGet:true 経路用 (#2106 N9)。echo の DefaultBinder は GET で BindQueryParams を呼ぶが、explicit query タグの無い field は 束縛しない。frontend welcome.entrance.classic.vue は misskeyApiGet で sort/limit/blocked 等を渡すため、これらが無いと表示順・件数・block 除外が全て効かなくなる。
type ModeratorChecker ¶
ModeratorChecker reports whether a user has moderator privileges. Used to gate moderator-only fields (moderationNote) on the otherwise-public federation/instances and federation/show-instance responses. nil disables the gate (moderationNote is never exposed).
type ShowInstanceRequest ¶
type ShowInstanceRequest struct {
Host *string `json:"host"`
}
ShowInstanceRequest is the request body for federation/show-instance.
type SignatureCapabilityLookup ¶
type SignatureCapabilityLookup interface {
FindByHost(host string) (*model.InstanceSignatureCapability, error)
FindManyByHosts(hosts []string) ([]*model.InstanceSignatureCapability, error)
}
SignatureCapabilityLookup is the read-only subset of repository.InstanceSignatureCapabilityRepository needed to decorate instance responses with the observed signature scheme (#2393). 未配線なら signatureCapability は常に null になる。