2020-10-12 17:00:50 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
2023-01-02 20:38:50 +00:00
|
|
|
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
2020-10-12 17:00:50 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2019-07-19 05:58:42 +00:00
|
|
|
defmodule Pleroma.Web.RichMedia.Parser.TTL do
|
2024-01-20 22:14:56 +00:00
|
|
|
@callback ttl(map(), String.t()) :: integer() | nil
|
2024-02-11 21:11:52 +00:00
|
|
|
|
|
|
|
def get_from_image(data, url) do
|
|
|
|
[:rich_media, :ttl_setters]
|
|
|
|
|> Pleroma.Config.get()
|
|
|
|
|> Enum.reduce({:ok, nil}, fn
|
|
|
|
module, {:ok, _ttl} ->
|
|
|
|
module.ttl(data, url)
|
|
|
|
|
|
|
|
_, error ->
|
|
|
|
error
|
|
|
|
end)
|
|
|
|
end
|
2019-07-19 05:58:42 +00:00
|
|
|
end
|