forked from AkkomaGang/akkoma
activitypub: upload: pass through an upload limit if one is provided
This commit is contained in:
parent
fa483cd7c2
commit
167d3789a5
2 changed files with 9 additions and 3 deletions
|
@ -84,6 +84,9 @@
|
||||||
description: "A Pleroma instance, an alternative fediverse server",
|
description: "A Pleroma instance, an alternative fediverse server",
|
||||||
limit: 5000,
|
limit: 5000,
|
||||||
upload_limit: 16_000_000,
|
upload_limit: 16_000_000,
|
||||||
|
avatar_upload_limit: 2_000_000,
|
||||||
|
background_upload_limit: 4_000_000,
|
||||||
|
banner_upload_limit: 4_000_000,
|
||||||
registrations_open: true,
|
registrations_open: true,
|
||||||
federating: true,
|
federating: true,
|
||||||
allow_relay: true,
|
allow_relay: true,
|
||||||
|
|
|
@ -575,10 +575,13 @@ def fetch_activities_bounded(recipients_to, recipients_cc, opts \\ %{}) do
|
||||||
|> Enum.reverse()
|
|> Enum.reverse()
|
||||||
end
|
end
|
||||||
|
|
||||||
def upload(file) do
|
def upload(file, size_limit \\ nil) do
|
||||||
data = Upload.store(file, Application.get_env(:pleroma, :instance)[:dedupe_media])
|
with data <-
|
||||||
|
Upload.store(file, Application.get_env(:pleroma, :instance)[:dedupe_media], size_limit),
|
||||||
|
false <- is_nil(data) do
|
||||||
Repo.insert(%Object{data: data})
|
Repo.insert(%Object{data: data})
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def user_data_from_user_object(data) do
|
def user_data_from_user_object(data) do
|
||||||
avatar =
|
avatar =
|
||||||
|
|
Loading…
Reference in a new issue