diff --git a/.gitignore b/.gitignore index 1b05740..f707afe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ __pycache__/ + +.env diff --git a/server.py b/server.py index 4f5c1de..817c818 100644 --- a/server.py +++ b/server.py @@ -80,19 +80,38 @@ def wallet(path): # Main routes @app.route('/') def index(): + git=requests.get('https://git.woodburn.au/api/v1/users/nathanwoodburn/activities/feeds?only-performed-by=true&limit=1&token=' + os.getenv('git_token')) + git = git.json() + git = git[0] + repo_name=git['repo']['name'] + repo_name=repo_name.lower() + repo_description=git['repo']['description'] + + # 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": handshake_scripts = "" + if request.cookies.get('HNS'): - return render_template('index.html', handshake_scripts=handshake_scripts, HNS=request.cookies.get('HNS')) - - address = requests.get('http://hip02-server:3000') + return render_template('index.html', handshake_scripts=handshake_scripts, HNS=request.cookies.get('HNS'), repo=repo, repo_description=repo_description) + + 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.text), 200, {'Content-Type': 'text/html'}) + resp = make_response(render_template('index.html', handshake_scripts=handshake_scripts, HNS=address, repo=repo, repo_description=repo_description), 200, {'Content-Type': 'text/html'}) # Cookie should last 1 week - resp.set_cookie('HNS', address.text, max_age=604800) + resp.set_cookie('HNS', address, max_age=604800) return resp diff --git a/templates/index.html b/templates/index.html index d4898da..9bc4807 100644 --- a/templates/index.html +++ b/templates/index.html @@ -85,7 +85,9 @@ height="0" width="0" style="display:none;visibility:hidden">
Hi, I'm Nathan Woodburn and I live in Canberra, Australia.
I've been home schooled all the way to Yr 12.
I'm currently studying a Bachelor of Computer Science.
I started a 3D printing service in early 2021.
I'm one of the founders of Handshake AU working to increase Handshake adoption in Australia.
I work for Namebase as tech and general support. Namebase is a US based company owned by Namecheap.
Hi, I'm Nathan Woodburn and I live in Canberra, Australia.
I've been home schooled all the way to Yr 12.
I'm currently studying a Bachelor of Computer Science.
I started a 3D printing service in early 2021.
I'm one of the founders of Handshake AU working to increase Handshake adoption in Australia.
I work for Namebase as tech and general support. Namebase is a US based company owned by Namecheap.
I'm currently working on
+{{repo | safe}}