summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2022-09-28 18:30:40 +0100
committerLibravatar GitHub <noreply@github.com>2022-09-28 18:30:40 +0100
commita156188b3eb5cb3da44aa1b7452265f5fa38a607 (patch)
tree7097fa48d56fbabc7c2c8750b1f3bc9321d71c0f /internal
parent[bugfix] Fix emphasis being added to emoji shortcodes with markdown parsing (... (diff)
downloadgotosocial-a156188b3eb5cb3da44aa1b7452265f5fa38a607.tar.xz
[chore] update dependencies, bump to Go 1.19.1 (#826)
* update dependencies, bump Go version to 1.19 * bump test image Go version * update golangci-lint * update gotosocial-drone-build * sign * linting, go fmt * update swagger docs * update swagger docs * whitespace * update contributing.md * fuckin whoopsie doopsie * linterino, linteroni * fix followrequest test not starting processor * fix other api/client tests not starting processor * fix remaining tests where processor not started * bump go-runners version * don't check last-webfingered-at, processor may have updated this * update swagger command * update bun to latest version * fix embed to work the same as before with new bun Signed-off-by: kim <grufwub@gmail.com> Co-authored-by: tsmethurst <tobi.smethurst@protonmail.com>
Diffstat (limited to 'internal')
-rw-r--r--internal/ap/extract.go22
-rw-r--r--internal/api/client/account/account_test.go2
-rw-r--r--internal/api/client/account/accountcreate.go54
-rw-r--r--internal/api/client/account/accountdelete.go55
-rw-r--r--internal/api/client/account/accountget.go58
-rw-r--r--internal/api/client/account/accountupdate.go168
-rw-r--r--internal/api/client/account/accountverify.go44
-rw-r--r--internal/api/client/account/block.go60
-rw-r--r--internal/api/client/account/follow.go93
-rw-r--r--internal/api/client/account/followers.go65
-rw-r--r--internal/api/client/account/following.go65
-rw-r--r--internal/api/client/account/relationships.go69
-rw-r--r--internal/api/client/account/statuses.go171
-rw-r--r--internal/api/client/account/unblock.go61
-rw-r--r--internal/api/client/account/unfollow.go61
-rw-r--r--internal/api/client/admin/accountaction.go84
-rw-r--r--internal/api/client/admin/domainblockcreate.go153
-rw-r--r--internal/api/client/admin/domainblockdelete.go63
-rw-r--r--internal/api/client/admin/domainblockget.go63
-rw-r--r--internal/api/client/admin/domainblocksget.go75
-rw-r--r--internal/api/client/admin/emojicreate.go92
-rw-r--r--internal/api/client/admin/mediacleanup.go57
-rw-r--r--internal/api/client/app/appcreate.go52
-rw-r--r--internal/api/client/blocks/blocksget.go95
-rw-r--r--internal/api/client/emoji/emojisget.go42
-rw-r--r--internal/api/client/favourites/favouritesget.go65
-rw-r--r--internal/api/client/followrequest/authorize.go61
-rw-r--r--internal/api/client/followrequest/followrequest_test.go2
-rw-r--r--internal/api/client/followrequest/get.go77
-rw-r--r--internal/api/client/followrequest/reject.go61
-rw-r--r--internal/api/client/instance/instanceget.go32
-rw-r--r--internal/api/client/instance/instancepatch.go152
-rw-r--r--internal/api/client/instance/instancepeersget.go110
-rw-r--r--internal/api/client/media/mediacreate.go101
-rw-r--r--internal/api/client/media/mediaget.go59
-rw-r--r--internal/api/client/media/mediaupdate.go102
-rw-r--r--internal/api/client/notification/notificationsclear.go32
-rw-r--r--internal/api/client/notification/notificationsget.go123
-rw-r--r--internal/api/client/search/searchget.go48
-rw-r--r--internal/api/client/status/status_test.go2
-rw-r--r--internal/api/client/status/statusboost.go67
-rw-r--r--internal/api/client/status/statusboostedby.go57
-rw-r--r--internal/api/client/status/statuscontext.go65
-rw-r--r--internal/api/client/status/statuscreate.go58
-rw-r--r--internal/api/client/status/statusdelete.go63
-rw-r--r--internal/api/client/status/statusfave.go63
-rw-r--r--internal/api/client/status/statusfavedby.go65
-rw-r--r--internal/api/client/status/statusget.go63
-rw-r--r--internal/api/client/status/statusunboost.go65
-rw-r--r--internal/api/client/status/statusunfave.go63
-rw-r--r--internal/api/client/streaming/stream.go169
-rw-r--r--internal/api/client/timeline/home.go119
-rw-r--r--internal/api/client/timeline/public.go119
-rw-r--r--internal/api/client/user/passwordchange.go50
-rw-r--r--internal/api/client/user/user_test.go2
-rw-r--r--internal/api/model/status.go26
-rw-r--r--internal/api/negotiate.go1
-rw-r--r--internal/api/s2s/emoji/emojiget_test.go2
-rw-r--r--internal/api/s2s/nodeinfo/nodeinfoget.go18
-rw-r--r--internal/api/s2s/nodeinfo/wellknownget.go18
-rw-r--r--internal/api/s2s/user/inboxpost_test.go6
-rw-r--r--internal/api/s2s/user/outboxget.go78
-rw-r--r--internal/api/s2s/user/outboxget_test.go2
-rw-r--r--internal/api/s2s/user/repliesget.go91
-rw-r--r--internal/api/s2s/user/repliesget_test.go2
-rw-r--r--internal/api/s2s/user/user_test.go2
-rw-r--r--internal/api/s2s/user/userget_test.go5
-rw-r--r--internal/api/s2s/webfinger/webfinger_test.go2
-rw-r--r--internal/api/s2s/webfinger/webfingerget.go22
-rw-r--r--internal/concurrency/workers.go10
-rw-r--r--internal/db/bundb/bundb.go2
-rw-r--r--internal/db/bundb/conn.go2
-rw-r--r--internal/db/bundb/migrations/20220214175650_media_cleanup/mediaattachment.go2
-rw-r--r--internal/db/bundb/migrations/20220315160814_admin_account_actions/mediaattachment.go2
-rw-r--r--internal/db/bundb/util.go4
-rw-r--r--internal/federation/federatingdb/util.go1
-rw-r--r--internal/gtsmodel/mediaattachment.go2
-rw-r--r--internal/httpclient/client.go14
-rw-r--r--internal/oauth/clientstore_test.go1
-rw-r--r--internal/processing/status/status_test.go4
-rw-r--r--internal/timeline/timeline.go10
-rw-r--r--internal/transport/dereference.go4
-rw-r--r--internal/transport/derefinstance.go8
-rw-r--r--internal/transport/finger.go4
-rw-r--r--internal/typeutils/defaulticons.go6
-rw-r--r--internal/web/profile.go4
-rw-r--r--internal/web/thread.go4
87 files changed, 2258 insertions, 2040 deletions
diff --git a/internal/ap/extract.go b/internal/ap/extract.go
index 2d3a6fd9c..8bd8aa3f4 100644
--- a/internal/ap/extract.go
+++ b/internal/ap/extract.go
@@ -168,11 +168,12 @@ func ExtractPublished(i WithPublished) (time.Time, error) {
}
// ExtractIconURL extracts a URL to a supported image file from something like:
-// "icon": {
-// "mediaType": "image/jpeg",
-// "type": "Image",
-// "url": "http://example.org/path/to/some/file.jpeg"
-// },
+//
+// "icon": {
+// "mediaType": "image/jpeg",
+// "type": "Image",
+// "url": "http://example.org/path/to/some/file.jpeg"
+// },
func ExtractIconURL(i WithIcon) (*url.URL, error) {
iconProp := i.GetActivityStreamsIcon()
if iconProp == nil {
@@ -204,11 +205,12 @@ func ExtractIconURL(i WithIcon) (*url.URL, error) {
}
// ExtractImageURL extracts a URL to a supported image file from something like:
-// "image": {
-// "mediaType": "image/jpeg",
-// "type": "Image",
-// "url": "http://example.org/path/to/some/file.jpeg"
-// },
+//
+// "image": {
+// "mediaType": "image/jpeg",
+// "type": "Image",
+// "url": "http://example.org/path/to/some/file.jpeg"
+// },
func ExtractImageURL(i WithImage) (*url.URL, error) {
imageProp := i.GetActivityStreamsImage()
if imageProp == nil {
diff --git a/internal/api/client/account/account_test.go b/internal/api/client/account/account_test.go
index ceb15c7a2..aa639b3f4 100644
--- a/internal/api/client/account/account_test.go
+++ b/internal/api/client/account/account_test.go
@@ -74,6 +74,8 @@ func (suite *AccountStandardTestSuite) SetupTest() {
suite.accountModule = account.New(suite.processor).(*account.Module)
testrig.StandardDBSetup(suite.db, nil)
testrig.StandardStorageSetup(suite.storage, "../../../../testrig/media")
+
+ suite.NoError(suite.processor.Start())
}
func (suite *AccountStandardTestSuite) TearDownTest() {
diff --git a/internal/api/client/account/accountcreate.go b/internal/api/client/account/accountcreate.go
index c00d4f1be..e7b6c642d 100644
--- a/internal/api/client/account/accountcreate.go
+++ b/internal/api/client/account/accountcreate.go
@@ -39,37 +39,37 @@ import (
// The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'.
// The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'.
//
-// ---
-// tags:
-// - accounts
+// ---
+// tags:
+// - accounts
//
-// consumes:
-// - application/json
-// - application/xml
-// - application/x-www-form-urlencoded
+// consumes:
+// - application/json
+// - application/xml
+// - application/x-www-form-urlencoded
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// security:
-// - OAuth2 Application:
-// - write:accounts
+// security:
+// - OAuth2 Application:
+// - write:accounts
//
-// responses:
-// '200':
-// description: "An OAuth2 access token for the newly-created account."
-// schema:
-// "$ref": "#/definitions/oauthToken"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: "An OAuth2 access token for the newly-created account."
+// schema:
+// "$ref": "#/definitions/oauthToken"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) AccountCreatePOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, false, false)
if err != nil {
diff --git a/internal/api/client/account/accountdelete.go b/internal/api/client/account/accountdelete.go
index 448eaeb7c..53bdedd0f 100644
--- a/internal/api/client/account/accountdelete.go
+++ b/internal/api/client/account/accountdelete.go
@@ -33,37 +33,38 @@ import (
//
// Delete your account.
//
-// ---
-// tags:
-// - accounts
+// ---
+// tags:
+// - accounts
//
-// consumes:
-// - multipart/form-data
+// consumes:
+// - multipart/form-data
//
-// parameters:
-// - name: password
-// in: formData
-// description: Password of the account user, for confirmation.
-// type: string
-// required: true
+// parameters:
+// -
+// name: password
+// in: formData
+// description: Password of the account user, for confirmation.
+// type: string
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - write:accounts
+// security:
+// - OAuth2 Bearer:
+// - write:accounts
//
-// responses:
-// '202':
-// description: "The account deletion has been accepted and the account will be deleted."
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '202':
+// description: "The account deletion has been accepted and the account will be deleted."
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) AccountDeletePOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/account/accountget.go b/internal/api/client/account/accountget.go
index 2a060e175..c9aae5b2b 100644
--- a/internal/api/client/account/accountget.go
+++ b/internal/api/client/account/accountget.go
@@ -32,38 +32,40 @@ import (
//
// Get information about an account with the given ID.
//
-// ---
-// tags:
-// - accounts
+// ---
+// tags:
+// - accounts
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: string
-// description: The id of the requested account.
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// type: string
+// description: The id of the requested account.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - read:accounts
+// security:
+// - OAuth2 Bearer:
+// - read:accounts
//
-// responses:
-// '200':
-// schema:
-// "$ref": "#/definitions/account"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: The requested account.
+// schema:
+// "$ref": "#/definitions/account"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) AccountGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/account/accountupdate.go b/internal/api/client/account/accountupdate.go
index 3e5f60324..e2b2a731c 100644
--- a/internal/api/client/account/accountupdate.go
+++ b/internal/api/client/account/accountupdate.go
@@ -35,89 +35,101 @@ import (
//
// Update your account.
//
-// ---
-// tags:
-// - accounts
+// ---
+// tags:
+// - accounts
//
-// consumes:
-// - multipart/form-data
+// consumes:
+// - multipart/form-data
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: discoverable
-// in: formData
-// description: Account should be made discoverable and shown in the profile directory (if enabled).
-// type: boolean
-// - name: bot
-// in: formData
-// description: Account is flagged as a bot.
-// type: boolean
-// - name: display_name
-// in: formData
-// description: The display name to use for the account.
-// type: string
-// allowEmptyValue: true
-// - name: note
-// in: formData
-// description: Bio/description of this account.
-// type: string
-// allowEmptyValue: true
-// - name: avatar
-// in: formData
-// description: Avatar of the user.
-// type: file
-// - name: header
-// in: formData
-// description: Header of the user.
-// type: file
-// - name: locked
-// in: formData
-// description: Require manual approval of follow requests.
-// type: boolean
-// - name: source[privacy]
-// in: formData
-// description: Default post privacy for authored statuses.
-// type: string
-// - name: source[sensitive]
-// in: formData
-// description: Mark authored statuses as sensitive by default.
-// type: boolean
-// - name: source[language]
-// in: formData
-// description: Default language to use for authored statuses (ISO 6391).
-// type: string
-// - name: source[status_format]
-// in: formData
-// description: Default format to use for authored statuses (plain or markdown).
-// type: string
-// - name: custom_css
-// in: formData
-// description: |-
-// Custom CSS to use when rendering this account's profile or statuses.
-// String must be no more than 5,000 characters (~5kb).
-// type: string
+// parameters:
+// -
+// name: discoverable
+// in: formData
+// description: Account should be made discoverable and shown in the profile directory (if enabled).
+// type: boolean
+// -
+// name: bot
+// in: formData
+// description: Account is flagged as a bot.
+// type: boolean
+// -
+// name: display_name
+// in: formData
+// description: The display name to use for the account.
+// type: string
+// allowEmptyValue: true
+// -
+// name: note
+// in: formData
+// description: Bio/description of this account.
+// type: string
+// allowEmptyValue: true
+// -
+// name: avatar
+// in: formData
+// description: Avatar of the user.
+// type: file
+// -
+// name: header
+// in: formData
+// description: Header of the user.
+// type: file
+// -
+// name: locked
+// in: formData
+// description: Require manual approval of follow requests.
+// type: boolean
+// -
+// name: source[privacy]
+// in: formData
+// description: Default post privacy for authored statuses.
+// type: string
+// -
+// name: source[sensitive]
+// in: formData
+// description: Mark authored statuses as sensitive by default.
+// type: boolean
+// -
+// name: source[language]
+// in: formData
+// description: Default language to use for authored statuses (ISO 6391).
+// type: string
+// -
+// name: source[status_format]
+// in: formData
+// description: Default format to use for authored statuses (plain or markdown).
+// type: string
+// -
+// name: custom_css
+// in: formData
+// description: >-
+// Custom CSS to use when rendering this account's profile or statuses.
+// String must be no more than 5,000 characters (~5kb).
+// type: string
//
-// security:
-// - OAuth2 Bearer:
-// - write:accounts
+// security:
+// - OAuth2 Bearer:
+// - write:accounts
//
-// responses:
-// '200':
-// description: "The newly updated account."
-// schema:
-// "$ref": "#/definitions/account"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: "The newly updated account."
+// schema:
+// "$ref": "#/definitions/account"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) AccountUpdateCredentialsPATCHHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/account/accountverify.go b/internal/api/client/account/accountverify.go
index e6cb65efd..916d0a322 100644
--- a/internal/api/client/account/accountverify.go
+++ b/internal/api/client/account/accountverify.go
@@ -31,31 +31,31 @@ import (
//
// Verify a token by returning account details pertaining to it.
//
-// ---
-// tags:
-// - accounts
+// ---
+// tags:
+// - accounts
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// security:
-// - OAuth2 Bearer:
-// - read:accounts
+// security:
+// - OAuth2 Bearer:
+// - read:accounts
//
-// responses:
-// '200':
-// schema:
-// "$ref": "#/definitions/account"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// schema:
+// "$ref": "#/definitions/account"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) AccountVerifyGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/account/block.go b/internal/api/client/account/block.go
index b5f7fdda8..9840c96ab 100644
--- a/internal/api/client/account/block.go
+++ b/internal/api/client/account/block.go
@@ -32,40 +32,40 @@ import (
//
// Block account with id.
//
-// ---
-// tags:
-// - accounts
+// ---
+// tags:
+// - accounts
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: string
-// description: The id of the account to block.
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// type: string
+// description: The id of the account to block.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - write:blocks
+// security:
+// - OAuth2 Bearer:
+// - write:blocks
//
-// responses:
-// '200':
-// name: account relationship
-// description: Your relationship to this account.
-// schema:
-// "$ref": "#/definitions/accountRelationship"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: Your relationship to the account.
+// schema:
+// "$ref": "#/definitions/accountRelationship"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) AccountBlockPOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/account/follow.go b/internal/api/client/account/follow.go
index 11bfbf965..cc523a7f8 100644
--- a/internal/api/client/account/follow.go
+++ b/internal/api/client/account/follow.go
@@ -36,57 +36,58 @@ import (
// The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'.
// The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'.
//
-// ---
-// tags:
-// - accounts
+// ---
+// tags:
+// - accounts
//
-// consumes:
-// - application/json
-// - application/xml
-// - application/x-www-form-urlencoded
+// consumes:
+// - application/json
+// - application/xml
+// - application/x-www-form-urlencoded
//
-// parameters:
-// - name: id
-// required: true
-// in: path
-// description: ID of the account to follow.
-// type: string
-// - default: true
-// description: Show reblogs from this account.
-// in: formData
-// name: reblogs
-// type: boolean
-// x-go-name: Reblogs
-// - default: false
-// description: Notify when this account posts.
-// in: formData
-// name: notify
-// type: boolean
-// x-go-name: Notify
+// parameters:
+// -
+// name: id
+// required: true
+// in: path
+// description: ID of the account to follow.
+// type: string
+// -
+// name: reblogs
+// type: boolean
+// default: true
+// description: Show reblogs from this account.
+// in: formData
+// -
+// default: false
+// description: Notify when this account posts.
+// in: formData
+// name: notify
+// type: boolean
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// security:
-// - OAuth2 Bearer:
-// - write:follows
+// security:
+// - OAuth2 Bearer:
+// - write:follows
//
-// responses:
-// '200':
-// name: account relationship
-// description: Your relationship to this account.
-// schema:
-// "$ref": "#/definitions/accountRelationship"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// name: account relationship
+// description: Your relationship to this account.
+// schema:
+// "$ref": "#/definitions/accountRelationship"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) AccountFollowPOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/account/followers.go b/internal/api/client/account/followers.go
index beb82a34e..cb2f4bfa6 100644
--- a/internal/api/client/account/followers.go
+++ b/internal/api/client/account/followers.go
@@ -32,42 +32,43 @@ import (
//
// See followers of account with given id.
//
-// ---
-// tags:
-// - accounts
+// ---
+// tags:
+// - accounts
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: string
-// description: Account ID.
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// type: string
+// description: Account ID.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - read:accounts
+// security:
+// - OAuth2 Bearer:
+// - read:accounts
//
-// responses:
-// '200':
-// name: accounts
-// description: Array of accounts that follow this account.
-// schema:
-// type: array
-// items:
-// "$ref": "#/definitions/account"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// name: accounts
+// description: Array of accounts that follow this account.
+// schema:
+// type: array
+// items:
+// "$ref": "#/definitions/account"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) AccountFollowersGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/account/following.go b/internal/api/client/account/following.go
index d03bf143d..3d69739c3 100644
--- a/internal/api/client/account/following.go
+++ b/internal/api/client/account/following.go
@@ -32,42 +32,43 @@ import (
//
// See accounts followed by given account id.
//
-// ---
-// tags:
-// - accounts
+// ---
+// tags:
+// - accounts
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: string
-// description: Account ID.
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// type: string
+// description: Account ID.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - read:accounts
+// security:
+// - OAuth2 Bearer:
+// - read:accounts
//
-// responses:
-// '200':
-// name: accounts
-// description: Array of accounts that are followed by this account.
-// schema:
-// type: array
-// items:
-// "$ref": "#/definitions/account"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// name: accounts
+// description: Array of accounts that are followed by this account.
+// schema:
+// type: array
+// items:
+// "$ref": "#/definitions/account"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) AccountFollowingGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/account/relationships.go b/internal/api/client/account/relationships.go
index 8facc118c..56159d48e 100644
--- a/internal/api/client/account/relationships.go
+++ b/internal/api/client/account/relationships.go
@@ -15,44 +15,45 @@ import (
//
// See your account's relationships with the given account IDs.
//
-// ---
-// tags:
-// - accounts
+// ---
+// tags:
+// - accounts
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: array
-// items:
-// type: string
-// description: Account IDs.
-// in: query
-// required: true
+// parameters:
+// -
+// name: id
+// type: array
+// items:
+// type: string
+// description: Account IDs.
+// in: query
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - read:accounts
+// security:
+// - OAuth2 Bearer:
+// - read:accounts
//
-// responses:
-// '200':
-// name: account relationships
-// description: Array of account relationships.
-// schema:
-// type: array
-// items:
-// "$ref": "#/definitions/accountRelationship"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// name: account relationships
+// description: Array of account relationships.
+// schema:
+// type: array
+// items:
+// "$ref": "#/definitions/accountRelationship"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) AccountRelationshipsGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/account/statuses.go b/internal/api/client/account/statuses.go
index 2f0b804d3..c4c5f67ee 100644
--- a/internal/api/client/account/statuses.go
+++ b/internal/api/client/account/statuses.go
@@ -36,91 +36,100 @@ import (
//
// The statuses will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer).
//
-// ---
-// tags:
-// - accounts
+// ---
+// tags:
+// - accounts
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: string
-// description: Account ID.
-// in: path
-// required: true
-// - name: limit
-// type: integer
-// description: Number of statuses to return.
-// default: 30
-// in: query
-// required: false
-// - name: exclude_replies
-// type: boolean
-// description: Exclude statuses that are a reply to another status.
-// default: false
-// in: query
-// required: false
-// - name: exclude_reblogs
-// type: boolean
-// description: Exclude statuses that are a reblog/boost of another status.
-// default: false
-// in: query
-// required: false
-// - name: max_id
-// type: string
-// description: |-
-// Return only statuses *OLDER* than the given max status ID.
-// The status with the specified ID will not be included in the response.
-// in: query
-// - name: min_id
-// type: string
-// description: |-
-// Return only statuses *NEWER* than the given min status ID.
-// The status with the specified ID will not be included in the response.
-// in: query
-// required: false
-// - name: pinned_only
-// type: boolean
-// description: Show only pinned statuses. In other words, exclude statuses that are not pinned to the given account ID.
-// default: false
-// in: query
-// required: false
-// - name: only_media
-// type: boolean
-// description: Show only statuses with media attachments.
-// default: false
-// in: query
-// required: false
-// - name: only_public
-// type: boolean
-// description: Show only statuses with a privacy setting of 'public'.
-// default: false
-// in: query
-// required: false
+// parameters:
+// -
+// name: id
+// type: string
+// description: Account ID.
+// in: path
+// required: true
+// -
+// name: limit
+// type: integer
+// description: Number of statuses to return.
+// default: 30
+// in: query
+// required: false
+// -
+// name: exclude_replies
+// type: boolean
+// description: Exclude statuses that are a reply to another status.
+// default: false
+// in: query
+// required: false
+// -
+// name: exclude_reblogs
+// type: boolean
+// description: Exclude statuses that are a reblog/boost of another status.
+// default: false
+// in: query
+// required: false
+// -
+// name: max_id
+// type: string
+// description: >-
+// Return only statuses *OLDER* than the given max status ID.
+// The status with the specified ID will not be included in the response.
+// in: query
+// -
+// name: min_id
+// type: string
+// description: >-
+// Return only statuses *NEWER* than the given min status ID.
+// The status with the specified ID will not be included in the response.
+// in: query
+// required: false
+// -
+// name: pinned_only
+// type: boolean
+// description: Show only pinned statuses. In other words, exclude statuses that are not pinned to the given account ID.
+// default: false
+// in: query
+// required: false
+// -
+// name: only_media
+// type: boolean
+// description: Show only statuses with media attachments.
+// default: false
+// in: query
+// required: false
+// -
+// name: only_public
+// type: boolean
+// description: Show only statuses with a privacy setting of 'public'.
+// default: false
+// in: query
+// required: false
//
-// security:
-// - OAuth2 Bearer:
-// - read:accounts
+// security:
+// - OAuth2 Bearer:
+// - read:accounts
//
-// responses:
-// '200':
-// name: statuses
-// description: Array of statuses.
-// schema:
-// type: array
-// items:
-// "$ref": "#/definitions/status"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// name: statuses
+// description: Array of statuses.
+// schema:
+// type: array
+// items:
+// "$ref": "#/definitions/status"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) AccountStatusesGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, false, false, false, false)
if err != nil {
diff --git a/internal/api/client/account/unblock.go b/internal/api/client/account/unblock.go
index 44f3a722c..451b7fd27 100644
--- a/internal/api/client/account/unblock.go
+++ b/internal/api/client/account/unblock.go
@@ -32,40 +32,41 @@ import (
//
// Unblock account with ID.
//
-// ---
-// tags:
-// - accounts
+// ---
+// tags:
+// - accounts
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: string
-// description: The id of the account to unblock.
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// type: string
+// description: The id of the account to unblock.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - write:blocks
+// security:
+// - OAuth2 Bearer:
+// - write:blocks
//
-// responses:
-// '200':
-// name: account relationship
-// description: Your relationship to this account.
-// schema:
-// "$ref": "#/definitions/accountRelationship"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// name: account relationship
+// description: Your relationship to this account.
+// schema:
+// "$ref": "#/definitions/accountRelationship"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) AccountUnblockPOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/account/unfollow.go b/internal/api/client/account/unfollow.go
index d92278f95..fafba99fd 100644
--- a/internal/api/client/account/unfollow.go
+++ b/internal/api/client/account/unfollow.go
@@ -32,40 +32,41 @@ import (
//
// Unfollow account with id.
//
-// ---
-// tags:
-// - accounts
+// ---
+// tags:
+// - accounts
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: string
-// description: The id of the account to unfollow.
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// type: string
+// description: The id of the account to unfollow.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - write:follows
+// security:
+// - OAuth2 Bearer:
+// - write:follows
//
-// responses:
-// '200':
-// name: account relationship
-// description: Your relationship to this account.
-// schema:
-// "$ref": "#/definitions/accountRelationship"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// name: account relationship
+// description: Your relationship to this account.
+// schema:
+// "$ref": "#/definitions/accountRelationship"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) AccountUnfollowPOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/admin/accountaction.go b/internal/api/client/admin/accountaction.go
index a9817f295..2dc84a2d0 100644
--- a/internal/api/client/admin/accountaction.go
+++ b/internal/api/client/admin/accountaction.go
@@ -34,52 +34,54 @@ import (
//
// Perform an admin action on an account.
//
-// ---
-// tags:
-// - admin
+// ---
+// tags:
+// - admin
//
-// consumes:
-// - multipart/form-data
+// consumes:
+// - multipart/form-data
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// required: true
-// in: path
-// description: ID of the account.
-// type: string
-// - name: type
-// in: formData
-// description: |-
-// Type of action to be taken. One of: disable, silence, suspend.
-// type: string
-// required: true
-// - name: text
-// in: formData
-// description: Optional text describing why this action was taken.
-// type: string
+// parameters:
+// -
+// name: id
+// required: true
+// in: path
+// description: ID of the account.
+// type: string
+// -
+// name: type
+// in: formData
+// description: Type of action to be taken (`disable`, `silence`, or `suspend`).
+// type: string
+// required: true
+// -
+// name: text
+// in: formData
+// description: Optional text describing why this action was taken.
+// type: string
//
-// security:
-// - OAuth2 Bearer:
-// - admin
+// security:
+// - OAuth2 Bearer:
+// - admin
//
-// responses:
-// '200':
-// description: OK
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: OK
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) AccountActionPOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/admin/domainblockcreate.go b/internal/api/client/admin/domainblockcreate.go
index 9ee725bef..034ea8682 100644
--- a/internal/api/client/admin/domainblockcreate.go
+++ b/internal/api/client/admin/domainblockcreate.go
@@ -35,87 +35,94 @@ import (
//
// Create one or more domain blocks, from a string or a file.
//
-// Note that you have two options when using this endpoint: either you can set `import` to true
-// and upload a file containing multiple domain blocks, JSON-formatted, or you can leave import as
-// false, and just add one domain block.
+// You have two options when using this endpoint: either you can set `import` to `true` and
+// upload a file containing multiple domain blocks, JSON-formatted, or you can leave import as
+// `false`, and just add one domain block.
//
// The format of the json file should be something like: `[{"domain":"example.org"},{"domain":"whatever.com","public_comment":"they smell"}]`
//
-// ---
-// tags:
-// - admin
+// ---
+// tags:
+// - admin
//
-// consumes:
-// - multipart/form-data
+// consumes:
+// - multipart/form-data
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: import
-// in: query
-// description: |-
-// Signal that a list of domain blocks is being imported as a file.
-// If set to true, then 'domains' must be present as a JSON-formatted file.
-// If set to false, then 'domains' will be ignored, and 'domain' must be present.
-// type: boolean
-// - name: domains
-// in: formData
-// description: |-
-// JSON-formatted list of domain blocks to import.
-// This is only used if `import` is set to true.
-// type: file
-// - name: domain
-// in: formData
-// description: |-
-// Single domain to block.
-// Used only if `import` is not true.
-// type: string
-// - name: obfuscate
-// in: formData
-// description: |-
-// Obfuscate the name of the domain when serving it publicly.
-// Eg., 'example.org' becomes something like 'ex***e.org'.
-// Used only if `import` is not true.
-// type: boolean
-// - name: public_comment
-// in: formData
-// description: |-
-// Public comment about this domain block.
-// Will be displayed alongside the domain block if you choose to share blocks.
-// Used only if `import` is not true.
-// type: string
-// - name: private_comment
-// in: formData
-// description: |-
-// Private comment about this domain block. Will only be shown to other admins, so this
-// is a useful way of internally keeping track of why a certain domain ended up blocked.
-// Used only if `import` is not true.
-// type: string
+// parameters:
+// -
+// name: import
+// in: query
+// description: >-
+// Signal that a list of domain blocks is being imported as a file.
+// If set to `true`, then 'domains' must be present as a JSON-formatted file.
+// If set to `false`, then `domains` will be ignored, and `domain` must be present.
+// type: boolean
+// default: false
+// -
+// name: domains
+// in: formData
+// description: >-
+// JSON-formatted list of domain blocks to import.
+// This is only used if `import` is set to `true`.
+// type: file
+// -
+// name: domain
+// in: formData
+// description: >-
+// Single domain to block.
+// Used only if `import` is not `true`.
+// type: string
+// -
+// name: obfuscate
+// in: formData
+// description: >-
+// Obfuscate the name of the domain when serving it publicly.
+// Eg., `example.org` becomes something like `ex***e.org`.
+// Used only if `import` is not `true`.
+// type: boolean
+// -
+// name: public_comment
+// in: formData
+// description: >-
+// Public comment about this domain block.
+// This will be displayed alongside the domain block if you choose to share blocks.
+// Used only if `import` is not `true`.
+// type: string
+// -
+// name: private_comment
+// in: formData
+// description: >-
+// Private comment about this domain block. Will only be shown to other admins, so this
+// is a useful way of internally keeping track of why a certain domain ended up blocked.
+// Used only if `import` is not `true`.
+// type: string
//
-// security:
-// - OAuth2 Bearer:
-// - admin
+// security:
+// - OAuth2 Bearer:
+// - admin
//
-// responses:
-// '200':
-// description: |-
-// The newly created domain block, if `import` != `true`.
-// Note that if a list has been imported, then an `array` of newly created domain blocks will be returned instead.
-// schema:
-// "$ref": "#/definitions/domainBlock"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: >-
+// The newly created domain block, if `import` != `true`.
+// If a list has been imported, then an `array` of newly created domain blocks will be returned instead.
+// schema:
+// "$ref": "#/definitions/domainBlock"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) DomainBlocksPOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/admin/domainblockdelete.go b/internal/api/client/admin/domainblockdelete.go
index aec1ba6df..6f3684418 100644
--- a/internal/api/client/admin/domainblockdelete.go
+++ b/internal/api/client/admin/domainblockdelete.go
@@ -33,41 +33,42 @@ import (
//
// Delete domain block with the given ID.
//
-// ---
-// tags:
-// - admin
+// ---
+// tags:
+// - admin
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: string
-// description: The id of the domain block.
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// type: string
+// description: The id of the domain block.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - admin
+// security:
+// - OAuth2 Bearer:
+// - admin
//
-// responses:
-// '200':
-// description: The domain block that was just deleted.
-// schema:
-// "$ref": "#/definitions/domainBlock"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: The domain block that was just deleted.
+// schema:
+// "$ref": "#/definitions/domainBlock"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) DomainBlockDELETEHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/admin/domainblockget.go b/internal/api/client/admin/domainblockget.go
index 1aeedce51..3d27b585e 100644
--- a/internal/api/client/admin/domainblockget.go
+++ b/internal/api/client/admin/domainblockget.go
@@ -34,41 +34,42 @@ import (
//
// View domain block with the given ID.
//
-// ---
-// tags:
-// - admin
+// ---
+// tags:
+// - admin
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: string
-// description: The id of the domain block.
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// type: string
+// description: The id of the domain block.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - admin
+// security:
+// - OAuth2 Bearer:
+// - admin
//
-// responses:
-// '200':
-// description: The requested domain block.
-// schema:
-// "$ref": "#/definitions/domainBlock"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: The requested domain block.
+// schema:
+// "$ref": "#/definitions/domainBlock"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) DomainBlockGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/admin/domainblocksget.go b/internal/api/client/admin/domainblocksget.go
index 93bd767c4..a4ab4ac1c 100644
--- a/internal/api/client/admin/domainblocksget.go
+++ b/internal/api/client/admin/domainblocksget.go
@@ -33,47 +33,48 @@ import (
//
// View all domain blocks currently in place.
//
-// ---
-// tags:
-// - admin
+// ---
+// tags:
+// - admin
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: export
-// type: boolean
-// description: |-
-// If set to true, then each entry in the returned list of domain blocks will only consist of
-// the fields 'domain' and 'public_comment'. This is perfect for when you want to save and share
-// a list of all the domains you have blocked on your instance, so that someone else can easily import them,
-// but you don't need them to see the database IDs of your blocks, or private comments etc.
-// in: query
-// required: false
+// parameters:
+// -
+// name: export
+// type: boolean
+// description: >-
+// If set to `true`, then each entry in the returned list of domain blocks will only consist of
+// the fields `domain` and `public_comment`. This is perfect for when you want to save and share
+// a list of all the domains you have blocked on your instance, so that someone else can easily import them,
+// but you don't want them to see the database IDs of your blocks, or private comments etc.
+// in: query
+// required: false
//
-// security:
-// - OAuth2 Bearer:
-// - admin
+// security:
+// - OAuth2 Bearer:
+// - admin
//
-// responses:
-// '200':
-// description: All domain blocks currently in place.
-// schema:
-// type: array
-// items:
-// "$ref": "#/definitions/domainBlock"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: All domain blocks currently in place.
+// schema:
+// type: array
+// items:
+// "$ref": "#/definitions/domainBlock"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) DomainBlocksGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/admin/emojicreate.go b/internal/api/client/admin/emojicreate.go
index eef49b2c7..b8dbfe43e 100644
--- a/internal/api/client/admin/emojicreate.go
+++ b/internal/api/client/admin/emojicreate.go
@@ -36,56 +36,58 @@ import (
//
// Upload and create a new instance emoji.
//
-// ---
-// tags:
-// - admin
+// ---
+// tags:
+// - admin
//
-// consumes:
-// - multipart/form-data
+// consumes:
+// - multipart/form-data
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: shortcode
-// in: formData
-// description: |-
-// The code to use for the emoji, which will be used by instance denizens to select it.
-// This must be unique on the instance.
-// type: string
-// pattern: \w{2,30}
-// required: true
-// - name: image
-// in: formData
-// description: |-
-// A png or gif image of the emoji. Animated pngs work too!
-// To ensure compatibility with other fedi implementations, emoji size limit is 50kb by default.
-// type: file
-// required: true
+// parameters:
+// -
+// name: shortcode
+// in: formData
+// description: >-
+// The code to use for the emoji, which will be used by instance denizens to select it.
+// This must be unique on the instance.
+// type: string
+// pattern: \w{2,30}
+// required: true
+// -
+// name: image
+// in: formData
+// description: >-
+// A png or gif image of the emoji. Animated pngs work too!
+// To ensure compatibility with other fedi implementations, emoji size limit is 50kb by default.
+// type: file
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - admin
+// security:
+// - OAuth2 Bearer:
+// - admin
//
-// responses:
-// '200':
-// description: The newly-created emoji.
-// schema:
-// "$ref": "#/definitions/emoji"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '409':
-// description: conflict -- domain/shortcode combo for emoji already exists
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: The newly-created emoji.
+// schema:
+// "$ref": "#/definitions/emoji"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '409':
+// description: conflict -- shortcode for this emoji is already in use
+// '500':
+// description: internal server error
func (m *Module) EmojiCreatePOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/admin/mediacleanup.go b/internal/api/client/admin/mediacleanup.go
index 44f0a1b52..157f35ab0 100644
--- a/internal/api/client/admin/mediacleanup.go
+++ b/internal/api/client/admin/mediacleanup.go
@@ -35,38 +35,39 @@ import (
// Clean up remote media older than the specified number of days.
// Also cleans up unused headers + avatars from the media cache.
//
-// ---
-// tags:
-// - admin
+// ---
+// tags:
+// - admin
//
-// consumes:
-// - application/json
-// - application/xml
-// - application/x-www-form-urlencoded
+// consumes:
+// - application/json
+// - application/xml
+// - application/x-www-form-urlencoded
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// security:
-// - OAuth2 Bearer:
-// - admin
+// security:
+// - OAuth2 Bearer:
+// - admin
//
-// responses:
-// '200':
-// description: |-
-// Echos the number of days requested. The cleanup is performed asynchronously after the request completes.
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: >-
+// Echos the number of days requested.
+// The cleanup is performed asynchronously after the request completes.
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) MediaCleanupPOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/app/appcreate.go b/internal/api/client/app/appcreate.go
index d402628de..641357d42 100644
--- a/internal/api/client/app/appcreate.go
+++ b/internal/api/client/app/appcreate.go
@@ -45,35 +45,35 @@ const (
// The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'.
// The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'.
//
-// ---
-// tags:
-// - apps
+// ---
+// tags:
+// - apps
//
-// consumes:
-// - application/json
-// - application/xml
-// - application/x-www-form-urlencoded
+// consumes:
+// - application/json
+// - application/xml
+// - application/x-www-form-urlencoded
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// responses:
-// '200':
-// description: "The newly-created application."
-// schema:
-// "$ref": "#/definitions/application"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: "The newly-created application."
+// schema:
+// "$ref": "#/definitions/application"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) AppsPOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, false, false, false, false)
if err != nil {
diff --git a/internal/api/client/blocks/blocksget.go b/internal/api/client/blocks/blocksget.go
index 8d3c51d82..a35e4548a 100644
--- a/internal/api/client/blocks/blocksget.go
+++ b/internal/api/client/blocks/blocksget.go
@@ -40,56 +40,59 @@ import (
// <https://example.org/api/v1/blocks?limit=80&max_id=01FC0SKA48HNSVR6YKZCQGS2V8>; rel="next", <https://example.org/api/v1/blocks?limit=80&min_id=01FC0SKW5JK2Q4EVAV2B462YY0>; rel="prev"
// ````
//
-// ---
-// tags:
-// - blocks
+// ---
+// tags:
+// - blocks
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: limit
-// type: integer
-// description: Number of blocks to return.
-// default: 20
-// in: query
-// - name: max_id
-// type: string
-// description: |-
-// Return only blocks *OLDER* than the given max block ID.
-// The block with the specified ID will not be included in the response.
-// in: query
-// - name: since_id
-// type: string
-// description: |-
-// Return only blocks *NEWER* than the given since block ID.
-// The block with the specified ID will not be included in the response.
-// in: query
+// parameters:
+// -
+// name: limit
+// type: integer
+// description: Number of blocks to return.
+// default: 20
+// in: query
+// -
+// name: max_id
+// type: string
+// description: >-
+// Return only blocks *OLDER* than the given block ID.
+// The block with the specified ID will not be included in the response.
+// in: query
+// -
+// name: since_id
+// type: string
+// description: >-
+// Return only blocks *NEWER* than the given block ID.
+// The block with the specified ID will not be included in the response.
+// in: query
//
-// security:
-// - OAuth2 Bearer:
-// - read:blocks
+// security:
+// - OAuth2 Bearer:
+// - read:blocks
//
-// responses:
-// '200':
-// headers:
-// Link:
-// type: string
-// description: Links to the next and previous queries.
-// schema:
-// type: array
-// items:
-// "$ref": "#/definitions/account"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// headers:
+// Link:
+// type: string
+// description: Links to the next and previous queries.
+// schema:
+// type: array
+// items:
+// "$ref": "#/definitions/account"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) BlocksGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/emoji/emojisget.go b/internal/api/client/emoji/emojisget.go
index c5a2ced63..d41e5e7df 100644
--- a/internal/api/client/emoji/emojisget.go
+++ b/internal/api/client/emoji/emojisget.go
@@ -13,30 +13,30 @@ import (
//
// Get an array of custom emojis available on the instance.
//
-// ---
-// tags:
-// - custom_emojis
+// ---
+// tags:
+// - custom_emojis
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// security:
-// - OAuth2 Bearer:
-// - read:custom_emojis
+// security:
+// - OAuth2 Bearer:
+// - read:custom_emojis
//
-// responses:
-// '200':
-// description: Array of custom emojis.
-// schema:
-// type: array
-// items:
-// "$ref": "#/definitions/emoji"
-// '401':
-// description: unauthorized
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: Array of custom emojis.
+// schema:
+// type: array
+// items:
+// "$ref": "#/definitions/emoji"
+// '401':
+// description: unauthorized
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) EmojisGETHandler(c *gin.Context) {
if _, err := oauth.Authed(c, true, true, true, true); err != nil {
api.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGet)
diff --git a/internal/api/client/favourites/favouritesget.go b/internal/api/client/favourites/favouritesget.go
index 31fd47c90..8ba20215d 100644
--- a/internal/api/client/favourites/favouritesget.go
+++ b/internal/api/client/favourites/favouritesget.go
@@ -11,7 +11,70 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/oauth"
)
-// FavouritesGETHandler handles GETting favourites.
+// FavouritesGETHandler swagger:operation GET /api/v1/favourites favouritesGet
+//
+// Get an array of statuses that the requesting account has favourited.
+//
+// The next and previous queries can be parsed from the returned Link header.
+// Example:
+//
+// ```
+// <https://example.org/api/v1/favourites?limit=80&max_id=01FC0SKA48HNSVR6YKZCQGS2V8>; rel="next", <https://example.org/api/v1/favourites?limit=80&min_id=01FC0SKW5JK2Q4EVAV2B462YY0>; rel="prev"
+// ````
+//
+// ---
+// tags:
+// - favourites
+//
+// produces:
+// - application/json
+//
+// parameters:
+// -
+// name: limit
+// type: integer
+// description: Number of statuses to return.
+// default: 20
+// in: query
+// -
+// name: max_id
+// type: string
+// description: >-
+// Return only favourited statuses *OLDER* than the given favourite ID.
+// The status with the corresponding fave ID will not be included in the response.
+// in: query
+// -
+// name: min_id
+// type: string
+// description: >-
+// Return only favourited statuses *NEWER* than the given favourite ID.
+// The status with the corresponding fave ID will not be included in the response.
+// in: query
+//
+// security:
+// - OAuth2 Bearer:
+// - read:favourites
+//
+// responses:
+// '200':
+// headers:
+// Link:
+// type: string
+// description: Links to the next and previous queries.
+// schema:
+// type: array
+// items:
+// "$ref": "#/definitions/status"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) FavouritesGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/followrequest/authorize.go b/internal/api/client/followrequest/authorize.go
index 528c39f2b..a5a392f76 100644
--- a/internal/api/client/followrequest/authorize.go
+++ b/internal/api/client/followrequest/authorize.go
@@ -34,40 +34,41 @@ import (
//
// Accept a follow request and put the requesting account in your 'followers' list.
//
-// ---
-// tags:
-// - follow_requests
+// ---
+// tags:
+// - follow_requests
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: account_id
-// type: string
-// description: ID of the account requesting to follow you.
-// in: path
-// required: true
+// parameters:
+// -
+// name: account_id
+// type: string
+// description: ID of the account requesting to follow you.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - write:follows
+// security:
+// - OAuth2 Bearer:
+// - write:follows
//
-// responses:
-// '200':
-// name: account relationship
-// description: Your relationship to this account.
-// schema:
-// "$ref": "#/definitions/accountRelationship"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// name: account relationship
+// description: Your relationship to this account.
+// schema:
+// "$ref": "#/definitions/accountRelationship"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) FollowRequestAuthorizePOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/followrequest/followrequest_test.go b/internal/api/client/followrequest/followrequest_test.go
index f9a14d261..44c9ef9ea 100644
--- a/internal/api/client/followrequest/followrequest_test.go
+++ b/internal/api/client/followrequest/followrequest_test.go
@@ -88,6 +88,8 @@ func (suite *FollowRequestStandardTestSuite) SetupTest() {
suite.followRequestModule = followrequest.New(suite.processor).(*followrequest.Module)
testrig.StandardDBSetup(suite.db, nil)
testrig.StandardStorageSetup(suite.storage, "../../../../testrig/media")
+
+ suite.NoError(suite.processor.Start())
}
func (suite *FollowRequestStandardTestSuite) TearDownTest() {
diff --git a/internal/api/client/followrequest/get.go b/internal/api/client/followrequest/get.go
index 5dd079ddb..8a2be3686 100644
--- a/internal/api/client/followrequest/get.go
+++ b/internal/api/client/followrequest/get.go
@@ -30,52 +30,47 @@ import (
// FollowRequestGETHandler swagger:operation GET /api/v1/follow_requests getFollowRequests
//
// Get an array of accounts that have requested to follow you.
+// Accounts will be sorted in order of follow request date descending (newest first).
//
-// The next and previous queries can be parsed from the returned Link header.
-// Example:
+// ---
+// tags:
+// - follow_requests
//
-// ```
-// <https://example.org/api/v1/follow_requests?limit=80&max_id=01FC0SKA48HNSVR6YKZCQGS2V8>; rel="next", <https://example.org/api/v1/follow_requests?limit=80&min_id=01FC0SKW5JK2Q4EVAV2B462YY0>; rel="prev"
-// ````
+// produces:
+// - application/json
//
-// ---
-// tags:
-// - follow_requests
+// parameters:
+// -
+// name: limit
+// type: integer
+// description: Number of accounts to return.
+// default: 40
+// in: query
//
-// produces:
-// - application/json
+// security:
+// - OAuth2 Bearer:
+// - read:follows
//
-// parameters:
-// - name: limit
-// type: integer
-// description: Number of accounts to return.
-// default: 40
-// in: query
-//
-// security:
-// - OAuth2 Bearer:
-// - read:follows
-//
-// responses:
-// '200':
-// headers:
-// Link:
-// type: string
-// description: Links to the next and previous queries.
-// schema:
-// type: array
-// items:
-// "$ref": "#/definitions/account"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// headers:
+// Link:
+// type: string
+// description: Links to the next and previous queries.
+// schema:
+// type: array
+// items:
+// "$ref": "#/definitions/account"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) FollowRequestGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/followrequest/reject.go b/internal/api/client/followrequest/reject.go
index c29ccbf5d..717dbf4dd 100644
--- a/internal/api/client/followrequest/reject.go
+++ b/internal/api/client/followrequest/reject.go
@@ -32,40 +32,41 @@ import (
//
// Reject/deny follow request from the given account ID.
//
-// ---
-// tags:
-// - follow_requests
+// ---
+// tags:
+// - follow_requests
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: account_id
-// type: string
-// description: ID of the account requesting to follow you.
-// in: path
-// required: true
+// parameters:
+// -
+// name: account_id
+// type: string
+// description: ID of the account requesting to follow you.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - write:follows
+// security:
+// - OAuth2 Bearer:
+// - write:follows
//
-// responses:
-// '200':
-// name: account relationship
-// description: Your relationship to this account.
-// schema:
-// "$ref": "#/definitions/accountRelationship"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// name: account relationship
+// description: Your relationship to this account.
+// schema:
+// "$ref": "#/definitions/accountRelationship"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) FollowRequestRejectPOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/instance/instanceget.go b/internal/api/client/instance/instanceget.go
index 5250b3b46..bcedf398b 100644
--- a/internal/api/client/instance/instanceget.go
+++ b/internal/api/client/instance/instanceget.go
@@ -32,26 +32,22 @@ import (
//
// View instance information.
//
-// This is mostly provided for Mastodon application compatibility, since many apps that work with Mastodon use `/api/v1/instance` to inform their connection parameters.
+// ---
+// tags:
+// - instance
//
-// However, it can also be used by other instances for gathering instance information and representing instances in some UI or other.
+// produces:
+// - application/json
//
-// ---
-// tags:
-// - instance
-//
-// produces:
-// - application/json
-//
-// responses:
-// '200':
-// description: "Instance information."
-// schema:
-// "$ref": "#/definitions/instance"
-// '406':
-// description: not acceptable
-// '500':
-// description: internal error
+// responses:
+// '200':
+// description: "Instance information."
+// schema:
+// "$ref": "#/definitions/instance"
+// '406':
+// description: not acceptable
+// '500':
+// description: internal error
func (m *Module) InstanceInformationGETHandler(c *gin.Context) {
if _, err := api.NegotiateAccept(c, api.JSONAcceptHeaders...); err != nil {
api.ErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGet)
diff --git a/internal/api/client/instance/instancepatch.go b/internal/api/client/instance/instancepatch.go
index 78d0af046..080327852 100644
--- a/internal/api/client/instance/instancepatch.go
+++ b/internal/api/client/instance/instancepatch.go
@@ -35,83 +35,91 @@ import (
//
// This requires admin permissions on the instance.
//
-// ---
-// tags:
-// - instance
+// ---
+// tags:
+// - instance
//
-// consumes:
-// - multipart/form-data
+// consumes:
+// - multipart/form-data
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: title
-// in: formData
-// description: Title to use for the instance.
-// type: string
-// maximum: 40
-// allowEmptyValue: true
-// - name: contact_username
-// in: formData
-// description: |-
-// Username of the contact account.
-// This must be the username of an instance admin.
-// type: string
-// allowEmptyValue: true
-// - name: contact_email
-// in: formData
-// description: Email address to use as the instance contact.
-// type: string
-// allowEmptyValue: true
-// - name: short_description
-// in: formData
-// description: Short description of the instance.
-// type: string
-// maximum: 500
-// allowEmptyValue: true
-// - name: description
-// in: formData
-// description: Longer description of the instance.
-// type: string
-// maximum: 5000
-// allowEmptyValue: true
-// - name: terms
-// in: formData
-// description: Terms and conditions of the instance.
-// type: string
-// maximum: 5000
-// allowEmptyValue: true
-// - name: avatar
-// in: formData
-// description: Avatar of the instance.
-// type: file
-// - name: header
-// in: formData
-// description: Header of the instance.
-// type: file
+// parameters:
+// -
+// name: title
+// in: formData
+// description: Title to use for the instance.
+// type: string
+// maximum: 40
+// allowEmptyValue: true
+// -
+// name: contact_username
+// in: formData
+// description: >-
+// Username of the contact account.
+// This must be the username of an instance admin.
+// type: string
+// allowEmptyValue: true
+// -
+// name: contact_email
+// in: formData
+// description: Email address to use as the instance contact.
+// type: string
+// allowEmptyValue: true
+// -
+// name: short_description
+// in: formData
+// description: Short description of the instance.
+// type: string
+// maximum: 500
+// allowEmptyValue: true
+// -
+// name: description
+// in: formData
+// description: Longer description of the instance.
+// type: string
+// maximum: 5000
+// allowEmptyValue: true
+// -
+// name: terms
+// in: formData
+// description: Terms and conditions of the instance.
+// type: string
+// maximum: 5000
+// allowEmptyValue: true
+// -
+// name: avatar
+// in: formData
+// description: Avatar of the instance.
+// type: file
+// -
+// name: header
+// in: formData
+// description: Header of the instance.
+// type: file
//
-// security:
-// - OAuth2 Bearer:
-// - admin
+// security:
+// - OAuth2 Bearer:
+// - admin
//
-// responses:
-// '200':
-// description: "The newly updated instance."
-// schema:
-// "$ref": "#/definitions/instance"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: "The newly updated instance."
+// schema:
+// "$ref": "#/definitions/instance"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) InstanceUpdatePATCHHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/instance/instancepeersget.go b/internal/api/client/instance/instancepeersget.go
index d4d33d5bf..f7d05acdc 100644
--- a/internal/api/client/instance/instancepeersget.go
+++ b/internal/api/client/instance/instancepeersget.go
@@ -32,62 +32,72 @@ import (
// InstancePeersGETHandler swagger:operation GET /api/v1/instance/peers instancePeersGet
//
-// ---
-// tags:
-// - instance
+// ---
+// tags:
+// - instance
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: filter
-// type: string
-// description: |-
-// Comma-separated list of filters to apply to results. Recognized values are:
-// 'open' -- include peers that are not suspended or silenced
-// 'suspended' -- include peers that have been suspended.
-// If filter is 'open', only instances that haven't been suspended or silenced will be returned.
-// If filter is 'suspended', only suspended instances will be shown.
-// If filter is 'open,suspended', then all known instances will be returned.
-// If filter is an empty string or not set, then 'open' will be assumed as the default.
-// in: query
-// required: false
+// parameters:
+// -
+// name: filter
+// type: string
+// description: |-
+// Comma-separated list of filters to apply to results. Recognized filters are:
+// - `open` -- include peers that are not suspended or silenced
+// - `suspended` -- include peers that have been suspended.
//
-// responses:
-// '200':
-// description: |-
-// If no filter parameter is provided, or filter is empty, then a legacy,
-// Mastodon-API compatible response will be returned. This will consist of
-// just a 'flat' array of strings like `["example.com", "example.org"]`.
+// If filter is `open`, only instances that haven't been suspended or silenced will be returned.
//
-// If a filter parameter is provided, then an array of objects with at least
-// a `domain` key set on each object will be returned.
+// If filter is `suspended`, only suspended instances will be shown.
//
-// Domains that are silenced or suspended will also have a key
-// 'suspended_at' or 'silenced_at' that contains an iso8601 date string.
-// If one of these keys is not present on the domain object, it is open.
-// Suspended instances may in some cases be obfuscated, which means they
-// will have some letters replaced by '*' to make it more difficult for
-// bad actors to target instances with harassment.
+// If filter is `open,suspended`, then all known instances will be returned.
//
-// Whether a flat response or a more detailed response is returned, domains
-// will be sorted alphabetically by hostname.
-// schema:
-// type: array
-// items:
-// "$ref": "#/definitions/domain"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// If filter is an empty string or not set, then `open` will be assumed as the default.
+// in: query
+// required: false
+// default: "open"
+//
+// responses:
+// '200':
+// description: >-
+// If no filter parameter is provided, or filter is empty, then a legacy,
+// Mastodon-API compatible response will be returned. This will consist of
+// just a 'flat' array of strings like `["example.com", "example.org"]`,
+// which corresponds to domains this instance peers with.
+//
+//
+// If a filter parameter is provided, then an array of objects with at least
+// a `domain` key set on each object will be returned.
+//
+//
+// Domains that are silenced or suspended will also have a key
+// `suspended_at` or `silenced_at` that contains an iso8601 date string.
+// If one of these keys is not present on the domain object, it is open.
+// Suspended instances may in some cases be obfuscated, which means they
+// will have some letters replaced by `*` to make it more difficult for
+// bad actors to target instances with harassment.
+//
+//
+// Whether a flat response or a more detailed response is returned, domains
+// will be sorted alphabetically by hostname.
+// schema:
+// type: array
+// items:
+// "$ref": "#/definitions/domain"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) InstancePeersGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, false, false, false, false)
if err != nil {
diff --git a/internal/api/client/media/mediacreate.go b/internal/api/client/media/mediacreate.go
index 5a040b26c..62f4a0d4e 100644
--- a/internal/api/client/media/mediacreate.go
+++ b/internal/api/client/media/mediacreate.go
@@ -35,59 +35,64 @@ import (
//
// Upload a new media attachment.
//
-// ---
-// tags:
-// - media
+// ---
+// tags:
+// - media
//
-// consumes:
-// - multipart/form-data
+// consumes:
+// - multipart/form-data
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: api version
-// type: string
-// in: path
-// description: Version of the API to use. Must be one of v1 or v2.
-// required: true
-// - name: description
-// in: formData
-// description: |-
-// Image or media description to use as alt-text on the attachment.
-// This is very useful for users of screenreaders.
-// May or may not be required, depending on your instance settings.
-// type: string
-// - name: focus
-// in: formData
-// description: |-
-// Focus of the media file.
-// If present, it should be in the form of two comma-separated floats between -1 and 1.
-// For example: `-0.5,0.25`.
-// type: string
-// - name: file
-// in: formData
-// description: The media attachment to upload.
-// type: file
-// required: true
+// parameters:
+// -
+// name: api_version
+// type: string
+// in: path
+// description: Version of the API to use. Must be either `v1` or `v2`.
+// required: true
+// -
+// name: description
+// in: formData
+// description: >-
+// Image or media description to use as alt-text on the attachment.
+// This is very useful for users of screenreaders!
+// May or may not be required, depending on your instance settings.
+// type: string
+// -
+// name: focus
+// in: formData
+// description: >-
+// Focus of the media file.
+// If present, it should be in the form of two comma-separated floats between -1 and 1.
+// For example: `-0.5,0.25`.
+// type: string
+// default: "0,0"
+// -
+// name: file
+// in: formData
+// description: The media attachment to upload.
+// type: file
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - write:media
+// security:
+// - OAuth2 Bearer:
+// - write:media
//
-// responses:
-// '200':
-// description: The newly-created media attachment.
-// schema:
-// "$ref": "#/definitions/attachment"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '422':
-// description: unprocessable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: The newly-created media attachment.
+// schema:
+// "$ref": "#/definitions/attachment"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '422':
+// description: unprocessable
+// '500':
+// description: internal server error
func (m *Module) MediaCreatePOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/media/mediaget.go b/internal/api/client/media/mediaget.go
index c2a0ab7a0..fd232c4c7 100644
--- a/internal/api/client/media/mediaget.go
+++ b/internal/api/client/media/mediaget.go
@@ -32,39 +32,40 @@ import (
//
// Get a media attachment that you own.
//
-// ---
-// tags:
-// - media
+// ---
+// tags:
+// - media
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// description: id of the attachment
-// type: string
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// description: id of the attachment
+// type: string
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - read:media
+// security:
+// - OAuth2 Bearer:
+// - read:media
//
-// responses:
-// '200':
-// description: The requested media attachment.
-// schema:
-// "$ref": "#/definitions/attachment"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: The requested media attachment.
+// schema:
+// "$ref": "#/definitions/attachment"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) MediaGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/media/mediaupdate.go b/internal/api/client/media/mediaupdate.go
index 32aef9cff..fb0e67ddc 100644
--- a/internal/api/client/media/mediaupdate.go
+++ b/internal/api/client/media/mediaupdate.go
@@ -40,60 +40,64 @@ import (
// The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'.
// The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'.
//
-// ---
-// tags:
-// - media
+// ---
+// tags:
+// - media
//
-// consumes:
-// - application/json
-// - application/xml
-// - application/x-www-form-urlencoded
+// consumes:
+// - application/json
+// - application/xml
+// - application/x-www-form-urlencoded
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// description: id of the attachment to update
-// type: string
-// in: path
-// required: true
-// - name: description
-// in: formData
-// description: |-
-// Image or media description to use as alt-text on the attachment.
-// This is very useful for users of screenreaders.
-// May or may not be required, depending on your instance settings.
-// type: string
-// allowEmptyValue: true
-// - name: focus
-// in: formData
-// description: |-
-// Focus of the media file.
-// If present, it should be in the form of two comma-separated floats between -1 and 1.
-// For example: `-0.5,0.25`.
-// type: string
-// allowEmptyValue: true
+// parameters:
+// -
+// name: id
+// description: id of the attachment to update
+// type: string
+// in: path
+// required: true
+// -
+// name: description
+// in: formData
+// description: >-
+// Image or media description to use as alt-text on the attachment.
+// This is very useful for users of screenreaders!
+// May or may not be required, depending on your instance settings.
+// type: string
+// allowEmptyValue: true
+// -
+// name: focus
+// in: formData
+// description: >-
+// Focus of the media file.
+// If present, it should be in the form of two comma-separated floats between -1 and 1.
+// For example: `-0.5,0.25`.
+// type: string
+// allowEmptyValue: true
+// default: "0,0"
//
-// security:
-// - OAuth2 Bearer:
-// - write:media
+// security:
+// - OAuth2 Bearer:
+// - write:media
//
-// responses:
-// '200':
-// description: The newly-updated media attachment.
-// schema:
-// "$ref": "#/definitions/attachment"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: The newly-updated media attachment.
+// schema:
+// "$ref": "#/definitions/attachment"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) MediaPUTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/notification/notificationsclear.go b/internal/api/client/notification/notificationsclear.go
index bcf7175d7..b97371638 100644
--- a/internal/api/client/notification/notificationsclear.go
+++ b/internal/api/client/notification/notificationsclear.go
@@ -27,7 +27,37 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/oauth"
)
-// NotificationsClearPOSTHandler clears all the notifications
+// NotificationsClearPOSTHandler swagger:operation POST /api/v1/notifications clearNotifications
+//
+// Clear/delete all notifications for currently authorized user.
+//
+// Will return an empty object `{}` to indicate success.
+//
+// ---
+// tags:
+// - notifications
+//
+// produces:
+// - application/json
+//
+// security:
+// - OAuth2 Bearer:
+// - read:notifications
+//
+// responses:
+// '200':
+// schema:
+// type: object
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) NotificationsClearPOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/notification/notificationsget.go b/internal/api/client/notification/notificationsget.go
index 88c2f663b..94ea6dbd9 100644
--- a/internal/api/client/notification/notificationsget.go
+++ b/internal/api/client/notification/notificationsget.go
@@ -35,64 +35,79 @@ import (
//
// The notifications will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer).
//
-// ---
-// tags:
-// - notifications
+// The next and previous queries can be parsed from the returned Link header.
+// Example:
//
-// produces:
-// - application/json
+// ```
+// <https://example.org/api/v1/notifications?limit=80&max_id=01FC0SKA48HNSVR6YKZCQGS2V8>; rel="next", <https://example.org/api/v1/notifications?limit=80&since_id=01FC0SKW5JK2Q4EVAV2B462YY0>; rel="prev"
+// ````
//
-// parameters:
-// - name: limit
-// type: integer
-// description: Number of notifications to return.
-// default: 20
-// in: query
-// required: false
-// - name: exclude_types
-// type: array
-// items:
-// type: string
-// description: Array of types of notifications to exclude (follow, favourite, reblog, mention, poll, follow_request)
-// in: query
-// required: false
-// - name: max_id
-// type: string
-// description: |-
-// Return only notifications *OLDER* than the given max status ID.
-// The status with the specified ID will not be included in the response.
-// in: query
-// required: false
-// - name: since_id
-// type: string
-// description: |-
-// Return only notifications *NEWER* than the given since status ID.
-// The status with the specified ID will not be included in the response.
-// in: query
-// required: false
+// ---
+// tags:
+// - notifications
//
-// security:
-// - OAuth2 Bearer:
-// - read:notifications
+// produces:
+// - application/json
//
-// responses:
-// '200':
-// name: notifications
-// description: Array of notifications.
-// schema:
-// type: array
-// items:
-// "$ref": "#/definitions/notification"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// parameters:
+// -
+// name: limit
+// type: integer
+// description: Number of notifications to return.
+// default: 20
+// in: query
+// required: false
+// -
+// name: exclude_types
+// type: array
+// items:
+// type: string
+// description: Array of types of notifications to exclude (follow, favourite, reblog, mention, poll, follow_request)
+// in: query
+// required: false
+// -
+// name: max_id
+// type: string
+// description: >-
+// Return only notifications *OLDER* than the given max status ID.
+// The status with the specified ID will not be included in the response.
+// in: query
+// required: false
+// -
+// name: since_id
+// type: string
+// description: |-
+// Return only notifications *NEWER* than the given since status ID.
+// The status with the specified ID will not be included in the response.
+// in: query
+// required: false
+//
+// security:
+// - OAuth2 Bearer:
+// - read:notifications
+//
+// responses:
+// '200':
+// headers:
+// Link:
+// type: string
+// description: Links to the next and previous queries.
+// name: notifications
+// description: Array of notifications.
+// schema:
+// type: array
+// items:
+// "$ref": "#/definitions/notification"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) NotificationsGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/search/searchget.go b/internal/api/client/search/searchget.go
index 8db49ebfd..b3da2640d 100644
--- a/internal/api/client/search/searchget.go
+++ b/internal/api/client/search/searchget.go
@@ -37,32 +37,32 @@ import (
//
// If statuses are in the result, they will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer).
//
-// ---
-// tags:
-// - search
+// ---
+// tags:
+// - search
//
-// security:
-// - OAuth2 Bearer:
-// - read:search
+// security:
+// - OAuth2 Bearer:
+// - read:search
//
-// responses:
-// '200':
-// name: search results
-// description: Results of the search.
-// schema:
-// type: array
-// items:
-// "$ref": "#/definitions/searchResult"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// name: search results
+// description: Results of the search.
+// schema:
+// type: array
+// items:
+// "$ref": "#/definitions/searchResult"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) SearchGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/status/status_test.go b/internal/api/client/status/status_test.go
index ad6901d9d..def13a23a 100644
--- a/internal/api/client/status/status_test.go
+++ b/internal/api/client/status/status_test.go
@@ -88,6 +88,8 @@ func (suite *StatusStandardTestSuite) SetupTest() {
suite.emailSender = testrig.NewEmailSender("../../../../web/template/", nil)
suite.processor = testrig.NewTestProcessor(suite.db, suite.storage, suite.federator, suite.emailSender, suite.mediaManager, clientWorker, fedWorker)
suite.statusModule = status.New(suite.processor).(*status.Module)
+
+ suite.NoError(suite.processor.Start())
}
func (suite *StatusStandardTestSuite) TearDownTest() {
diff --git a/internal/api/client/status/statusboost.go b/internal/api/client/status/statusboost.go
index 0642ad92e..d43bedd6c 100644
--- a/internal/api/client/status/statusboost.go
+++ b/internal/api/client/status/statusboost.go
@@ -33,44 +33,45 @@ import (
// Reblog/boost status with the given ID.
//
// If the target status is rebloggable/boostable, it will be shared with your followers.
-// This is equivalent to an activitypub 'announce' activity.
+// This is equivalent to an ActivityPub 'Announce' activity.
//
-// ---
-// tags:
-// - statuses
+// ---
+// tags:
+// - statuses
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: string
-// description: Target status ID.
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// type: string
+// description: Target status ID.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - write:statuses
+// security:
+// - OAuth2 Bearer:
+// - write:statuses
//
-// responses:
-// '200':
-// name: status
-// description: The boost of the status.
-// schema:
-// "$ref": "#/definitions/status"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// name: status
+// description: The boost of the status.
+// schema:
+// "$ref": "#/definitions/status"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) StatusBoostPOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/status/statusboostedby.go b/internal/api/client/status/statusboostedby.go
index fbe447bf4..883f07fac 100644
--- a/internal/api/client/status/statusboostedby.go
+++ b/internal/api/client/status/statusboostedby.go
@@ -32,38 +32,39 @@ import (
//
// View accounts that have reblogged/boosted the target status.
//
-// ---
-// tags:
-// - statuses
+// ---
+// tags:
+// - statuses
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: string
-// description: Target status ID.
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// type: string
+// description: Target status ID.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - read:accounts
+// security:
+// - OAuth2 Bearer:
+// - read:accounts
//
-// responses:
-// '200':
-// schema:
-// type: array
-// items:
-// "$ref": "#/definitions/account"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
+// responses:
+// '200':
+// schema:
+// type: array
+// items:
+// "$ref": "#/definitions/account"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
func (m *Module) StatusBoostedByGETHandler(c *gin.Context) {
l := log.WithFields(kv.Fields{
diff --git a/internal/api/client/status/statuscontext.go b/internal/api/client/status/statuscontext.go
index 0daefaec1..632a151d5 100644
--- a/internal/api/client/status/statuscontext.go
+++ b/internal/api/client/status/statuscontext.go
@@ -34,42 +34,43 @@ import (
//
// The returned statuses will be ordered in a thread structure, so they are suitable to be displayed in the order in which they were returned.
//
-// ---
-// tags:
-// - statuses
+// ---
+// tags:
+// - statuses
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: string
-// description: Target status ID.
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// type: string
+// description: Target status ID.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - read:statuses
+// security:
+// - OAuth2 Bearer:
+// - read:statuses
//
-// responses:
-// '200':
-// name: statuses
-// description: Status context object.
-// schema:
-// "$ref": "#/definitions/statusContext"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// name: statuses
+// description: Status context object.
+// schema:
+// "$ref": "#/definitions/statusContext"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) StatusContextGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/status/statuscreate.go b/internal/api/client/status/statuscreate.go
index 4218c9d48..13aa5d173 100644
--- a/internal/api/client/status/statuscreate.go
+++ b/internal/api/client/status/statuscreate.go
@@ -39,39 +39,39 @@ import (
// The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'.
// The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'.
//
-// ---
-// tags:
-// - statuses
+// ---
+// tags:
+// - statuses
//
-// consumes:
-// - application/json
-// - application/xml
-// - application/x-www-form-urlencoded
+// consumes:
+// - application/json
+// - application/xml
+// - application/x-www-form-urlencoded
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// security:
-// - OAuth2 Bearer:
-// - write:statuses
+// security:
+// - OAuth2 Bearer:
+// - write:statuses
//
-// responses:
-// '200':
-// description: "The newly created status."
-// schema:
-// "$ref": "#/definitions/status"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: "The newly created status."
+// schema:
+// "$ref": "#/definitions/status"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) StatusCreatePOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/status/statusdelete.go b/internal/api/client/status/statusdelete.go
index f9adccb57..b37dd5f14 100644
--- a/internal/api/client/status/statusdelete.go
+++ b/internal/api/client/status/statusdelete.go
@@ -35,41 +35,42 @@ import (
// The deleted status will be returned in the response. The `text` field will contain the original text of the status as it was submitted.
// This is useful when doing a 'delete and redraft' type operation.
//
-// ---
-// tags:
-// - statuses
+// ---
+// tags:
+// - statuses
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: string
-// description: Target status ID.
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// type: string
+// description: Target status ID.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - write:statuses
+// security:
+// - OAuth2 Bearer:
+// - write:statuses
//
-// responses:
-// '200':
-// description: "The newly deleted status."
-// schema:
-// "$ref": "#/definitions/status"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: "The status that was just deleted."
+// schema:
+// "$ref": "#/definitions/status"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) StatusDELETEHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/status/statusfave.go b/internal/api/client/status/statusfave.go
index 29f74316a..3117e7ef2 100644
--- a/internal/api/client/status/statusfave.go
+++ b/internal/api/client/status/statusfave.go
@@ -32,41 +32,42 @@ import (
//
// Star/like/favourite the given status, if permitted.
//
-// ---
-// tags:
-// - statuses
+// ---
+// tags:
+// - statuses
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: string
-// description: Target status ID.
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// type: string
+// description: Target status ID.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - write:statuses
+// security:
+// - OAuth2 Bearer:
+// - write:statuses
//
-// responses:
-// '200':
-// description: "The newly faved status."
-// schema:
-// "$ref": "#/definitions/status"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: "The newly faved status."
+// schema:
+// "$ref": "#/definitions/status"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) StatusFavePOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/status/statusfavedby.go b/internal/api/client/status/statusfavedby.go
index 579df6432..20ef86ded 100644
--- a/internal/api/client/status/statusfavedby.go
+++ b/internal/api/client/status/statusfavedby.go
@@ -32,42 +32,43 @@ import (
//
// View accounts that have faved/starred/liked the target status.
//
-// ---
-// tags:
-// - statuses
+// ---
+// tags:
+// - statuses
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: string
-// description: Target status ID.
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// type: string
+// description: Target status ID.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - read:accounts
+// security:
+// - OAuth2 Bearer:
+// - read:accounts
//
-// responses:
-// '200':
-// schema:
-// type: array
-// items:
-// "$ref": "#/definitions/account"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// schema:
+// type: array
+// items:
+// "$ref": "#/definitions/account"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) StatusFavedByGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/status/statusget.go b/internal/api/client/status/statusget.go
index 9a8b406dc..a0d0e913c 100644
--- a/internal/api/client/status/statusget.go
+++ b/internal/api/client/status/statusget.go
@@ -32,41 +32,42 @@ import (
//
// View status with the given ID.
//
-// ---
-// tags:
-// - statuses
+// ---
+// tags:
+// - statuses
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: string
-// description: Target status ID.
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// type: string
+// description: Target status ID.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - read:statuses
+// security:
+// - OAuth2 Bearer:
+// - read:statuses
//
-// responses:
-// '200':
-// description: "The requested created status."
-// schema:
-// "$ref": "#/definitions/status"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: "The requested status."
+// schema:
+// "$ref": "#/definitions/status"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) StatusGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/status/statusunboost.go b/internal/api/client/status/statusunboost.go
index b3e921bb7..45a8e0ece 100644
--- a/internal/api/client/status/statusunboost.go
+++ b/internal/api/client/status/statusunboost.go
@@ -32,42 +32,43 @@ import (
//
// Unreblog/unboost status with the given ID.
//
-// ---
-// tags:
-// - statuses
+// ---
+// tags:
+// - statuses
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: string
-// description: Target status ID.
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// type: string
+// description: Target status ID.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - write:statuses
+// security:
+// - OAuth2 Bearer:
+// - write:statuses
//
-// responses:
-// '200':
-// name: status
-// description: The unboosted status.
-// schema:
-// "$ref": "#/definitions/status"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// name: status
+// description: The unboosted status.
+// schema:
+// "$ref": "#/definitions/status"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) StatusUnboostPOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/status/statusunfave.go b/internal/api/client/status/statusunfave.go
index 19f217160..19d3da3bd 100644
--- a/internal/api/client/status/statusunfave.go
+++ b/internal/api/client/status/statusunfave.go
@@ -32,41 +32,42 @@ import (
//
// Unstar/unlike/unfavourite the given status.
//
-// ---
-// tags:
-// - statuses
+// ---
+// tags:
+// - statuses
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// type: string
-// description: Target status ID.
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// type: string
+// description: Target status ID.
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - write:statuses
+// security:
+// - OAuth2 Bearer:
+// - write:statuses
//
-// responses:
-// '200':
-// description: "The unfaved status."
-// schema:
-// "$ref": "#/definitions/status"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
-// '406':
-// description: not acceptable
-// '500':
-// description: internal server error
+// responses:
+// '200':
+// description: "The unfaved status."
+// schema:
+// "$ref": "#/definitions/status"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
+// '406':
+// description: not acceptable
+// '500':
+// description: internal server error
func (m *Module) StatusUnfavePOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/streaming/stream.go b/internal/api/client/streaming/stream.go
index 7e2922acf..a406de74b 100644
--- a/internal/api/client/streaming/stream.go
+++ b/internal/api/client/streaming/stream.go
@@ -35,89 +35,92 @@ var wsUpgrader = websocket.Upgrader{
//
// If the ping fails, or something else goes wrong during transmission, then the connection will be dropped, and the client will be expected to start it again.
//
-// ---
-// tags:
-// - streaming
-//
-// produces:
-// - application/json
-//
-// schemes:
-// - wss
-//
-// parameters:
-// - name: access_token
-// type: string
-// description: Access token for the requesting account.
-// in: query
-// required: true
-// - name: stream
-// type: string
-// description: |-
-// Type of stream to request.
-//
-// Options are:
-//
-// `user`: receive updates for the account's home timeline.
-// `public`: receive updates for the public timeline.
-// `public:local`: receive updates for the local timeline.
-// `hashtag`: receive updates for a given hashtag.
-// `hashtag:local`: receive local updates for a given hashtag.
-// `list`: receive updates for a certain list of accounts.
-// `direct`: receive updates for direct messages.
-// in: query
-// required: true
-// security:
-// - OAuth2 Bearer:
-// - read:streaming
-//
-// responses:
-// '101':
-// schema:
-// type: object
-// properties:
-// stream:
-// type: array
-// items:
-// type: string
-// enum:
-// - user
-// - public
-// - public:local
-// - hashtag
-// - hashtag:local
-// - list
-// - direct
-// event:
-// description: |-
-// The type of event being received.
-//
-// `update`: a new status has been received.
-// `notification`: a new notification has been received.
-// `delete`: a status has been deleted.
-// `filters_changed`: not implemented.
-// type: string
-// enum:
-// - update
-// - notification
-// - delete
-// - filters_changed
-// payload:
-// description: |-
-// The payload of the streamed message.
-// Different depending on the `event` type.
-//
-// If present, it should be parsed as a string.
-//
-// If `event` = `update`, then the payload will be a JSON string of a status.
-// If `event` = `notification`, then the payload will be a JSON string of a notification.
-// If `event` = `delete`, then the payload will be a status ID.
-// type: string
-// example: "{\"id\":\"01FC3TZ5CFG6H65GCKCJRKA669\",\"created_at\":\"2021-08-02T16:25:52Z\",\"sensitive\":false,\"spoiler_text\":\"\",\"visibility\":\"public\",\"language\":\"en\",\"uri\":\"https://gts.superseriousbusiness.org/users/dumpsterqueer/statuses/01FC3TZ5CFG6H65GCKCJRKA669\",\"url\":\"https://gts.superseriousbusiness.org/@dumpsterqueer/statuses/01FC3TZ5CFG6H65GCKCJRKA669\",\"replies_count\":0,\"reblogs_count\":0,\"favourites_count\":0,\"favourited\":false,\"reblogged\":false,\"muted\":false,\"bookmarked\":fals…//gts.superseriousbusiness.org/fileserver/01JNN207W98SGG3CBJ76R5MVDN/header/original/019036W043D8FXPJKSKCX7G965.png\",\"header_static\":\"https://gts.superseriousbusiness.org/fileserver/01JNN207W98SGG3CBJ76R5MVDN/header/small/019036W043D8FXPJKSKCX7G965.png\",\"followers_count\":33,\"following_count\":28,\"statuses_count\":126,\"last_status_at\":\"2021-08-02T16:25:52Z\",\"emojis\":[],\"fields\":[]},\"media_attachments\":[],\"mentions\":[],\"tags\":[],\"emojis\":[],\"card\":null,\"poll\":null,\"text\":\"a\"}"
-// '401':
-// description: unauthorized
-// '400':
-// description: bad request
+// ---
+// tags:
+// - streaming
+//
+// produces:
+// - application/json
+//
+// schemes:
+// - wss
+//
+// parameters:
+// -
+// name: access_token
+// type: string
+// description: Access token for the requesting account.
+// in: query
+// required: true
+// -
+// name: stream
+// type: string
+// description: |-
+// Type of stream to request.
+//
+// Options are:
+//
+// `user`: receive updates for the account's home timeline.
+// `public`: receive updates for the public timeline.
+// `public:local`: receive updates for the local timeline.
+// `hashtag`: receive updates for a given hashtag.
+// `hashtag:local`: receive local updates for a given hashtag.
+// `list`: receive updates for a certain list of accounts.
+// `direct`: receive updates for direct messages.
+// in: query
+// required: true
+//
+// security:
+// - OAuth2 Bearer:
+// - read:streaming
+//
+// responses:
+// '101':
+// schema:
+// type: object
+// properties:
+// stream:
+// type: array
+// items:
+// type: string
+// enum:
+// - user
+// - public
+// - public:local
+// - hashtag
+// - hashtag:local
+// - list
+// - direct
+// event:
+// description: |-
+// The type of event being received.
+//
+// `update`: a new status has been received.
+// `notification`: a new notification has been received.
+// `delete`: a status has been deleted.
+// `filters_changed`: not implemented.
+// type: string
+// enum:
+// - update
+// - notification
+// - delete
+// - filters_changed
+// payload:
+// description: |-
+// The payload of the streamed message.
+// Different depending on the `event` type.
+//
+// If present, it should be parsed as a string.
+//
+// If `event` = `update`, then the payload will be a JSON string of a status.
+// If `event` = `notification`, then the payload will be a JSON string of a notification.
+// If `event` = `delete`, then the payload will be a status ID.
+// type: string
+// example: "{\"id\":\"01FC3TZ5CFG6H65GCKCJRKA669\",\"created_at\":\"2021-08-02T16:25:52Z\",\"sensitive\":false,\"spoiler_text\":\"\",\"visibility\":\"public\",\"language\":\"en\",\"uri\":\"https://gts.superseriousbusiness.org/users/dumpsterqueer/statuses/01FC3TZ5CFG6H65GCKCJRKA669\",\"url\":\"https://gts.superseriousbusiness.org/@dumpsterqueer/statuses/01FC3TZ5CFG6H65GCKCJRKA669\",\"replies_count\":0,\"reblogs_count\":0,\"favourites_count\":0,\"favourited\":false,\"reblogged\":false,\"muted\":false,\"bookmarked\":fals…//gts.superseriousbusiness.org/fileserver/01JNN207W98SGG3CBJ76R5MVDN/header/original/019036W043D8FXPJKSKCX7G965.png\",\"header_static\":\"https://gts.superseriousbusiness.org/fileserver/01JNN207W98SGG3CBJ76R5MVDN/header/small/019036W043D8FXPJKSKCX7G965.png\",\"followers_count\":33,\"following_count\":28,\"statuses_count\":126,\"last_status_at\":\"2021-08-02T16:25:52Z\",\"emojis\":[],\"fields\":[]},\"media_attachments\":[],\"mentions\":[],\"tags\":[],\"emojis\":[],\"card\":null,\"poll\":null,\"text\":\"a\"}"
+// '401':
+// description: unauthorized
+// '400':
+// description: bad request
func (m *Module) StreamGETHandler(c *gin.Context) {
streamType := c.Query(StreamQueryKey)
if streamType == "" {
diff --git a/internal/api/client/timeline/home.go b/internal/api/client/timeline/home.go
index db712e4d2..5349f8c5f 100644
--- a/internal/api/client/timeline/home.go
+++ b/internal/api/client/timeline/home.go
@@ -43,67 +43,72 @@ import (
// <https://example.org/api/v1/timelines/home?limit=20&max_id=01FC3GSQ8A3MMJ43BPZSGEG29M>; rel="next", <https://example.org/api/v1/timelines/home?limit=20&min_id=01FC3KJW2GYXSDDRA6RWNDM46M>; rel="prev"
// ````
//
-// ---
-// tags:
-// - timelines
+// ---
+// tags:
+// - timelines
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: max_id
-// type: string
-// description: |-
-// Return only statuses *OLDER* than the given max status ID.
-// The status with the specified ID will not be included in the response.
-// in: query
-// required: false
-// - name: since_id
-// type: string
-// description: |-
-// Return only statuses *NEWER* than the given since status ID.
-// The status with the specified ID will not be included in the response.
-// in: query
-// - name: min_id
-// type: string
-// description: |-
-// Return only statuses *NEWER* than the given since status ID.
-// The status with the specified ID will not be included in the response.
-// in: query
-// required: false
-// - name: limit
-// type: integer
-// description: Number of statuses to return.
-// default: 20
-// in: query
-// required: false
-// - name: local
-// type: boolean
-// description: Show only statuses posted by local accounts.
-// default: false
-// in: query
-// required: false
+// parameters:
+// -
+// name: max_id
+// type: string
+// description: >-
+// Return only statuses *OLDER* than the given max status ID.
+// The status with the specified ID will not be included in the response.
+// in: query
+// required: false
+// -
+// name: since_id
+// type: string
+// description: >-
+// Return only statuses *NEWER* than the given since status ID.
+// The status with the specified ID will not be included in the response.
+// in: query
+// -
+// name: min_id
+// type: string
+// description: >-
+// Return only statuses *NEWER* than the given since status ID.
+// The status with the specified ID will not be included in the response.
+// in: query
+// required: false
+// -
+// name: limit
+// type: integer
+// description: Number of statuses to return.
+// default: 20
+// in: query
+// required: false
+// -
+// name: local
+// type: boolean
+// description: Show only statuses posted by local accounts.
+// default: false
+// in: query
+// required: false
//
-// security:
-// - OAuth2 Bearer:
-// - read:statuses
+// security:
+// - OAuth2 Bearer:
+// - read:statuses
//
-// responses:
-// '200':
-// name: statuses
-// description: Array of statuses.
-// schema:
-// type: array
-// items:
-// "$ref": "#/definitions/status"
-// headers:
-// Link:
-// type: string
-// description: Links to the next and previous queries.
-// '401':
-// description: unauthorized
-// '400':
-// description: bad request
+// responses:
+// '200':
+// name: statuses
+// description: Array of statuses.
+// schema:
+// type: array
+// items:
+// "$ref": "#/definitions/status"
+// headers:
+// Link:
+// type: string
+// description: Links to the next and previous queries.
+// '401':
+// description: unauthorized
+// '400':
+// description: bad request
func (m *Module) HomeTimelineGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/timeline/public.go b/internal/api/client/timeline/public.go
index 0cea856c9..673c20a99 100644
--- a/internal/api/client/timeline/public.go
+++ b/internal/api/client/timeline/public.go
@@ -43,67 +43,72 @@ import (
// <https://example.org/api/v1/timelines/public?limit=20&max_id=01FC3GSQ8A3MMJ43BPZSGEG29M>; rel="next", <https://example.org/api/v1/timelines/public?limit=20&min_id=01FC3KJW2GYXSDDRA6RWNDM46M>; rel="prev"
// ````
//
-// ---
-// tags:
-// - timelines
+// ---
+// tags:
+// - timelines
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: max_id
-// type: string
-// description: |-
-// Return only statuses *OLDER* than the given max status ID.
-// The status with the specified ID will not be included in the response.
-// in: query
-// required: false
-// - name: since_id
-// type: string
-// description: |-
-// Return only statuses *NEWER* than the given since status ID.
-// The status with the specified ID will not be included in the response.
-// in: query
-// - name: min_id
-// type: string
-// description: |-
-// Return only statuses *NEWER* than the given since status ID.
-// The status with the specified ID will not be included in the response.
-// in: query
-// required: false
-// - name: limit
-// type: integer
-// description: Number of statuses to return.
-// default: 20
-// in: query
-// required: false
-// - name: local
-// type: boolean
-// description: Show only statuses posted by local accounts.
-// default: false
-// in: query
-// required: false
+// parameters:
+// -
+// name: max_id
+// type: string
+// description: >-
+// Return only statuses *OLDER* than the given max status ID.
+// The status with the specified ID will not be included in the response.
+// in: query
+// required: false
+// -
+// name: since_id
+// type: string
+// description: >-
+// Return only statuses *NEWER* than the given since status ID.
+// The status with the specified ID will not be included in the response.
+// in: query
+// -
+// name: min_id
+// type: string
+// description: >-
+// Return only statuses *NEWER* than the given since status ID.
+// The status with the specified ID will not be included in the response.
+// in: query
+// required: false
+// -
+// name: limit
+// type: integer
+// description: Number of statuses to return.
+// default: 20
+// in: query
+// required: false
+// -
+// name: local
+// type: boolean
+// description: Show only statuses posted by local accounts.
+// default: false
+// in: query
+// required: false
//
-// security:
-// - OAuth2 Bearer:
-// - read:statuses
+// security:
+// - OAuth2 Bearer:
+// - read:statuses
//
-// responses:
-// '200':
-// name: statuses
-// description: Array of statuses.
-// schema:
-// type: array
-// items:
-// "$ref": "#/definitions/status"
-// headers:
-// Link:
-// type: string
-// description: Links to the next and previous queries.
-// '401':
-// description: unauthorized
-// '400':
-// description: bad request
+// responses:
+// '200':
+// name: statuses
+// description: Array of statuses.
+// schema:
+// type: array
+// items:
+// "$ref": "#/definitions/status"
+// headers:
+// Link:
+// type: string
+// description: Links to the next and previous queries.
+// '401':
+// description: unauthorized
+// '400':
+// description: bad request
func (m *Module) PublicTimelineGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/user/passwordchange.go b/internal/api/client/user/passwordchange.go
index 2b40a345e..a900af897 100644
--- a/internal/api/client/user/passwordchange.go
+++ b/internal/api/client/user/passwordchange.go
@@ -36,35 +36,35 @@ import (
// The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'.
// The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'.
//
-// ---
-// tags:
-// - user
+// ---
+// tags:
+// - user
//
-// consumes:
-// - application/json
-// - application/xml
-// - application/x-www-form-urlencoded
+// consumes:
+// - application/json
+// - application/xml
+// - application/x-www-form-urlencoded
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// security:
-// - OAuth2 Bearer:
-// - write:user
+// security:
+// - OAuth2 Bearer:
+// - write:user
//
-// responses:
-// '200':
-// description: Change successful
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '406':
-// description: not acceptable
-// '500':
-// description: internal error
+// responses:
+// '200':
+// description: Change successful
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '406':
+// description: not acceptable
+// '500':
+// description: internal error
func (m *Module) PasswordChangePOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/user/user_test.go b/internal/api/client/user/user_test.go
index 116f3711b..18986c98d 100644
--- a/internal/api/client/user/user_test.go
+++ b/internal/api/client/user/user_test.go
@@ -76,6 +76,8 @@ func (suite *UserStandardTestSuite) SetupTest() {
suite.userModule = user.New(suite.processor).(*user.Module)
testrig.StandardDBSetup(suite.db, suite.testAccounts)
testrig.StandardStorageSetup(suite.storage, "../../../../testrig/media")
+
+ suite.NoError(suite.processor.Start())
}
func (suite *UserStandardTestSuite) TearDownTest() {
diff --git a/internal/api/model/status.go b/internal/api/model/status.go
index b9ac99c44..2abe5af1b 100644
--- a/internal/api/model/status.go
+++ b/internal/api/model/status.go
@@ -168,15 +168,10 @@ type StatusCreateRequest struct {
// in: formData
SpoilerText string `form:"spoiler_text" json:"spoiler_text" xml:"spoiler_text"`
// Visibility of the posted status.
- // enum:
- // - public
- // - unlisted
- // - private
- // - direct
// in: formData
Visibility Visibility `form:"visibility" json:"visibility" xml:"visibility"`
// ISO 8601 Datetime at which to schedule a status.
- // Providing this paramter will cause ScheduledStatus to be returned instead of Status.
+ // Providing this parameter will cause ScheduledStatus to be returned instead of Status.
// Must be at least 5 minutes in the future.
// in: formData
ScheduledAt string `form:"scheduled_at" json:"scheduled_at" xml:"scheduled_at"`
@@ -184,22 +179,14 @@ type StatusCreateRequest struct {
// in: formData
Language string `form:"language" json:"language" xml:"language"`
// Format to use when parsing this status.
- // enum:
- // - plain
- // - markdown
// in: formData
Format StatusFormat `form:"format" json:"format" xml:"format"`
}
// Visibility models the visibility of a status.
//
-// swagger:model statusVisibility
-// enum:
-// - public
-// - unlisted
-// - private
-// - mutuals_only
-// - direct
+// swagger:enum statusVisibility
+// swagger:type string
type Visibility string
const (
@@ -242,11 +229,8 @@ type AdvancedVisibilityFlagsForm struct {
// StatusFormat is the format in which to parse the submitted status.
// Can be either plain or markdown. Empty will default to plain.
//
-// swagger:model statusFormat
-// enum:
-// - plain
-// - markdown
-// example: plain
+// swagger:enum statusFormat
+// swagger:type string
type StatusFormat string
// Format to use when parsing submitted status into an html-formatted status
diff --git a/internal/api/negotiate.go b/internal/api/negotiate.go
index 510694857..cf44f4328 100644
--- a/internal/api/negotiate.go
+++ b/internal/api/negotiate.go
@@ -26,7 +26,6 @@ import (
)
// ActivityPubAcceptHeaders represents the Accept headers mentioned here:
-//
var ActivityPubAcceptHeaders = []MIME{
AppActivityJSON,
AppActivityLDJSON,
diff --git a/internal/api/s2s/emoji/emojiget_test.go b/internal/api/s2s/emoji/emojiget_test.go
index e8c5d1350..959204c7e 100644
--- a/internal/api/s2s/emoji/emojiget_test.go
+++ b/internal/api/s2s/emoji/emojiget_test.go
@@ -84,6 +84,8 @@ func (suite *EmojiGetTestSuite) SetupTest() {
suite.securityModule = security.New(suite.db, suite.oauthServer).(*security.Module)
testrig.StandardDBSetup(suite.db, suite.testAccounts)
testrig.StandardStorageSetup(suite.storage, "../../../../testrig/media")
+
+ suite.NoError(suite.processor.Start())
}
func (suite *EmojiGetTestSuite) TearDownTest() {
diff --git a/internal/api/s2s/nodeinfo/nodeinfoget.go b/internal/api/s2s/nodeinfo/nodeinfoget.go
index 8f111bd98..6cb5e1ebf 100644
--- a/internal/api/s2s/nodeinfo/nodeinfoget.go
+++ b/internal/api/s2s/nodeinfo/nodeinfoget.go
@@ -33,17 +33,17 @@ import (
//
// See: https://nodeinfo.diaspora.software/schema.html
//
-// ---
-// tags:
-// - nodeinfo
+// ---
+// tags:
+// - nodeinfo
//
-// produces:
-// - application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.0#"
+// produces:
+// - application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.0#"
//
-// responses:
-// '200':
-// schema:
-// "$ref": "#/definitions/nodeinfo"
+// responses:
+// '200':
+// schema:
+// "$ref": "#/definitions/nodeinfo"
func (m *Module) NodeInfoGETHandler(c *gin.Context) {
if _, err := api.NegotiateAccept(c, api.JSONAcceptHeaders...); err != nil {
api.ErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGet)
diff --git a/internal/api/s2s/nodeinfo/wellknownget.go b/internal/api/s2s/nodeinfo/wellknownget.go
index 27e18987f..dc14e43a3 100644
--- a/internal/api/s2s/nodeinfo/wellknownget.go
+++ b/internal/api/s2s/nodeinfo/wellknownget.go
@@ -33,17 +33,17 @@ import (
// eg. `{"links":[{"rel":"http://nodeinfo.diaspora.software/ns/schema/2.0","href":"http://example.org/nodeinfo/2.0"}]}`
// See: https://nodeinfo.diaspora.software/protocol.html
//
-// ---
-// tags:
-// - nodeinfo
+// ---
+// tags:
+// - nodeinfo
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// responses:
-// '200':
-// schema:
-// "$ref": "#/definitions/wellKnownResponse"
+// responses:
+// '200':
+// schema:
+// "$ref": "#/definitions/wellKnownResponse"
func (m *Module) NodeInfoWellKnownGETHandler(c *gin.Context) {
if _, err := api.NegotiateAccept(c, api.JSONAcceptHeaders...); err != nil {
api.ErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGet)
diff --git a/internal/api/s2s/user/inboxpost_test.go b/internal/api/s2s/user/inboxpost_test.go
index 7180fd2f9..90783406f 100644
--- a/internal/api/s2s/user/inboxpost_test.go
+++ b/internal/api/s2s/user/inboxpost_test.go
@@ -93,6 +93,7 @@ func (suite *InboxPostTestSuite) TestPostBlock() {
emailSender := testrig.NewEmailSender("../../../../web/template/", nil)
processor := testrig.NewTestProcessor(suite.db, suite.storage, federator, emailSender, suite.mediaManager, clientWorker, fedWorker)
userModule := user.New(processor).(*user.Module)
+ suite.NoError(processor.Start())
// setup request
recorder := httptest.NewRecorder()
@@ -196,6 +197,7 @@ func (suite *InboxPostTestSuite) TestPostUnblock() {
emailSender := testrig.NewEmailSender("../../../../web/template/", nil)
processor := testrig.NewTestProcessor(suite.db, suite.storage, federator, emailSender, suite.mediaManager, clientWorker, fedWorker)
userModule := user.New(processor).(*user.Module)
+ suite.NoError(processor.Start())
// setup request
recorder := httptest.NewRecorder()
@@ -300,6 +302,7 @@ func (suite *InboxPostTestSuite) TestPostUpdate() {
}()
userModule := user.New(processor).(*user.Module)
+ suite.NoError(processor.Start())
// setup request
recorder := httptest.NewRecorder()
@@ -430,8 +433,7 @@ func (suite *InboxPostTestSuite) TestPostDelete() {
federator := testrig.NewTestFederator(suite.db, tc, suite.storage, suite.mediaManager, fedWorker)
emailSender := testrig.NewEmailSender("../../../../web/template/", nil)
processor := testrig.NewTestProcessor(suite.db, suite.storage, federator, emailSender, suite.mediaManager, clientWorker, fedWorker)
- err = processor.Start()
- suite.NoError(err)
+ suite.NoError(processor.Start())
userModule := user.New(processor).(*user.Module)
// setup request
diff --git a/internal/api/s2s/user/outboxget.go b/internal/api/s2s/user/outboxget.go
index a146cd551..726f86237 100644
--- a/internal/api/s2s/user/outboxget.go
+++ b/internal/api/s2s/user/outboxget.go
@@ -41,46 +41,50 @@ import (
//
// HTTP signature is required on the request.
//
-// ---
-// tags:
-// - s2s/federation
+// ---
+// tags:
+// - s2s/federation
//
-// produces:
-// - application/activity+json
+// produces:
+// - application/activity+json
//
-// parameters:
-// - name: username
-// type: string
-// description: Username of the account.
-// in: path
-// required: true
-// - name: page
-// type: boolean
-// description: Return response as a CollectionPage.
-// in: query
-// default: false
-// - name: min_id
-// type: string
-// description: Minimum ID of the next status, used for paging.
-// in: query
-// - name: max_id
-// type: string
-// description: Maximum ID of the next status, used for paging.
-// in: query
+// parameters:
+// -
+// name: username
+// type: string
+// description: Username of the account.
+// in: path
+// required: true
+// -
+// name: page
+// type: boolean
+// description: Return response as a CollectionPage.
+// in: query
+// default: false
+// -
+// name: min_id
+// type: string
+// description: Minimum ID of the next status, used for paging.
+// in: query
+// -
+// name: max_id
+// type: string
+// description: Maximum ID of the next status, used for paging.
+// in: query
//
-// responses:
-// '200':
-// in: body
-// schema:
-// "$ref": "#/definitions/swaggerCollection"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
+// responses:
+// '200':
+// in: body
+// schema:
+// "$ref": "#/definitions/swaggerCollection"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
func (m *Module) OutboxGETHandler(c *gin.Context) {
// usernames on our instance are always lowercase
requestedUsername := strings.ToLower(c.Param(UsernameKey))
diff --git a/internal/api/s2s/user/outboxget_test.go b/internal/api/s2s/user/outboxget_test.go
index 24c0e2cee..35a048323 100644
--- a/internal/api/s2s/user/outboxget_test.go
+++ b/internal/api/s2s/user/outboxget_test.go
@@ -103,6 +103,7 @@ func (suite *OutboxGetTestSuite) TestGetOutboxFirstPage() {
emailSender := testrig.NewEmailSender("../../../../web/template/", nil)
processor := testrig.NewTestProcessor(suite.db, suite.storage, federator, emailSender, suite.mediaManager, clientWorker, fedWorker)
userModule := user.New(processor).(*user.Module)
+ suite.NoError(processor.Start())
// setup request
recorder := httptest.NewRecorder()
@@ -161,6 +162,7 @@ func (suite *OutboxGetTestSuite) TestGetOutboxNextPage() {
emailSender := testrig.NewEmailSender("../../../../web/template/", nil)
processor := testrig.NewTestProcessor(suite.db, suite.storage, federator, emailSender, suite.mediaManager, clientWorker, fedWorker)
userModule := user.New(processor).(*user.Module)
+ suite.NoError(processor.Start())
// setup request
recorder := httptest.NewRecorder()
diff --git a/internal/api/s2s/user/repliesget.go b/internal/api/s2s/user/repliesget.go
index 86a57e692..b3b20d0c2 100644
--- a/internal/api/s2s/user/repliesget.go
+++ b/internal/api/s2s/user/repliesget.go
@@ -41,52 +41,57 @@ import (
//
// HTTP signature is required on the request.
//
-// ---
-// tags:
-// - s2s/federation
+// ---
+// tags:
+// - s2s/federation
//
-// produces:
-// - application/activity+json
+// produces:
+// - application/activity+json
//
-// parameters:
-// - name: username
-// type: string
-// description: Username of the account.
-// in: path
-// required: true
-// - name: status
-// type: string
-// description: ID of the status.
-// in: path
-// required: true
-// - name: page
-// type: boolean
-// description: Return response as a CollectionPage.
-// in: query
-// default: false
-// - name: only_other_accounts
-// type: boolean
-// description: Return replies only from accounts other than the status owner.
-// in: query
-// default: false
-// - name: min_id
-// type: string
-// description: Minimum ID of the next status, used for paging.
-// in: query
+// parameters:
+// -
+// name: username
+// type: string
+// description: Username of the account.
+// in: path
+// required: true
+// -
+// name: status
+// type: string
+// description: ID of the status.
+// in: path
+// required: true
+// -
+// name: page
+// type: boolean
+// description: Return response as a CollectionPage.
+// in: query
+// default: false
+// -
+// name: only_other_accounts
+// type: boolean
+// description: Return replies only from accounts other than the status owner.
+// in: query
+// default: false
+// -
+// name: min_id
+// type: string
+// description: Minimum ID of the next status, used for paging.
+// in: query
//
-// responses:
-// '200':
-// in: body
-// schema:
-// "$ref": "#/definitions/swaggerCollection"
-// '400':
-// description: bad request
-// '401':
-// description: unauthorized
-// '403':
-// description: forbidden
-// '404':
-// description: not found
+// responses:
+// '200':
+// in: body
+// schema:
+// "$ref": "#/definitions/swaggerCollection"
+// '400':
+// description: bad request
+// '401':
+// description: unauthorized
+// '403':
+// description: forbidden
+// '404':
+// description: not found
func (m *Module) StatusRepliesGETHandler(c *gin.Context) {
// usernames on our instance are always lowercase
requestedUsername := strings.ToLower(c.Param(UsernameKey))
diff --git a/internal/api/s2s/user/repliesget_test.go b/internal/api/s2s/user/repliesget_test.go
index 7ec9ae54c..5ab7f1ebd 100644
--- a/internal/api/s2s/user/repliesget_test.go
+++ b/internal/api/s2s/user/repliesget_test.go
@@ -112,6 +112,7 @@ func (suite *RepliesGetTestSuite) TestGetRepliesNext() {
emailSender := testrig.NewEmailSender("../../../../web/template/", nil)
processor := testrig.NewTestProcessor(suite.db, suite.storage, federator, emailSender, suite.mediaManager, clientWorker, fedWorker)
userModule := user.New(processor).(*user.Module)
+ suite.NoError(processor.Start())
// setup request
recorder := httptest.NewRecorder()
@@ -179,6 +180,7 @@ func (suite *RepliesGetTestSuite) TestGetRepliesLast() {
emailSender := testrig.NewEmailSender("../../../../web/template/", nil)
processor := testrig.NewTestProcessor(suite.db, suite.storage, federator, emailSender, suite.mediaManager, clientWorker, fedWorker)
userModule := user.New(processor).(*user.Module)
+ suite.NoError(processor.Start())
// setup request
recorder := httptest.NewRecorder()
diff --git a/internal/api/s2s/user/user_test.go b/internal/api/s2s/user/user_test.go
index 28ca2fa67..2c320d640 100644
--- a/internal/api/s2s/user/user_test.go
+++ b/internal/api/s2s/user/user_test.go
@@ -93,6 +93,8 @@ func (suite *UserStandardTestSuite) SetupTest() {
suite.securityModule = security.New(suite.db, suite.oauthServer).(*security.Module)
testrig.StandardDBSetup(suite.db, suite.testAccounts)
testrig.StandardStorageSetup(suite.storage, "../../../../testrig/media")
+
+ suite.NoError(suite.processor.Start())
}
func (suite *UserStandardTestSuite) TearDownTest() {
diff --git a/internal/api/s2s/user/userget_test.go b/internal/api/s2s/user/userget_test.go
index 9e0fd33ad..c656911d7 100644
--- a/internal/api/s2s/user/userget_test.go
+++ b/internal/api/s2s/user/userget_test.go
@@ -98,11 +98,6 @@ func (suite *UserGetTestSuite) TestGetUser() {
// TestGetUserPublicKeyDeleted checks whether the public key of a deleted account can still be dereferenced.
// This is needed by remote instances for authenticating delete requests and stuff like that.
func (suite *UserGetTestSuite) TestGetUserPublicKeyDeleted() {
- if err := suite.processor.Start(); err != nil {
- suite.FailNow(err.Error())
- }
- defer suite.processor.Stop()
-
userModule := user.New(suite.processor).(*user.Module)
targetAccount := suite.testAccounts["local_account_1"]
diff --git a/internal/api/s2s/webfinger/webfinger_test.go b/internal/api/s2s/webfinger/webfinger_test.go
index 19a627a35..d4b721300 100644
--- a/internal/api/s2s/webfinger/webfinger_test.go
+++ b/internal/api/s2s/webfinger/webfinger_test.go
@@ -96,6 +96,8 @@ func (suite *WebfingerStandardTestSuite) SetupTest() {
suite.securityModule = security.New(suite.db, suite.oauthServer).(*security.Module)
testrig.StandardDBSetup(suite.db, suite.testAccounts)
testrig.StandardStorageSetup(suite.storage, "../../../../testrig/media")
+
+ suite.NoError(suite.processor.Start())
}
func (suite *WebfingerStandardTestSuite) TearDownTest() {
diff --git a/internal/api/s2s/webfinger/webfingerget.go b/internal/api/s2s/webfinger/webfingerget.go
index 68ea760bd..9949140c1 100644
--- a/internal/api/s2s/webfinger/webfingerget.go
+++ b/internal/api/s2s/webfinger/webfingerget.go
@@ -39,22 +39,24 @@ import (
// For example, a GET to `https://goblin.technology/.well-known/webfinger?resource=acct:tobi@goblin.technology` would return:
//
// ```
-// {"subject":"acct:tobi@goblin.technology","aliases":["https://goblin.technology/users/tobi","https://goblin.technology/@tobi"],"links":[{"rel":"http://webfinger.net/rel/profile-page","type":"text/html","href":"https://goblin.technology/@tobi"},{"rel":"self","type":"application/activity+json","href":"https://goblin.technology/users/tobi"}]}
+//
+// {"subject":"acct:tobi@goblin.technology","aliases":["https://goblin.technology/users/tobi","https://goblin.technology/@tobi"],"links":[{"rel":"http://webfinger.net/rel/profile-page","type":"text/html","href":"https://goblin.technology/@tobi"},{"rel":"self","type":"application/activity+json","href":"https://goblin.technology/users/tobi"}]}
+//
// ```
//
// See: https://webfinger.net/
//
-// ---
-// tags:
-// - webfinger
+// ---
+// tags:
+// - webfinger
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// responses:
-// '200':
-// schema:
-// "$ref": "#/definitions/wellKnownResponse"
+// responses:
+// '200':
+// schema:
+// "$ref": "#/definitions/wellKnownResponse"
func (m *Module) WebfingerGETRequest(c *gin.Context) {
l := log.WithFields(kv.Fields{
{K: "user-agent", V: c.Request.UserAgent()},
diff --git a/internal/concurrency/workers.go b/internal/concurrency/workers.go
index d9669fcb3..279a0c3c1 100644
--- a/internal/concurrency/workers.go
+++ b/internal/concurrency/workers.go
@@ -34,6 +34,7 @@ import (
type WorkerPool[MsgType any] struct {
workers runners.WorkerPool
process func(context.Context, MsgType) error
+ nw, nq int
prefix string // contains type prefix for logging
}
@@ -57,8 +58,9 @@ func NewWorkerPool[MsgType any](workers int, queueRatio int) *WorkerPool[MsgType
_, msgType = path.Split(msgType)
w := &WorkerPool[MsgType]{
- workers: runners.NewWorkerPool(workers, workers*queueRatio),
process: nil,
+ nw: workers,
+ nq: workers * queueRatio,
prefix: fmt.Sprintf("worker.Worker[%s]", msgType),
}
@@ -82,7 +84,7 @@ func (w *WorkerPool[MsgType]) Start() error {
}
// Attempt to start pool
- if !w.workers.Start() {
+ if !w.workers.Start(w.nw, w.nq) {
return errors.New("failed to start Worker pool")
}
@@ -111,8 +113,8 @@ func (w *WorkerPool[MsgType]) SetProcessor(fn func(context.Context, MsgType) err
// Queue will queue provided message to be processed with there's a free worker.
func (w *WorkerPool[MsgType]) Queue(msg MsgType) {
- log.Tracef("%s queueing message (workers=%d queue=%d): %+v",
- w.prefix, w.workers.Workers(), w.workers.Queue(), msg,
+ log.Tracef("%s queueing message (queue=%d): %+v",
+ w.prefix, w.workers.Queue(), msg,
)
w.workers.Enqueue(func(ctx context.Context) {
if err := w.process(ctx, msg); err != nil {
diff --git a/internal/db/bundb/bundb.go b/internal/db/bundb/bundb.go
index 2fc65364f..1579fae76 100644
--- a/internal/db/bundb/bundb.go
+++ b/internal/db/bundb/bundb.go
@@ -282,7 +282,7 @@ func sqliteConn(ctx context.Context) (*DBConn, error) {
}
func pgConn(ctx context.Context) (*DBConn, error) {
- opts, err := deriveBunDBPGOptions()
+ opts, err := deriveBunDBPGOptions() //nolint:contextcheck
if err != nil {
return nil, fmt.Errorf("could not create bundb postgres options: %s", err)
}
diff --git a/internal/db/bundb/conn.go b/internal/db/bundb/conn.go
index 1c85f6f6f..2f2dfbe9f 100644
--- a/internal/db/bundb/conn.go
+++ b/internal/db/bundb/conn.go
@@ -55,7 +55,7 @@ func (conn *DBConn) RunInTx(ctx context.Context, fn func(bun.Tx) error) db.Error
}
// Finally, commit
- err = tx.Commit()
+ err = tx.Commit() //nolint:contextcheck
done = true
return err
}())
diff --git a/internal/db/bundb/migrations/20220214175650_media_cleanup/mediaattachment.go b/internal/db/bundb/migrations/20220214175650_media_cleanup/mediaattachment.go
index a2f0b5f29..7081c730b 100644
--- a/internal/db/bundb/migrations/20220214175650_media_cleanup/mediaattachment.go
+++ b/internal/db/bundb/migrations/20220214175650_media_cleanup/mediaattachment.go
@@ -30,7 +30,7 @@ type MediaAttachment struct {
URL string `validate:"required_without=RemoteURL,omitempty,url" bun:",nullzero"` // Where can the attachment be retrieved on *this* server
RemoteURL string `validate:"required_without=URL,omitempty,url" bun:",nullzero"` // Where can the attachment be retrieved on a remote server (empty for local media)
Type FileType `validate:"oneof=Image Gif Audio Video Unknown" bun:",nullzero,notnull"` // Type of file (image/gif/audio/video)
- FileMeta FileMeta `validate:"required" bun:",embed:filemeta_,nullzero,notnull"` // Metadata about the file
+ FileMeta FileMeta `validate:"required" bun:",embed:,nullzero,notnull"` // Metadata about the file
AccountID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // To which account does this attachment belong
Account *Account `validate:"-" bun:"rel:has-one"` // Account corresponding to accountID
Description string `validate:"-" bun:""` // Description of the attachment (for screenreaders)
diff --git a/internal/db/bundb/migrations/20220315160814_admin_account_actions/mediaattachment.go b/internal/db/bundb/migrations/20220315160814_admin_account_actions/mediaattachment.go
index 20cc6d3bf..b29d718ad 100644
--- a/internal/db/bundb/migrations/20220315160814_admin_account_actions/mediaattachment.go
+++ b/internal/db/bundb/migrations/20220315160814_admin_account_actions/mediaattachment.go
@@ -32,7 +32,7 @@ type MediaAttachment struct {
URL string `validate:"required_without=RemoteURL,omitempty,url" bun:",nullzero"` // Where can the attachment be retrieved on *this* server
RemoteURL string `validate:"required_without=URL,omitempty,url" bun:",nullzero"` // Where can the attachment be retrieved on a remote server (empty for local media)
Type FileType `validate:"oneof=Image Gif Audio Video Unknown" bun:",nullzero,notnull"` // Type of file (image/gif/audio/video)
- FileMeta FileMeta `validate:"required" bun:",embed:filemeta_,nullzero,notnull"` // Metadata about the file
+ FileMeta FileMeta `validate:"required" bun:",embed:,nullzero,notnull"` // Metadata about the file
AccountID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // To which account does this attachment belong
Account *Account `validate:"-" bun:"rel:has-one"` // Account corresponding to accountID
Description string `validate:"-" bun:""` // Description of the attachment (for screenreaders)
diff --git a/internal/db/bundb/util.go b/internal/db/bundb/util.go
index 34a988472..434d12f32 100644
--- a/internal/db/bundb/util.go
+++ b/internal/db/bundb/util.go
@@ -28,7 +28,7 @@ import (
//
// Use it as follows:
//
-// q = q.WhereGroup(" AND ", whereEmptyOrNull("whatever_column"))
+// q = q.WhereGroup(" AND ", whereEmptyOrNull("whatever_column"))
func whereEmptyOrNull(column string) func(*bun.SelectQuery) *bun.SelectQuery {
return func(q *bun.SelectQuery) *bun.SelectQuery {
return q.
@@ -42,7 +42,7 @@ func whereEmptyOrNull(column string) func(*bun.SelectQuery) *bun.SelectQuery {
//
// Use it as follows:
//
-// q = q.WhereGroup(" AND ", whereNotEmptyAndNotNull("whatever_column"))
+// q = q.WhereGroup(" AND ", whereNotEmptyAndNotNull("whatever_column"))
func whereNotEmptyAndNotNull(column string) func(*bun.SelectQuery) *bun.SelectQuery {
return func(q *bun.SelectQuery) *bun.SelectQuery {
return q.
diff --git a/internal/federation/federatingdb/util.go b/internal/federation/federatingdb/util.go
index 9fc35faa4..63f63abe7 100644
--- a/internal/federation/federatingdb/util.go
+++ b/internal/federation/federatingdb/util.go
@@ -300,6 +300,7 @@ func (f *federatingDB) collectIRIs(ctx context.Context, iris []*url.URL) (vocab.
// - The target account that owns the inbox or URI being interacted with.
// - The requesting account that posted to the inbox.
// - A channel that messages for the processor can be placed into.
+//
// If a value is not present, nil will be returned for it. It's up to the caller to check this and respond appropriately.
func extractFromCtx(ctx context.Context) (receivingAccount, requestingAccount *gtsmodel.Account) {
receivingAccountI := ctx.Value(ap.ContextReceivingAccount)
diff --git a/internal/gtsmodel/mediaattachment.go b/internal/gtsmodel/mediaattachment.go
index 8836808d4..915f5fb24 100644
--- a/internal/gtsmodel/mediaattachment.go
+++ b/internal/gtsmodel/mediaattachment.go
@@ -32,7 +32,7 @@ type MediaAttachment struct {
URL string `validate:"required_without=RemoteURL,omitempty,url" bun:",nullzero"` // Where can the attachment be retrieved on *this* server
RemoteURL string `validate:"required_without=URL,omitempty,url" bun:",nullzero"` // Where can the attachment be retrieved on a remote server (empty for local media)
Type FileType `validate:"oneof=Image Gifv Audio Video Unknown" bun:",nullzero,notnull"` // Type of file (image/gifv/audio/video)
- FileMeta FileMeta `validate:"required" bun:",embed:filemeta_,nullzero,notnull"` // Metadata about the file
+ FileMeta FileMeta `validate:"required" bun:",embed:,nullzero,notnull"` // Metadata about the file
AccountID string `validate:"required,ulid" bun:"type:CHAR(26),nullzero,notnull"` // To which account does this attachment belong
Account *Account `validate:"-" bun:"rel:belongs-to,join:account_id=id"` // Account corresponding to accountID
Description string `validate:"-" bun:""` // Description of the attachment (for screenreaders)
diff --git a/internal/httpclient/client.go b/internal/httpclient/client.go
index 45994b2ba..7aa0cd8ea 100644
--- a/internal/httpclient/client.go
+++ b/internal/httpclient/client.go
@@ -71,13 +71,13 @@ type Config struct {
}
// Client wraps an underlying http.Client{} to provide the following:
-// - setting a maximum received request body size, returning error on
-// large content lengths, and using a limited reader in all other
-// cases to protect against forged / unknown content-lengths
-// - protection from server side request forgery (SSRF) by only dialing
-// out to known public IP prefixes, configurable with allows/blocks
-// - limit number of concurrent requests, else blocking until a slot
-// is available (context channels still respected)
+// - setting a maximum received request body size, returning error on
+// large content lengths, and using a limited reader in all other
+// cases to protect against forged / unknown content-lengths
+// - protection from server side request forgery (SSRF) by only dialing
+// out to known public IP prefixes, configurable with allows/blocks
+// - limit number of concurrent requests, else blocking until a slot
+// is available (context channels still respected)
type Client struct {
client http.Client
rc *requestQueue
diff --git a/internal/oauth/clientstore_test.go b/internal/oauth/clientstore_test.go
index 1dba43c2c..3b051f8f3 100644
--- a/internal/oauth/clientstore_test.go
+++ b/internal/oauth/clientstore_test.go
@@ -15,6 +15,7 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
package oauth_test
import (
diff --git a/internal/processing/status/status_test.go b/internal/processing/status/status_test.go
index 199c36404..e723c6200 100644
--- a/internal/processing/status/status_test.go
+++ b/internal/processing/status/status_test.go
@@ -19,6 +19,8 @@
package status_test
import (
+ "context"
+
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/concurrency"
"github.com/superseriousbusiness/gotosocial/internal/db"
@@ -85,6 +87,8 @@ func (suite *StatusStandardTestSuite) SetupTest() {
suite.mediaManager = testrig.NewTestMediaManager(suite.db, suite.storage)
suite.federator = testrig.NewTestFederator(suite.db, suite.tc, suite.storage, suite.mediaManager, fedWorker)
suite.status = status.New(suite.db, suite.typeConverter, suite.clientWorker, processing.GetParseMentionFunc(suite.db, suite.federator))
+ suite.clientWorker.SetProcessor(func(ctx context.Context, msg messages.FromClientAPI) error { return nil })
+ suite.NoError(suite.clientWorker.Start())
testrig.StandardDBSetup(suite.db, suite.testAccounts)
testrig.StandardStorageSetup(suite.storage, "../../../testrig/media")
diff --git a/internal/timeline/timeline.go b/internal/timeline/timeline.go
index 1d82914f8..1076d05a6 100644
--- a/internal/timeline/timeline.go
+++ b/internal/timeline/timeline.go
@@ -28,11 +28,11 @@ import (
// It should be provided to NewTimeline when the caller is creating a timeline
// (of statuses, notifications, etc).
//
-// timelineAccountID: the owner of the timeline
-// maxID: the maximum item ID desired.
-// sinceID: the minimum item ID desired.
-// minID: see sinceID
-// limit: the maximum amount of items to be returned
+// timelineAccountID: the owner of the timeline
+// maxID: the maximum item ID desired.
+// sinceID: the minimum item ID desired.
+// minID: see sinceID
+// limit: the maximum amount of items to be returned
//
// If an error is returned, the timeline will stop processing whatever request called GrabFunction,
// and return the error. If no error is returned, but stop = true, this indicates to the caller of GrabFunction
diff --git a/internal/transport/dereference.go b/internal/transport/dereference.go
index cb1220d13..d14af7a47 100644
--- a/internal/transport/dereference.go
+++ b/internal/transport/dereference.go
@@ -21,7 +21,7 @@ package transport
import (
"context"
"fmt"
- "io/ioutil"
+ "io"
"net/http"
"net/url"
@@ -71,5 +71,5 @@ func (t *transport) Dereference(ctx context.Context, iri *url.URL) ([]byte, erro
return nil, fmt.Errorf("GET request to %s failed (%d): %s", iriStr, rsp.StatusCode, rsp.Status)
}
- return ioutil.ReadAll(rsp.Body)
+ return io.ReadAll(rsp.Body)
}
diff --git a/internal/transport/derefinstance.go b/internal/transport/derefinstance.go
index c43625a0b..26f5fd02d 100644
--- a/internal/transport/derefinstance.go
+++ b/internal/transport/derefinstance.go
@@ -23,7 +23,7 @@ import (
"encoding/json"
"errors"
"fmt"
- "io/ioutil"
+ "io"
"net/http"
"net/url"
"strings"
@@ -106,7 +106,7 @@ func dereferenceByAPIV1Instance(ctx context.Context, t *transport, iri *url.URL)
return nil, fmt.Errorf("GET request to %s failed (%d): %s", iriStr, resp.StatusCode, resp.Status)
}
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
} else if len(b) == 0 {
@@ -257,7 +257,7 @@ func callNodeInfoWellKnown(ctx context.Context, t *transport, iri *url.URL) (*ur
return nil, fmt.Errorf("callNodeInfoWellKnown: GET request to %s failed (%d): %s", iriStr, resp.StatusCode, resp.Status)
}
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
} else if len(b) == 0 {
@@ -309,7 +309,7 @@ func callNodeInfo(ctx context.Context, t *transport, iri *url.URL) (*apimodel.No
return nil, fmt.Errorf("callNodeInfo: GET request to %s failed (%d): %s", iriStr, resp.StatusCode, resp.Status)
}
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
} else if len(b) == 0 {
diff --git a/internal/transport/finger.go b/internal/transport/finger.go
index 2ea34ad81..cefe93fc9 100644
--- a/internal/transport/finger.go
+++ b/internal/transport/finger.go
@@ -21,7 +21,7 @@ package transport
import (
"context"
"fmt"
- "io/ioutil"
+ "io"
"net/http"
"github.com/superseriousbusiness/gotosocial/internal/api"
@@ -56,5 +56,5 @@ func (t *transport) Finger(ctx context.Context, targetUsername string, targetDom
return nil, fmt.Errorf("GET request to %s failed (%d): %s", urlStr, rsp.StatusCode, rsp.Status)
}
- return ioutil.ReadAll(rsp.Body)
+ return io.ReadAll(rsp.Body)
}
diff --git a/internal/typeutils/defaulticons.go b/internal/typeutils/defaulticons.go
index b2a9858af..3b0ce870c 100644
--- a/internal/typeutils/defaulticons.go
+++ b/internal/typeutils/defaulticons.go
@@ -19,8 +19,8 @@
package typeutils
import (
- "io/ioutil"
"math/rand"
+ "os"
"path/filepath"
"strings"
@@ -45,7 +45,7 @@ func populateDefaultAvatars() (defaultAvatars []string) {
}
defaultAvatarsAbsFilePath := filepath.Join(webAssetsAbsFilePath, "default_avatars")
- defaultAvatarFiles, err := ioutil.ReadDir(defaultAvatarsAbsFilePath)
+ defaultAvatarFiles, err := os.ReadDir(defaultAvatarsAbsFilePath)
if err != nil {
log.Warnf("populateDefaultAvatars: error reading default avatars at %s: %s", defaultAvatarsAbsFilePath, err)
return
@@ -58,7 +58,7 @@ func populateDefaultAvatars() (defaultAvatars []string) {
}
// ignore files bigger than 50kb
- if f.Size() > 50000 {
+ if i, err := f.Info(); err != nil || i.Size() > 50000 {
continue
}
diff --git a/internal/web/profile.go b/internal/web/profile.go
index 67407f8e4..c6bc5ee5a 100644
--- a/internal/web/profile.go
+++ b/internal/web/profile.go
@@ -135,14 +135,14 @@ func (m *Module) returnAPProfile(ctx context.Context, c *gin.Context, username s
user, errWithCode := m.processor.GetFediUser(ctx, username, c.Request.URL)
if errWithCode != nil {
- api.ErrorHandler(c, errWithCode, m.processor.InstanceGet)
+ api.ErrorHandler(c, errWithCode, m.processor.InstanceGet) //nolint:contextcheck
return
}
b, mErr := json.Marshal(user)
if mErr != nil {
err := fmt.Errorf("could not marshal json: %s", mErr)
- api.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGet)
+ api.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGet) //nolint:contextcheck
return
}
diff --git a/internal/web/thread.go b/internal/web/thread.go
index b7e1bef3d..48c53c448 100644
--- a/internal/web/thread.go
+++ b/internal/web/thread.go
@@ -137,14 +137,14 @@ func (m *Module) returnAPStatus(ctx context.Context, c *gin.Context, username st
status, errWithCode := m.processor.GetFediStatus(ctx, username, statusID, c.Request.URL)
if errWithCode != nil {
- api.ErrorHandler(c, errWithCode, m.processor.InstanceGet)
+ api.ErrorHandler(c, errWithCode, m.processor.InstanceGet) //nolint:contextcheck
return
}
b, mErr := json.Marshal(status)
if mErr != nil {
err := fmt.Errorf("could not marshal json: %s", mErr)
- api.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGet)
+ api.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGet) //nolint:contextcheck
return
}