Skip to content

armgit / posta

Public Imported from GitHub
0

Self-hosted email delivery platform that enables applications to send emails via HTTP APIs while handling SMTP delivery, templates, storage, security, and analytics. Fully self-hostable alternative to services like SendGrid or Mailgun.

chore(deps): upgrade jkaninda/okapi from 0.6.3 to 0.7.0

Jonas Kaninda6417f0144648
diff --git a/go.mod b/go.mod
index 5d02343..f3a2d20 100644
--- a/go.mod
+++ b/go.mod
@@ -13,7 +13,7 @@ require (
github.com/hibiken/asynq v0.26.0
github.com/jkaninda/go-utils v0.1.4
github.com/jkaninda/logger v0.0.5
- github.com/jkaninda/okapi v0.6.3
+ github.com/jkaninda/okapi v0.7.0
github.com/joho/godotenv v1.5.1
github.com/lib/pq v1.12.3
github.com/pquerna/otp v1.5.0
diff --git a/go.sum b/go.sum
index 968c650..31268f4 100644
--- a/go.sum
+++ b/go.sum
@@ -103,8 +103,8 @@ github.com/jkaninda/go-utils v0.1.4 h1:ZdNlI+yLWc4/S0qKcCNQIPj+6lHSdJcGaxtRADAif
github.com/jkaninda/go-utils v0.1.4/go.mod h1:Aa54jEAcDykc3CnOdreqZG80UfSZOvrYecyusu+oPb4=
github.com/jkaninda/logger v0.0.5 h1:fTHKgDsHtuN8rkSBvwe6QStfi8yIdm8O3r0g99dRDTY=
github.com/jkaninda/logger v0.0.5/go.mod h1:ZUXJ2BdxDPG6e8t6mbKhc2ZFaFi2Iuy/4ukquFrPkFE=
-github.com/jkaninda/okapi v0.6.3 h1:HEX1JvGn02OQhR3Qx/7SBK1MAJw4lrkqdnkX5svcDuQ=
-github.com/jkaninda/okapi v0.6.3/go.mod h1:3oisc16k4EbUCUHr3TRZ9V9DkpdLACmo4Y04uEwagG4=
+github.com/jkaninda/okapi v0.7.0 h1:O6tFFjzI4B0Aw/h3aiJMv3F+eAkP9hvIzUc1lAAHK5o=
+github.com/jkaninda/okapi v0.7.0/go.mod h1:3oisc16k4EbUCUHr3TRZ9V9DkpdLACmo4Y04uEwagG4=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
diff --git a/internal/routes/routes.go b/internal/routes/routes.go
index 94a0128..63e794d 100644
--- a/internal/routes/routes.go
+++ b/internal/routes/routes.go
@@ -19,10 +19,6 @@ package routes
import (
"context"
- "net/http"
- "os"
- "path/filepath"
- "strings"
"time"
"github.com/goposta/posta/internal/config"
@@ -475,23 +471,6 @@ func (r *Router) registerRoutes() {
r.registerWebhookDocs()
// Dashboard UI (static files + SPA fallback)
- webDir := r.cfg.WebDir
- if info, err := os.Stat(webDir); err == nil && info.IsDir() {
- r.app.Static("/assets", filepath.Join(webDir, "assets"))
-
- indexPath := filepath.Join(webDir, "index.html")
- r.app.NoRoute(func(c *okapi.Context) error {
- path := c.Request().URL.Path
- if strings.HasPrefix(path, "/api/v1/") || strings.HasPrefix(path, "/healthz") || strings.HasPrefix(path, "/readyz") || strings.HasPrefix(path, "/metrics") || strings.HasPrefix(path, "/docs") {
- return c.AbortNotFound("not found")
- }
- filePath := filepath.Join(webDir, filepath.Clean(path))
- if stat, err := os.Stat(filePath); err == nil && !stat.IsDir() {
- http.ServeFile(c.ResponseWriter(), c.Request(), filePath)
- return nil
- }
- http.ServeFile(c.ResponseWriter(), c.Request(), indexPath)
- return nil
- })
- }
+ r.app.SPA("/", r.cfg.WebDir, okapi.SPAConfig{MaxAge: time.Hour})
+
}