diff --git a/server.py b/server.py index 350ec50..8a3290a 100644 --- a/server.py +++ b/server.py @@ -19,6 +19,8 @@ exchange = { } +tlds = ['australia','newzealand'] + #Assets routes @app.route('/assets/') def send_report(path): @@ -374,21 +376,32 @@ def login(): @app.route('/') def index(): year = datetime.datetime.now().year - return render_template('index.html',year=year) + hns_scripts = '' + + if not request.host in tlds and 'localhost' not in request.host: + return render_template('index.html',year=year, handshake_scripts=hns_scripts) + + tld = request.host.split('.')[-1] + print(tld) + if 'localhost' in tld: + tld = tlds[0] + hns_scripts = '' + return render_template('/tlds/'+tld+'.html',year=year, handshake_scripts=hns_scripts) @app.route('/') def catch_all(path): year = datetime.datetime.now().year + hns_scripts = '' # If file exists, load it if os.path.isfile('templates/' + path): - return render_template(path, year=year) + return render_template(path, year=year, handshake_scripts=hns_scripts) # Try with .html if os.path.isfile('templates/' + path + '.html'): - return render_template(path + '.html', year=year) + return render_template(path + '.html', year=year, handshake_scripts=hns_scripts) if os.path.isfile('templates/' + path.strip('/') + '.html'): - return render_template(path.strip('/') + '.html', year=year) + return render_template(path.strip('/') + '.html', year=year, handshake_scripts=hns_scripts) return render_template('404.html'), 404 diff --git a/templates/404.html b/templates/404.html index 7439481..1b7e107 100644 --- a/templates/404.html +++ b/templates/404.html @@ -31,6 +31,7 @@ +{{handshake_scripts | safe}} diff --git a/templates/about.html b/templates/about.html index dcb2dba..497a90d 100644 --- a/templates/about.html +++ b/templates/about.html @@ -33,6 +33,7 @@ +{{handshake_scripts | safe}} @@ -92,8 +93,7 @@ - - + diff --git a/templates/blog.html b/templates/blog.html index 04b20ed..99e6954 100644 --- a/templates/blog.html +++ b/templates/blog.html @@ -30,6 +30,7 @@ +{{handshake_scripts | safe}} @@ -114,8 +115,7 @@ - - + diff --git a/templates/blog/happening.html b/templates/blog/happening.html index d11e3fb..29e27f1 100644 --- a/templates/blog/happening.html +++ b/templates/blog/happening.html @@ -30,6 +30,7 @@ +{{handshake_scripts | safe}} diff --git a/templates/blog/new_domains.html b/templates/blog/new_domains.html index 139c129..789beb0 100644 --- a/templates/blog/new_domains.html +++ b/templates/blog/new_domains.html @@ -33,6 +33,7 @@ Register even more Australian SLDs on HNSAU."> +{{handshake_scripts | safe}} diff --git a/templates/blog/pins.html b/templates/blog/pins.html index a204860..41ac4c4 100644 --- a/templates/blog/pins.html +++ b/templates/blog/pins.html @@ -32,6 +32,7 @@ +{{handshake_scripts | safe}} diff --git a/templates/cart.html b/templates/cart.html index 36f33d8..a397925 100644 --- a/templates/cart.html +++ b/templates/cart.html @@ -30,6 +30,7 @@ +{{handshake_scripts | safe}} diff --git a/templates/contact.html b/templates/contact.html index cb2b62f..490f996 100644 --- a/templates/contact.html +++ b/templates/contact.html @@ -31,6 +31,7 @@ +{{handshake_scripts | safe}} @@ -93,8 +94,7 @@ - - + diff --git a/templates/domains.html b/templates/domains.html index 62c17cb..9edd433 100644 --- a/templates/domains.html +++ b/templates/domains.html @@ -30,6 +30,7 @@ +{{handshake_scripts | safe}} diff --git a/templates/faq.html b/templates/faq.html index 02ed80e..a854cee 100644 --- a/templates/faq.html +++ b/templates/faq.html @@ -30,6 +30,7 @@ +{{handshake_scripts | safe}} @@ -96,8 +97,7 @@ - - + diff --git a/templates/index.html b/templates/index.html index 80e4ae1..8d61380 100644 --- a/templates/index.html +++ b/templates/index.html @@ -38,10 +38,10 @@ +{{handshake_scripts | safe}} - - +