Feat rebrand armature (#43)
All checks were successful
CI/CD / detect-changes (push) Successful in 3s
CI/CD / test-frontend (push) Successful in 5s
CI/CD / test-go-pg (push) Successful in 2m34s
CI/CD / test-sqlite (push) Successful in 2m46s
CI/CD / build-and-deploy (push) Successful in 1m55s

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #43.
This commit is contained in:
2026-03-31 23:25:37 +00:00
committed by xcaliber
parent fb5284f667
commit 680ec3b897
321 changed files with 956 additions and 1033 deletions

View File

@@ -5,8 +5,8 @@ import (
"github.com/gin-gonic/gin"
"switchboard-core/auth"
"switchboard-core/store"
"armature/auth"
"armature/store"
)
// RequireAdmin returns middleware that restricts access to users with the

View File

@@ -11,9 +11,9 @@ import (
"github.com/gin-gonic/gin"
"github.com/golang-jwt/jwt/v5"
"switchboard-core/config"
"switchboard-core/database"
"switchboard-core/store"
"armature/config"
"armature/database"
"armature/store"
)
// Claims represents the JWT payload. Must match handlers.Claims.
@@ -142,11 +142,11 @@ func parseAndValidateJWT(tokenString string, jwtSecret string) (*Claims, bool) {
return claims, true
}
// UserIDFromCookie extracts the user ID from the sb_token cookie without
// UserIDFromCookie extracts the user ID from the arm_token cookie without
// requiring authentication. Returns "" if no valid token is found.
// Used by unauthenticated routes that want optional user context.
func UserIDFromCookie(c *gin.Context, jwtSecret string) string {
cookie, err := c.Cookie("sb_token")
cookie, err := c.Cookie("arm_token")
if err != nil || cookie == "" {
return ""
}

View File

@@ -7,17 +7,17 @@ import (
"github.com/gin-gonic/gin"
"switchboard-core/auth"
"switchboard-core/config"
"switchboard-core/database"
"switchboard-core/store"
"armature/auth"
"armature/config"
"armature/database"
"armature/store"
)
// AuthOrRedirect validates JWT tokens for page routes.
// Unlike Auth() which returns 401 JSON for API calls, this redirects
// to the login page — appropriate for browser navigation.
//
// Token is read from the "sb_token" cookie (set by the login page JS)
// Token is read from the "arm_token" cookie (set by the login page JS)
// since page requests don't have Authorization headers.
func AuthOrRedirect(cfg *config.Config, users store.UserStore, cache *UserStatusCache) gin.HandlerFunc {
loginPath := cfg.BasePath + "/login"
@@ -32,7 +32,7 @@ func AuthOrRedirect(cfg *config.Config, users store.UserStore, cache *UserStatus
// Try cookie first (set by login page), then Authorization header,
// then query param (for edge cases)
tokenString := ""
if cookie, err := c.Cookie("sb_token"); err == nil && cookie != "" {
if cookie, err := c.Cookie("arm_token"); err == nil && cookie != "" {
tokenString = cookie
}
if tokenString == "" {
@@ -109,7 +109,7 @@ func OptionalAuth(cfg *config.Config, users store.UserStore, cache *UserStatusCa
}
tokenString := ""
if cookie, err := c.Cookie("sb_token"); err == nil && cookie != "" {
if cookie, err := c.Cookie("arm_token"); err == nil && cookie != "" {
tokenString = cookie
}
if tokenString == "" {

View File

@@ -5,8 +5,8 @@ import (
"github.com/gin-gonic/gin"
"switchboard-core/auth"
"switchboard-core/store"
"armature/auth"
"armature/store"
)
const permCacheKey = "resolved_permissions"

View File

@@ -6,7 +6,7 @@ import (
"github.com/gin-gonic/gin"
"switchboard-core/metrics"
"armature/metrics"
)
// Prometheus returns a Gin middleware that records HTTP request metrics.

View File

@@ -6,7 +6,7 @@ import (
"github.com/gin-gonic/gin"
"switchboard-core/store"
"armature/store"
)
// RateLimiter implements per-IP rate limiting backed by a shared store.

View File

@@ -5,7 +5,7 @@ import (
"github.com/gin-gonic/gin"
"switchboard-core/store"
"armature/store"
)
// RequireTeamAdmin returns middleware that restricts access to team admins.