projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add simple way to decode fully qualified mediaproxy URLs
[akkoma]
/
lib
/
pleroma
/
web
/
rich_media
/
parser.ex
diff --git
a/lib/pleroma/web/rich_media/parser.ex
b/lib/pleroma/web/rich_media/parser.ex
index c70d2fdbade7c66a6f253ecbf2e0d3672523e059..d6b54943b40ee2ee0289ef648a1f2cdf4a79a3ba 100644
(file)
--- a/
lib/pleroma/web/rich_media/parser.ex
+++ b/
lib/pleroma/web/rich_media/parser.ex
@@
-1,10
+1,12
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-202
0
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-202
1
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.RichMedia.Parser do
require Logger
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.RichMedia.Parser do
require Logger
+ @cachex Pleroma.Config.get([:cachex, :provider], Cachex)
+
defp parsers do
Pleroma.Config.get([:rich_media, :parsers])
end
defp parsers do
Pleroma.Config.get([:rich_media, :parsers])
end
@@
-24,7
+26,7
@@
defmodule Pleroma.Web.RichMedia.Parser do
end
defp get_cached_or_parse(url) do
end
defp get_cached_or_parse(url) do
- case
C
achex.fetch(:rich_media_cache, url, fn ->
+ case
@c
achex.fetch(:rich_media_cache, url, fn ->
case parse_url(url) do
{:ok, _} = res ->
{:commit, res}
case parse_url(url) do
{:ok, _} = res ->
{:commit, res}
@@
-64,7
+66,7
@@
defmodule Pleroma.Web.RichMedia.Parser do
defp set_error_ttl(url, _reason) do
ttl = Pleroma.Config.get([:rich_media, :failure_backoff], 60_000)
defp set_error_ttl(url, _reason) do
ttl = Pleroma.Config.get([:rich_media, :failure_backoff], 60_000)
-
C
achex.expire(:rich_media_cache, url, ttl)
+
@c
achex.expire(:rich_media_cache, url, ttl)
:ok
end
:ok
end
@@
-106,7
+108,7
@@
defmodule Pleroma.Web.RichMedia.Parser do
{:ok, ttl} when is_number(ttl) ->
ttl = ttl * 1000
{:ok, ttl} when is_number(ttl) ->
ttl = ttl * 1000
- case
C
achex.expire_at(:rich_media_cache, url, ttl) do
+ case
@c
achex.expire_at(:rich_media_cache, url, ttl) do
{:ok, true} -> {:ok, ttl}
{:ok, false} -> {:error, :no_key}
end
{:ok, true} -> {:ok, ttl}
{:ok, false} -> {:error, :no_key}
end