Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
matrix-media-repo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
matrix-media-repo
Commits
1cc1c26d
"git@forge.tedomum.net:mickge/ttrss.git" did not exist on "610fe1153518a4223c2bf2d70723104932cb8d77"
Commit
1cc1c26d
authored
6 years ago
by
Travis Ralston
Browse files
Options
Downloads
Patches
Plain Diff
Add hashes to the media info API
parent
3da9fe39
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/github.com/turt2live/matrix-media-repo/api/unstable/info.go
+13
-5
13 additions, 5 deletions
...thub.com/turt2live/matrix-media-repo/api/unstable/info.go
with
13 additions
and
5 deletions
src/github.com/turt2live/matrix-media-repo/api/unstable/info.go
+
13
−
5
View file @
1cc1c26d
...
...
@@ -12,12 +12,17 @@ import (
"github.com/turt2live/matrix-media-repo/controllers/download_controller"
)
type
mediaInfoHashes
struct
{
Sha256
string
`json:"sha256"`
}
type
MediaInfoResponse
struct
{
ContentUri
string
`json:"content_uri"`
ContentType
string
`json:"content_type"`
Width
int
`json:"width,omitempty"`
Height
int
`json:"height,omitempty"`
Size
int64
`json:"size"`
ContentUri
string
`json:"content_uri"`
ContentType
string
`json:"content_type"`
Width
int
`json:"width,omitempty"`
Height
int
`json:"height,omitempty"`
Size
int64
`json:"size"`
Hashes
mediaInfoHashes
`json:"hashes"`
}
func
MediaInfo
(
r
*
http
.
Request
,
log
*
logrus
.
Entry
,
user
api
.
UserInfo
)
interface
{}
{
...
...
@@ -60,6 +65,9 @@ func MediaInfo(r *http.Request, log *logrus.Entry, user api.UserInfo) interface{
ContentUri
:
streamedMedia
.
Media
.
MxcUri
(),
ContentType
:
streamedMedia
.
Media
.
ContentType
,
Size
:
streamedMedia
.
Media
.
SizeBytes
,
Hashes
:
mediaInfoHashes
{
Sha256
:
streamedMedia
.
Media
.
Sha256Hash
,
},
}
img
,
err
:=
imaging
.
Decode
(
streamedMedia
.
Stream
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment