Prep for reactions, some fixes and improvements
Some checks failed
/ docker (push) Failing after 1m35s
Some checks failed
/ docker (push) Failing after 1m35s
This commit is contained in:
parent
4b62c32247
commit
8947d97825
13 changed files with 262 additions and 43 deletions
26
activitypub/translators/media.go
Normal file
26
activitypub/translators/media.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
package translators
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.mstar.dev/mstar/linstrom/storage-new/dbgen"
|
||||
)
|
||||
|
||||
type Media struct {
|
||||
Type string `json:"type"`
|
||||
Url string `json:"url"`
|
||||
MediaType string `json:"mediaType"`
|
||||
}
|
||||
|
||||
func MediaFromStorage(ctx context.Context, id string) (*Media, error) {
|
||||
metadata, err := dbgen.MediaMetadata.Where(dbgen.MediaMetadata.ID.Eq(id)).First()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
data := Media{
|
||||
Type: "Image", // FIXME: Change this to a sort of dynamic detection based on mimetype
|
||||
MediaType: metadata.Type,
|
||||
Url: metadata.Location,
|
||||
}
|
||||
return &data, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue