Documentation
¶
Index ¶
- Variables
- func AssertResponseContains(t interface{}, response *httptest.ResponseRecorder, expected string)
- func AssetExists(assetPath string) bool
- func CreateTestRequest(method, path, body string) *httptest.ResponseRecorder
- func ExtractCSRFTokenFromHTML(html string) string
- func GenerateCSRFToken() (string, error)
- func GetAsset(assetPath string) ([]byte, error)
- func GetAssetMimeType(assetPath string) string
- func ListAssets() ([]string, error)
- func LoadTemplates() (*template.Template, error)
- func ReloadTemplates() error
- func RenderTemplate(w http.ResponseWriter, name string, data TemplateData) error
- func ServeAsset(w http.ResponseWriter, r *http.Request, assetPath string)
- func ServeAssetWithFallback(w http.ResponseWriter, r *http.Request, assetPath, fallbackPath string)
- type CategoryResponse
- type CategoryResponseItem
- type LogBuffer
- type LogEntry
- type LogsResponse
- type MockRSSFFSResponse
- type RateLimiter
- type Server
- type SubmitRequest
- type SubmitResponse
- type TemplateData
- type TestServer
- type ValidationError
- type ValidationErrors
- type WebUIHook
Constants ¶
This section is empty.
Variables ¶
var MockRSSFFSResponses = map[string]MockRSSFFSResponse{ "https://example.com": { Success: true, FeedCount: 1, }, "https://multi-feed.example.com": { Success: true, FeedCount: 3, }, "https://no-feeds.example.com": { Success: true, FeedCount: 0, }, "https://error.example.com": { Success: false, Error: "Connection timeout", }, }
MockRSSFFSResponses maps URLs to mock responses for testing
Functions ¶
func AssertResponseContains ¶
func AssertResponseContains(t interface{}, response *httptest.ResponseRecorder, expected string)
AssertResponseContains checks if response body contains expected content
func AssetExists ¶
AssetExists checks if an asset exists in the embedded filesystem
func CreateTestRequest ¶
func CreateTestRequest(method, path, body string) *httptest.ResponseRecorder
CreateTestRequest creates a test HTTP request with proper headers
func ExtractCSRFTokenFromHTML ¶
ExtractCSRFTokenFromHTML extracts CSRF token from HTML response (simplified)
func GenerateCSRFToken ¶
GenerateCSRFToken generates a new, random CSRF token.
func GetAssetMimeType ¶
GetAssetMimeType determines the MIME type for an asset based on file extension
func ListAssets ¶
ListAssets returns a list of all embedded assets (useful for debugging)
func LoadTemplates ¶
LoadTemplates loads and parses embedded HTML templates
func ReloadTemplates ¶
func ReloadTemplates() error
ReloadTemplates forces a reload of templates (useful for development)
func RenderTemplate ¶
func RenderTemplate(w http.ResponseWriter, name string, data TemplateData) error
RenderTemplate renders the specified template with the provided data
func ServeAsset ¶
func ServeAsset(w http.ResponseWriter, r *http.Request, assetPath string)
ServeAsset serves an embedded asset with proper headers and caching
func ServeAssetWithFallback ¶
func ServeAssetWithFallback(w http.ResponseWriter, r *http.Request, assetPath, fallbackPath string)
ServeAssetWithFallback serves an asset or falls back to a default asset
Types ¶
type CategoryResponse ¶
type CategoryResponse struct {
Success bool `json:"success"`
Categories []CategoryResponseItem `json:"categories,omitempty"`
Error string `json:"error,omitempty"`
}
CategoryResponse represents the JSON response for category list
type CategoryResponseItem ¶
CategoryResponseItem represents a single category in the response
type LogBuffer ¶ added in v1.3.0
type LogBuffer struct {
// contains filtered or unexported fields
}
LogBuffer manages a circular buffer of log entries for the web UI
func NewLogBuffer ¶ added in v1.3.0
NewLogBuffer creates a new log buffer with the specified size
type LogEntry ¶ added in v1.3.0
type LogEntry struct {
Timestamp time.Time `json:"timestamp"`
Level string `json:"level"`
Message string `json:"message"`
Fields map[string]interface{} `json:"fields,omitempty"`
}
LogEntry represents a single log entry for the web UI
type LogsResponse ¶ added in v1.3.0
type LogsResponse struct {
Success bool `json:"success"`
Logs []LogEntry `json:"logs,omitempty"`
Error string `json:"error,omitempty"`
}
LogsResponse represents the JSON response for log entries
type MockRSSFFSResponse ¶
MockRSSFFSResponse represents a mock response from RSSFFS processing
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter implements basic rate limiting
func NewRateLimiter ¶
func NewRateLimiter(limit int, window time.Duration) *RateLimiter
NewRateLimiter creates a new rate limiter
func (*RateLimiter) IsAllowed ¶
func (rl *RateLimiter) IsAllowed(ip string) bool
IsAllowed checks if a request from the given IP is allowed
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the HTTP server with configuration and debug settings
func (*Server) SetupRoutes ¶
SetupRoutes configures HTTP routes and middleware
type SubmitRequest ¶
type SubmitRequest struct {
URL string `json:"url"`
Category string `json:"category"`
SingleURLMode bool `json:"single_url_mode"`
}
SubmitRequest represents the form submission data
type SubmitResponse ¶
type SubmitResponse struct {
Success bool `json:"success"`
Message string `json:"message"`
Count int `json:"count,omitempty"`
Error string `json:"error,omitempty"`
}
SubmitResponse represents the JSON response sent back to the client
type TemplateData ¶
type TemplateData struct {
Title string // Page title
Debug bool // Debug mode flag
Version string // Application version
}
TemplateData represents the data structure passed to HTML templates
type TestServer ¶
type TestServer struct {
*Server
// contains filtered or unexported fields
}
TestServer wraps the web server for testing purposes
func NewTestServer ¶
func NewTestServer(conf config.Config, debug bool) *TestServer
NewTestServer creates a server instance configured for testing
type ValidationError ¶
ValidationError represents a validation error with field-specific details
type ValidationErrors ¶
type ValidationErrors struct {
Errors []ValidationError `json:"errors"`
}
ValidationErrors represents multiple validation errors
func (ValidationErrors) Error ¶
func (ve ValidationErrors) Error() string
type WebUIHook ¶ added in v1.3.0
type WebUIHook struct {
// contains filtered or unexported fields
}
WebUIHook is a logrus hook that captures logs for the web UI
func NewWebUIHook ¶ added in v1.3.0
NewWebUIHook creates a new web UI log hook