projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update CHANGELOG.md
[akkoma]
/
lib
/
pleroma
/
upload.ex
diff --git
a/lib/pleroma/upload.ex
b/lib/pleroma/upload.ex
index 4d58abd481e96ddf2aa119b6179d8eb0383b53ce..17822dc5eb65959e5ad753f9550d0a119de058d8 100644
(file)
--- a/
lib/pleroma/upload.ex
+++ b/
lib/pleroma/upload.ex
@@
-25,6
+25,7
@@
defmodule Pleroma.Upload do
path as the temporary file is also tracked by `Plug.Upload{}` and automatically deleted once the request is over.
* `:width` - width of the media in pixels
* `:height` - height of the media in pixels
path as the temporary file is also tracked by `Plug.Upload{}` and automatically deleted once the request is over.
* `:width` - width of the media in pixels
* `:height` - height of the media in pixels
+ * `:blurhash` - string hash of the image encoded with the blurhash algorithm (https://blurha.sh/)
Related behaviors:
Related behaviors:
@@
-58,9
+59,10
@@
defmodule Pleroma.Upload do
content_type: String.t(),
width: integer(),
height: integer(),
content_type: String.t(),
width: integer(),
height: integer(),
+ blurhash: String.t(),
path: String.t()
}
path: String.t()
}
- defstruct [:id, :name, :tempfile, :content_type, :width, :height, :path]
+ defstruct [:id, :name, :tempfile, :content_type, :width, :height, :
blurhash, :
path]
defp get_description(opts, upload) do
case {opts[:description], Pleroma.Config.get([Pleroma.Upload, :default_description])} do
defp get_description(opts, upload) do
case {opts[:description], Pleroma.Config.get([Pleroma.Upload, :default_description])} do
@@
-98,7
+100,8
@@
defmodule Pleroma.Upload do
|> Maps.put_if_present("height", upload.height)
],
"name" => description
|> Maps.put_if_present("height", upload.height)
],
"name" => description
- }}
+ }
+ |> Maps.put_if_present("blurhash", upload.blurhash)}
else
{:description_limit, _} ->
{:error, :description_too_long}
else
{:description_limit, _} ->
{:error, :description_too_long}
@@
-232,7
+235,7
@@
defmodule Pleroma.Upload do
case uploader do
Pleroma.Uploaders.Local ->
case uploader do
Pleroma.Uploaders.Local ->
- upload_base_url || Pleroma.Web.
base_
url() <> "/media/"
+ upload_base_url || Pleroma.Web.
Endpoint.
url() <> "/media/"
Pleroma.Uploaders.S3 ->
bucket = Config.get([Pleroma.Uploaders.S3, :bucket])
Pleroma.Uploaders.S3 ->
bucket = Config.get([Pleroma.Uploaders.S3, :bucket])
@@
-258,7
+261,7
@@
defmodule Pleroma.Upload do
end
_ ->
end
_ ->
- public_endpoint || upload_base_url || Pleroma.Web.
base_
url() <> "/media/"
+ public_endpoint || upload_base_url || Pleroma.Web.
Endpoint.
url() <> "/media/"
end
end
end
end
end
end