Added Desktop app deployment (#39)

Created a desktop app using Walis framework.
This embeds the frontend and backend into one binary that shows itself on a desktop
This commit is contained in:
Bardioc26
2026-02-24 22:10:05 +01:00
committed by GitHub
parent c6539d17f4
commit bb9ef4f77e
15 changed files with 1061 additions and 23 deletions
+31 -17
View File
@@ -8,23 +8,37 @@ import (
)
func SetupGin(r *gin.Engine) {
// Build allowed origins list from configuration
allowedOrigins := []string{
config.Cfg.FrontendURL,
"http://localhost:5173", // Development frontend
"http://192.168.0.48:5173", // Development frontend
"http://192.168.0.36:5173", // Development frontend
"https://bamort.trokan.de", // Production frontend
var corsConfig cors.Config
// Desktop: the Wails WebView origin varies by platform/version (wails.localhost,
// localhost, null …). Since the server is local, allow all origins.
if config.Cfg.Environment == "desktop" {
corsConfig = cors.Config{
AllowOriginFunc: func(_ string) bool { return true },
AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
AllowHeaders: []string{"Origin", "Content-Type", "Authorization"},
ExposeHeaders: []string{"Content-Length"},
AllowCredentials: true,
MaxAge: 12 * 3600,
}
} else {
allowedOrigins := []string{
config.Cfg.FrontendURL,
"http://localhost:5173", // Development frontend
"http://192.168.0.48:5173", // Development frontend
"http://192.168.0.36:5173", // Development frontend
"https://bamort.trokan.de", // Production frontend
"http://wails.localhost", // Wails desktop WebView
}
corsConfig = cors.Config{
AllowOrigins: allowedOrigins,
AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE"},
AllowHeaders: []string{"Origin", "Content-Type", "Authorization"},
ExposeHeaders: []string{"Content-Length"},
AllowCredentials: true,
MaxAge: 12 * 3600,
}
}
// Add CORS middleware
r.Use(cors.New(cors.Config{
//AllowOrigins: []string{"http://localhost:3000"}, // Replace with your frontend's URL
AllowOrigins: allowedOrigins,
AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE"},
AllowHeaders: []string{"Origin", "Content-Type", "Authorization"},
ExposeHeaders: []string{"Content-Length"},
AllowCredentials: true,
MaxAge: 12 * 3600, // Cache preflight for 12 hours
}))
r.Use(cors.New(corsConfig))
}