diff --git a/app/templates/button.html b/app/templates/button.html new file mode 100644 index 0000000..674985d --- /dev/null +++ b/app/templates/button.html @@ -0,0 +1,7 @@ +{% extends 'index.html' %} +{% block body %} +

Output:

+
+
{{ output }}
+
+{% endblock %} diff --git a/app/templates/index.html b/app/templates/index.html index 2e7ca09..c2ac08a 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -16,9 +16,15 @@

Welcome To WebDist

Home | Latest packages - +
{% block body %} - +
{{ output }}
+ {% for button in config['BUTTONS'] %} +
+ {{ config['BUTTONS'][button]['text'] }} +
+ + {% endfor %} {% endblock %}
diff --git a/app/webdist.py b/app/webdist.py index dbfd658..3269cd0 100644 --- a/app/webdist.py +++ b/app/webdist.py @@ -75,6 +75,13 @@ def _latest(): return render_template("latest.html", data=data) +@app.route("/button/") +def _button(name): + script = app.config['BUTTONS'][name]['script'] + output = subprocess.check_output([script]) + return render_template("button.html",output=output.decode()) + + @app.route("/query/") def _query(qs): body = "" diff --git a/main.cfg.example b/main.cfg.example index 2a8f8a3..2bbcd85 100644 --- a/main.cfg.example +++ b/main.cfg.example @@ -5,3 +5,6 @@ REPOS = { 'openmamba-rolling': { 'dbname': 'devel', 'path': '/var/webbuild/db/' }, 'openmamba-testing': { 'dbname': 'devel-makedist', 'path': '/var/webbuild/db/' }, } +BUTTONS = { + 'sample_button': { 'text':"This is a sample button", 'script': '/bin/true' } +}