diff --git a/server.py b/server.py index 817c818..31087e2 100644 --- a/server.py +++ b/server.py @@ -86,15 +86,26 @@ def index(): repo_name=git['repo']['name'] repo_name=repo_name.lower() repo_description=git['repo']['description'] + custom = "" + + # Check for downtime + uptime = requests.get('https://uptime.woodburn.au/api/status-page/main/badge') + uptime = uptime.content.count(b'Up') > 1 + + if uptime: + custom += "" + else: + custom += "" + + + # Special names if repo_name == "nathanwoodburn.github.io": repo_name = "Nathan.Woodburn/" html_url=git['repo']['html_url'] - repo = "" + repo_name + "" - handshake_scripts = "" # If localhost, don't load handshake if request.host == "localhost:5000" or request.host == "127.0.0.1:5000" or os.getenv('dev') == "true" or request.host == "test.nathan.woodburn.au": @@ -102,14 +113,14 @@ def index(): if request.cookies.get('HNS'): - return render_template('index.html', handshake_scripts=handshake_scripts, HNS=request.cookies.get('HNS'), repo=repo, repo_description=repo_description) + return render_template('index.html', handshake_scripts=handshake_scripts, HNS=request.cookies.get('HNS'), repo=repo, repo_description=repo_description, custom=custom) if handshake_scripts == "": address = "hs1............example" else: address = requests.get('http://hip02-server:3000').text # Set cookie - resp = make_response(render_template('index.html', handshake_scripts=handshake_scripts, HNS=address, repo=repo, repo_description=repo_description), 200, {'Content-Type': 'text/html'}) + resp = make_response(render_template('index.html', handshake_scripts=handshake_scripts, HNS=address, repo=repo, repo_description=repo_description, custom=custom), 200, {'Content-Type': 'text/html'}) # Cookie should last 1 week resp.set_cookie('HNS', address, max_age=604800) return resp diff --git a/templates/assets/css/index.min.css b/templates/assets/css/index.min.css index cb53a4f..beaf81f 100644 --- a/templates/assets/css/index.min.css +++ b/templates/assets/css/index.min.css @@ -1 +1 @@ -img.no-drag{pointer-events:none}img.fog{pointer-events:none;position:absolute;left:0;top:0;width:100%;height:100%} \ No newline at end of file +img.no-drag{pointer-events:none}img.fog{pointer-events:none;position:absolute;left:0;top:0;width:100%;height:100%}#downtime{z-index:2;position:fixed;right:0;bottom:0;width:20%;transition:opacity .5s;opacity:0}blockquote.speech{position:absolute;display:inline-block;right:14vw;bottom:23vh;width:17vw;background:url(/assets/img/speech-bubble.svg) center;color:#fff;padding-top:3%;padding-bottom:20%;background-repeat:no-repeat!important;margin:0 auto;text-align:center;box-sizing:content-box;line-height:1;font-family:SequentialistBB,cursive;font-size:1.2vw} \ No newline at end of file diff --git a/templates/assets/img/speech-bubble.svg b/templates/assets/img/speech-bubble.svg new file mode 100644 index 0000000..c9e2fbe --- /dev/null +++ b/templates/assets/img/speech-bubble.svg @@ -0,0 +1,48 @@ + + + + + + + + diff --git a/templates/assets/js/downtime.min.js b/templates/assets/js/downtime.min.js new file mode 100644 index 0000000..54669e2 --- /dev/null +++ b/templates/assets/js/downtime.min.js @@ -0,0 +1 @@ +document.addEventListener("DOMContentLoaded",(function(){var n=document.getElementById("downtime");n&&n.addEventListener("click",(function(){"0"!==n.style.opacity&&window.open("https://uptime.woodburn.au","_blank")}))})),window.addEventListener("scroll",(function(){const n=document.getElementById("downtime"),t=window.scrollY;n.style.opacity=t>200?"0":"1"})); \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 9bc4807..e765d27 100644 --- a/templates/index.html +++ b/templates/index.html @@ -72,6 +72,9 @@ height="0" width="0" style="display:none;visibility:hidden"> +
G'day!
+Some services are down.
+Check them out here!

G'day, Welcome to
my Personal Site

@@ -79,7 +82,7 @@ height="0" width="0" style="display:none;visibility:hidden">

Nathan Woodburn

-
+
@@ -147,7 +150,7 @@ height="0" width="0" style="display:none;visibility:hidden">
-
+
@@ -229,10 +232,11 @@ height="0" width="0" style="display:none;visibility:hidden"> hns.addEventListener('click', () => { copyToClipboard(hns); }); - +{{custom | safe}} + \ No newline at end of file