From 0328c8fb4bc61db67a6f213983a4c57c8fcc510b Mon Sep 17 00:00:00 2001 From: nune <145225213+gigirassy@users.noreply.github.com> Date: Thu, 19 Dec 2024 19:39:15 -0500 Subject: [PATCH] Update client.js --- public/client.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/public/client.js b/public/client.js index 7465819..f9f182a 100644 --- a/public/client.js +++ b/public/client.js @@ -23,11 +23,12 @@ document.addEventListener('DOMContentLoaded', async () => { return; } - // Redirect to raw paste page - const rawPasteUrl = `/${pasteId}`; + const frontendUrl = `/${pasteId}`; + + // If auto-copy is enabled, fetch and copy the paste contents if (autoCopyCheckbox.checked) { try { - const response = await fetch(rawPasteUrl); + const response = await fetch(frontendUrl); if (response.ok) { const pasteContents = await response.text(); await navigator.clipboard.writeText(pasteContents); @@ -39,7 +40,9 @@ document.addEventListener('DOMContentLoaded', async () => { alert('Error copying to clipboard: ' + error.message); } } - window.location.href = `/${pasteId}` + + // Redirect to the frontend paste URL + window.location.href = frontendUrl; }); }); @@ -73,3 +76,4 @@ function setCookie(name, value, days) { function getCookie(name) { const match = document.cookie.match(new RegExp(`(?:^|; )${name}=([^;]*)`)); return match ? decodeURIComponent(match[1]) : null; +}