Documentation
¶
Index ¶
- func AuthMiddleware(db *gorm.DB, jwtSecret string) echo.MiddlewareFunc
- func CleanExpiredTokens(db *gorm.DB)
- func CustomErrorHandler(err error, c echo.Context)
- func GetUserFromContext(c echo.Context) (userID, email, role string)
- func HashToken(token string) string
- func IsTokenRevoked(db *gorm.DB, token string) bool
- func NewPublicS3Wrapper(s3Proxy http.Handler, db *gorm.DB, s3Client bucketClient) http.Handler
- func NewS3Proxy(s3Endpoint string, requireSigV4 bool) http.Handler
- func RegisterRoutes(e *echo.Echo, db *gorm.DB, cfg *config.Config, store *storage.Manager, ...)
- func RequireAdmin() echo.MiddlewareFunc
- func RequireRole(roles ...string) echo.MiddlewareFunc
- func RequireSiteOwner(db *gorm.DB) echo.MiddlewareFunc
- func RevokeToken(db *gorm.DB, token string, expiresAt time.Time) error
- func SubdomainRouter(db *gorm.DB, store *storage.Manager, cache *storage.SiteRulesCache, ...) echo.MiddlewareFunc
- func VersionCheckMiddleware(minVersion string) echo.MiddlewareFunc
- type APIKeyHandler
- type AdminHandler
- func (h *AdminHandler) CreateInvite(c echo.Context) error
- func (h *AdminHandler) DeleteUser(c echo.Context) error
- func (h *AdminHandler) GetSettings(c echo.Context) error
- func (h *AdminHandler) ListInvites(c echo.Context) error
- func (h *AdminHandler) ListUsers(c echo.Context) error
- func (h *AdminHandler) RevokeInvite(c echo.Context) error
- func (h *AdminHandler) UpdateSettings(c echo.Context) error
- func (h *AdminHandler) UpdateUserRole(c echo.Context) error
- type AuthHandler
- func (h *AuthHandler) CLILogin(c echo.Context) error
- func (h *AuthHandler) CLILoginSubmit(c echo.Context) error
- func (h *AuthHandler) Login(c echo.Context) error
- func (h *AuthHandler) Logout(c echo.Context) error
- func (h *AuthHandler) Register(c echo.Context) error
- func (h *AuthHandler) TokenExchange(c echo.Context) error
- type DeployHandler
- type ErrorResponse
- type SiteHandler
- type StorageHandler
- func (h *StorageHandler) CreateBucket(c echo.Context) error
- func (h *StorageHandler) CreateS3Credential(c echo.Context) error
- func (h *StorageHandler) DeleteBucket(c echo.Context) error
- func (h *StorageHandler) DeleteS3Credential(c echo.Context) error
- func (h *StorageHandler) ListBuckets(c echo.Context) error
- func (h *StorageHandler) ListS3Credentials(c echo.Context) error
- func (h *StorageHandler) UpdateBucket(c echo.Context) error
- func (h *StorageHandler) UploadURL(c echo.Context) error
- type WorkerHandler
- func (h *WorkerHandler) CreateCronSchedule(c echo.Context) error
- func (h *WorkerHandler) CreateD1Database(c echo.Context) error
- func (h *WorkerHandler) CreateDurableObjectNamespace(c echo.Context) error
- func (h *WorkerHandler) CreateKVNamespace(c echo.Context) error
- func (h *WorkerHandler) DeleteCronSchedule(c echo.Context) error
- func (h *WorkerHandler) DeleteD1Database(c echo.Context) error
- func (h *WorkerHandler) DeleteDurableObjectNamespace(c echo.Context) error
- func (h *WorkerHandler) DeleteEnvVar(c echo.Context) error
- func (h *WorkerHandler) DeleteKVNamespace(c echo.Context) error
- func (h *WorkerHandler) GetLogs(c echo.Context) error
- func (h *WorkerHandler) ListCronSchedules(c echo.Context) error
- func (h *WorkerHandler) ListD1Databases(c echo.Context) error
- func (h *WorkerHandler) ListDurableObjectNamespaces(c echo.Context) error
- func (h *WorkerHandler) ListEnvVars(c echo.Context) error
- func (h *WorkerHandler) ListKVNamespaces(c echo.Context) error
- func (h *WorkerHandler) SetEnvVar(c echo.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthMiddleware ¶
func AuthMiddleware(db *gorm.DB, jwtSecret string) echo.MiddlewareFunc
func CleanExpiredTokens ¶
CleanExpiredTokens removes revocation entries whose JWTs have naturally expired. Called periodically to keep the table small.
func CustomErrorHandler ¶
func GetUserFromContext ¶
func IsTokenRevoked ¶
IsTokenRevoked checks whether a token has been explicitly revoked.
func NewPublicS3Wrapper ¶
NewPublicS3Wrapper wraps the existing S3 proxy to serve objects from public buckets without authentication. Unauthenticated GET/HEAD requests for public buckets are served directly via the minio client. All other requests (or requests for non-public buckets) pass through to the underlying S3 proxy.
func NewS3Proxy ¶
NewS3Proxy creates a reverse proxy that forwards requests to the SeaweedFS S3 endpoint. When requireSigV4 is true, unsigned requests are rejected before proxying.
func RegisterRoutes ¶
func RequireAdmin ¶
func RequireAdmin() echo.MiddlewareFunc
func RequireRole ¶
func RequireRole(roles ...string) echo.MiddlewareFunc
func RequireSiteOwner ¶
func RequireSiteOwner(db *gorm.DB) echo.MiddlewareFunc
RequireSiteOwner checks that the authenticated user owns the site identified by the :id path parameter, or has an admin/superadmin role.
func RevokeToken ¶
RevokeToken adds a token to the revocation table. The expiresAt should match the token's natural expiry so the entry can be cleaned up later.
func SubdomainRouter ¶
func SubdomainRouter(db *gorm.DB, store *storage.Manager, cache *storage.SiteRulesCache, domain string, workerEngine *worker.Engine, s3Proxy http.Handler) echo.MiddlewareFunc
SubdomainRouter inspects the Host header and routes subdomain requests to the static site handler. Bare-domain requests pass through to the API.
func VersionCheckMiddleware ¶
func VersionCheckMiddleware(minVersion string) echo.MiddlewareFunc
VersionCheckMiddleware rejects requests from CLI clients whose version is below the configured minimum. Skips if no minimum is set, if the header is absent (browser/curl), or if the version is unparseable (dev builds).
Types ¶
type APIKeyHandler ¶
type AdminHandler ¶
type AdminHandler struct {
DB *gorm.DB
Storage *storage.Manager
S3Client *minio.Client // optional; nil when object storage is disabled
IAMClient *seaweedfs.Client // optional; nil when object storage is disabled
}
func (*AdminHandler) CreateInvite ¶
func (h *AdminHandler) CreateInvite(c echo.Context) error
func (*AdminHandler) DeleteUser ¶
func (h *AdminHandler) DeleteUser(c echo.Context) error
func (*AdminHandler) GetSettings ¶
func (h *AdminHandler) GetSettings(c echo.Context) error
func (*AdminHandler) ListInvites ¶
func (h *AdminHandler) ListInvites(c echo.Context) error
func (*AdminHandler) RevokeInvite ¶
func (h *AdminHandler) RevokeInvite(c echo.Context) error
func (*AdminHandler) UpdateSettings ¶
func (h *AdminHandler) UpdateSettings(c echo.Context) error
func (*AdminHandler) UpdateUserRole ¶
func (h *AdminHandler) UpdateUserRole(c echo.Context) error
type AuthHandler ¶
func (*AuthHandler) CLILogin ¶
func (h *AuthHandler) CLILogin(c echo.Context) error
CLILogin serves a self-contained HTML login form for CLI authentication. GET /api/v1/auth/cli?port=PORT&state=STATE&code_challenge=CHALLENGE&code_challenge_method=S256
func (*AuthHandler) CLILoginSubmit ¶
func (h *AuthHandler) CLILoginSubmit(c echo.Context) error
CLILoginSubmit validates credentials and returns a redirect URL with an auth code. POST /api/v1/auth/cli
func (*AuthHandler) TokenExchange ¶
func (h *AuthHandler) TokenExchange(c echo.Context) error
TokenExchange exchanges an authorization code + PKCE code verifier for a JWT. POST /api/v1/auth/token
type DeployHandler ¶
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
type SiteHandler ¶
type StorageHandler ¶
type StorageHandler struct {
DB *gorm.DB
S3Client bucketClient
PresignClient bucketClient // minio client configured with public S3 endpoint for presigned URL generation
IAMClient iamClient
Region string
PublicS3URL string // public-facing S3 URL for presigned URLs (e.g. https://storage.example.com)
}
StorageHandler manages object storage buckets and S3 credentials.
func (*StorageHandler) CreateBucket ¶
func (h *StorageHandler) CreateBucket(c echo.Context) error
CreateBucket creates a storage bucket bound to a site.
func (*StorageHandler) CreateS3Credential ¶
func (h *StorageHandler) CreateS3Credential(c echo.Context) error
CreateS3Credential creates an S3 credential for the current user.
func (*StorageHandler) DeleteBucket ¶
func (h *StorageHandler) DeleteBucket(c echo.Context) error
DeleteBucket deletes a storage bucket.
func (*StorageHandler) DeleteS3Credential ¶
func (h *StorageHandler) DeleteS3Credential(c echo.Context) error
DeleteS3Credential deletes an S3 credential.
func (*StorageHandler) ListBuckets ¶
func (h *StorageHandler) ListBuckets(c echo.Context) error
ListBuckets returns all storage buckets for a site.
func (*StorageHandler) ListS3Credentials ¶
func (h *StorageHandler) ListS3Credentials(c echo.Context) error
ListS3Credentials returns the user's S3 credentials (no secrets).
func (*StorageHandler) UpdateBucket ¶
func (h *StorageHandler) UpdateBucket(c echo.Context) error
UpdateBucket updates a storage bucket's settings (e.g. public access toggle).
type WorkerHandler ¶
func (*WorkerHandler) CreateCronSchedule ¶
func (h *WorkerHandler) CreateCronSchedule(c echo.Context) error
func (*WorkerHandler) CreateD1Database ¶
func (h *WorkerHandler) CreateD1Database(c echo.Context) error
func (*WorkerHandler) CreateDurableObjectNamespace ¶
func (h *WorkerHandler) CreateDurableObjectNamespace(c echo.Context) error
func (*WorkerHandler) CreateKVNamespace ¶
func (h *WorkerHandler) CreateKVNamespace(c echo.Context) error
func (*WorkerHandler) DeleteCronSchedule ¶
func (h *WorkerHandler) DeleteCronSchedule(c echo.Context) error
func (*WorkerHandler) DeleteD1Database ¶
func (h *WorkerHandler) DeleteD1Database(c echo.Context) error
func (*WorkerHandler) DeleteDurableObjectNamespace ¶
func (h *WorkerHandler) DeleteDurableObjectNamespace(c echo.Context) error
func (*WorkerHandler) DeleteEnvVar ¶
func (h *WorkerHandler) DeleteEnvVar(c echo.Context) error
func (*WorkerHandler) DeleteKVNamespace ¶
func (h *WorkerHandler) DeleteKVNamespace(c echo.Context) error
func (*WorkerHandler) ListCronSchedules ¶
func (h *WorkerHandler) ListCronSchedules(c echo.Context) error
func (*WorkerHandler) ListD1Databases ¶
func (h *WorkerHandler) ListD1Databases(c echo.Context) error
func (*WorkerHandler) ListDurableObjectNamespaces ¶
func (h *WorkerHandler) ListDurableObjectNamespaces(c echo.Context) error
func (*WorkerHandler) ListEnvVars ¶
func (h *WorkerHandler) ListEnvVars(c echo.Context) error
func (*WorkerHandler) ListKVNamespaces ¶
func (h *WorkerHandler) ListKVNamespaces(c echo.Context) error