diff options
author | 2022-06-23 16:54:54 +0200 | |
---|---|---|
committer | 2022-06-23 16:54:54 +0200 | |
commit | 5f00d4980bdc55bce8d23e38392b345d525dbf4a (patch) | |
tree | 5300f3bbe38d7fcbf5ba07eda2c8c2142c573040 /testrig | |
parent | [bugfix] Don't remove jpeg orientation metadata (#663) (diff) | |
download | gotosocial-5f00d4980bdc55bce8d23e38392b345d525dbf4a.tar.xz |
[feature] Implement `/api/v1/instance/peers` endpoint (#660)
* add missing license headers
* start adding instance peers get
* rename domainblock.go
* embed domain in domainblock so it can be reused
* update swagger docs
* add test instances to db
* update tests
* add/update instancepeersget
* update domain model
* add getinstancepeers to db
* instance-expose-peers, instance-expose-suspended
* add auth checks for both current filters
* attach endpoint to router
* include public comment
* obfuscate domain if required
* go mod tidy
* update swagger docs
* remove unnecessary comment
* return 'flat' peerlist if no query params provided
Diffstat (limited to 'testrig')
-rw-r--r-- | testrig/config.go | 3 | ||||
-rw-r--r-- | testrig/db.go | 6 | ||||
-rw-r--r-- | testrig/testmodels.go | 21 |
3 files changed, 30 insertions, 0 deletions
diff --git a/testrig/config.go b/testrig/config.go index 92d04c453..e0e5d1029 100644 --- a/testrig/config.go +++ b/testrig/config.go @@ -56,6 +56,9 @@ var TestDefaults = config.Configuration{ WebTemplateBaseDir: "./web/template/", WebAssetBaseDir: "./web/assets/", + InstanceExposePeers: true, + InstanceExposeSuspended: true, + AccountsRegistrationOpen: true, AccountsApprovalRequired: true, AccountsReasonRequired: true, diff --git a/testrig/db.go b/testrig/db.go index 67bc681c6..b4c05d727 100644 --- a/testrig/db.go +++ b/testrig/db.go @@ -153,6 +153,12 @@ func StandardDBSetup(db db.DB, accounts map[string]*gtsmodel.Account) { } } + for _, v := range NewTestInstances() { + if err := db.Put(ctx, v); err != nil { + logrus.Panic(err) + } + } + for _, v := range NewTestUsers() { if err := db.Put(ctx, v); err != nil { logrus.Panic(err) diff --git a/testrig/testmodels.go b/testrig/testmodels.go index e734ff255..bca894266 100644 --- a/testrig/testmodels.go +++ b/testrig/testmodels.go @@ -936,10 +936,31 @@ func NewTestEmojis() map[string]*gtsmodel.Emoji { } } +func NewTestInstances() map[string]*gtsmodel.Instance { + return map[string]*gtsmodel.Instance{ + "fossbros-anonymous.io": { + ID: "01G5H6YMJQKR86QZKXXQ2S95FZ", + CreatedAt: TimeMustParse("2021-09-20T12:40:37+02:00"), + UpdatedAt: TimeMustParse("2021-09-20T12:40:37+02:00"), + Domain: "fossbros-anonymous.io", + URI: "http://fossbros-anonymous.io", + }, + "example.org": { + ID: "01G5H71G52DJKVBYKXPNPNDN1G", + CreatedAt: TimeMustParse("2020-05-13T15:29:12+02:00"), + UpdatedAt: TimeMustParse("2020-05-13T15:29:12+02:00"), + Domain: "example.org", + URI: "http://example.org", + }, + } +} + func NewTestDomainBlocks() map[string]*gtsmodel.DomainBlock { return map[string]*gtsmodel.DomainBlock{ "replyguys.com": { ID: "01FF22EQM7X8E3RX1XGPN7S87D", + CreatedAt: TimeMustParse("2020-05-13T15:29:12+02:00"), + UpdatedAt: TimeMustParse("2020-05-13T15:29:12+02:00"), Domain: "replyguys.com", CreatedByAccountID: "01F8MH17FWEB39HZJ76B6VXSKF", PrivateComment: "i blocked this domain because they keep replying with pushy + unwarranted linux advice", |