From db484a637b128447df40e29d32404751fb5ff9d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Dvo=C5=99=C3=A1k?= <150935816+Dvorinka@users.noreply.github.com> Date: Wed, 21 May 2025 13:12:46 +0200 Subject: [PATCH] Add files via upload --- index.html | 53 ++++++++++++++++++++++++++++++++------------- main.go | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 15 deletions(-) diff --git a/index.html b/index.html index 63d4c20..745cc38 100644 --- a/index.html +++ b/index.html @@ -72,7 +72,7 @@
Systém technické podpory a hlášení problémů
- + Otevřít aplikaci @@ -82,9 +82,9 @@Správa úkolů a projektů v přehledném kanban stylu
- + Otevřít aplikaci @@ -185,20 +185,43 @@ }); }); - // Function to open Windows Explorer with a specific path + // Function to open Windows folders via Go server function openWindowsFolder(path) { - // Using ActiveX to open Windows Explorer (works in IE) - try { - const shell = new ActiveXObject("Shell.Application"); - shell.Explore(path); - return; - } catch (e) { - console.log("ActiveX not supported or disabled"); - } + // Show loading indicator or disable button + const allButtons = document.querySelectorAll('button'); + allButtons.forEach(button => { + if (button.innerHTML.includes('Otevřít složku')) { + button.disabled = true; + } + }); - // Fallback to file:// protocol - const encodedPath = path.split('\\').map(part => encodeURIComponent(part)).join('/'); - window.open('file:///' + encodedPath, '_blank'); + // Make API call to our Go endpoint + fetch('/open-folder', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ path: path }) + }) + .then(response => response.json()) + .then(data => { + if (data.error) { + console.error('Chyba při otevírání složky:', data.error); + alert('Chyba při otevírání složky: ' + data.error); + } else { + console.log('Složka úspěšně otevřena'); + } + }) + .catch(error => { + console.error('Chyba při komunikaci se serverem:', error); + alert('Chyba při komunikaci se serverem. Zkuste to prosím později.'); + }) + .finally(() => { + // Re-enable buttons + allButtons.forEach(button => { + button.disabled = false; + }); + }); }