diff --git a/bank/Caddyfile b/Caddyfile similarity index 100% rename from bank/Caddyfile rename to Caddyfile diff --git a/bank/README.md b/README.md similarity index 100% rename from bank/README.md rename to README.md diff --git a/bank/build.sh b/bank/build.sh deleted file mode 100644 index ae91220..0000000 --- a/bank/build.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - -# SecureBank - Build Script -# Ustvari standalone izvršilne datoteke z vključenimi resources - -echo "🏗️ SecureBank - Build processo" -echo "================================" - -# Preveri če obstajajo potrebni direktoriji -if [ ! -d "templates" ] || [ ! -d "static" ]; then - echo "❌ Napaka: Manjkajo templates/ vagy static/ direktoriji!" - echo " Poženite script iz /bank direktorija" - exit 1 -fi - -# Ustvari build direktorij -mkdir -p dist - -echo "📦 Building za Linux (amd64)..." -GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o dist/securebank-linux ./ -echo "✅ Linux binary: dist/securebank-linux" - -echo "📦 Building za Windows (amd64)..." -GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o dist/securebank-windows.exe ./ -echo "✅ Windows binary: dist/securebank-windows.exe" - -echo "📦 Building za macOS (amd64)..." -GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o dist/securebank-macos ./ -echo "✅ macOS binary: dist/securebank-macos" - -echo "📦 Building za macOS (ARM64 - M1/M2)..." -GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o dist/securebank-macos-arm64 ./ -echo "✅ macOS ARM binary: dist/securebank-macos-arm64" - -echo "" -echo "🎉 Build process končan!" -echo "" -echo "📁 Izvršilne datoteke v dist/ direktoriju:" -ls -la dist/ -echo "" -echo "🚀 Testiranje:" -echo " ./dist/securebank-linux -port 8080" -echo "" -echo "📋 Opozorilo:" -echo " - Vsi HTML, CSS in JS fajli so vključeni v binary" -echo " - Binary lahko kopirate kjerkoli - ne potrebuje dodatnih datotek" -echo " - Za deployment samo kopirajte binary datoteko" \ No newline at end of file diff --git a/bank/dist/securebank-embedded b/bank/dist/securebank-embedded deleted file mode 100755 index 07fee85..0000000 Binary files a/bank/dist/securebank-embedded and /dev/null differ diff --git a/bank/dist/securebank-windows.exe b/bank/dist/securebank-windows.exe deleted file mode 100755 index e950063..0000000 Binary files a/bank/dist/securebank-windows.exe and /dev/null differ diff --git a/bank/go.mod b/go.mod similarity index 100% rename from bank/go.mod rename to go.mod diff --git a/bank/launch_browsers.sh b/launch_browsers.sh similarity index 100% rename from bank/launch_browsers.sh rename to launch_browsers.sh diff --git a/bank/main.go b/main.go similarity index 86% rename from bank/main.go rename to main.go index c04fbba..49ca72e 100644 --- a/bank/main.go +++ b/main.go @@ -1,22 +1,14 @@ package main import ( - "embed" "flag" "fmt" "html/template" - "io/fs" "log" "net/http" "sync" ) -//go:embed templates/* -var templatesFS embed.FS - -//go:embed static/* -var staticFS embed.FS - // User struktura za uporabniške podatke type User struct { ID int @@ -60,19 +52,15 @@ func main() { var port = flag.String("port", "8080", "Port na katerem se bo zagnal server") flag.Parse() - // Naložimo HTML predloge iz embedded FS + // Naložimo HTML predloge var err error - templates, err = template.ParseFS(templatesFS, "templates/*.html") + templates, err = template.ParseGlob("templates/*.html") if err != nil { - log.Fatal("Napaka pri nalaganju embedded predlog:", err) + log.Fatal("Napaka pri nalaganju predlog:", err) } - // Statične datoteke iz embedded FS - staticSubFS, err := fs.Sub(staticFS, "static") - if err != nil { - log.Fatal("Napaka pri ustvarjanju static subFS:", err) - } - http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(staticSubFS)))) + // Statične datoteke (CSS) + http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static/")))) // Routes http.HandleFunc("/", homeHandler) @@ -82,11 +70,8 @@ func main() { http.HandleFunc("/logout", logoutHandler) // Zagon strežnika - fmt.Printf("🏦 SecureBank aplikacija (embedded build)\n") - fmt.Printf("Port: %s\n", *port) - fmt.Printf("HTTP: http://localhost:%s\n", *port) - fmt.Printf("📦 Vsi fajli so vključeni v binary!\n") - fmt.Println() + fmt.Printf("SecureBank aplikacija se zaganja na portu %s\n", *port) + fmt.Printf("Dostop: http://localhost:%s\n", *port) serverAddr := ":" + *port log.Fatal(http.ListenAndServe(serverAddr, nil)) diff --git a/bank/static/style.css b/static/style.css similarity index 100% rename from bank/static/style.css rename to static/style.css diff --git a/bank/templates/dashboard.html b/templates/dashboard.html similarity index 100% rename from bank/templates/dashboard.html rename to templates/dashboard.html diff --git a/bank/templates/home.html b/templates/home.html similarity index 100% rename from bank/templates/home.html rename to templates/home.html diff --git a/bank/templates/login.html b/templates/login.html similarity index 100% rename from bank/templates/login.html rename to templates/login.html diff --git a/bank/templates/register.html b/templates/register.html similarity index 100% rename from bank/templates/register.html rename to templates/register.html