This commit is contained in:
parent
7e4e76ce19
commit
42fca1fc41
7 changed files with 146 additions and 1 deletions
55
.drone.yml
Normal file
55
.drone.yml
Normal file
|
@ -0,0 +1,55 @@
|
|||
kind: pipeline
|
||||
type: docker
|
||||
name: linux-amd64
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: docker
|
||||
image: plugins/docker
|
||||
settings:
|
||||
purge: true
|
||||
no_cache: true
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-amd64
|
||||
repo: spcodes/unifiedpush-gotify
|
||||
username:
|
||||
from_secret: USERNAME
|
||||
password:
|
||||
from_secret: PASSWORD
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
- push
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: manifest
|
||||
|
||||
steps:
|
||||
- name: publish-latest
|
||||
image: plugins/manifest
|
||||
settings:
|
||||
ignore_missing: true
|
||||
target: spcodes/unifiedpush-gotify
|
||||
template: spcodes/unifiedpush-gotify:OS-ARCH
|
||||
platforms:
|
||||
- linux/amd64
|
||||
username:
|
||||
from_secret: USERNAME
|
||||
password:
|
||||
from_secret: PASSWORD
|
||||
|
||||
depends_on:
|
||||
- linux-amd64
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
- push
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
.idea/
|
||||
*.iml
|
14
Dockerfile
Normal file
14
Dockerfile
Normal file
|
@ -0,0 +1,14 @@
|
|||
FROM openresty/openresty:1.19.3.1-buster@sha256:1b970e585389f3cbbb4429c00ec6ada0082926ea0db9a2f3a9c105cbb4f437e4
|
||||
|
||||
COPY nginx.conf.template /
|
||||
COPY entrypoint.sh /
|
||||
|
||||
ENV RESOLVER=1.1.1.1
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
STOPSIGNAL SIGQUIT
|
||||
|
||||
ENTRYPOINT ["bash", "entrypoint.sh"]
|
||||
|
||||
CMD ["openresty", "-g", "daemon off;"]
|
15
README.md
15
README.md
|
@ -1,2 +1,15 @@
|
|||
# unifiedpush-gotify
|
||||
# [Gotify UnifiedPush Gateway](https://git.sp-codes.de/sp-codes/unifiedpush-gotify)
|
||||
|
||||
[![Build Status](https://ci.sp-codes.de/api/badges/sp-codes/unifiedpush-gotify/status.svg)](https://ci.sp-codes.de/sp-codes/unifiedpush-gotify) [![License](https://img.shields.io/badge/license-AGPL--3.0-purple)](#license) [![Docker Pulls](https://img.shields.io/docker/pulls/spcodes/unifiedpush-gotify)](https://hub.docker.com/r/spcodes/unifiedpush-gotify)
|
||||
|
||||
A Docker Image for [UnifiedPush](https://unifiedpush.org). Including the [Proxy](https://unifiedpush.org/users/distributors/gotify/#nginx) and the [Matrix-Gateway](https://github.com/UnifiedPush/contrib/blob/main/gateways/matrix.md#matrix-gateway). The extension to Gotify.
|
||||
|
||||
## Usage
|
||||
|
||||
coming soon
|
||||
|
||||
## License
|
||||
|
||||
[![GNU AGPLv3 Image](https://www.gnu.org/graphics/agplv3-155x51.png)](https://www.gnu.org/licenses/agpl-3.0)
|
||||
|
||||
This project is Free Software: It is licensed under GNU AGPL v3 (See [LICENSE](LICENSE) for more information).
|
||||
|
|
10
entrypoint.sh
Normal file
10
entrypoint.sh
Normal file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ -z "${GOTIFY_URL}" ]]; then
|
||||
echo "Please set GOTIFY_URL to your gotify instance."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
envsubst '${RESOLVER} ${GOTIFY_URL}' < /nginx.conf.template > /etc/nginx/conf.d/default.conf
|
||||
|
||||
exec "$@"
|
41
nginx.conf.template
Normal file
41
nginx.conf.template
Normal file
|
@ -0,0 +1,41 @@
|
|||
server {
|
||||
listen 80;
|
||||
|
||||
resolver ${RESOLVER} ipv6=off;
|
||||
|
||||
location /_matrix/push/v1/notify {
|
||||
set $target '';
|
||||
if ($request_method = GET ) {
|
||||
return 200 '{"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)
|
||||
ngx.var.target = parsedBody["notification"]["devices"][1]["pushkey"]
|
||||
ngx.req.set_body_data(body)
|
||||
}
|
||||
proxy_set_header Content-Type application/json;
|
||||
proxy_set_header Host $host;
|
||||
proxy_pass $target;
|
||||
proxy_ssl_server_name on;
|
||||
}
|
||||
|
||||
location /UP {
|
||||
access_by_lua_block{
|
||||
ngx.req.read_body()
|
||||
local req = ngx.req.get_body_data()
|
||||
local newreq, n, err = ngx.re.gsub(req, '\\\\', '\\\\')
|
||||
local newreq, n, err = ngx.re.gsub(newreq, '"', '\\"')
|
||||
local newreq, n, err = ngx.re.gsub(newreq, "^", "{\"message\":\"")
|
||||
local newreq, n, err = ngx.re.gsub(newreq, "$", "\"}")
|
||||
ngx.req.set_body_data(newreq)
|
||||
}
|
||||
|
||||
proxy_set_header Content-Type application/json;
|
||||
proxy_set_header Host $host;
|
||||
proxy_pass ${GOTIFY_URL}/message;
|
||||
proxy_ssl_server_name on;
|
||||
}
|
||||
}
|
10
renovate.json
Normal file
10
renovate.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"assignees": [
|
||||
"samuel-p"
|
||||
],
|
||||
"baseBranches": [
|
||||
"main"
|
||||
],
|
||||
"rangeStrategy": "bump",
|
||||
"rebaseWhen": "behind-base-branch"
|
||||
}
|
Reference in a new issue