mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-21 23:44:30 +00:00
Expose maximum picture sizes
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
fb614cf877
commit
0210b677c5
7 changed files with 39 additions and 4 deletions
|
@ -25,9 +25,9 @@ config :mobilizon, :instance,
|
|||
allow_relay: true,
|
||||
federating: true,
|
||||
remote_limit: 100_000,
|
||||
upload_limit: 10_000_000,
|
||||
avatar_upload_limit: 2_000_000,
|
||||
banner_upload_limit: 4_000_000,
|
||||
upload_limit: 10_485_760,
|
||||
avatar_upload_limit: 2_097_152,
|
||||
banner_upload_limit: 4_194_304,
|
||||
remove_orphan_uploads: true,
|
||||
orphan_upload_grace_period_hours: 48,
|
||||
remove_unconfirmed_users: true,
|
||||
|
|
|
@ -75,6 +75,11 @@ export const CONFIG = gql`
|
|||
label
|
||||
}
|
||||
}
|
||||
uploadLimits {
|
||||
default
|
||||
avatar
|
||||
banner
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
|
|
@ -89,4 +89,9 @@ export interface IConfig {
|
|||
ldap: boolean;
|
||||
oauthProviders: IOAuthProvider[];
|
||||
};
|
||||
uploadLimits: {
|
||||
default: number;
|
||||
avatar: number;
|
||||
banner: number;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -102,6 +102,12 @@ export const configMock = {
|
|||
},
|
||||
],
|
||||
slogan: null,
|
||||
uploadLimits: {
|
||||
__typename: "UploadLimits",
|
||||
default: 10_000_000,
|
||||
avatar: 2_000_000,
|
||||
banner: 4_000_000,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -134,6 +134,11 @@ defmodule Mobilizon.GraphQL.Resolvers.Config do
|
|||
auth: %{
|
||||
ldap: Config.ldap_enabled?(),
|
||||
oauth_providers: Config.oauth_consumer_strategies()
|
||||
},
|
||||
upload_limits: %{
|
||||
default: Config.get([:instance, :upload_limit]),
|
||||
avatar: Config.get([:instance, :avatar_upload_limit]),
|
||||
banner: Config.get([:instance, :banner_upload_limit])
|
||||
}
|
||||
}
|
||||
end
|
||||
|
|
|
@ -33,6 +33,8 @@ defmodule Mobilizon.GraphQL.Schema.ConfigType do
|
|||
description: "The instance's enabled resource providers"
|
||||
)
|
||||
|
||||
field(:upload_limits, :upload_limits, description: "The configuration for upload limits")
|
||||
|
||||
field(:timezones, list_of(:string), description: "The instance's available timezones")
|
||||
field(:features, :features, description: "The instance's features")
|
||||
field(:version, :string, description: "The instance's version")
|
||||
|
@ -283,6 +285,15 @@ defmodule Mobilizon.GraphQL.Schema.ConfigType do
|
|||
field(:label, :string, description: "The label for the auth provider")
|
||||
end
|
||||
|
||||
@desc """
|
||||
An upload limits configuration
|
||||
"""
|
||||
object :upload_limits do
|
||||
field(:default, :integer, description: "The default limitation, in bytes")
|
||||
field(:avatar, :integer, description: "The avatar limitation, in bytes")
|
||||
field(:banner, :integer, description: "The banner limitation, in bytes")
|
||||
end
|
||||
|
||||
object :config_queries do
|
||||
@desc "Get the instance config"
|
||||
field :config, :config do
|
||||
|
|
|
@ -62,9 +62,12 @@ defmodule Mobilizon.Web.Endpoint do
|
|||
plug(Plug.RequestId)
|
||||
plug(Plug.Logger)
|
||||
|
||||
upload_limit =
|
||||
Keyword.get(Application.get_env(:mobilizon, :instance, []), :upload_limit, 10_485_760)
|
||||
|
||||
plug(
|
||||
Plug.Parsers,
|
||||
parsers: [:urlencoded, {:multipart, length: 10_000_000}, :json, Absinthe.Plug.Parser],
|
||||
parsers: [:urlencoded, {:multipart, length: upload_limit}, :json, Absinthe.Plug.Parser],
|
||||
pass: ["*/*"],
|
||||
json_decoder: Jason
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue