diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/cache/cache.go | 4 | ||||
-rw-r--r-- | internal/client/media.go | 65 | ||||
-rw-r--r-- | internal/gotosocial/gotosocial.go | 20 | ||||
-rw-r--r-- | internal/media/media.go | 1 |
4 files changed, 12 insertions, 78 deletions
diff --git a/internal/cache/cache.go b/internal/cache/cache.go index ed13aded4..1d2d0533b 100644 --- a/internal/cache/cache.go +++ b/internal/cache/cache.go @@ -20,6 +20,6 @@ package cache // Cache defines an in-memory cache that is safe to be wiped when the application is restarted type Cache interface { - Store(k string, v interface{}) error - Fetch(k string) (interface{}, error) + Store(k string, v interface{}) error + Fetch(k string) (interface{}, error) } diff --git a/internal/client/media.go b/internal/client/media.go deleted file mode 100644 index add204a35..000000000 --- a/internal/client/media.go +++ /dev/null @@ -1,65 +0,0 @@ -/* - GoToSocial - Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - 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 client - -import "mime/multipart" - -// MediaRequest represents the form data parameters submitted by a client during a media upload request. -// See: https://docs.joinmastodon.org/methods/statuses/media/ -type MediaRequest struct { - File *multipart.FileHeader `form:"file"` - Thumbnail *multipart.FileHeader `form:"thumbnail"` - Description string `form:"description"` - Focus string `form:"focus"` -} - -// MediaResponse represents the object returned to a client after a successful media upload request. -// See: https://docs.joinmastodon.org/methods/statuses/media/ -type MediaResponse struct { - ID string `json:"id"` - Type string `json:"type"` - URL string `json:"url"` - PreviewURL string `json:"preview_url"` - RemoteURL string `json:"remote_url"` - TextURL string `json:"text_url"` - Meta MediaMeta `json:"meta"` - Description string `json:"description"` - Blurhash string `json:"blurhash"` -} - -// MediaMeta describes the media that's just been uploaded. It should be returned to the caller as part of MediaResponse. -type MediaMeta struct { - Focus MediaFocus `json:"focus"` - Original MediaDimensions `json:"original"` - Small MediaDimensions `json:"small"` -} - -// MediaFocus describes the focal point of a piece of media. It should be returned to the caller as part of MediaMeta. -type MediaFocus struct { - X float32 `json:"x"` // should be between -1 and 1 - Y float32 `json:"y"` // should be between -1 and 1 -} - -// MediaDimensions describes the physical properties of a piece of media. It should be returned to the caller as part of MediaMeta. -type MediaDimensions struct { - Width int `json:"width"` - Height int `json:"height"` - Size string `json:"size"` - Aspect float32 `json:"aspect"` -} diff --git a/internal/gotosocial/gotosocial.go b/internal/gotosocial/gotosocial.go index 8ad79e09d..cf4305ee2 100644 --- a/internal/gotosocial/gotosocial.go +++ b/internal/gotosocial/gotosocial.go @@ -35,20 +35,20 @@ type Gotosocial interface { func New(db db.DB, cache cache.Cache, clientAPI client.API, federationAPI pub.FederatingActor, config *config.Config) (Gotosocial, error) { return &gotosocial{ - db: db, - cache: cache, - clientAPI: clientAPI, - federationAPI: federationAPI, - config: config, + db: db, + cache: cache, + clientAPI: clientAPI, + federationAPI: federationAPI, + config: config, }, nil } type gotosocial struct { - db db.DB - cache cache.Cache - clientAPI client.API - federationAPI pub.FederatingActor - config *config.Config + db db.DB + cache cache.Cache + clientAPI client.API + federationAPI pub.FederatingActor + config *config.Config } func (gts *gotosocial) Start(ctx context.Context) error { diff --git a/internal/media/media.go b/internal/media/media.go index 8ff8693f4..644edb8e4 100644 --- a/internal/media/media.go +++ b/internal/media/media.go @@ -20,5 +20,4 @@ package media // API provides an interface for parsing, storing, and retrieving media objects like photos and videos type API interface { - } |