mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-03 20:12:59 +00:00
Add files via upload
This commit is contained in:
@@ -0,0 +1,68 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"os/exec"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// Set up HTTP server
|
||||||
|
http.HandleFunc("/open", openFolderHandler)
|
||||||
|
|
||||||
|
// Start server on port 8080
|
||||||
|
fmt.Println("Folder opener server running on http://localhost:8080")
|
||||||
|
log.Fatal(http.ListenAndServe(":8080", nil))
|
||||||
|
}
|
||||||
|
|
||||||
|
func openFolderHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
// Set CORS headers to allow requests from any origin
|
||||||
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||||
|
w.Header().Set("Access-Control-Allow-Methods", "GET, OPTIONS")
|
||||||
|
w.Header().Set("Access-Control-Allow-Headers", "Content-Type")
|
||||||
|
|
||||||
|
// Handle preflight OPTIONS request
|
||||||
|
if r.Method == "OPTIONS" {
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only allow GET requests
|
||||||
|
if r.Method != "GET" {
|
||||||
|
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the folder path from the query parameter
|
||||||
|
folderPath := r.URL.Query().Get("path")
|
||||||
|
if folderPath == "" {
|
||||||
|
http.Error(w, "Missing path parameter", http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Log the request
|
||||||
|
fmt.Printf("Opening folder: %s\n", folderPath)
|
||||||
|
|
||||||
|
// Open the folder in Windows Explorer
|
||||||
|
// The /select flag opens Explorer with the specified folder selected
|
||||||
|
cmd := exec.Command("explorer.exe", folderPath)
|
||||||
|
err := cmd.Start()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
// If there was an error, try to clean the path and retry
|
||||||
|
cleanPath := strings.ReplaceAll(folderPath, "/", "\\")
|
||||||
|
cmd = exec.Command("explorer.exe", cleanPath)
|
||||||
|
err = cmd.Start()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, fmt.Sprintf("Error opening folder: %v", err), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return success response
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
|
fmt.Fprintf(w, "Opening folder: %s", folderPath)
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
@echo off
|
||||||
|
echo Starting Folder Opener Server...
|
||||||
|
cd %~dp0
|
||||||
|
go run main.go
|
||||||
+204
-122
@@ -1,123 +1,205 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="cs">
|
<html lang="cs">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Aplikační Rozcestník</title>
|
<title>Aplikační Rozcestník</title>
|
||||||
<script src="https://cdn.tailwindcss.com"></script>
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
|
||||||
<style>
|
<style>
|
||||||
.card {
|
.card {
|
||||||
transition: transform 0.2s, box-shadow 0.2s;
|
transition: transform 0.2s, box-shadow 0.2s;
|
||||||
}
|
}
|
||||||
.card:hover {
|
.card:hover {
|
||||||
transform: translateY(-5px);
|
transform: translateY(-5px);
|
||||||
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-gray-100 min-h-screen">
|
<body class="bg-gray-100 min-h-screen">
|
||||||
<header class="bg-gradient-to-r from-blue-600 to-indigo-700 text-white shadow-lg" style="margin-bottom: 20px;">
|
<header class="bg-gradient-to-r from-blue-600 to-indigo-700 text-white shadow-lg" style="margin-bottom: 20px;">
|
||||||
<div class="container mx-auto px-4 py-6 flex items-center">
|
<div class="container mx-auto px-4 py-6 flex items-center">
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h1 class="text-3xl font-bold">Poppe + Potthoff - Firemní Aplikace</h1>
|
<h1 class="text-3xl font-bold">Poppe + Potthoff - Firemní Aplikace</h1>
|
||||||
<p class="mt-2 text-blue-100">Rychlý přístup ke všem důležitým systémům</p>
|
<p class="mt-2 text-blue-100">Rychlý přístup ke všem důležitým systémům</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main class="container mx-auto px-4 py-8">
|
<main class="container mx-auto px-4 py-8">
|
||||||
<!-- Search -->
|
<!-- Search -->
|
||||||
<div class="mb-8 max-w-xl mx-auto">
|
<div class="mb-8 max-w-xl mx-auto">
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
<input type="text" id="search" placeholder="Hledat aplikaci..." style="margin-bottom: 20px;"
|
<input type="text" id="search" placeholder="Hledat aplikaci..." style="margin-bottom: 20px;"
|
||||||
class="w-full px-4 py-3 rounded-lg shadow-sm border-gray-200 focus:border-blue-500 focus:ring-2 focus:ring-blue-500 focus:outline-none">
|
class="w-full px-4 py-3 rounded-lg shadow-sm border-gray-200 focus:border-blue-500 focus:ring-2 focus:ring-blue-500 focus:outline-none">
|
||||||
<div class="absolute right-3 top-3 text-gray-400">
|
<div class="absolute right-3 top-3 text-gray-400">
|
||||||
<i class="fas fa-search"></i>
|
<i class="fas fa-search"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Apps Grid -->
|
<!-- Apps Grid -->
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
||||||
<!-- 1. Car trips app -->
|
<!-- 1. Car trips app -->
|
||||||
<div class="card bg-white rounded-xl shadow p-6 border-t-4 border-blue-600" data-name="zápis cest aut project">
|
<div class="card bg-white rounded-xl shadow p-6 border-t-4 border-blue-600" data-name="zápis cest aut project">
|
||||||
<div class="rounded-full w-14 h-14 flex items-center justify-center bg-blue-100 text-blue-600 mb-4">
|
<div class="rounded-full w-14 h-14 flex items-center justify-center bg-blue-100 text-blue-600 mb-4">
|
||||||
<i class="fas fa-car-side text-2xl"></i>
|
<i class="fas fa-car-side text-2xl"></i>
|
||||||
</div>
|
</div>
|
||||||
<h2 class="text-xl font-bold text-gray-800 mb-2">Záznam jízdy služebního vozu</h2>
|
<h2 class="text-xl font-bold text-gray-800 mb-2">Záznam jízdy služebního vozu</h2>
|
||||||
<p class="text-gray-600 mb-4">Systém pro evidenci služebních jízd.</p>
|
<p class="text-gray-600 mb-4">Systém pro evidenci služebních jízd.</p>
|
||||||
<a href="/evidence-aut" class="block text-center bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-lg transition-colors">
|
<a href="/evidence-aut" class="block text-center bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-lg transition-colors">
|
||||||
Otevřít aplikaci
|
Otevřít aplikaci
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 2. Lunches -->
|
<!-- 2. Lunches -->
|
||||||
<div class="card bg-white rounded-xl shadow p-6 border-t-4 border-green-600" data-name="obědy obedy jídlo lunch">
|
<div class="card bg-white rounded-xl shadow p-6 border-t-4 border-green-600" data-name="obědy obedy jídlo lunch">
|
||||||
<div class="rounded-full w-14 h-14 flex items-center justify-center bg-green-100 text-green-600 mb-4">
|
<div class="rounded-full w-14 h-14 flex items-center justify-center bg-green-100 text-green-600 mb-4">
|
||||||
<i class="fas fa-utensils text-2xl"></i>
|
<i class="fas fa-utensils text-2xl"></i>
|
||||||
</div>
|
</div>
|
||||||
<h2 class="text-xl font-bold text-gray-800 mb-2">Objednávka obědů</h2>
|
<h2 class="text-xl font-bold text-gray-800 mb-2">Objednávka obědů</h2>
|
||||||
<p class="text-gray-600 mb-4">Portál pro objednávku a přehled firemních obědů</p>
|
<p class="text-gray-600 mb-4">Portál pro objednávku a přehled firemních obědů</p>
|
||||||
<a href="http://ppc-app/pwkweb2" class="block text-center bg-green-600 hover:bg-green-700 text-white font-medium py-2 px-4 rounded-lg transition-colors">
|
<a href="http://ppc-app/pwkweb2" class="block text-center bg-green-600 hover:bg-green-700 text-white font-medium py-2 px-4 rounded-lg transition-colors">
|
||||||
Otevřít aplikaci
|
Otevřít aplikaci
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 3. OSTicket -->
|
<!-- 3. OSTicket -->
|
||||||
<div class="card bg-white rounded-xl shadow p-6 border-t-4 border-orange-600" data-name="osticket pomoc podpora support ticket">
|
<div class="card bg-white rounded-xl shadow p-6 border-t-4 border-orange-600" data-name="osticket pomoc podpora support ticket">
|
||||||
<div class="rounded-full w-14 h-14 flex items-center justify-center bg-orange-100 text-orange-600 mb-4">
|
<div class="rounded-full w-14 h-14 flex items-center justify-center bg-orange-100 text-orange-600 mb-4">
|
||||||
<i class="fas fa-headset text-2xl"></i>
|
<i class="fas fa-headset text-2xl"></i>
|
||||||
</div>
|
</div>
|
||||||
<h2 class="text-xl font-bold text-gray-800 mb-2">OSTicket</h2>
|
<h2 class="text-xl font-bold text-gray-800 mb-2">OSTicket</h2>
|
||||||
<p class="text-gray-600 mb-4">Systém technické podpory a hlášení problémů</p>
|
<p class="text-gray-600 mb-4">Systém technické podpory a hlášení problémů</p>
|
||||||
<a href="#" class="block text-center bg-orange-600 hover:bg-orange-700 text-white font-medium py-2 px-4 rounded-lg transition-colors">
|
<a href="http://osticket/" class="block text-center bg-orange-600 hover:bg-orange-700 text-white font-medium py-2 px-4 rounded-lg transition-colors">
|
||||||
Otevřít aplikaci
|
Otevřít aplikaci
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 4. Canboard tasks -->
|
<!-- 4. Canboard tasks -->
|
||||||
<div class="card bg-white rounded-xl shadow p-6 border-t-4 border-purple-600" data-name="canboard úkoly úkolníček tasks">
|
<div class="card bg-white rounded-xl shadow p-6 border-t-4 border-purple-600" data-name="canboard úkoly úkolníček tasks">
|
||||||
<div class="rounded-full w-14 h-14 flex items-center justify-center bg-purple-100 text-purple-600 mb-4">
|
<div class="rounded-full w-14 h-14 flex items-center justify-center bg-purple-100 text-purple-600 mb-4">
|
||||||
<i class="fas fa-tasks text-2xl"></i>
|
<i class="fas fa-tasks text-2xl"></i>
|
||||||
</div>
|
</div>
|
||||||
<h2 class="text-xl font-bold text-gray-800 mb-2">Canboard úkolníček</h2>
|
<h2 class="text-xl font-bold text-gray-800 mb-2">Kanboard</h2>
|
||||||
<p class="text-gray-600 mb-4">Správa úkolů a projektů v přehledném kanban stylu</p>
|
<p class="text-gray-600 mb-4">Správa úkolů a projektů v přehledném kanban stylu</p>
|
||||||
<a href="#" class="block text-center bg-purple-600 hover:bg-purple-700 text-white font-medium py-2 px-4 rounded-lg transition-colors">
|
<a href="http://kanboard/" class="block text-center bg-purple-600 hover:bg-purple-700 text-white font-medium py-2 px-4 rounded-lg transition-colors">
|
||||||
Otevřít aplikaci
|
Otevřít aplikaci
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</main>
|
</div>
|
||||||
|
|
||||||
<footer class="bg-gray-800 text-gray-400 py-6 mt-12">
|
<!-- Separator with heading -->
|
||||||
<div class="container mx-auto px-4 text-center">
|
<div class="my-10 text-center">
|
||||||
<p>© 2025 Poppe + Potthoff</p>
|
<div class="relative">
|
||||||
<p class="mt-2 text-sm">Created by <a href="https://tdvorak.dev" class="text-blue-400 hover:text-blue-300">TDvorak</a></p>
|
<div class="absolute inset-0 flex items-center">
|
||||||
</div>
|
<div class="w-full border-t border-gray-300"></div>
|
||||||
</footer>
|
</div>
|
||||||
|
<div class="relative flex justify-center">
|
||||||
<script>
|
<span class="bg-gray-100 px-4 text-sm text-gray-500">WINDOWS SDÍLENÉ SLOŽKY</span>
|
||||||
// Search functionality
|
</div>
|
||||||
const searchInput = document.getElementById('search');
|
</div>
|
||||||
const appCards = document.querySelectorAll('.card');
|
</div>
|
||||||
|
|
||||||
searchInput.addEventListener('input', function() {
|
<!-- Windows Folders Grid - smaller and more subtle cards -->
|
||||||
const searchTerm = this.value.toLowerCase();
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||||
|
<!-- 1. Telefonní seznam -->
|
||||||
appCards.forEach(card => {
|
<div class="card bg-white rounded-lg shadow-sm p-4 border border-gray-200" data-name="telefonní seznam telefony kontakty">
|
||||||
const cardName = card.getAttribute('data-name').toLowerCase();
|
<div class="flex items-center">
|
||||||
const cardTitle = card.querySelector('h2').textContent.toLowerCase();
|
<div class="rounded-full w-10 h-10 flex items-center justify-center bg-gray-100 text-gray-600 mr-3">
|
||||||
const cardDesc = card.querySelector('p').textContent.toLowerCase();
|
<i class="fas fa-phone-alt"></i>
|
||||||
|
</div>
|
||||||
if (cardName.includes(searchTerm) || cardTitle.includes(searchTerm) || cardDesc.includes(searchTerm)) {
|
<div class="flex-1">
|
||||||
card.style.display = 'block';
|
<h3 class="text-md font-medium text-gray-800">Telefonní seznam</h3>
|
||||||
} else {
|
<p class="text-xs text-gray-500 mb-2">Aktuální telefonní seznam společnosti</p>
|
||||||
card.style.display = 'none';
|
</div>
|
||||||
}
|
</div>
|
||||||
});
|
<button onclick="openWindowsFolder('M:\\X. IT\\0. PUBLIC\\Aktuální telefonní seznam')" class="block w-full text-center bg-gray-200 hover:bg-gray-300 text-gray-700 text-sm py-1 px-3 rounded transition-colors mt-2">
|
||||||
});
|
<i class="fas fa-folder-open mr-1"></i> Otevřít složku
|
||||||
</script>
|
</button>
|
||||||
</body>
|
</div>
|
||||||
|
|
||||||
|
<!-- 2. Řízená dokumentace -->
|
||||||
|
<div class="card bg-white rounded-lg shadow-sm p-4 border border-gray-200" data-name="řízená dokumentace dokumenty">
|
||||||
|
<div class="flex items-center">
|
||||||
|
<div class="rounded-full w-10 h-10 flex items-center justify-center bg-gray-100 text-gray-600 mr-3">
|
||||||
|
<i class="fas fa-file-alt"></i>
|
||||||
|
</div>
|
||||||
|
<div class="flex-1">
|
||||||
|
<h3 class="text-md font-medium text-gray-800">Řízená dokumentace</h3>
|
||||||
|
<p class="text-xs text-gray-500 mb-2">Přístup k firemní řízené dokumentaci</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button onclick="openWindowsFolder('M:\\06. ŘÍZENÁ DOKUMENTACE')" class="block w-full text-center bg-gray-200 hover:bg-gray-300 text-gray-700 text-sm py-1 px-3 rounded transition-colors mt-2">
|
||||||
|
<i class="fas fa-folder-open mr-1"></i> Otevřít složku
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 3. Management úkolů -->
|
||||||
|
<div class="card bg-white rounded-lg shadow-sm p-4 border border-gray-200" data-name="management úkolů úkoly projekty">
|
||||||
|
<div class="flex items-center">
|
||||||
|
<div class="rounded-full w-10 h-10 flex items-center justify-center bg-gray-100 text-gray-600 mr-3">
|
||||||
|
<i class="fas fa-clipboard-list"></i>
|
||||||
|
</div>
|
||||||
|
<div class="flex-1">
|
||||||
|
<h3 class="text-md font-medium text-gray-800">Management úkolů</h3>
|
||||||
|
<p class="text-xs text-gray-500 mb-2">Systém pro správu a sledování firemních úkolů</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button onclick="openWindowsFolder('M:\\10. MANAGEMENT ÚKOLŮ')" class="block w-full text-center bg-gray-200 hover:bg-gray-300 text-gray-700 text-sm py-1 px-3 rounded transition-colors mt-2">
|
||||||
|
<i class="fas fa-folder-open mr-1"></i> Otevřít složku
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="bg-gray-800 text-gray-400 py-6 mt-12">
|
||||||
|
<div class="container mx-auto px-4 text-center">
|
||||||
|
<p>© 2025 Poppe + Potthoff</p>
|
||||||
|
<p class="mt-2 text-sm">Created by <a href="https://tdvorak.dev" class="text-blue-400 hover:text-blue-300">TDvorak</a></p>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Search functionality
|
||||||
|
const searchInput = document.getElementById('search');
|
||||||
|
const appCards = document.querySelectorAll('.card');
|
||||||
|
|
||||||
|
searchInput.addEventListener('input', function() {
|
||||||
|
const searchTerm = this.value.toLowerCase();
|
||||||
|
|
||||||
|
appCards.forEach(card => {
|
||||||
|
const cardName = card.getAttribute('data-name').toLowerCase();
|
||||||
|
const cardTitle = card.querySelector('h2') || card.querySelector('h3');
|
||||||
|
const cardDesc = card.querySelector('p');
|
||||||
|
const titleText = cardTitle ? cardTitle.textContent.toLowerCase() : '';
|
||||||
|
const descText = cardDesc ? cardDesc.textContent.toLowerCase() : '';
|
||||||
|
|
||||||
|
if (cardName.includes(searchTerm) || titleText.includes(searchTerm) || descText.includes(searchTerm)) {
|
||||||
|
card.style.display = 'block';
|
||||||
|
} else {
|
||||||
|
card.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Function to open Windows Explorer with a specific path using our integrated Go server
|
||||||
|
function openWindowsFolder(path) {
|
||||||
|
// Call our Go server to open the folder in Windows Explorer
|
||||||
|
fetch(`/open?path=${encodeURIComponent(path)}`)
|
||||||
|
.then(response => {
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('Failed to open folder');
|
||||||
|
}
|
||||||
|
console.log('Folder opened successfully');
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error opening folder:', error);
|
||||||
|
alert('Could not open folder. Make sure the server is running.');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -50,12 +51,15 @@ func main() {
|
|||||||
http.ServeFile(w, r, "evidence-aut.html")
|
http.ServeFile(w, r, "evidence-aut.html")
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
// Add folder opener endpoint
|
||||||
|
http.HandleFunc("/open", enableCORS(openFolderHandler))
|
||||||
|
|
||||||
port := os.Getenv("PORT")
|
port := os.Getenv("PORT")
|
||||||
if port == "" {
|
if port == "" {
|
||||||
port = "8080"
|
port = "8080"
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Server běží na portu %s", port)
|
log.Printf("Server běží na portu %s (včetně otevírání složek Windows)", port)
|
||||||
err := http.ListenAndServe(":"+port, nil)
|
err := http.ListenAndServe(":"+port, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Chyba při spuštění serveru: %v", err)
|
log.Fatalf("Chyba při spuštění serveru: %v", err)
|
||||||
@@ -156,6 +160,55 @@ func handleSubmit(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.Write([]byte(`{"message":"Záznam byl úspěšně uložen a email odeslán"}`))
|
w.Write([]byte(`{"message":"Záznam byl úspěšně uložen a email odeslán"}`))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handler pro otevírání Windows složek přímo z prohlížeče
|
||||||
|
func openFolderHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
// Get the folder path from the query parameter
|
||||||
|
folderPath := r.URL.Query().Get("path")
|
||||||
|
if folderPath == "" {
|
||||||
|
http.Error(w, "Missing path parameter", http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Log the request
|
||||||
|
log.Printf("Otevírání složky: %s", folderPath)
|
||||||
|
|
||||||
|
// Properly handle backslashes in Windows paths
|
||||||
|
// First, replace any forward slashes with backslashes
|
||||||
|
folderPath = strings.ReplaceAll(folderPath, "/", "\\")
|
||||||
|
|
||||||
|
// Fix any double backslashes that might have been created by JavaScript escaping
|
||||||
|
for strings.Contains(folderPath, "\\\\") {
|
||||||
|
folderPath = strings.ReplaceAll(folderPath, "\\\\", "\\")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Log the cleaned path
|
||||||
|
log.Printf("Upravená cesta: %s", folderPath)
|
||||||
|
|
||||||
|
// Open the folder in Windows Explorer
|
||||||
|
cmd := exec.Command("explorer.exe", folderPath)
|
||||||
|
err := cmd.Start()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
// If there was an error, try opening the parent directory
|
||||||
|
log.Printf("Chyba při otevírání složky: %v, zkouším jinou metodu", err)
|
||||||
|
|
||||||
|
// Try using /root,path format which sometimes works better
|
||||||
|
cmd = exec.Command("explorer.exe", "/root," + folderPath)
|
||||||
|
err = cmd.Start()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Chyba při otevírání složky: %v", err)
|
||||||
|
http.Error(w, fmt.Sprintf("Error opening folder: %v", err), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return success response
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
|
json.NewEncoder(w).Encode(map[string]string{"status": "success", "message": fmt.Sprintf("Opening folder: %s", folderPath)})
|
||||||
|
}
|
||||||
|
|
||||||
func sendEmail(entry TripEntry, parsedDateStart, parsedDateEnd time.Time, czechMonths []string) error {
|
func sendEmail(entry TripEntry, parsedDateStart, parsedDateEnd time.Time, czechMonths []string) error {
|
||||||
smtpHost := "mail.pp-kunovice.cz"
|
smtpHost := "mail.pp-kunovice.cz"
|
||||||
smtpPort := 465
|
smtpPort := 465
|
||||||
|
|||||||
Reference in New Issue
Block a user