updated docs
This commit is contained in:
parent
3f8d68bdf3
commit
c33a4315fb
|
@ -380,10 +380,7 @@
|
||||||
enabled: false,
|
enabled: false,
|
||||||
invalidation: [
|
invalidation: [
|
||||||
enabled: false,
|
enabled: false,
|
||||||
provider: Pleroma.Web.MediaProxy.Invalidation.Script,
|
provider: Pleroma.Web.MediaProxy.Invalidation.Script
|
||||||
options: %{
|
|
||||||
script_path: "./installation/nginx-cache-purge.example"
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
proxy_opts: [
|
proxy_opts: [
|
||||||
redirect_on_failure: false,
|
redirect_on_failure: false,
|
||||||
|
|
|
@ -249,6 +249,26 @@ This section describe PWA manifest instance-specific values. Currently this opti
|
||||||
* `base_url`: The base URL to access a user-uploaded file. Useful when you want to proxy the media files via another host/CDN fronts.
|
* `base_url`: The base URL to access a user-uploaded file. Useful when you want to proxy the media files via another host/CDN fronts.
|
||||||
* `proxy_opts`: All options defined in `Pleroma.ReverseProxy` documentation, defaults to `[max_body_length: (25*1_048_576)]`.
|
* `proxy_opts`: All options defined in `Pleroma.ReverseProxy` documentation, defaults to `[max_body_length: (25*1_048_576)]`.
|
||||||
* `whitelist`: List of domains to bypass the mediaproxy
|
* `whitelist`: List of domains to bypass the mediaproxy
|
||||||
|
* `invalidation`: options for remove media from cache after delete object:
|
||||||
|
* `enabled`: Enables purge cache
|
||||||
|
* `provider`: Which one of the [purge cache strategy](#purge-cache-strategy) to use.
|
||||||
|
|
||||||
|
### Purge cache strategy
|
||||||
|
|
||||||
|
#### Pleroma.Web.MediaProxy.Invalidation.Script
|
||||||
|
|
||||||
|
This strategy allow perform external bash script to purge cache.
|
||||||
|
Urls of attachments pass to script as arguments.
|
||||||
|
|
||||||
|
* `script_path`: path to external script.
|
||||||
|
|
||||||
|
#### Pleroma.Web.MediaProxy.Invalidation.Http
|
||||||
|
|
||||||
|
This strategy allow perform custom http request to purge cache.
|
||||||
|
|
||||||
|
* `method`: http method. default is `purge`
|
||||||
|
* `headers`: http headers. default is empty
|
||||||
|
* `options`: request options. default is empty
|
||||||
|
|
||||||
## Link previews
|
## Link previews
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,9 @@ def purge(urls) do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp do_purge(true, urls) do
|
defp do_purge(true, urls) do
|
||||||
config = Config.get([:media_proxy, :invalidation])
|
provider = Config.get([:media_proxy, :invalidation, :provider])
|
||||||
config[:provider].purge(urls, config[:options])
|
options = Config.get(provider)
|
||||||
|
provider.purge(urls, options)
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@ defmodule Pleroma.Web.MediaProxy.Invalidation.Http do
|
||||||
|
|
||||||
@impl Pleroma.Web.MediaProxy.Invalidation
|
@impl Pleroma.Web.MediaProxy.Invalidation
|
||||||
def purge(urls, opts) do
|
def purge(urls, opts) do
|
||||||
method = Map.get(opts, :http_method, :purge)
|
method = Map.get(opts, :method, :purge)
|
||||||
headers = Map.get(opts, :http_headers, [])
|
headers = Map.get(opts, :headers, [])
|
||||||
options = Map.get(opts, :http_options, [])
|
options = Map.get(opts, :options, [])
|
||||||
|
|
||||||
Enum.each(urls, fn url ->
|
Enum.each(urls, fn url ->
|
||||||
Pleroma.HTTP.request(method, url, "", headers, options)
|
Pleroma.HTTP.request(method, url, "", headers, options)
|
||||||
|
|
Loading…
Reference in New Issue