summaryrefslogtreecommitdiff
path: root/docs/config/howto_set_richmedia_cache_ttl_based_on_image.md
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2019-10-03 15:43:03 +0000
committerrinpatch <rinpatch@sdf.org>2019-10-03 15:43:03 +0000
commit4fe2af3b2d6b0701de2ae88f9932e4b6039ced11 (patch)
tree95dfb9f82ee8a3259f0f8d1d6ce27cc562819fb6 /docs/config/howto_set_richmedia_cache_ttl_based_on_image.md
parentc5e937b156ea1f8f96ade7d9104fc2c5fd1dd9cd (diff)
parentb2f2012a4f34cfe8151e62d045f0eab3d165791a (diff)
downloadpleroma-4fe2af3b2d6b0701de2ae88f9932e4b6039ced11.tar.gz
pleroma-4fe2af3b2d6b0701de2ae88f9932e4b6039ced11.zip
Merge branch 'mkdocs-migration-prep' into 'develop'
MkDocs migration preparation See merge request pleroma/pleroma!1774
Diffstat (limited to 'docs/config/howto_set_richmedia_cache_ttl_based_on_image.md')
-rw-r--r--docs/config/howto_set_richmedia_cache_ttl_based_on_image.md33
1 files changed, 0 insertions, 33 deletions
diff --git a/docs/config/howto_set_richmedia_cache_ttl_based_on_image.md b/docs/config/howto_set_richmedia_cache_ttl_based_on_image.md
deleted file mode 100644
index bfee5a9e6..000000000
--- a/docs/config/howto_set_richmedia_cache_ttl_based_on_image.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# How to set rich media cache ttl based on image ttl
-## Explanation
-
-Richmedia are cached without the ttl but the rich media may have image which can expire, like aws signed url.
-In such cases the old image url (expired) is returned from the media cache.
-
-So to avoid such situation we can define a module that will set ttl based on image.
-The module must adopt behaviour `Pleroma.Web.RichMedia.Parser.TTL`
-
-### Example
-
-```exs
-defmodule MyModule do
- @behaviour Pleroma.Web.RichMedia.Parser.TTL
-
- @impl Pleroma.Web.RichMedia.Parser.TTL
- def ttl(data, url) do
- image_url = Map.get(data, :image)
- # do some parsing in the url and get the ttl of the image
- # return ttl is unix time
- parse_ttl_from_url(image_url)
- end
-end
-```
-
-And update the config
-
-```exs
-config :pleroma, :rich_media,
- ttl_setters: [Pleroma.Web.RichMedia.Parser.TTL.AwsSignedUrl, MyModule]
-```
-
-> For reference there is a parser for AWS signed URL `Pleroma.Web.RichMedia.Parser.TTL.AwsSignedUrl`, it's enabled by default.