update readme

This commit is contained in:
S1m 2021-05-26 18:52:04 +02:00
parent b092aef74d
commit c08d4a4569
1 changed files with 6 additions and 3 deletions

View File

@ -132,22 +132,25 @@ Next, you add the `repo.unifiedpush.org` repository to fdroid and install the go
## Matrix-specific re-write proxy ## Matrix-specific re-write proxy
Until [MSC2970](https://github.com/matrix-org/matrix-doc/pull/2970) is figured out we unfortunately Until [MSC2970](https://github.com/matrix-org/matrix-doc/pull/2970) is figured out we unfortunately
need another simple re-write proxy. By default the one at https://matrix.gateway.unifiedpush.org need another simple re-write proxy. By default the one at https://matrix.gateway.unifiedpush.org
is used, however you can easily self-host it. For that, add to your nginx config on the same domain you serve gotify the following: is used, however you can easily self-host it. For that, add to your nginx config on the same domain you serve gotify the following (change *relay.example.tld*):
``` ```
resolver 8.8.8.8; resolver 9.9.9.9;
location /_matrix/push/v1/notify { location /_matrix/push/v1/notify {
set $target ''; set $target '';
if ($request_method = GET ) { if ($request_method = GET ) {
return 200 '{"gateway":"matrix"}'; return 200 '{"gateway":"matrix","unifiedpush":{"gateway":"matrix"}}';
} }
access_by_lua_block { access_by_lua_block {
local cjson = require("cjson") local cjson = require("cjson")
ngx.req.read_body() ngx.req.read_body()
local body = ngx.req.get_body_data() local body = ngx.req.get_body_data()
local parsedBody = cjson.decode(body) local parsedBody = cjson.decode(body)
local accepted = "https://relay.example.tld/"
ngx.var.target = parsedBody["notification"]["devices"][1]["pushkey"] ngx.var.target = parsedBody["notification"]["devices"][1]["pushkey"]
ngx.req.set_body_data(body) ngx.req.set_body_data(body)
if(string.sub(ngx.var.target,1,string.len(accepted))~=accepted) then ngx.var.target="http://0.0.0.0/"
end
} }
proxy_set_header Content-Type application/json; proxy_set_header Content-Type application/json;
proxy_set_header Host $host; proxy_set_header Host $host;