diff --git a/server.py b/server.py index 411b061..1ce8cad 100644 --- a/server.py +++ b/server.py @@ -536,6 +536,13 @@ def index(): # Check if referrer includes nathan.woodburn.au if "nathan.woodburn.au" in request.referrer: loaded = True + if request.cookies.get("loaded"): + loaded = True + + # Always load if load=true is in the query string + if request.args.get("load").lower() == "true": + loaded = False + # Check if crawler if request.headers and request.headers.get("User-Agent"): @@ -554,7 +561,7 @@ def index(): "User-Agent" ) and "Bingbot" not in request.headers.get("User-Agent"): # Check if cookie is set - if not request.cookies.get("loaded") and not loaded: + if not loaded: # Set cookie resp = make_response( render_template("loading.html").replace( diff --git a/templates/assets/js/loading.min.js b/templates/assets/js/loading.min.js index 51d5eee..13156e4 100644 --- a/templates/assets/js/loading.min.js +++ b/templates/assets/js/loading.min.js @@ -1 +1 @@ -document.addEventListener("DOMContentLoaded",(function(){const s=document.getElementById("loading-screen"),e=[{pre:'┌──(nathan@NWTux)-[~]',message:"cd Git"},{pre:'┌──(nathan@NWTux)-[~/Git]',message:"cd Nathanwoodburn.github.io"},{pre:'┌──(nathan@NWTux)-[~/Git/Nathanwoodburn.github.io]',message:"python3 main.py"}],t=["Starting server with 1 workers and 2 threads","+0000] [1] [INFO] Starting gunicorn 22.0.0","+0000] [1] [INFO] Listening at: http://0.0.0.0:5000 (1)","+0000] [1] [INFO] Using worker: gthread","+0000] [8] [INFO] Booting worker with pid: 8","Preloading assets for faster navigation..."];let n=0,a=!1,i=!1;function r(){i&&setTimeout(l,200)}function o(e,t){const n=function(){const s=new Date;return`${s.getUTCFullYear()}-${String(s.getUTCMonth()+1).padStart(2,"0")}-${String(s.getUTCDate()).padStart(2,"0")} ${String(s.getUTCHours()).padStart(2,"0")}:${String(s.getUTCMinutes()).padStart(2,"0")}:${String(s.getUTCSeconds()).padStart(2,"0")}`}();for(let t=0;t{const e=document.createElement("link");e.rel="preload",e.as=s.type,e.href=s.url,"font"===s.type&&(e.crossOrigin="anonymous"),e.onload=n,e.onerror=n,document.head.appendChild(e)}))}),100),function a(){n$ ',s.appendChild(a);let i=0;const r=setInterval((()=>{a.removeChild(a.querySelector(".cursor")),a.innerHTML+=e.message[i]+'',i++,i===e.message.length&&(a.removeChild(a.querySelector(".cursor")),clearInterval(r),t())}),50)}(e[n],(()=>{n++,setTimeout(a,200)})):o(t,(()=>{r()}))}()})); \ No newline at end of file +document.addEventListener("DOMContentLoaded",(function(){const s=document.getElementById("loading-screen"),e=[{pre:'┌──(nathan@NWTux)-[~]',message:"cd Git"},{pre:'┌──(nathan@NWTux)-[~/Git]',message:"cd Nathanwoodburn.github.io"},{pre:'┌──(nathan@NWTux)-[~/Git/Nathanwoodburn.github.io]',message:"python3 main.py"}],t=["Starting server with 1 workers and 2 threads","+0000] [1] [INFO] Starting gunicorn 22.0.0","+0000] [1] [INFO] Listening at: http://0.0.0.0:5000 (1)","+0000] [1] [INFO] Using worker: gthread","+0000] [8] [INFO] Booting worker with pid: 8"];let n=0,a=!1,i=!1;function r(){i&&setTimeout(l,200)}function o(e,t){const n=function(){const s=new Date;return`${s.getUTCFullYear()}-${String(s.getUTCMonth()+1).padStart(2,"0")}-${String(s.getUTCDate()).padStart(2,"0")} ${String(s.getUTCHours()).padStart(2,"0")}:${String(s.getUTCMinutes()).padStart(2,"0")}:${String(s.getUTCSeconds()).padStart(2,"0")}`}();for(let t=0;t{const e=document.createElement("link");e.rel="preload",e.as=s.type,e.href=s.url,"font"===s.type&&(e.crossOrigin="anonymous"),e.onload=n,e.onerror=n,document.head.appendChild(e)}))}),100),function a(){n$ ',s.appendChild(a);let i=0;const r=setInterval((()=>{a.removeChild(a.querySelector(".cursor")),a.innerHTML+=e.message[i]+'',i++,i===e.message.length&&(a.removeChild(a.querySelector(".cursor")),clearInterval(r),t())}),50)}(e[n],(()=>{n++,setTimeout(a,200)})):o(t,(()=>{r()}))}()})); \ No newline at end of file