Documentation
¶
Index ¶
- func GzipMiddleware(next http.Handler) http.Handler
- func HTTPRateLimitMiddleware(limiter *RateLimiter, next http.Handler) http.Handler
- func RateLimitMiddleware(limiter *RateLimiter) wish.Middleware
- type APIConfig
- type APIPost
- type APIPostDetail
- type APIPostList
- type APISearchResult
- type APITag
- type APIThemeColors
- type APIThemeInfo
- type CommandHandler
- type HTTPServer
- type RateLimiter
- type SSHConfig
- type SSHServer
- type ThemeColors
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GzipMiddleware ¶ added in v0.3.0
GzipMiddleware wraps an http.Handler to provide gzip compression
func HTTPRateLimitMiddleware ¶ added in v0.6.2
func HTTPRateLimitMiddleware(limiter *RateLimiter, next http.Handler) http.Handler
Creates an HTTP middleware that enforces rate limits per IP
func RateLimitMiddleware ¶ added in v0.2.0
func RateLimitMiddleware(limiter *RateLimiter) wish.Middleware
Creates a Wish middleware that enforces rate limits
Types ¶
type APIConfig ¶ added in v0.6.0
type APIConfig struct {
Title string `json:"title"`
Description string `json:"description"`
Author string `json:"author"`
Themes []APIThemeInfo `json:"themes"`
DefaultTheme string `json:"default_theme"`
ASCIIHeader string `json:"ascii_header,omitempty"`
}
APIConfig exposes blog configuration to the WASM app
type APIPost ¶ added in v0.6.0
type APIPost struct {
Slug string `json:"slug"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
Author string `json:"author,omitempty"`
Tags []string `json:"tags"`
PublishedAt string `json:"published_at,omitempty"`
ReadingTime int `json:"reading_time"`
CanonicalURL string `json:"canonical_url,omitempty"`
}
APIPost is a post summary for list endpoints
type APIPostDetail ¶ added in v0.6.0
type APIPostDetail struct {
Slug string `json:"slug"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
Author string `json:"author,omitempty"`
Content string `json:"content"`
Tags []string `json:"tags"`
PublishedAt string `json:"published_at,omitempty"`
ReadingTime int `json:"reading_time"`
CanonicalURL string `json:"canonical_url,omitempty"`
}
APIPostDetail is a full post with markdown content
type APIPostList ¶ added in v0.6.0
type APIPostList struct {
Posts []APIPost `json:"posts"`
Total int `json:"total"`
Page int `json:"page"`
PerPage int `json:"per_page"`
TotalPages int `json:"total_pages"`
}
APIPostList is a paginated list of posts
type APISearchResult ¶ added in v0.6.0
type APISearchResult struct {
Query string `json:"query"`
Results []APIPost `json:"results"`
Total int `json:"total"`
}
APISearchResult wraps search results
type APIThemeColors ¶ added in v0.6.0
type APIThemeColors struct {
Primary string `json:"primary"`
Secondary string `json:"secondary"`
Background string `json:"background"`
Text string `json:"text"`
Muted string `json:"muted"`
Accent string `json:"accent"`
Error string `json:"error"`
Success string `json:"success"`
Warning string `json:"warning"`
Border string `json:"border"`
}
APIThemeColors holds all theme color values
type APIThemeInfo ¶ added in v0.6.0
type APIThemeInfo struct {
Key string `json:"key"`
Name string `json:"name"`
Description string `json:"description"`
Colors APIThemeColors `json:"colors"`
}
APIThemeInfo describes a theme for the client
type CommandHandler ¶ added in v0.3.0
type CommandHandler struct {
// contains filtered or unexported fields
}
CommandHandler handles non-interactive SSH commands
func NewCommandHandler ¶ added in v0.3.0
func NewCommandHandler(repo *storage.PostRepository, loader *blog.ContentLoader, feed *blog.FeedGenerator) *CommandHandler
NewCommandHandler creates a new command handler
func (*CommandHandler) HandleCommand ¶ added in v0.3.0
HandleCommand processes a non-interactive SSH command Returns true if the command was handled, false if it should fall through to TUI
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
Handles HTTP requests and serves the WASM web app
func NewHTTPServer ¶
func NewHTTPServer( host string, port int, repo *storage.PostRepository, viewRepo *storage.ViewRepository, loader *blog.ContentLoader, feed *blog.FeedGenerator, blogTitle string, blogDescription string, blogAuthor string, asciiHeader string, t *theme.Theme, themeKey string, trustProxy bool, faviconCfg app.FaviconConfig, ) (*HTTPServer, error)
Creates a new HTTP server
func (*HTTPServer) ListenAndServeWithSignal ¶
func (s *HTTPServer) ListenAndServeWithSignal() error
Starts the server and handles shutdown signals
type RateLimiter ¶ added in v0.2.0
type RateLimiter struct {
// contains filtered or unexported fields
}
Tracks connection attempts per IP using a sliding window
func NewRateLimiter ¶ added in v0.2.0
func NewRateLimiter(limit int, window time.Duration) *RateLimiter
Creates a rate limiter with the given limit and time window
func (*RateLimiter) Allow ¶ added in v0.2.0
func (rl *RateLimiter) Allow(ip string) (allowed bool, count int)
Checks if a connection from the given IP should be allowed. Returns whether the request is allowed and the current request count for the IP.
func (*RateLimiter) Stop ¶ added in v0.2.0
func (rl *RateLimiter) Stop()
Stops the cleanup goroutine. Call this when shutting down. Safe to call multiple times.
type SSHConfig ¶ added in v0.2.0
type SSHConfig struct {
RateLimitCount int
RateLimitWindow time.Duration
ExitMessage string
FeedGenerator *blog.FeedGenerator // For RSS command support
AdminFingerprints []string // SSH fingerprints with admin access
}
SSHConfig holds SSH server-specific configuration
type SSHServer ¶
type SSHServer struct {
// contains filtered or unexported fields
}
SSHServer wraps the Wish SSH server
func NewSSHServer ¶
func NewSSHServer(host string, port int, hostKeyPath string, repo *storage.PostRepository, prefRepo *storage.PreferenceRepository, viewRepo *storage.ViewRepository, loader *blog.ContentLoader, t *theme.Theme, tuiCfg tui.Config, sshCfg SSHConfig) (*SSHServer, error)
NewSSHServer creates a new SSH server
func (*SSHServer) ListenAndServeWithSignal ¶
ListenAndServeWithSignal starts the server and handles shutdown signals