From 715b0c8ea3aa9212f9bd30e19c90fd2d070c90a2 Mon Sep 17 00:00:00 2001 From: Glenn Petter Pettersen <218738@student.usn.no> Date: Mon, 25 Feb 2019 16:26:49 +0100 Subject: [PATCH 1/8] Laget kvittering.html --- routes.py | 5 +++++ templates/kvittering.html | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 templates/kvittering.html diff --git a/routes.py b/routes.py index ae7338c..a82fea0 100644 --- a/routes.py +++ b/routes.py @@ -5,3 +5,8 @@ from objects import glob # Global sharing of python objects in a manageable way @glob.app.route("/home") def home(): return render_template("home.html") + +@glob.app.route("/kvittering") +def serve_kvittering(): + return render_template("kvittering.html") + \ No newline at end of file diff --git a/templates/kvittering.html b/templates/kvittering.html new file mode 100644 index 0000000..5743bef --- /dev/null +++ b/templates/kvittering.html @@ -0,0 +1,10 @@ +{% set title = "Kvitteringer" %} + +{% extends "layout/bootstrap.html" %} + +{% block content %} + +

Tester siden!

+

KVITTERINGER FOR FAEN!

+ +{% endblock %} \ No newline at end of file From a3a4a51f73e628671ff7c5e3ef29586ddf5d9f8f Mon Sep 17 00:00:00 2001 From: Sunpy Date: Mon, 25 Feb 2019 16:29:35 +0100 Subject: [PATCH 2/8] Added regninger.html --- routes.py | 4 ++++ templates/regninger.html | 8 ++++++++ 2 files changed, 12 insertions(+) create mode 100644 templates/regninger.html diff --git a/routes.py b/routes.py index ae7338c..2efdd8d 100644 --- a/routes.py +++ b/routes.py @@ -5,3 +5,7 @@ from objects import glob # Global sharing of python objects in a manageable way @glob.app.route("/home") def home(): return render_template("home.html") + +@glob.app.route("/regninger") +def serve_regninger(): + return render_template("regninger.html") diff --git a/templates/regninger.html b/templates/regninger.html new file mode 100644 index 0000000..87e0e34 --- /dev/null +++ b/templates/regninger.html @@ -0,0 +1,8 @@ +{% set title = "Regninger" %} + +{% extends "layout/bootstrap.html" %} + +{% block content %} +

Regninger :D

+

test

+{% endblock %} \ No newline at end of file From 6f0d860439d0c04357b7d0b3ad11c68909394d6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffan=20Svartkj=C3=B8nneng?= Date: Mon, 25 Feb 2019 16:33:56 +0100 Subject: [PATCH 3/8] Added bill.html and changes to routes.py --- routes.py | 4 ++++ templates/bill.html | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 templates/bill.html diff --git a/routes.py b/routes.py index ae7338c..a0b51ac 100644 --- a/routes.py +++ b/routes.py @@ -5,3 +5,7 @@ from objects import glob # Global sharing of python objects in a manageable way @glob.app.route("/home") def home(): return render_template("home.html") + +@glob.app.route("/bill") +def serve_bill(): + return render_template("bill.html") diff --git a/templates/bill.html b/templates/bill.html new file mode 100644 index 0000000..ea43231 --- /dev/null +++ b/templates/bill.html @@ -0,0 +1,11 @@ +{% set title = "bill:)" %} + +{% extends "layout/bootstrap.html" %} + +{% block content %} +

lotsa bills

+

many bills

+ + + +{% endblock %} \ No newline at end of file From 74838697a600d329cfbf15f02691dc4cca6cafe3 Mon Sep 17 00:00:00 2001 From: Nabeel Date: Mon, 25 Feb 2019 16:37:24 +0100 Subject: [PATCH 4/8] testing.html --- templates/testing.html | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 templates/testing.html diff --git a/templates/testing.html b/templates/testing.html new file mode 100644 index 0000000..e69de29 From 2e1521853773aeb990e43d109097e11b88544843 Mon Sep 17 00:00:00 2001 From: Nabeel Date: Mon, 25 Feb 2019 16:43:57 +0100 Subject: [PATCH 5/8] testing --- routes.py | 11 +++-------- templates/testing.html | 8 ++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/routes.py b/routes.py index 840c9d5..1086ed3 100644 --- a/routes.py +++ b/routes.py @@ -6,11 +6,6 @@ from objects import glob # Global sharing of python objects in a manageable way def home(): return render_template("home.html") -@glob.app.route("/regninger") -def serve_regninger(): - return render_template("regninger.html") - -@glob.app.route("/kvittering") -def serve_kvittering(): - return render_template("kvittering.html") - +@glob.app.route("/testing") +def we_are_testing(): + return render_template("testing.html") \ No newline at end of file diff --git a/templates/testing.html b/templates/testing.html index e69de29..91a7ad0 100644 --- a/templates/testing.html +++ b/templates/testing.html @@ -0,0 +1,8 @@ +{% set title = "testing" %} + +{% extends "layout/bootstrap.html" %} + +{% block content %} +

