mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-07 17:08:08 -06:00
[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>
This commit is contained in:
parent
00d38855d4
commit
a156188b3e
1135 changed files with 258905 additions and 137146 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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{
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
// ---
|
||||
// tags:
|
||||
// - streaming
|
||||
//
|
||||
// produces:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// schemes:
|
||||
// - wss
|
||||
// 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.
|
||||
// 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:
|
||||
// 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
|
||||
// `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
|
||||
//
|
||||
// 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.
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - read:streaming
|
||||
//
|
||||
// `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.
|
||||
// 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.
|
||||
//
|
||||
// If present, it should be parsed as a string.
|
||||
// `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 `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
|
||||
// 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 == "" {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import (
|
|||
)
|
||||
|
||||
// ActivityPubAcceptHeaders represents the Accept headers mentioned here:
|
||||
//
|
||||
var ActivityPubAcceptHeaders = []MIME{
|
||||
AppActivityJSON,
|
||||
AppActivityLDJSON,
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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()},
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}())
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue