fix: Don't show loader to google crawler
All checks were successful
Build Docker / BuildImage (push) Successful in 1m10s
All checks were successful
Build Docker / BuildImage (push) Successful in 1m10s
This commit is contained in:
parent
fb8136f3b6
commit
eea21cea1e
@ -6,3 +6,4 @@ requests
|
|||||||
cloudflare
|
cloudflare
|
||||||
qrcode
|
qrcode
|
||||||
ansi2html
|
ansi2html
|
||||||
|
cachetools
|
38
server.py
38
server.py
@ -9,13 +9,13 @@ import datetime
|
|||||||
import qrcode
|
import qrcode
|
||||||
import re
|
import re
|
||||||
from ansi2html import Ansi2HTMLConverter
|
from ansi2html import Ansi2HTMLConverter
|
||||||
|
from functools import cache
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
CORS(app)
|
CORS(app)
|
||||||
|
|
||||||
dotenv.load_dotenv()
|
dotenv.load_dotenv()
|
||||||
|
|
||||||
address = ''
|
|
||||||
handshake_scripts = '<script src="https://nathan.woodburn/handshake.js" domain="nathan.woodburn" async></script><script src="https://nathan.woodburn/https.js" async></script>'
|
handshake_scripts = '<script src="https://nathan.woodburn/handshake.js" domain="nathan.woodburn" async></script><script src="https://nathan.woodburn/https.js" async></script>'
|
||||||
|
|
||||||
restricted = ['ascii']
|
restricted = ['ascii']
|
||||||
@ -30,11 +30,12 @@ if os.path.isfile('data/sites.json'):
|
|||||||
projects = []
|
projects = []
|
||||||
projectsUpdated = 0
|
projectsUpdated = 0
|
||||||
|
|
||||||
|
@cache
|
||||||
def getAddress():
|
def getAddress(coin:str) -> str:
|
||||||
global address
|
address = ''
|
||||||
if address == '':
|
if os.path.isfile('.well-known/wallets/' + coin.upper()):
|
||||||
address = 'hs1qv3uu4amv87g7p7h49xez2pmzwjf92am0wzpnh4'
|
with open('.well-known/wallets/' + coin.upper()) as file:
|
||||||
|
address = file.read()
|
||||||
return address
|
return address
|
||||||
|
|
||||||
#Assets routes
|
#Assets routes
|
||||||
@ -110,20 +111,6 @@ def removeTrailingSlash():
|
|||||||
|
|
||||||
@app.route('/.well-known/wallets/<path:path>')
|
@app.route('/.well-known/wallets/<path:path>')
|
||||||
def wallet(path):
|
def wallet(path):
|
||||||
# If HNS, redirect to HNS wallet
|
|
||||||
if path == "HNS":
|
|
||||||
# Get from 100.66.107.77:8080 then return result
|
|
||||||
# Check for cookie
|
|
||||||
if request.cookies.get('HNS'):
|
|
||||||
return make_response(request.cookies.get('HNS'), 200, {'Content-Type': 'text/plain'})
|
|
||||||
|
|
||||||
address = getAddress()
|
|
||||||
# Set cookie
|
|
||||||
resp = make_response(address, 200, {'Content-Type': 'text/plain'})
|
|
||||||
# Cookie should last 1 week
|
|
||||||
resp.set_cookie('HNS', address, max_age=604800)
|
|
||||||
return resp
|
|
||||||
|
|
||||||
if path[0] == ".":
|
if path[0] == ".":
|
||||||
return send_from_directory('.well-known/wallets', path, mimetype='application/json')
|
return send_from_directory('.well-known/wallets', path, mimetype='application/json')
|
||||||
elif os.path.isfile('.well-known/wallets/' + path):
|
elif os.path.isfile('.well-known/wallets/' + path):
|
||||||
@ -181,6 +168,8 @@ def index():
|
|||||||
loaded = True
|
loaded = True
|
||||||
|
|
||||||
|
|
||||||
|
# Check if crawler
|
||||||
|
if request.user_agent.browser != 'Googlebot' and request.user_agent.browser != 'Bingbot':
|
||||||
# Check if cookie is set
|
# Check if cookie is set
|
||||||
if not request.cookies.get('loaded') and not loaded:
|
if not request.cookies.get('loaded') and not loaded:
|
||||||
# Set cookie
|
# Set cookie
|
||||||
@ -189,7 +178,6 @@ def index():
|
|||||||
return resp
|
return resp
|
||||||
|
|
||||||
|
|
||||||
global address
|
|
||||||
global handshake_scripts
|
global handshake_scripts
|
||||||
global projects
|
global projects
|
||||||
global projectsUpdated
|
global projectsUpdated
|
||||||
@ -257,10 +245,14 @@ def index():
|
|||||||
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":
|
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 = ""
|
handshake_scripts = ""
|
||||||
|
|
||||||
address = getAddress()
|
HNSaddress = getAddress("HNS")
|
||||||
|
SOLaddress = getAddress("SOL")
|
||||||
|
BTCaddress = getAddress("BTC")
|
||||||
|
ETHaddress = getAddress("ETH")
|
||||||
# Set cookie
|
# Set cookie
|
||||||
resp = make_response(render_template('index.html', handshake_scripts=handshake_scripts,
|
resp = make_response(render_template('index.html', handshake_scripts=handshake_scripts,
|
||||||
HNS=address, repo=repo,
|
HNS=HNSaddress, SOL=SOLaddress, BTC=BTCaddress,
|
||||||
|
ETH=ETHaddress, repo=repo,
|
||||||
repo_description=repo_description,
|
repo_description=repo_description,
|
||||||
custom=custom,sites=sites,projects=projects), 200, {'Content-Type': 'text/html'})
|
custom=custom,sites=sites,projects=projects), 200, {'Content-Type': 'text/html'})
|
||||||
resp.set_cookie('loaded', 'true', max_age=604800)
|
resp.set_cookie('loaded', 'true', max_age=604800)
|
||||||
|
2
templates/assets/js/hacker-podcast.min.js
vendored
2
templates/assets/js/hacker-podcast.min.js
vendored
@ -1 +1 @@
|
|||||||
const letters="ABCDEFGHIJKLMNOPQRSTUVWXYZ/.?!@#$%^&*()_+";let interval=null,interval2=null,interval3=null;document.querySelector(".copyright").onmouseover=t=>{let e=0,l="Copyright © Nathan Woodburn 2023";clearInterval(interval2),interval2=setInterval((()=>{t.target.innerText=t.target.innerText.split("").map(((t,r)=>r<e?l[r]:letters[Math.floor(41*Math.random())])).join(""),e>=l.length&&clearInterval(interval2),e+=1/3}),10)};
|
const letters="ABCDEFGHIJKLMNOPQRSTUVWXYZ/.?!@#$%^&*()_+";let interval=null,interval2=null,interval3=null;document.querySelector(".copyright").onmouseover=t=>{let e=0,l="Copyright © Nathan.Woodburn/ 2024";clearInterval(interval2),interval2=setInterval((()=>{t.target.innerText=t.target.innerText.split("").map(((t,r)=>r<e?l[r]:letters[Math.floor(41*Math.random())])).join(""),e>=l.length&&clearInterval(interval2),e+=1/3}),10)};
|
@ -163,7 +163,7 @@ Check them out here!</blockquote><img class="img-fluid" src="/assets/img/pfront.
|
|||||||
<li class="list-inline-item"> <a class="btn btn-primary btn-lg btn-default" role="button" href="https://github.com/sponsors/Nathanwoodburn" style="width: 170px;" target="_blank"><i class="fab fa-github fa-fw"></i><span class="network-name"> Github</span></a></li>
|
<li class="list-inline-item"> <a class="btn btn-primary btn-lg btn-default" role="button" href="https://github.com/sponsors/Nathanwoodburn" style="width: 170px;" target="_blank"><i class="fab fa-github fa-fw"></i><span class="network-name"> Github</span></a></li>
|
||||||
<li class="list-inline-item"> <a class="btn btn-primary btn-lg btn-default" role="button" href="https://donate.stripe.com/8wM6pv0VD08Xe408ww" style="width: 170px;" target="_blank"><i class="fab fa-stripe-s fa-fw"></i><span class="network-name"> Stripe</span></a></li>
|
<li class="list-inline-item"> <a class="btn btn-primary btn-lg btn-default" role="button" href="https://donate.stripe.com/8wM6pv0VD08Xe408ww" style="width: 170px;" target="_blank"><i class="fab fa-stripe-s fa-fw"></i><span class="network-name"> Stripe</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>HNS:<br><code data-bs-toggle="tooltip" data-bss-tooltip="" id="hns-domain" class="hns" style="color: rgb(242,90,5);display: block;" title="Click to copy">nathan.woodburn</code><code data-bs-toggle="tooltip" data-bss-tooltip="" id="hns" class="hns" style="color: rgb(242,90,5);display: block;" title="Click to copy">{{HNS}}</code><br>BTC:<br><code data-bs-toggle="tooltip" data-bss-tooltip="" id="btc" class="btc" style="color: rgb(242,90,5);display: block;" title="Click to copy">bc1qhs94zzcw64qnwq4hvk056rwxwvgrkd7tq7d4xw</code><br>SOL:<br><code data-bs-toggle="tooltip" data-bss-tooltip="" id="sol-domain" class="sol" style="color: rgb(242,90,5);display: block;" title="Click to copy">woodburn.sol</code><code data-bs-toggle="tooltip" data-bss-tooltip="" id="sol" class="sol" style="color: rgb(242,90,5);display: block;" title="Click to copy">AJsPEEe6S7XSiVcdZKbeV8GRp1QuhFUsG8mLrqL4XgiU</code><br>ETH:<br><code data-bs-toggle="tooltip" data-bss-tooltip="" id="eth-domain" class="eth" style="color: rgb(242,90,5);display: block;" title="Click to copy">woodburn.au</code><code data-bs-toggle="tooltip" data-bss-tooltip="" id="eth" class="eth" style="color: rgb(242,90,5);display: block;" title="Click to copy">0x6cB4B39bEc23a921C9a20D061Bf17d4640B0d39e</code><a class="btn btn-primary btn-default" role="button" href="/donate" style="width: 170px;margin-top: 10px;">OTHER OPTIONS</a></p>
|
<p>HNS:<br><code data-bs-toggle="tooltip" data-bss-tooltip="" id="hns-domain" class="hns" style="color: rgb(242,90,5);display: block;" title="Click to copy">nathan.woodburn</code><code data-bs-toggle="tooltip" data-bss-tooltip="" id="hns" class="hns" style="color: rgb(242,90,5);display: block;" title="Click to copy">{{HNS}}</code><br>BTC:<br><code data-bs-toggle="tooltip" data-bss-tooltip="" id="btc" class="btc" style="color: rgb(242,90,5);display: block;" title="Click to copy">{{BTC}}</code><br>SOL:<br><code data-bs-toggle="tooltip" data-bss-tooltip="" id="sol-domain" class="sol" style="color: rgb(242,90,5);display: block;" title="Click to copy">woodburn.sol</code><code data-bs-toggle="tooltip" data-bss-tooltip="" id="sol" class="sol" style="color: rgb(242,90,5);display: block;" title="Click to copy">{{SOL}}</code><br>ETH:<br><code data-bs-toggle="tooltip" data-bss-tooltip="" id="eth-domain" class="eth" style="color: rgb(242,90,5);display: block;" title="Click to copy">woodburn.au</code><code data-bs-toggle="tooltip" data-bss-tooltip="" id="eth" class="eth" style="color: rgb(242,90,5);display: block;" title="Click to copy">{{ETH}}</code><a class="btn btn-primary btn-default" role="button" href="/donate" style="width: 170px;margin-top: 10px;">OTHER OPTIONS</a></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user