Only find SHA256 for packs that are shared
This commit is contained in:
parent
54b8e683bc
commit
7fb7dd9e0e
@ -36,13 +36,19 @@ defmodule Pleroma.Web.EmojiAPI.EmojiAPIController do
|
|||||||
|> Enum.map(fn {name, pack} ->
|
|> Enum.map(fn {name, pack} ->
|
||||||
pack_path = Path.join(@emoji_dir_path, name)
|
pack_path = Path.join(@emoji_dir_path, name)
|
||||||
|
|
||||||
|
if can_download?(pack, pack_path) do
|
||||||
archive_for_sha = make_archive(name, pack, pack_path)
|
archive_for_sha = make_archive(name, pack, pack_path)
|
||||||
archive_sha = :crypto.hash(:sha256, archive_for_sha) |> Base.encode16()
|
archive_sha = :crypto.hash(:sha256, archive_for_sha) |> Base.encode16()
|
||||||
|
|
||||||
{name,
|
{name,
|
||||||
pack
|
pack
|
||||||
|> put_in(["pack", "can-download"], can_download?(pack, pack_path))
|
|> put_in(["pack", "can-download"], true)
|
||||||
|> put_in(["pack", "download-sha256"], archive_sha)}
|
|> put_in(["pack", "download-sha256"], archive_sha)}
|
||||||
|
else
|
||||||
|
{name,
|
||||||
|
pack
|
||||||
|
|> put_in(["pack", "can-download"], false)}
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|> Enum.into(%{})
|
|> Enum.into(%{})
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user