diff options
author | Roman Chvanikov <chvanikoff@pm.me> | 2019-07-20 01:03:25 +0300 |
---|---|---|
committer | Roman Chvanikov <chvanikoff@pm.me> | 2019-07-20 01:03:25 +0300 |
commit | 36049f08efadb5f6f727753ecc1f7be6a5b4e3d8 (patch) | |
tree | 2f1e1b5a20ad654cda4021115e621887d2735959 /docs/config | |
parent | e7c175c943e9e3f53df76d812c09cfeffdb1c56b (diff) | |
parent | 33729bbb2834bfa1f223b11d47dc8e3230d47657 (diff) | |
download | pleroma-36049f08efadb5f6f727753ecc1f7be6a5b4e3d8.tar.gz |
Merge develop
Diffstat (limited to 'docs/config')
-rw-r--r-- | docs/config/howto_mediaproxy.md | 4 | ||||
-rw-r--r-- | docs/config/howto_set_richmedia_cache_ttl_based_on_image.md | 33 |
2 files changed, 36 insertions, 1 deletions
diff --git a/docs/config/howto_mediaproxy.md b/docs/config/howto_mediaproxy.md index fb731112b..ed70c3ed4 100644 --- a/docs/config/howto_mediaproxy.md +++ b/docs/config/howto_mediaproxy.md @@ -24,7 +24,9 @@ If you came here from one of the installation guides, take a look at the example ``` config :pleroma, :media_proxy, enabled: true, - redirect_on_failure: true + proxy_opts: [ + redirect_on_failure: true + ] #base_url: "https://cache.pleroma.social" ``` If you want to use a subdomain to serve the files, uncomment `base_url`, change the url and add a comma after `true` in the previous line. 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 new file mode 100644 index 000000000..bfee5a9e6 --- /dev/null +++ b/docs/config/howto_set_richmedia_cache_ttl_based_on_image.md @@ -0,0 +1,33 @@ +# 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. |