1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.RichMedia.Parser.TTL do
6 @callback ttl(map(), String.t()) :: integer() | nil
8 @spec process(map(), String.t()) :: {:ok, integer() | nil}
9 def process(data, url) do
10 [:rich_media, :ttl_setters]
11 |> Pleroma.Config.get()
12 |> Enum.reduce_while({:ok, nil}, fn
14 case module.ttl(data, url) do
15 ttl when is_number(ttl) -> {:halt, {:ok, ttl}}