[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: remote reducer
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: remote reducer |
Date: |
Thu, 14 Oct 2021 12:21:11 +0200 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new 82acf4d remote reducer
82acf4d is described below
commit 82acf4decaa2d012bb46d3c0b87b5d6c0741f996
Author: Florian Dold <florian@dold.me>
AuthorDate: Thu Oct 14 12:21:06 2021 +0200
remote reducer
---
contrib/remote-reducer/remote_reducer.py | 47 ++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/contrib/remote-reducer/remote_reducer.py
b/contrib/remote-reducer/remote_reducer.py
new file mode 100644
index 0000000..e21047b
--- /dev/null
+++ b/contrib/remote-reducer/remote_reducer.py
@@ -0,0 +1,47 @@
+import flask
+from flask import Flask, request
+import subprocess
+import json
+
+app = Flask(__name__)
+
+
+@app.route("/")
+def hello_world():
+ return "<p>Hello, World!</p>"
+
+
+@app.route("/start-recovery")
+def start_recovery():
+ res = subprocess.run(["anastasis-reducer", "-r"], capture_output=True)
+ resp = flask.Response(res.stdout)
+ resp.headers['Access-Control-Allow-Origin'] = '*'
+ return resp
+
+
+@app.route("/start-backup")
+def start_backup():
+ res = subprocess.run(["anastasis-reducer", "-b"], capture_output=True)
+ resp = flask.Response(res.stdout)
+ resp.headers['Access-Control-Allow-Origin'] = '*'
+ return resp
+
+
+@app.route("/action", methods=["POST", "OPTIONS"])
+def reduce_action():
+ if request.method == "OPTIONS":
+ resp = flask.Response()
+ resp.headers['Access-Control-Allow-Origin'] = '*'
+ resp.headers['Access-Control-Allow-Headers'] = '*'
+ resp.headers['Access-Control-Allow-Method'] = '*'
+ return resp
+
+ b = request.get_json()
+ res = subprocess.run(
+ ["anastasis-reducer", "-a", json.dumps(b["arguments"]), b["action"]],
+ capture_output=True,
+ input=json.dumps(b["state"]).encode("utf-8"),
+ )
+ resp = flask.Response(res.stdout)
+ resp.headers['Access-Control-Allow-Origin'] = '*'
+ return resp
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis] branch master updated: remote reducer,
gnunet <=