testing

+

tester dette

+{% endblock %} \ No newline at end of file From 87b6b53e180f60945b74423daffb4850eda597b8 Mon Sep 17 00:00:00 2001 From: Sunpy Date: Sat, 2 Mar 2019 20:39:36 +0000 Subject: [PATCH 6/8] Fixed VPS auto-restart on commit --- main.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/main.py b/main.py index b5095d7..5aff984 100644 --- a/main.py +++ b/main.py @@ -10,21 +10,23 @@ if glob.config["git"]["auto_pull_and_restart"]: # Only used on the VPS (Do not e @glob.app.route(glob.config["git"]["webhook_endpoint"], methods = ["POST"]) def git_fetch(): if request.method != "POST": - return "No" + return "No", 400 data = json.loads( request.data.decode() ) if data["secret"] != glob.config["git"]["secret"]: - return "No" - - import subprocess, os, sys - process = subprocess.Popen(["git", "pull"], stdout=subprocess.PIPE) - output = process.communicate()[0] + return "No", 400 + + from subprocess import check_output + output = check_output(["git", "pull", "origin", "master"]) + + print( "GIT: {}".format( output.decode() ) ) if output.decode().split("\n")[-2].find("fail") != -1: - return "Failed to pull changes" + return "Failed to pull changes", 500 # If needed; every open file or connection HAVE to be closed at this point + import os, sys os.execv(sys.executable, ["python"] + sys.argv) # Restart service if glob.config["disable-static-cache"]: @@ -37,7 +39,7 @@ if glob.config["disable-static-cache"]: caching static files. """ return dict(url_for=dated_url_for) - + def dated_url_for(endpoint, **values): if endpoint == "static": filename = values.get("filename", None) From b23e6e0d9cb34973dc9d2f059166ab19c24de7c8 Mon Sep 17 00:00:00 2001 From: Sunpy Date: Sat, 2 Mar 2019 23:38:59 +0100 Subject: [PATCH 7/8] Alert script --- static/js/alerts.js | 20 ++++++++++++++++++++ templates/layout/bootstrap.html | 1 + 2 files changed, 21 insertions(+) create mode 100644 static/js/alerts.js diff --git a/static/js/alerts.js b/static/js/alerts.js new file mode 100644 index 0000000..bb6f417 --- /dev/null +++ b/static/js/alerts.js @@ -0,0 +1,20 @@ +function _findAlertDom(caller) { + let selectedDOM = caller; + do { + if (selectedDOM.classList.contains("alert-section")){ + return selectedDOM; + } + selectedDOM = selectedDOM.parentElement; + } while (selectedDOM != null); + throw Error("Missing alert-section class for self/parent(s)"); +} + +function alertAbove(caller, t, s) { + let dom = _findAlertDom(caller); + dom.outerHTML = `` + dom.outerHTML; +} + +function alertUnder(caller, t, s) { + let dom = _findAlertDom(caller); + dom.outerHTML += ``; +} \ No newline at end of file diff --git a/templates/layout/bootstrap.html b/templates/layout/bootstrap.html index 93c1322..93d6d7a 100644 --- a/templates/layout/bootstrap.html +++ b/templates/layout/bootstrap.html @@ -17,5 +17,6 @@ + \ No newline at end of file From a8d33edaf33043fbb4b27389fb800396585363ff Mon Sep 17 00:00:00 2001 From: Sunpy Date: Sat, 2 Mar 2019 23:41:16 +0100 Subject: [PATCH 8/8] Simple login option page --- routes.py | 8 +++++++- templates/login.html | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 templates/login.html diff --git a/routes.py b/routes.py index f038fba..4392b5b 100644 --- a/routes.py +++ b/routes.py @@ -1,4 +1,4 @@ -from flask import render_template, url_for +from flask import render_template, url_for, request from objects import glob # Global sharing of python objects in a manageable way @glob.app.route("/") @@ -6,6 +6,12 @@ from objects import glob # Global sharing of python objects in a manageable way def home(): return render_template("home.html") +@glob.app.route("/login", methods = ["GET", "POST"]) +def serve_login(): + if request.method == "POST": + return "TODO: Login handle", 501 + return render_template("login.html") + @glob.app.route("/testing") def we_are_testing(): return render_template("testing.html") diff --git a/templates/login.html b/templates/login.html new file mode 100644 index 0000000..d2a17bc --- /dev/null +++ b/templates/login.html @@ -0,0 +1,42 @@ +{% set title = "Login" %} + +{% extends "layout/bootstrap.html" %} + +{% block content %} +
+
+
+
+
+

Login Methods

+
+
+
+
Electronic ID
+

+ Secure login using Electronic ID allows Husstanden to show you banking details, bills and receipts.
+ How to obtain an Electronic ID +

+
+
+
House Account
+

+ Accounts with less privileges and fast login to view non-sensitive information.
+ Multiple house accounts can be created by logging in with house holder's verified Electronic ID. +

+
+
+
+ +
+
+
+
+{% endblock %} \ No newline at end of file