diff options
author | 2023-01-25 18:06:41 +0100 | |
---|---|---|
committer | 2023-01-25 18:06:41 +0100 | |
commit | 17eecfb6d9f50821d7822d60fa4135d59ea5ca57 (patch) | |
tree | 26796a658eb1b05e27c34ec23c2fc8030ffb4458 /internal/processing | |
parent | [feature] Accept incoming federated Flag activity (#1382) (diff) | |
download | gotosocial-17eecfb6d9f50821d7822d60fa4135d59ea5ca57.tar.xz |
[feature] Public list of suspended domains (#1362)
* basic rendered domain blocklist (unauthenticated!)
* style basic domain block list
* better formatting for domain blocklist
* add opt-in config option for showing suspended domains
* format/linter
* re-use InstancePeersGet for web-accessible domain blocklist
* reword explanation, border styling
* always attach blocklist handler, update error message
* domain blocklist error message grammar
Diffstat (limited to 'internal/processing')
-rw-r--r-- | internal/processing/instance.go | 13 | ||||
-rw-r--r-- | internal/processing/processor.go | 2 |
2 files changed, 2 insertions, 13 deletions
diff --git a/internal/processing/instance.go b/internal/processing/instance.go index fec636d2a..afa60ad1e 100644 --- a/internal/processing/instance.go +++ b/internal/processing/instance.go @@ -28,7 +28,6 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" - "github.com/superseriousbusiness/gotosocial/internal/oauth" "github.com/superseriousbusiness/gotosocial/internal/text" "github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/internal/validate" @@ -48,15 +47,10 @@ func (p *processor) InstanceGet(ctx context.Context, domain string) (*apimodel.I return ai, nil } -func (p *processor) InstancePeersGet(ctx context.Context, authed *oauth.Auth, includeSuspended bool, includeOpen bool, flat bool) (interface{}, gtserror.WithCode) { +func (p *processor) InstancePeersGet(ctx context.Context, includeSuspended bool, includeOpen bool, flat bool) (interface{}, gtserror.WithCode) { domains := []*apimodel.Domain{} if includeOpen { - if !config.GetInstanceExposePeers() && (authed.Account == nil || authed.User == nil) { - err := fmt.Errorf("peers open query requires an authenticated account/user") - return nil, gtserror.NewErrorUnauthorized(err, err.Error()) - } - instances, err := p.db.GetInstancePeers(ctx, false) if err != nil && err != db.ErrNoEntries { err = fmt.Errorf("error selecting instance peers: %s", err) @@ -70,11 +64,6 @@ func (p *processor) InstancePeersGet(ctx context.Context, authed *oauth.Auth, in } if includeSuspended { - if !config.GetInstanceExposeSuspended() && (authed.Account == nil || authed.User == nil) { - err := fmt.Errorf("peers suspended query requires an authenticated account/user") - return nil, gtserror.NewErrorUnauthorized(err, err.Error()) - } - domainBlocks := []*gtsmodel.DomainBlock{} if err := p.db.GetAll(ctx, &domainBlocks); err != nil && err != db.ErrNoEntries { return nil, gtserror.NewErrorInternalError(err) diff --git a/internal/processing/processor.go b/internal/processing/processor.go index 46634aaaa..68a4c5fa4 100644 --- a/internal/processing/processor.go +++ b/internal/processing/processor.go @@ -172,7 +172,7 @@ type Processor interface { // InstanceGet retrieves instance information for serving at api/v1/instance InstanceGet(ctx context.Context, domain string) (*apimodel.Instance, gtserror.WithCode) - InstancePeersGet(ctx context.Context, authed *oauth.Auth, includeSuspended bool, includeOpen bool, flat bool) (interface{}, gtserror.WithCode) + InstancePeersGet(ctx context.Context, includeSuspended bool, includeOpen bool, flat bool) (interface{}, gtserror.WithCode) // InstancePatch updates this instance according to the given form. // // It should already be ascertained that the requesting account is authenticated and an admin. |