diff --git a/app/resourceIntegrityHashes.js b/app/resourceIntegrityHashes.js index fbdf524..e8164c0 100644 --- a/app/resourceIntegrityHashes.js +++ b/app/resourceIntegrityHashes.js @@ -10,7 +10,7 @@ module.exports = "jquery.min.js": "sha384-vtXRMe3mGCbOeY7l30aIg8H9p3GdeSe4IFlP6G8JMa7o7lXvnz3GFKzPxzJdPfGK", "moment.min.js": "sha384-CJyhAlbbRZX14Q8KxKBt0na1ad4KBs9PklAiNk2Efxs9sgimbIZm9kYLJQeNMUfM", "sentry.min.js": "sha384-da/Bo2Ah6Uw3mlhl6VINMblg2SyGbSnULKrukse3P5D9PTJi4np9HoKvR19D7zOL", - "site.js": "sha384-+oXWKXwPD9Fyf6EYrFPvPAPGVsB7INqoVZhse4PVoWQYgCsJ5M9bI0YWIsgYT0NR", + "site.js": "sha384-G8o2io5zIdQiiVN+4CAGGXPO4UvV8jGkSMlfddSPbqIUd3x5Rv01pNH6ec8QOATu", "bootstrap-icons.css": "sha384-rJFhkIguED0Z4GX6r6ReHpTCkwWtiPHZnQtWVP0DQWcKHzeJAlYb1m/xdYkeEk+f", "dark-v1.min.css": "sha384-7nc/D1JfDkQU5dNF5LLXrlAmfZQr9A0PgyeEBKNVtVnyww7HO1WJtyDIOO/voke9", "dark.min.css": "sha384-K1njself27eyYQZECXmxrP5uhM6YJtHrbxRi0s5FTvP3y5t3nvjL6lfaLNuHiAxt", diff --git a/bin/frontend-resource-integrity.js b/bin/frontend-resource-integrity.js index 20fb20b..826b33e 100644 --- a/bin/frontend-resource-integrity.js +++ b/bin/frontend-resource-integrity.js @@ -37,4 +37,4 @@ let fileContent = "module.exports =\n" + JSON.stringify(hashesByFilename, null, fs.writeFileSync(path.join(process.cwd(), "app/resourceIntegrityHashes.js"), fileContent); -console.log("\npublic/txt/resource-integrity.json written.\n"); \ No newline at end of file +console.log("\napp/resourceIntegrityHashes.js written.\n"); \ No newline at end of file diff --git a/public/js/site.js b/public/js/site.js index a1983fd..8f02dcc 100644 --- a/public/js/site.js +++ b/public/js/site.js @@ -34,9 +34,30 @@ function showAllTxOutputs(link, txid) { } function copyTextToClipboard(text) { - navigator.clipboard.writeText(text).then(() => {}, (err) => { - console.error('Error copying text: ', err); - }); + // navigator.clipboard won't exist if it's not secure (i.e. http on non-localhost) + // so there's a backup method + if (navigator.clipboard) { + navigator.clipboard.writeText(text).then(() => {}, (err) => { + console.error('Error copying text: ', err); + }); + } else { + var inputId = "copy-text-hidden-input"; + + var input = document.createElement('input'); + input.setAttribute("id", inputId); + input.setAttribute("class", "hidden"); + input.setAttribute("value", text); + + document.body.appendChild(input); + + // copy address + document.getElementById(inputId).select(); + document.execCommand('copy'); + + // remove element + input.remove(); + } + } function enableTooltipsAndPopovers() {