diff --git a/README.md b/README.md index d666828..ffd1543 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# wifi-with-matrix +# Matrix Webhook -Bridge between https://code.ffdn.org/FFDN/wifi-with-me & a matrix room +Post a message to a matrix room with a simple HTTP POST ## Configuration @@ -30,6 +30,6 @@ docker-compose up -d ## Test ``` -curl -d '{"text":"new contrib from toto: http://radio.localhost/map/#44", "key": "secret"}' wwm.localhost +curl -d '{"text":"new contrib from toto: http://radio.localhost/map/#44", "key": "secret"}' mwh.localhost ``` -(or wwm.localhost:4785 without docker) +(or mwh.localhost:4785 without docker) diff --git a/docker-compose.yml b/docker-compose.yml index 2834a05..fb004e1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,5 +14,4 @@ services: - web labels: traefik.enable: "true" - traefik.frontend.rule: "Host: ${CHATONS_SERVICE:-wwm}.${CHATONS_DOMAIN:-localhost}, www.${CHATONS_SERVICE:-wwm}.${CHATONS_DOMAIN:-localhost}" - + traefik.frontend.rule: "Host: ${CHATONS_SERVICE:-mwh}.${CHATONS_DOMAIN:-localhost}, www.${CHATONS_SERVICE:-mwh}.${CHATONS_DOMAIN:-localhost}" diff --git a/main.py b/main.py index 758205f..de0d360 100755 --- a/main.py +++ b/main.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """ -wifi-with-matrix script. -Bridge between https://code.ffdn.org/FFDN/wifi-with-me & a matrix room +Matrix Webhook +Post a message to a matrix room with a simple HTTP POST """ import json @@ -17,9 +17,9 @@ MATRIX_PW = os.environ['MATRIX_PW'] API_KEY = os.environ['API_KEY'] -class WWMBotServer(HTTPServer): +class MatrixWebhookServer(HTTPServer): """ - an HTTPServer that also contain a matrix client + an HTTPServer that embeds a matrix client """ def __init__(self, *args, **kwargs): @@ -29,7 +29,7 @@ class WWMBotServer(HTTPServer): self.rooms = self.client.get_rooms() -class WWMBotForwarder(BaseHTTPRequestHandler): +class MatrixWebhookHandler(BaseHTTPRequestHandler): """ Class given to the server, st. it knows what to do with a request. This one handles the HTTP request, and forwards it to the matrix room. @@ -60,5 +60,4 @@ class WWMBotForwarder(BaseHTTPRequestHandler): if __name__ == '__main__': - print('Wifi-With-Matrix bridge starting…') - WWMBotServer(SERVER_ADDRESS, WWMBotForwarder).serve_forever() + MatrixWebhookServer(SERVER_ADDRESS, MatrixWebhookHandler).serve_forever()