From 7f287231420f1aa80936cd4a599e1a23a59225c7 Mon Sep 17 00:00:00 2001 From: Pasha8914 Date: Mon, 13 Jun 2022 20:49:00 +1000 Subject: [PATCH] return app.html --- app.html | 0 static/headerScript.js | 35 ----------------------------------- 2 files changed, 35 deletions(-) create mode 100644 app.html delete mode 100644 static/headerScript.js diff --git a/app.html b/app.html new file mode 100644 index 0000000..e69de29 diff --git a/static/headerScript.js b/static/headerScript.js deleted file mode 100644 index a7feffb..0000000 --- a/static/headerScript.js +++ /dev/null @@ -1,35 +0,0 @@ -const main = () => { - if (window.location.search) { - console.log('redirect') - window.location = window.location.origin + window.location.pathname - } - - function addScript(src) { - const s = document.createElement('script') - s.setAttribute('src', src) - document.body.appendChild(s) - } - - document.addEventListener('DOMContentLoaded', () => { - const ipfsPathRegExp = /^(\/(?:ipfs|ipns)\/[^/]+)/ - const ipfsPathPrefix = (window.location.pathname.match(ipfsPathRegExp) || [])[1] || '' - if (ipfsPathPrefix) { - const scripts = [...document.getElementsByTagName('script')] - - for (let i = 0; i < scripts.length; i++) { - if (scripts[i].src) { - const source = new URL(scripts[i].src) - if (!source.pathname.includes(ipfsPathPrefix)) { - console.log('Loading', source.pathname) - - const newSource = window.location.origin + ipfsPathPrefix + source.pathname - addScript(newSource) - } - } - } - console.log('Finished') - } - }) -} - -main()