2 Commits

Author SHA1 Message Date
2c9fc03a61 fix
All checks were successful
Build and Publish Docker Image / deploy (push) Successful in 1m42s
2026-05-04 00:45:03 +03:00
0bdf11d3a7 patch(version): Implemented version reporting for the app
Some checks failed
Build and Publish Docker Image / deploy (push) Has been cancelled
2026-05-04 00:40:02 +03:00
4 changed files with 23 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ func (app *App) handleIndex(ctx *gin.Context) {
"UploadsEnabled": app.config.GuestUploadsEnabled && app.config.APIEnabled, "UploadsEnabled": app.config.GuestUploadsEnabled && app.config.APIEnabled,
"MaxFileSizeBytes": app.config.GlobalMaxFileSizeBytes, "MaxFileSizeBytes": app.config.GlobalMaxFileSizeBytes,
"MaxBoxSizeBytes": app.config.GlobalMaxBoxSizeBytes, "MaxBoxSizeBytes": app.config.GlobalMaxBoxSizeBytes,
"AppVersion": app.appVersion,
}) })
} }

View File

@@ -3,7 +3,9 @@ package server
import ( import (
"encoding/json" "encoding/json"
"html/template" "html/template"
"os"
"path/filepath" "path/filepath"
"strings"
"time" "time"
"github.com/gin-contrib/gzip" "github.com/gin-contrib/gzip"
@@ -23,6 +25,7 @@ type App struct {
activityStore *activity.Store activityStore *activity.Store
alertStore *alerts.Store alertStore *alerts.Store
securityGuard *security.Guard securityGuard *security.Guard
appVersion string
} }
func Run(addr string) error { func Run(addr string) error {
@@ -56,12 +59,14 @@ func Run(addr string) error {
activityStore: activity.NewStore(filepath.Join(cfg.DBDir, "activity_log.json")), activityStore: activity.NewStore(filepath.Join(cfg.DBDir, "activity_log.json")),
alertStore: alerts.NewStore(filepath.Join(cfg.DBDir, "alerts.json")), alertStore: alerts.NewStore(filepath.Join(cfg.DBDir, "alerts.json")),
securityGuard: security.NewGuard(), securityGuard: security.NewGuard(),
appVersion: currentAppVersion(),
} }
if err := app.reloadSecurityConfig(); err != nil { if err := app.reloadSecurityConfig(); err != nil {
return err return err
} }
router := gin.Default() router := gin.Default()
router.Use(app.versionHeaderMiddleware())
router.Use(app.securityMiddleware()) router.Use(app.securityMiddleware())
router.NoRoute(app.handleNoRoute) router.NoRoute(app.handleNoRoute)
htmlTemplates, err := loadHTMLTemplates() htmlTemplates, err := loadHTMLTemplates()
@@ -149,3 +154,18 @@ func (app *App) handleHealth(c *gin.Context) {
"status": "healthy", "status": "healthy",
}) })
} }
func (app *App) versionHeaderMiddleware() gin.HandlerFunc {
return func(ctx *gin.Context) {
ctx.Header("X-App-Version", app.appVersion)
ctx.Next()
}
}
func currentAppVersion() string {
version := strings.TrimSpace(os.Getenv("APP_VERSION"))
if version == "" {
return "dev"
}
return version
}

View File

@@ -1,5 +1,5 @@
.upload-statusbar { .upload-statusbar {
grid-template-columns: 1fr 100px; grid-template-columns: minmax(0, 1fr) auto auto;
} }
.side-stack { .side-stack {

View File

@@ -126,6 +126,7 @@
<div class="win98-statusbar upload-statusbar"> <div class="win98-statusbar upload-statusbar">
<span id="status-text">{{ if .UploadsEnabled }}Ready · drag files anywhere onto the window{{ else }}Guest uploads are disabled{{ end }}</span> <span id="status-text">{{ if .UploadsEnabled }}Ready · drag files anywhere onto the window{{ else }}Guest uploads are disabled{{ end }}</span>
<span>WarpBox</span> <span>WarpBox</span>
<span>v{{ .AppVersion }}</span>
</div> </div>
</section> </section>