summaryrefslogtreecommitdiff
path: root/internal/api/client/admin/admin.go
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-07-05 13:23:03 +0200
committerLibravatar GitHub <noreply@github.com>2021-07-05 13:23:03 +0200
commitd389e7b150df6ecd215c7b661b294ea153ad0103 (patch)
tree8739e3103cb5130875d903cc7fc72fd9db3b8434 /internal/api/client/admin/admin.go
parentFix 404 contact (#74) (diff)
downloadgotosocial-d389e7b150df6ecd215c7b661b294ea153ad0103.tar.xz
Domain block (#76)
* start work on admin domain blocking * move stuff around + further work on domain blocks * move + restructure processor * prep work for deleting account * tidy * go fmt * formatting * domain blocking more work * check domain blocks way earlier on * progress on delete account * delete more stuff when an account is gone * and more... * domain blocky block block * get individual domain block, delete a block
Diffstat (limited to 'internal/api/client/admin/admin.go')
-rw-r--r--internal/api/client/admin/admin.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/internal/api/client/admin/admin.go b/internal/api/client/admin/admin.go
index b33813a7d..b8b94be76 100644
--- a/internal/api/client/admin/admin.go
+++ b/internal/api/client/admin/admin.go
@@ -29,10 +29,19 @@ import (
)
const (
- // BasePath is the base API path for this module
+ // BasePath is the base API path for this module.
BasePath = "/api/v1/admin"
- // EmojiPath is used for posting/deleting custom emojis
+ // EmojiPath is used for posting/deleting custom emojis.
EmojiPath = BasePath + "/custom_emojis"
+ // DomainBlocksPath is used for posting domain blocks.
+ DomainBlocksPath = BasePath + "/domain_blocks"
+ // DomainBlockPath is used for interacting with a single domain block.
+ DomainBlockPath = DomainBlocksPath + "/:" + IDKey
+
+ // ExportQueryKey is for requesting a public export of some data.
+ ExportQueryKey = "export"
+ // IDKey specifies the ID of a single item being interacted with.
+ IDKey = "id"
)
// Module implements the ClientAPIModule interface for admin-related actions (reports, emojis, etc)
@@ -54,5 +63,9 @@ func New(config *config.Config, processor processing.Processor, log *logrus.Logg
// Route attaches all routes from this module to the given router
func (m *Module) Route(r router.Router) error {
r.AttachHandler(http.MethodPost, EmojiPath, m.emojiCreatePOSTHandler)
+ r.AttachHandler(http.MethodPost, DomainBlocksPath, m.DomainBlocksPOSTHandler)
+ r.AttachHandler(http.MethodGet, DomainBlocksPath, m.DomainBlocksGETHandler)
+ r.AttachHandler(http.MethodGet, DomainBlockPath, m.DomainBlockGETHandler)
+ r.AttachHandler(http.MethodDelete, DomainBlockPath, m.DomainBlockDELETEHandler)
return nil
}