124 lines
3.6 KiB
Go
124 lines
3.6 KiB
Go
|
|
package handlers
|
||
|
|
|
||
|
|
import "time"
|
||
|
|
|
||
|
|
// ==============================================================================
|
||
|
|
// HTTP CONTENT TYPES
|
||
|
|
// ==============================================================================
|
||
|
|
|
||
|
|
const (
|
||
|
|
// ContentTypePDF is the MIME type for PDF documents
|
||
|
|
ContentTypePDF = "application/pdf"
|
||
|
|
|
||
|
|
// ContentTypeHTML is the MIME type for HTML documents
|
||
|
|
ContentTypeHTML = "text/html; charset=utf-8"
|
||
|
|
|
||
|
|
// ContentTypeJSON is the MIME type for JSON documents
|
||
|
|
ContentTypeJSON = "application/json"
|
||
|
|
|
||
|
|
// ContentTypePlainText is the MIME type for plain text
|
||
|
|
ContentTypePlainText = "text/plain; charset=utf-8"
|
||
|
|
)
|
||
|
|
|
||
|
|
// ==============================================================================
|
||
|
|
// RATE LIMITING
|
||
|
|
// ==============================================================================
|
||
|
|
|
||
|
|
const (
|
||
|
|
// PDFRateLimitRequests is the maximum number of PDF requests per window
|
||
|
|
PDFRateLimitRequests = 3
|
||
|
|
|
||
|
|
// PDFRateLimitWindow is the time window for PDF rate limiting
|
||
|
|
PDFRateLimitWindow = 1 * time.Minute
|
||
|
|
|
||
|
|
// GeneralRateLimitRequests is the default rate limit for general requests
|
||
|
|
GeneralRateLimitRequests = 100
|
||
|
|
|
||
|
|
// GeneralRateLimitWindow is the time window for general rate limiting
|
||
|
|
GeneralRateLimitWindow = 1 * time.Minute
|
||
|
|
)
|
||
|
|
|
||
|
|
// ==============================================================================
|
||
|
|
// PDF GENERATION
|
||
|
|
// ==============================================================================
|
||
|
|
|
||
|
|
const (
|
||
|
|
// A4WidthInches is the width of A4 paper in inches
|
||
|
|
A4WidthInches = 8.27
|
||
|
|
|
||
|
|
// A4HeightInches is the height of A4 paper in inches
|
||
|
|
A4HeightInches = 11.69
|
||
|
|
|
||
|
|
// PDFGenerationTimeout is the maximum time allowed for PDF generation
|
||
|
|
PDFGenerationTimeout = 30 * time.Second
|
||
|
|
)
|
||
|
|
|
||
|
|
// ==============================================================================
|
||
|
|
// COOKIE SETTINGS
|
||
|
|
// ==============================================================================
|
||
|
|
|
||
|
|
const (
|
||
|
|
// CookieMaxAge is the default cookie expiration (1 year in seconds)
|
||
|
|
CookieMaxAge = 365 * 24 * 60 * 60
|
||
|
|
|
||
|
|
// CookiePath is the default cookie path
|
||
|
|
CookiePath = "/"
|
||
|
|
)
|
||
|
|
|
||
|
|
// ==============================================================================
|
||
|
|
// LANGUAGE CODES
|
||
|
|
// ==============================================================================
|
||
|
|
|
||
|
|
const (
|
||
|
|
// LangEnglish is the English language code
|
||
|
|
LangEnglish = "en"
|
||
|
|
|
||
|
|
// LangSpanish is the Spanish language code
|
||
|
|
LangSpanish = "es"
|
||
|
|
|
||
|
|
// DefaultLanguage is the default language for the application
|
||
|
|
DefaultLanguage = LangEnglish
|
||
|
|
)
|
||
|
|
|
||
|
|
// ==============================================================================
|
||
|
|
// CV PREFERENCES
|
||
|
|
// ==============================================================================
|
||
|
|
|
||
|
|
const (
|
||
|
|
// CVLengthShort represents the short CV format
|
||
|
|
CVLengthShort = "short"
|
||
|
|
|
||
|
|
// CVLengthLong represents the long CV format
|
||
|
|
CVLengthLong = "long"
|
||
|
|
|
||
|
|
// CVIconsShow indicates icons should be visible
|
||
|
|
CVIconsShow = "show"
|
||
|
|
|
||
|
|
// CVIconsHide indicates icons should be hidden
|
||
|
|
CVIconsHide = "hide"
|
||
|
|
|
||
|
|
// CVThemeDefault is the default CV theme
|
||
|
|
CVThemeDefault = "default"
|
||
|
|
|
||
|
|
// CVThemeClean is the clean CV theme
|
||
|
|
CVThemeClean = "clean"
|
||
|
|
)
|
||
|
|
|
||
|
|
// ==============================================================================
|
||
|
|
// HTTP HEADERS
|
||
|
|
// ==============================================================================
|
||
|
|
|
||
|
|
const (
|
||
|
|
// HeaderContentType is the Content-Type header key
|
||
|
|
HeaderContentType = "Content-Type"
|
||
|
|
|
||
|
|
// HeaderContentDisposition is the Content-Disposition header key
|
||
|
|
HeaderContentDisposition = "Content-Disposition"
|
||
|
|
|
||
|
|
// HeaderCacheControl is the Cache-Control header key
|
||
|
|
HeaderCacheControl = "Cache-Control"
|
||
|
|
|
||
|
|
// HeaderHXRequest is the HTMX request header
|
||
|
|
HeaderHXRequest = "HX-Request"
|
||
|
|
)
|