mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-19 10:39:26 +01:00
Merge branch 'readme' into 'main'
readme: unifiedpush gateway See merge request famedly/fluffychat!418
This commit is contained in:
commit
6d8c4d470a
@ -132,22 +132,25 @@ Next, you add the `repo.unifiedpush.org` repository to fdroid and install the go
|
||||
## Matrix-specific re-write proxy
|
||||
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
|
||||
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 {
|
||||
set $target '';
|
||||
if ($request_method = GET ) {
|
||||
return 200 '{"gateway":"matrix"}';
|
||||
return 200 '{"gateway":"matrix","unifiedpush":{"gateway":"matrix"}}';
|
||||
}
|
||||
access_by_lua_block {
|
||||
local cjson = require("cjson")
|
||||
ngx.req.read_body()
|
||||
local body = ngx.req.get_body_data()
|
||||
local parsedBody = cjson.decode(body)
|
||||
local accepted = "https://relay.example.tld/"
|
||||
ngx.var.target = parsedBody["notification"]["devices"][1]["pushkey"]
|
||||
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 Host $host;
|
||||
|
Loading…
Reference in New Issue
Block a user