Add a setup question asking if the user wants to use AnalyzeMetadata
This commit is contained in:
parent
7f9d011076
commit
3b7ef1bad8
1 changed files with 30 additions and 2 deletions
|
@ -38,7 +38,8 @@ def run(["gen" | rest]) do
|
||||||
listen_port: :string,
|
listen_port: :string,
|
||||||
strip_uploads: :string,
|
strip_uploads: :string,
|
||||||
anonymize_uploads: :string,
|
anonymize_uploads: :string,
|
||||||
dedupe_uploads: :string
|
dedupe_uploads: :string,
|
||||||
|
analyze_uploads: :string
|
||||||
],
|
],
|
||||||
aliases: [
|
aliases: [
|
||||||
o: :output,
|
o: :output,
|
||||||
|
@ -216,6 +217,25 @@ def run(["gen" | rest]) do
|
||||||
"n"
|
"n"
|
||||||
) === "y"
|
) === "y"
|
||||||
|
|
||||||
|
{analyze_uploads_message, analyze_uploads_default} =
|
||||||
|
if Enum.all?(["mogrify", "convert", "ffprobe"], fn x ->
|
||||||
|
Pleroma.Utils.command_available?(x)
|
||||||
|
end) do
|
||||||
|
{"Do you want to analyse the metadata of uploaded media and generate blurry thumbnails of sensitive images? This depends on Imagemagick and FFmpeg, which are detected as already installed. (y/n)",
|
||||||
|
"y"}
|
||||||
|
else
|
||||||
|
{"Do you want to analyse the metadata of uploaded media and generate blurry thumbnails of sensitive images? This depends on Imagemagick and FFmpeg, which are detected as missing. (y/n)",
|
||||||
|
"n"}
|
||||||
|
end
|
||||||
|
|
||||||
|
analyze_uploads =
|
||||||
|
get_option(
|
||||||
|
options,
|
||||||
|
:analyze_uploads,
|
||||||
|
analyze_uploads_message,
|
||||||
|
analyze_uploads_default
|
||||||
|
) === "y"
|
||||||
|
|
||||||
Config.put([:instance, :static_dir], static_dir)
|
Config.put([:instance, :static_dir], static_dir)
|
||||||
|
|
||||||
secret = :crypto.strong_rand_bytes(64) |> Base.encode64() |> binary_part(0, 64)
|
secret = :crypto.strong_rand_bytes(64) |> Base.encode64() |> binary_part(0, 64)
|
||||||
|
@ -258,7 +278,8 @@ def run(["gen" | rest]) do
|
||||||
upload_filters(%{
|
upload_filters(%{
|
||||||
strip: strip_uploads,
|
strip: strip_uploads,
|
||||||
anonymize: anonymize_uploads,
|
anonymize: anonymize_uploads,
|
||||||
dedupe: dedupe_uploads
|
dedupe: dedupe_uploads,
|
||||||
|
analyze: analyze_uploads
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -354,6 +375,13 @@ defp upload_filters(filters) when is_map(filters) do
|
||||||
enabled_filters
|
enabled_filters
|
||||||
end
|
end
|
||||||
|
|
||||||
|
enabled_filters =
|
||||||
|
if filters.analyze do
|
||||||
|
enabled_filters ++ [Pleroma.Upload.Filter.AnalyzeMetadata]
|
||||||
|
else
|
||||||
|
enabled_filters
|
||||||
|
end
|
||||||
|
|
||||||
enabled_filters
|
enabled_filters
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue