a8d6805e27
This commit includes graphical keyboard icons integration, modal styling improvements, and comprehensive "Logos" to "Icons" terminology update. Changes: - Add graphical keyboard icons using Iconify MDI (Tab, Ctrl, Cmd, Esc, etc.) - Implement color scheme: black title, green subtitle/headers, blue kbd elements - Add visual boxes with borders and shadows for section grouping - Change modal from 3-column to 2-column grid layout (900px width) - Fix critical bug: all 5 sections now render (was only showing 2) Rename "Logos" to "Icons" across entire codebase: - Go models: ToggleLogos → ToggleIcons, ShowLogos → ShowIcons - Routes: /toggle/logos → /toggle/icons - Templates: desktop-logo-toggle → desktop-icon-toggle, #logoToggle → #iconToggle - JavaScript: logoToggles → iconToggles, sync logic updated - CSS: .show-logos → .show-icons - UI JSON: toggleLogos → toggleIcons - Comments and labels updated Technical details: - Rebuilt Go binary to fix template rendering error - Fixed JSON struct tag: json:"toggleLogos" → json:"toggleIcons" - Updated kbd element styling for icon alignment (inline-flex) - Added margin-bottom to subtitle (0.5rem) - Grid now 2 columns for better 5-section layout All 5 sections now render correctly: 1. Zoom Control 2. View Controls 3. Navigation 4. Actions 5. Browser Defaults
48 lines
1.4 KiB
Go
48 lines
1.4 KiB
Go
package routes
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"github.com/juanatsap/cv-site/internal/handlers"
|
|
"github.com/juanatsap/cv-site/internal/middleware"
|
|
)
|
|
|
|
// Setup configures all application routes and middleware
|
|
func Setup(cvHandler *handlers.CVHandler, healthHandler *handlers.HealthHandler) http.Handler {
|
|
mux := http.NewServeMux()
|
|
|
|
// Public routes
|
|
mux.HandleFunc("/", cvHandler.Home)
|
|
mux.HandleFunc("/cv", cvHandler.CVContent)
|
|
mux.HandleFunc("/health", healthHandler.Check)
|
|
|
|
// HTMX endpoints for interactive controls
|
|
mux.HandleFunc("/switch-language", cvHandler.SwitchLanguage)
|
|
mux.HandleFunc("/toggle/length", cvHandler.ToggleLength)
|
|
mux.HandleFunc("/toggle/icons", cvHandler.ToggleIcons)
|
|
mux.HandleFunc("/toggle/theme", cvHandler.ToggleTheme)
|
|
|
|
// Protected PDF endpoint with rate limiting (3 requests/minute per IP)
|
|
pdfRateLimiter := middleware.NewRateLimiter(3, 1*time.Minute)
|
|
protectedPDFHandler := middleware.OriginChecker(
|
|
pdfRateLimiter.Middleware(
|
|
http.HandlerFunc(cvHandler.ExportPDF),
|
|
),
|
|
)
|
|
mux.Handle("/export/pdf", protectedPDFHandler)
|
|
|
|
// Static files with cache control
|
|
staticHandler := http.StripPrefix("/static/", http.FileServer(http.Dir("static")))
|
|
mux.Handle("/static/", middleware.CacheControl(staticHandler))
|
|
|
|
// Apply comprehensive middleware chain
|
|
handler := middleware.Recovery(
|
|
middleware.Logger(
|
|
middleware.SecurityHeaders(mux),
|
|
),
|
|
)
|
|
|
|
return handler
|
|
}
|