Documentation
¶
Overview ¶
Package handler implements HTTP handlers for the admin interface, including user management, page editing, configuration, and authentication.
Package handler provides HTTP handlers for the application.
Index ¶
- Constants
- Variables
- func CalculateTotalPages(totalItems, perPage int) int
- func ClampPage(page, totalPages int) int
- func ContentTypeByExtension(filename string) string
- func ConvertPagination(p AdminPagination) adminviews.PaginationData
- func FindDefaultLanguage(languages []store.Language) *store.Language
- func FrontendCategoryPage(data CategoryPageData) templ.Component
- func FrontendFormPage(data PublicFormViewData) templ.Component
- func FrontendHomePage(data HomeData) templ.Component
- func FrontendInternalErrorPage() templ.Component
- func FrontendListPage(data ListData) templ.Component
- func FrontendNotFoundPage(data NotFoundData) templ.Component
- func FrontendPageDetail(data PageData) templ.Component
- func FrontendSearchPage(data SearchData) templ.Component
- func FrontendTagPage(data TagPageData) templ.Component
- func IsImageMime(mimeType string) bool
- func ListActiveLanguagesWithFallback(ctx context.Context, queries *store.Queries) []store.Language
- func ListAndCount[T any](listFn func() ([]T, error), countFn func() (int64, error)) ([]T, int64, error)
- func NormalizePagination(page, totalItems, perPage int) (normalizedPage, totalPages int)
- func ParseIDParam(r *http.Request) (int64, error)
- func ParseIntParam(r *http.Request, param string, defaultVal, minVal, maxVal int) int
- func ParsePageParam(r *http.Request) int
- func ParsePerPageParam(r *http.Request, defaultPerPage, maxPerPage int) int
- func ParseQueryInt64(r *http.Request, name string) int64
- func ParseURLParamInt64(r *http.Request, name string) (int64, error)
- func PerPageSelector(current int, options []int) *adminviews.PaginationPerPageSelector
- func ValidateSlugForUpdate(slug, currentSlug string, checkExists SlugExistsFunc) string
- func ValidateSlugFormat(slug string) string
- func ValidateSlugWithChecker(slug string, checkExists SlugExistsFunc) string
- type APIKeysHandler
- func (h *APIKeysHandler) BulkDelete(w http.ResponseWriter, r *http.Request)
- func (h *APIKeysHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *APIKeysHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *APIKeysHandler) EditForm(w http.ResponseWriter, r *http.Request)
- func (h *APIKeysHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *APIKeysHandler) NewForm(w http.ResponseWriter, r *http.Request)
- func (h *APIKeysHandler) SetMaxTTLDays(days int)
- func (h *APIKeysHandler) SetRequireExpiry(required bool)
- func (h *APIKeysHandler) SetRequireSourceCIDRs(required bool)
- func (h *APIKeysHandler) Update(w http.ResponseWriter, r *http.Request)
- type ActivityItem
- type AddFieldRequest
- type AddItemRequest
- type AdminHandler
- type AdminPagination
- func (p AdminPagination) FirstURL() string
- func (p AdminPagination) LastURL() string
- func (p AdminPagination) NextURL() string
- func (p AdminPagination) PageRange() string
- func (p AdminPagination) PageURL(page int) string
- func (p AdminPagination) PrevURL() string
- func (p AdminPagination) ShouldShow() bool
- func (p AdminPagination) SortState(field string) string
- func (p AdminPagination) SortURL(field, defaultDir string) string
- type AdminPaginationPage
- type AuthHandler
- type AuthorView
- type BaseTemplateData
- type CacheHandler
- func (h *CacheHandler) Clear(w http.ResponseWriter, r *http.Request)
- func (h *CacheHandler) ClearConfig(w http.ResponseWriter, r *http.Request)
- func (h *CacheHandler) ClearLanguages(w http.ResponseWriter, r *http.Request)
- func (h *CacheHandler) ClearMenus(w http.ResponseWriter, r *http.Request)
- func (h *CacheHandler) ClearPages(w http.ResponseWriter, r *http.Request)
- func (h *CacheHandler) ClearSitemap(w http.ResponseWriter, r *http.Request)
- func (h *CacheHandler) Stats(w http.ResponseWriter, r *http.Request)
- type CacheStatsData
- type CategoriesListData
- type CategoryFormData
- type CategoryPageData
- type CategoryTranslationInfo
- type CategoryTreeNode
- type CategoryView
- type Check
- type ConfigFormData
- type ConfigHandler
- type ConfigItem
- type ConfigLanguage
- type ConfigTranslationValue
- type ConflictStrategyOption
- type CreateWidgetRequest
- type DashboardData
- type DashboardStats
- type DocsEndpoint
- type DocsEndpointGroup
- type DocsGuide
- type DocsHandler
- type DocsPageData
- type DocsSystemInfo
- type EventWithUser
- type EventsHandler
- type ExportFormData
- type FeaturedImageData
- type FooterWidget
- type FormFormData
- type FormListItem
- type FormTemplateData
- type FormTranslationInfo
- type FormsHandler
- func (h *FormsHandler) AddField(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) BulkDeleteSubmissions(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) DeleteField(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) DeleteSubmission(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) EditForm(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) ExportSubmissions(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) NewForm(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) ReorderFields(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) SetDispatcher(d *webhook.Dispatcher)
- func (h *FormsHandler) SetRequireCaptcha(required bool)
- func (h *FormsHandler) SetWebhookFormDataMode(mode string)
- func (h *FormsHandler) Show(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) Submissions(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) Submit(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) TranslateForm(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) Update(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) UpdateField(w http.ResponseWriter, r *http.Request)
- func (h *FormsHandler) ViewSubmission(w http.ResponseWriter, r *http.Request)
- type FormsListData
- type FrontendHandler
- func (h *FrontendHandler) APICatalog(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) AgentSkillsIndex(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) Blog(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) Category(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) Favicon(w http.ResponseWriter, r *http.Request, defaultFavicon []byte)
- func (h *FrontendHandler) Home(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) MCPServerCard(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) NotFound(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) Page(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) PageByID(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) Robots(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) Search(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) Security(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) SetModuleTemplateFuncsProvider(p ModuleTemplateFuncsProvider)
- func (h *FrontendHandler) SetOpenAPISpecProvider(fn func() ([]byte, error))
- func (h *FrontendHandler) SetSanitizePageHTML(enabled bool)
- func (h *FrontendHandler) Sitemap(w http.ResponseWriter, r *http.Request)
- func (h *FrontendHandler) Tag(w http.ResponseWriter, r *http.Request)
- type HealthHandler
- type HealthStatus
- type HealthStatusPublic
- type HomeData
- type HrefLangLink
- type ImportExportHandler
- func (h *ImportExportHandler) Export(w http.ResponseWriter, r *http.Request)
- func (h *ImportExportHandler) ExportForm(w http.ResponseWriter, r *http.Request)
- func (h *ImportExportHandler) Import(w http.ResponseWriter, r *http.Request)
- func (h *ImportExportHandler) ImportForm(w http.ResponseWriter, r *http.Request)
- func (h *ImportExportHandler) ImportValidate(w http.ResponseWriter, r *http.Request)
- func (h *ImportExportHandler) SetBlockSuspiciousMarkup(block bool)
- type ImportFormData
- type LanguageView
- type LanguagesHandler
- func (h *LanguagesHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *LanguagesHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *LanguagesHandler) EditForm(w http.ResponseWriter, r *http.Request)
- func (h *LanguagesHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *LanguagesHandler) NewForm(w http.ResponseWriter, r *http.Request)
- func (h *LanguagesHandler) SetDefault(w http.ResponseWriter, r *http.Request)
- func (h *LanguagesHandler) Update(w http.ResponseWriter, r *http.Request)
- type ListData
- type MediaEditData
- type MediaHandler
- func (h *MediaHandler) API(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) BulkDelete(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) CreateFolder(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) DeleteFolder(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) EditForm(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) Library(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) MoveMedia(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) RegenerateVariants(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) SetDispatcher(d *webhook.Dispatcher)
- func (h *MediaHandler) Update(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) UpdateFolder(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) Upload(w http.ResponseWriter, r *http.Request)
- func (h *MediaHandler) UploadForm(w http.ResponseWriter, r *http.Request)
- type MediaItem
- type MediaLibraryData
- type MediaTranslationData
- type MenuItem
- type MenuItemNode
- type MenusHandler
- func (h *MenusHandler) AddItem(w http.ResponseWriter, r *http.Request)
- func (h *MenusHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *MenusHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *MenusHandler) DeleteItem(w http.ResponseWriter, r *http.Request)
- func (h *MenusHandler) EditForm(w http.ResponseWriter, r *http.Request)
- func (h *MenusHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *MenusHandler) NewForm(w http.ResponseWriter, r *http.Request)
- func (h *MenusHandler) Reorder(w http.ResponseWriter, r *http.Request)
- func (h *MenusHandler) Update(w http.ResponseWriter, r *http.Request)
- func (h *MenusHandler) UpdateItem(w http.ResponseWriter, r *http.Request)
- type ModuleTemplateFuncsProvider
- type ModulesHandler
- type ModulesListData
- type MoveWidgetRequest
- type NotFoundData
- type PageCategoryNode
- type PageData
- type PageFormData
- type PageTranslationInfo
- type PageVersionsData
- type PageView
- type PagesHandler
- func (h *PagesHandler) BulkDelete(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) EditForm(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) NewForm(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) RestoreVersion(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) SetBlockSuspiciousMarkup(block bool)
- func (h *PagesHandler) SetCacheManager(cm *cache.Manager)
- func (h *PagesHandler) SetDispatcher(d *webhook.Dispatcher)
- func (h *PagesHandler) SetSanitizePageHTML(sanitize bool)
- func (h *PagesHandler) TogglePublish(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) Translate(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) Update(w http.ResponseWriter, r *http.Request)
- func (h *PagesHandler) Versions(w http.ResponseWriter, r *http.Request)
- type PagesListData
- type Pagination
- type PaginationPage
- type PublicFormData
- type PublicFormField
- type PublicFormViewData
- type RecentFailedDelivery
- type RecentPost
- type RecentSubmission
- type RedirectsHandler
- func (h *RedirectsHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *RedirectsHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *RedirectsHandler) EditForm(w http.ResponseWriter, r *http.Request)
- func (h *RedirectsHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *RedirectsHandler) NewForm(w http.ResponseWriter, r *http.Request)
- func (h *RedirectsHandler) Toggle(w http.ResponseWriter, r *http.Request)
- func (h *RedirectsHandler) Update(w http.ResponseWriter, r *http.Request)
- type ReorderFieldsRequest
- type ReorderItem
- type ReorderRequest
- type ReorderWidgetsRequest
- type SchedulerHandler
- func (h *SchedulerHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *SchedulerHandler) ResetSchedule(w http.ResponseWriter, r *http.Request)
- func (h *SchedulerHandler) TaskCreate(w http.ResponseWriter, r *http.Request)
- func (h *SchedulerHandler) TaskDelete(w http.ResponseWriter, r *http.Request)
- func (h *SchedulerHandler) TaskForm(w http.ResponseWriter, r *http.Request)
- func (h *SchedulerHandler) TaskRuns(w http.ResponseWriter, r *http.Request)
- func (h *SchedulerHandler) TaskToggle(w http.ResponseWriter, r *http.Request)
- func (h *SchedulerHandler) TaskTrigger(w http.ResponseWriter, r *http.Request)
- func (h *SchedulerHandler) TaskUpdate(w http.ResponseWriter, r *http.Request)
- func (h *SchedulerHandler) TriggerNow(w http.ResponseWriter, r *http.Request)
- func (h *SchedulerHandler) UpdateSchedule(w http.ResponseWriter, r *http.Request)
- type SchedulerJobView
- type SchedulerListData
- type SchedulerTaskView
- type SearchData
- type SecuritySummary
- type SiteData
- type SlugExistsChecker
- type SlugExistsFunc
- type SocialLink
- type SortConfig
- type StatusCodeOption
- type SubcategoryView
- type SubmissionListItem
- type SubmissionViewData
- type SubmissionsListData
- type SystemInfo
- type TagFormData
- type TagPageData
- type TagTranslationInfo
- type TagView
- type TagsListData
- type TaxonomyHandler
- func (h *TaxonomyHandler) BulkDeleteTags(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) CreateCategory(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) CreateTag(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) DeleteCategory(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) DeleteTag(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) EditCategoryForm(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) EditTagForm(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) ListCategories(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) ListTags(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) NewCategoryForm(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) NewTagForm(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) SearchCategories(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) SearchTags(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) TranslateCategory(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) TranslateTag(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) UpdateCategory(w http.ResponseWriter, r *http.Request)
- func (h *TaxonomyHandler) UpdateTag(w http.ResponseWriter, r *http.Request)
- type ThemeListData
- type ThemeSettingsData
- type ThemesHandler
- type ToggleActiveRequest
- type ToggleActiveResponse
- type ToggleSidebarRequest
- type ToggleSidebarResponse
- type TranslatableConfigItem
- type TranslationCoverage
- type TranslationLink
- type UpdateFieldRequest
- type UpdateItemRequest
- type UpdateWidgetRequest
- type UploadFormData
- type UsersHandler
- func (h *UsersHandler) BulkDelete(w http.ResponseWriter, r *http.Request)
- func (h *UsersHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *UsersHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *UsersHandler) EditForm(w http.ResponseWriter, r *http.Request)
- func (h *UsersHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *UsersHandler) NewForm(w http.ResponseWriter, r *http.Request)
- func (h *UsersHandler) SetDispatcher(d *webhook.Dispatcher)
- func (h *UsersHandler) Update(w http.ResponseWriter, r *http.Request)
- type WebhookDeliveriesData
- type WebhookFormData
- type WebhookHealthItem
- type WebhookWithStats
- type WebhooksHandler
- func (h *WebhooksHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *WebhooksHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *WebhooksHandler) Deliveries(w http.ResponseWriter, r *http.Request)
- func (h *WebhooksHandler) EditForm(w http.ResponseWriter, r *http.Request)
- func (h *WebhooksHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *WebhooksHandler) NewForm(w http.ResponseWriter, r *http.Request)
- func (h *WebhooksHandler) RetryDelivery(w http.ResponseWriter, r *http.Request)
- func (h *WebhooksHandler) Test(w http.ResponseWriter, r *http.Request)
- func (h *WebhooksHandler) Update(w http.ResponseWriter, r *http.Request)
- type WebhooksListData
- type WidgetAreaWithWidgets
- type WidgetsHandler
- func (h *WidgetsHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *WidgetsHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *WidgetsHandler) GetWidget(w http.ResponseWriter, r *http.Request)
- func (h *WidgetsHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *WidgetsHandler) MoveWidget(w http.ResponseWriter, r *http.Request)
- func (h *WidgetsHandler) Reorder(w http.ResponseWriter, r *http.Request)
- func (h *WidgetsHandler) Update(w http.ResponseWriter, r *http.Request)
- type WidgetsListData
Constants ¶
const ( // RouteRoot is the root path. RouteRoot = "/" // RouteSuffixNew is the suffix for "new" routes. RouteSuffixNew = "/new" // RouteSuffixSearch is the suffix for search routes. RouteSuffixSearch = "/search" // RouteSuffixUpload is the suffix for upload routes. RouteSuffixUpload = "/upload" // RouteSuffixReorder is the suffix for reorder routes. RouteSuffixReorder = "/reorder" // RouteSuffixMove is the suffix for move routes. RouteSuffixMove = "/move" // RouteSuffixRegenerate is the suffix for variant regeneration routes. RouteSuffixRegenerate = "/regenerate" // RouteSuffixTranslate is the suffix for translation routes. RouteSuffixTranslate = "/translate/{langCode}" // RouteSuffixFolders is the suffix for folder routes. RouteSuffixFolders = "/folders" // RouteSuffixBulkDelete is the suffix for bulk delete/revoke routes. RouteSuffixBulkDelete = "/bulk-delete" // RouteParamID is the ID parameter pattern. RouteParamID = "/{id}" // RouteParamSlug is the slug parameter pattern. RouteParamSlug = "/{slug}" // RoutePageByID is the page by ID route pattern (redirects to slug URL). RoutePageByID = "/page/{id}" // RouteTagSlug is the tag slug route pattern. RouteTagSlug = "/tag/{slug}" // RouteCategorySlug is the category slug route pattern. RouteCategorySlug = "/category/{slug}" // RouteFormsSlug is the forms slug route pattern. RouteFormsSlug = "/forms/{slug}" // RouteSubmissionsSubID is the submissions sub-ID route pattern. RouteSubmissionsSubID = "/submissions/{subId}" // RouteItemsItemID is the items item-ID route pattern. RouteItemsItemID = "/items/{itemId}" // RouteFieldsFieldID is the fields field-ID route pattern. RouteFieldsFieldID = "/fields/{fieldId}" // RouteLogin is the login route. RouteLogin = "/login" // RouteLogout is the logout route. RouteLogout = "/logout" // RouteLanguage is the public language switch route. RouteLanguage = "/language" // RouteBlog is the blog route. RouteBlog = "/blog" // RouteUsers is the users admin route. RouteUsers = "/users" // RouteLanguages is the languages admin route. RouteLanguages = "/languages" // RoutePages is the pages admin route. RoutePages = "/pages" // RouteTags is the tags admin route. RouteTags = "/tags" // RouteCategories is the categories admin route. RouteCategories = "/categories" // RouteMedia is the media admin route. RouteMedia = "/media" // RouteMenus is the menus admin route. RouteMenus = "/menus" // RouteForms is the forms admin route. RouteForms = "/forms" // RouteWidgets is the widgets admin route. RouteWidgets = "/widgets" // RouteAPIKeys is the API keys admin route. RouteAPIKeys = "/api-keys" // RouteWebhooks is the webhooks admin route. RouteWebhooks = "/webhooks" // RouteRedirects is the redirects admin route. RouteRedirects = "/redirects" // RouteExport is the export admin route. RouteExport = "/export" // RouteImport is the import admin route. RouteImport = "/import" // RouteConfig is the config admin route. RouteConfig = "/config" // RouteDocs is the site docs admin route. RouteDocs = "/docs" // RouteDocsSlug is the site docs guide route pattern. RouteDocsSlug = RouteDocs + RouteParamSlug // RouteUsersID is the users ID route pattern. RouteUsersID = RouteUsers + RouteParamID // RouteLanguagesID is the languages ID route pattern. RouteLanguagesID = RouteLanguages + RouteParamID // RoutePagesID is the pages ID route pattern. RoutePagesID = RoutePages + RouteParamID // RouteTagsID is the tags ID route pattern. RouteTagsID = RouteTags + RouteParamID // RouteCategoriesID is the categories ID route pattern. RouteCategoriesID = RouteCategories + RouteParamID // RouteMediaID is the media ID route pattern. RouteMediaID = RouteMedia + RouteParamID // RouteMediaFoldersID is the media folders ID route pattern. RouteMediaFoldersID = RouteMedia + RouteSuffixFolders + RouteParamID // RouteMenusID is the menus ID route pattern. RouteMenusID = RouteMenus + RouteParamID // RouteFormsID is the forms ID route pattern. RouteFormsID = RouteForms + RouteParamID // RouteThemeSettings is the theme settings route pattern. RouteThemeSettings = "/themes/{name}/settings" // RouteWidgetsID is the widgets ID route pattern. RouteWidgetsID = RouteWidgets + RouteParamID // RouteAPIKeysID is the API keys ID route pattern. RouteAPIKeysID = RouteAPIKeys + RouteParamID // RouteWebhooksID is the webhooks ID route pattern. RouteWebhooksID = RouteWebhooks + RouteParamID // RouteRedirectsID is the redirects ID route pattern. RouteRedirectsID = RouteRedirects + RouteParamID )
Route pattern constants for chi router registration.
const ( // LogCacheManagerInit is the log message for cache manager initialization. LogCacheManagerInit = "cache manager initialized" // HeaderContentType is the Content-Type HTTP header name. HeaderContentType = "Content-Type" )
Utility constants used by main.go.
const ( PageStatusDraft = "draft" PageStatusPublished = "published" )
Page statuses
const ( PageTypePost = "post" PageTypePage = "page" )
Page types
const APIKeysPerPage = 10
APIKeysPerPage is the number of API keys to display per page.
const DeliveriesPerPage = 25
DeliveriesPerPage is the number of deliveries to display per page.
const DocsDir = "./docs"
DocsDir is the default directory containing documentation files.
const EventsPerPage = 25
EventsPerPage is the number of events to display per page.
const MaxBioLength = 500
MaxBioLength is the maximum allowed length for a user bio.
const MaxJSONBodyBytes int64 = 1 << 20
MaxJSONBodyBytes is the default maximum JSON request body size (1 MiB).
const MaxPerPageSelectionValue = maxPerPageSelectionValue
MaxPerPageSelectionValue is the maximum allowed per-page value. Exported for use by modules.
const MaxProfileURLLength = 255
MaxProfileURLLength is the maximum allowed length for profile URL fields.
const MediaPerPage = 24
MediaPerPage is the number of media items to display per page.
const MinPasswordLength = 12
MinPasswordLength is the minimum required password length.
const PagesPerPage = 10
PagesPerPage is the number of pages to display per page.
const TagsPerPage = 20
TagsPerPage is the number of tags to display per page.
const UsersPerPage = 10
UsersPerPage is the number of users to display per page.
const VersionsPerPage = 20
VersionsPerPage is the number of versions to display per page.
Variables ¶
var PerPageOptionsStandard = perPageOptionsStandard
PerPageOptionsStandard exposes the standard per-page options for modules.
var ValidPageStatuses = []string{PageStatusDraft, PageStatusPublished}
ValidPageStatuses contains all valid page statuses.
var ValidPageTypes = []string{PageTypePost, PageTypePage}
ValidPageTypes contains all valid page types.
var ValidStatusCodes = []StatusCodeOption{
{Code: 301, Label: "301 - Permanent Redirect"},
{Code: 302, Label: "302 - Temporary Redirect"},
{Code: 307, Label: "307 - Temporary Redirect (preserve method)"},
{Code: 308, Label: "308 - Permanent Redirect (preserve method)"},
}
ValidStatusCodes contains valid HTTP redirect status codes.
var WidgetTypes = []struct { ID string Name string Description string }{ {ID: "text", Name: "Text/HTML", Description: "Custom text or HTML content"}, {ID: "recent_posts", Name: "Recent Posts", Description: "Display recent blog posts"}, {ID: "categories", Name: "Categories", Description: "Display category list"}, {ID: "tags", Name: "Tags", Description: "Display tag cloud"}, {ID: "search", Name: "Search", Description: "Search form widget"}, {ID: "custom_menu", Name: "Custom Menu", Description: "Display a navigation menu"}, }
WidgetTypes defines available widget types.
Functions ¶
func CalculateTotalPages ¶
CalculateTotalPages calculates the number of pages for the given total items and items per page.
func ContentTypeByExtension ¶ added in v0.2.0
ContentTypeByExtension returns the MIME content type for a file based on its extension. Falls back to "application/octet-stream" for unknown extensions.
func ConvertPagination ¶ added in v0.10.0
func ConvertPagination(p AdminPagination) adminviews.PaginationData
ConvertPagination converts handler AdminPagination to view PaginationData. Exported for use by modules that need pagination support.
func FindDefaultLanguage ¶
FindDefaultLanguage returns a pointer to the default language from a slice. Returns nil if no default language is found or the slice is empty.
func FrontendCategoryPage ¶ added in v0.9.0
func FrontendCategoryPage(data CategoryPageData) templ.Component
FrontendCategoryPage renders a category archive page.
func FrontendFormPage ¶ added in v0.9.0
func FrontendFormPage(data PublicFormViewData) templ.Component
FrontendFormPage renders the public form page.
func FrontendHomePage ¶ added in v0.9.0
FrontendHomePage renders the homepage.
func FrontendInternalErrorPage ¶ added in v0.9.0
FrontendInternalErrorPage renders a 500 Internal Server Error page.
func FrontendListPage ¶ added in v0.9.0
FrontendListPage renders a paginated list of posts (blog, archives).
func FrontendNotFoundPage ¶ added in v0.9.0
func FrontendNotFoundPage(data NotFoundData) templ.Component
FrontendNotFoundPage renders the 404 page.
func FrontendPageDetail ¶ added in v0.9.0
FrontendPageDetail renders a single page/post.
func FrontendSearchPage ¶ added in v0.9.0
func FrontendSearchPage(data SearchData) templ.Component
FrontendSearchPage renders the search results page.
func FrontendTagPage ¶ added in v0.9.0
func FrontendTagPage(data TagPageData) templ.Component
FrontendTagPage renders a tag archive page.
func IsImageMime ¶
IsImageMime checks if the MIME type is an image.
func ListActiveLanguagesWithFallback ¶
ListActiveLanguagesWithFallback returns all active languages, or an empty slice on error. This is useful when the languages list is needed for display but not critical for the operation.
func ListAndCount ¶
func ListAndCount[T any]( listFn func() ([]T, error), countFn func() (int64, error), ) ([]T, int64, error)
ListAndCount executes list and count queries, returning combined results. This is a generic helper for paginated list endpoints.
func NormalizePagination ¶
NormalizePagination calculates total pages and clamps the current page to a valid range. Returns the normalized page number and total pages.
func ParseIDParam ¶
ParseIDParam parses the "id" URL parameter from the request as int64. Returns the parsed ID or an error if the parameter is missing or invalid.
func ParseIntParam ¶
ParseIntParam parses an integer query parameter from the request. Returns defaultVal if the parameter is missing, empty, or invalid. If minVal > 0, values below minVal return defaultVal. If maxVal > 0, values above maxVal return defaultVal.
func ParsePageParam ¶
ParsePageParam parses the "page" query parameter from the request. Returns 1 if the parameter is missing, empty, or invalid.
func ParsePerPageParam ¶
ParsePerPageParam parses the "per_page" query parameter from the request. Returns the default value if the parameter is missing, empty, or invalid. The value is clamped to the range [1, maxPerPage].
func ParseQueryInt64 ¶
ParseQueryInt64 parses a named query parameter as a positive int64. Returns 0 if the parameter is missing, empty, invalid, or not positive.
func ParseURLParamInt64 ¶
ParseURLParamInt64 parses a named URL parameter from the request as int64. Returns the parsed value or an error if the parameter is missing or invalid.
func PerPageSelector ¶ added in v0.10.0
func PerPageSelector(current int, options []int) *adminviews.PaginationPerPageSelector
PerPageSelector creates a per-page selector config for pagination. Exported for use by modules.
func ValidateSlugForUpdate ¶
func ValidateSlugForUpdate(slug, currentSlug string, checkExists SlugExistsFunc) string
ValidateSlugForUpdate validates a slug for update operations. Skips validation if the slug hasn't changed from the current value.
func ValidateSlugFormat ¶
ValidateSlugFormat validates only the slug format without checking existence. Use this when uniqueness checking is not required.
func ValidateSlugWithChecker ¶
func ValidateSlugWithChecker(slug string, checkExists SlugExistsFunc) string
ValidateSlugWithChecker validates a slug using a custom existence checker. Returns an error message string if validation fails, or empty string if valid.
Types ¶
type APIKeysHandler ¶
type APIKeysHandler struct {
// contains filtered or unexported fields
}
APIKeysHandler handles API key management routes.
func NewAPIKeysHandler ¶
func NewAPIKeysHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *APIKeysHandler
NewAPIKeysHandler creates a new APIKeysHandler.
func (*APIKeysHandler) BulkDelete ¶ added in v0.10.0
func (h *APIKeysHandler) BulkDelete(w http.ResponseWriter, r *http.Request)
BulkDelete handles POST /admin/api-keys/bulk-delete - revokes multiple API keys.
func (*APIKeysHandler) Create ¶
func (h *APIKeysHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /admin/api-keys - creates a new API key.
func (*APIKeysHandler) Delete ¶
func (h *APIKeysHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /admin/api-keys/{id} - deletes (deactivates) an API key.
func (*APIKeysHandler) EditForm ¶
func (h *APIKeysHandler) EditForm(w http.ResponseWriter, r *http.Request)
EditForm handles GET /admin/api-keys/{id} - displays the edit API key form.
func (*APIKeysHandler) List ¶
func (h *APIKeysHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/api-keys - displays a paginated list of API keys.
func (*APIKeysHandler) NewForm ¶
func (h *APIKeysHandler) NewForm(w http.ResponseWriter, r *http.Request)
NewForm handles GET /admin/api-keys/new - displays the new API key form.
func (*APIKeysHandler) SetMaxTTLDays ¶ added in v0.9.0
func (h *APIKeysHandler) SetMaxTTLDays(days int)
SetMaxTTLDays configures the optional maximum lifetime policy for API keys. Values <= 0 disable policy enforcement in the admin create/update forms.
func (*APIKeysHandler) SetRequireExpiry ¶ added in v0.9.0
func (h *APIKeysHandler) SetRequireExpiry(required bool)
SetRequireExpiry configures whether API key updates must keep an explicit expiration date.
func (*APIKeysHandler) SetRequireSourceCIDRs ¶ added in v0.9.0
func (h *APIKeysHandler) SetRequireSourceCIDRs(required bool)
SetRequireSourceCIDRs configures whether API key create/update requires at least one per-key source CIDR/IP entry.
func (*APIKeysHandler) Update ¶
func (h *APIKeysHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/api-keys/{id} - updates an existing API key.
type ActivityItem ¶
type ActivityItem struct {
ID int64
Level string // info, warning, error
Category string // auth, page, user, config, system, cache
Message string
UserName string
UserEmail string
CreatedAt string
TimeAgo string
}
ActivityItem represents a recent activity event for dashboard display.
type AddFieldRequest ¶
type AddFieldRequest struct {
Type string `json:"type"`
Name string `json:"name"`
Label string `json:"label"`
Placeholder string `json:"placeholder"`
HelpText string `json:"help_text"`
Options string `json:"options"`
Validation string `json:"validation"`
IsRequired bool `json:"is_required"`
}
AddFieldRequest represents the JSON request for adding a form field.
type AddItemRequest ¶
type AddItemRequest struct {
Title string `json:"title"`
URL string `json:"url"`
Target string `json:"target"`
PageID *int64 `json:"page_id"`
ParentID *int64 `json:"parent_id"`
CSSClass string `json:"css_class"`
}
AddItemRequest represents the JSON request for adding a menu item.
type AdminHandler ¶
type AdminHandler struct {
// contains filtered or unexported fields
}
AdminHandler handles admin routes.
func NewAdminHandler ¶
func NewAdminHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager, cacheManager *cache.Manager) *AdminHandler
NewAdminHandler creates a new AdminHandler.
func (*AdminHandler) Dashboard ¶
func (h *AdminHandler) Dashboard(w http.ResponseWriter, r *http.Request)
Dashboard renders the admin dashboard with stats and recent activity.
func (*AdminHandler) SetLanguage ¶
func (h *AdminHandler) SetLanguage(w http.ResponseWriter, r *http.Request)
SetLanguage changes the admin UI language preference. POST /admin/language
type AdminPagination ¶
type AdminPagination struct {
CurrentPage int
TotalPages int
TotalItems int64
PerPage int
SortField string
SortDir string
HasFirst bool
HasPrev bool
HasNext bool
HasLast bool
FirstPage int
PrevPage int
NextPage int
LastPage int
Pages []AdminPaginationPage
BaseURL string
QueryString string
}
AdminPagination holds pagination data for admin templates.
func BuildAdminPagination ¶
func BuildAdminPagination(currentPage, totalItems, perPage int, baseURL string, queryParams url.Values) AdminPagination
BuildAdminPagination creates pagination data for admin templates. baseURL is the path without query string (e.g., "/admin/events") queryParams are the current query parameters to preserve (e.g., filters)
func (AdminPagination) FirstURL ¶
func (p AdminPagination) FirstURL() string
FirstURL returns the URL for the first page.
func (AdminPagination) LastURL ¶
func (p AdminPagination) LastURL() string
LastURL returns the URL for the last page.
func (AdminPagination) NextURL ¶
func (p AdminPagination) NextURL() string
NextURL returns the URL for the next page.
func (AdminPagination) PageRange ¶
func (p AdminPagination) PageRange() string
PageRange returns a description of the current page range.
func (AdminPagination) PageURL ¶
func (p AdminPagination) PageURL(page int) string
PageURL returns the URL for a specific page number.
func (AdminPagination) PrevURL ¶
func (p AdminPagination) PrevURL() string
PrevURL returns the URL for the previous page.
func (AdminPagination) ShouldShow ¶
func (p AdminPagination) ShouldShow() bool
ShouldShow returns true if pagination should be displayed (more than 1 page).
func (AdminPagination) SortState ¶ added in v0.10.0
func (p AdminPagination) SortState(field string) string
SortState returns "asc", "desc", or "none" for the given sortable field.
func (AdminPagination) SortURL ¶ added in v0.10.0
func (p AdminPagination) SortURL(field, defaultDir string) string
SortURL returns a URL for sorting by the given field. Clicking the active field toggles direction; changing field uses defaultDir. Sort changes always reset page=1.
type AdminPaginationPage ¶
AdminPaginationPage represents a single page link in admin pagination.
type AuthHandler ¶
type AuthHandler struct {
// contains filtered or unexported fields
}
AuthHandler handles authentication routes.
func NewAuthHandler ¶
func NewAuthHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager, lp *middleware.LoginProtection, hr *module.HookRegistry) *AuthHandler
NewAuthHandler creates a new AuthHandler.
func (*AuthHandler) Login ¶
func (h *AuthHandler) Login(w http.ResponseWriter, r *http.Request)
Login handles the login form submission.
func (*AuthHandler) LoginForm ¶
func (h *AuthHandler) LoginForm(w http.ResponseWriter, r *http.Request)
LoginForm renders the login page. Redirects already-authenticated users: admin/editor → dashboard, others → homepage.
func (*AuthHandler) Logout ¶
func (h *AuthHandler) Logout(w http.ResponseWriter, r *http.Request)
Logout handles user logout.
func (*AuthHandler) SetLanguage ¶
func (h *AuthHandler) SetLanguage(w http.ResponseWriter, r *http.Request)
SetLanguage changes the UI language preference on the login page. POST /language
type AuthorView ¶
type AuthorView struct {
ID int64
Name string
Email string
Avatar string
Bio string
WebsiteURL string
LinkedInURL string
GitHubURL string
TelegramURL string
}
AuthorView represents an author for template rendering.
type BaseTemplateData ¶
type BaseTemplateData struct {
// SEO Meta
Title string
MetaDescription string
MetaKeywords string
Canonical string
FeaturedImage string
Robots string // Robots directive (index,follow / noindex,nofollow)
OGImage string // Open Graph image (absolute URL)
OGImageWidth int // Open Graph image width
OGImageHeight int // Open Graph image height
OGImageType string // Open Graph image MIME type (e.g. image/jpeg)
OGType string // Open Graph type (website, article)
ArticlePublishedTime string // article:published_time (ISO 8601)
ArticleModifiedTime string // article:modified_time (ISO 8601)
ArticleAuthor string // article:author
ArticleSection string // article:section (primary category)
ArticleTags []string // article:tag
JSONLD template.JS // JSON-LD structured data
// Site info
SiteName string
SiteURL string
SiteLogo string
SiteTagline string
RequestURI string
CurrentPath string
Year int
// Layout options
BodyClass string
ShowSidebar bool
// Page - set when rendering a single page (for Open Graph article type)
Page *PageView
// Site data
Site SiteData
// Theme settings - key-value pairs from theme configuration
ThemeSettings map[string]string
CustomCSS string
// Menus - MainMenu/FooterMenu for code, Navigation/FooterNav for templates
MainMenu []MenuItem
// Footer
CopyrightText string
SocialLinks []SocialLink
// Search
ShowSearch bool
SearchQuery string
// Widgets - map of widget area ID to widgets
Widgets map[string][]service.WidgetView
// Language support
CurrentLanguage *LanguageView // Current language for the request
Languages []LanguageView // All active languages
Translations []TranslationLink // Available translations for current page
HrefLangs []HrefLangLink // hreflang links for SEO
LangCode string // Current language code (shortcut)
LangDirection string // Current language direction (ltr/rtl)
LangPrefix string // URL prefix for current language (e.g., "/ru" or "" for default)
ShowLanguagePicker bool // Whether to show language picker
CSPNonce string // CSP nonce for inline scripts
PageOrigin string // Normalized scheme://host the page is served from — used by template funcs like embedBody that need to bind render-time tokens to the page origin
// Module-rendered HTML for templ-based layouts (aggregated from all active modules).
// HTML themes use template funcs directly; templ layouts use these fields.
ModuleHeadHTML template.HTML // Before </head>: privacy consent, analytics, embeds
ModuleBodyTopHTML template.HTML // After <body>: informer bar, analytics noscript
ModuleBodyEndHTML template.HTML // Before </body>: embed widgets (chat, etc.)
}
BaseTemplateData contains common fields expected by all frontend templates.
type CacheHandler ¶
type CacheHandler struct {
// contains filtered or unexported fields
}
CacheHandler handles cache management routes.
func NewCacheHandler ¶
func NewCacheHandler(renderer *render.Renderer, sm *scs.SessionManager, cm *cache.Manager, es *service.EventService) *CacheHandler
NewCacheHandler creates a new CacheHandler.
func (*CacheHandler) Clear ¶
func (h *CacheHandler) Clear(w http.ResponseWriter, r *http.Request)
Clear handles POST /admin/cache/clear - clears all caches.
func (*CacheHandler) ClearConfig ¶
func (h *CacheHandler) ClearConfig(w http.ResponseWriter, r *http.Request)
ClearConfig handles POST /admin/cache/clear/config - clears config cache.
func (*CacheHandler) ClearLanguages ¶ added in v0.3.0
func (h *CacheHandler) ClearLanguages(w http.ResponseWriter, r *http.Request)
ClearLanguages handles POST /admin/cache/clear/languages - clears language cache.
func (*CacheHandler) ClearMenus ¶ added in v0.3.0
func (h *CacheHandler) ClearMenus(w http.ResponseWriter, r *http.Request)
ClearMenus handles POST /admin/cache/clear/menus - clears menu cache.
func (*CacheHandler) ClearPages ¶ added in v0.3.0
func (h *CacheHandler) ClearPages(w http.ResponseWriter, r *http.Request)
ClearPages handles POST /admin/cache/clear/pages - clears page cache.
func (*CacheHandler) ClearSitemap ¶
func (h *CacheHandler) ClearSitemap(w http.ResponseWriter, r *http.Request)
ClearSitemap handles POST /admin/cache/clear/sitemap - clears sitemap cache.
func (*CacheHandler) Stats ¶
func (h *CacheHandler) Stats(w http.ResponseWriter, r *http.Request)
Stats handles GET /admin/cache - displays cache statistics.
type CacheStatsData ¶
type CacheStatsData struct {
Caches []cache.ManagerCacheStats
TotalStats cache.Stats
Info cache.ManagerInfo
IsRedis bool
HealthError string // Non-empty if health check failed
}
CacheStatsData holds data for the cache stats template.
type CategoriesListData ¶
type CategoriesListData struct {
Categories []CategoryTreeNode
TotalCount int64
}
CategoriesListData holds data for the categories list template.
type CategoryFormData ¶
type CategoryFormData struct {
Category *store.Category
AllCategories []CategoryTreeNode // For parent selector
Errors map[string]string
FormValues map[string]string
IsEdit bool
Language *store.Language // Current category language
AllLanguages []store.Language // All active languages for selection
Translations []CategoryTranslationInfo // Existing translations
MissingLanguages []store.Language // Languages without translations
}
CategoryFormData holds data for the category form template.
type CategoryPageData ¶
type CategoryPageData struct {
BaseTemplateData
Category CategoryView
Pages []PageView
Pagination Pagination
PageCount int
Subcategories []SubcategoryView
// Sidebar data for themes that show sidebar on category pages
Categories []CategoryView
Tags []TagView
RecentPages []PageView
}
CategoryPageData holds data for category archive templates.
type CategoryTranslationInfo ¶
CategoryTranslationInfo holds information about a category translation.
type CategoryTreeNode ¶
type CategoryTreeNode struct {
Category store.Category
Children []CategoryTreeNode
Depth int
UsageCount int64
LanguageCode string
LanguageName string
}
CategoryTreeNode represents a category with its children for tree display.
type CategoryView ¶
type CategoryView struct {
ID int64
Name string
Slug string
Description string
URL string
PageCount int64
}
CategoryView represents a category for template rendering.
type Check ¶
type Check struct {
Status string `json:"status"`
Message string `json:"message,omitempty"`
Latency string `json:"latency,omitempty"`
}
Check represents a single health check result.
type ConfigFormData ¶
type ConfigFormData struct {
Items []ConfigItem // Non-translatable items
TranslatableItems []TranslatableConfigItem // Translatable items with language tabs
Languages []ConfigLanguage // Available languages for translation
Errors map[string]string
HasMultipleLanguages bool
}
ConfigFormData holds data for the config form template.
type ConfigHandler ¶
type ConfigHandler struct {
// contains filtered or unexported fields
}
ConfigHandler handles configuration management routes.
func NewConfigHandler ¶
func NewConfigHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager, cm *cache.Manager) *ConfigHandler
NewConfigHandler creates a new ConfigHandler.
func (*ConfigHandler) List ¶
func (h *ConfigHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/config - displays configuration settings.
func (*ConfigHandler) Update ¶
func (h *ConfigHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/config - updates configuration values.
type ConfigItem ¶
type ConfigItem struct {
Key string
Value string
Type string
Description string
Label string
Translatable bool
}
ConfigItem represents a config item with display metadata.
type ConfigLanguage ¶
ConfigLanguage represents a language option for the config form.
type ConfigTranslationValue ¶
type ConfigTranslationValue struct {
LanguageID int64
LanguageCode string
LanguageName string
Value string
}
ConfigTranslationValue holds a translation value for a specific language.
type ConflictStrategyOption ¶
ConflictStrategyOption represents a conflict strategy for the dropdown.
type CreateWidgetRequest ¶
type CreateWidgetRequest struct {
Theme string `json:"theme"`
Area string `json:"area"`
WidgetType string `json:"widget_type"`
Title string `json:"title"`
Content string `json:"content"`
Settings string `json:"settings"`
}
CreateWidgetRequest represents the JSON request for creating a widget.
type DashboardData ¶
type DashboardData struct {
Stats DashboardStats
RecentSubmissions []RecentSubmission
WebhookHealth []WebhookHealthItem
RecentFailedDeliveries []RecentFailedDelivery
TranslationCoverage []TranslationCoverage
RecentActivity []ActivityItem
}
DashboardData holds all dashboard data including stats and recent items.
type DashboardStats ¶
type DashboardStats struct {
TotalPages int64
PublishedPages int64
DraftPages int64
TotalUsers int64
TotalMedia int64
TotalForms int64
UnreadSubmissions int64
// Webhook stats
TotalWebhooks int64
ActiveWebhooks int64
FailedDeliveries24h int64
// Phase 4 additions
TotalLanguages int64
ActiveLanguages int64
CacheHitRate float64
CacheHits int64
CacheMisses int64
CacheItems int
CacheBackendType string // "memory" or "redis"
}
DashboardStats holds the statistics displayed on the dashboard.
type DocsEndpoint ¶
DocsEndpoint describes a single API/route endpoint.
type DocsEndpointGroup ¶
type DocsEndpointGroup struct {
Name string
Endpoints []DocsEndpoint
}
DocsEndpointGroup groups related endpoints.
type DocsHandler ¶
type DocsHandler struct {
// contains filtered or unexported fields
}
DocsHandler handles the site documentation admin page.
func NewDocsHandler ¶
func NewDocsHandler(renderer *render.Renderer, sm *scs.SessionManager, cfg *config.Config, registry *module.Registry, startTime time.Time, versionInfo *version.Info) *DocsHandler
NewDocsHandler creates a new DocsHandler.
func (*DocsHandler) Guide ¶
func (h *DocsHandler) Guide(w http.ResponseWriter, r *http.Request)
Guide handles GET /admin/docs/{slug} - displays a specific documentation guide.
func (*DocsHandler) Overview ¶
func (h *DocsHandler) Overview(w http.ResponseWriter, r *http.Request)
Overview handles GET /admin/docs - displays the site documentation overview.
type DocsPageData ¶
type DocsPageData struct {
System DocsSystemInfo
Endpoints []DocsEndpointGroup
Guides []DocsGuide
}
DocsPageData holds data for the site docs overview page.
type DocsSystemInfo ¶
type DocsSystemInfo struct {
Version string
GitCommit string
BuildTime string
GoVersion string
Environment string
ServerPort int
DBPath string
ActiveTheme string
CacheType string
EnabledModules int
TotalModules int
Uptime string
}
DocsSystemInfo contains system-level information for display.
type EventWithUser ¶
type EventWithUser struct {
ID int64
Level string
Category string
Message string
Metadata string
Details string // Formatted metadata as readable text
DetailsLong bool // True if details exceed display threshold
IPAddress string
IsOwnIP bool // True if this event's IP matches the current admin's IP
RequestURL string
CreatedAt string
UserName string
UserEmail string
}
EventWithUser represents an event with associated user info.
type EventsHandler ¶
type EventsHandler struct {
// contains filtered or unexported fields
}
EventsHandler handles event log viewing routes.
func NewEventsHandler ¶
func NewEventsHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *EventsHandler
NewEventsHandler creates a new EventsHandler.
func (*EventsHandler) List ¶
func (h *EventsHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/events - displays a paginated list of events.
type ExportFormData ¶
type ExportFormData struct {
PageStatuses []string
}
ExportFormData holds data for the export form template.
type FeaturedImageData ¶
type FeaturedImageData struct {
ID int64
Filename string
Filepath string
Thumbnail string
Mimetype string
}
FeaturedImageData holds featured image data for the template.
type FooterWidget ¶
type FooterWidget struct {
}
FooterWidget represents a widget in the footer area.
type FormFormData ¶
type FormFormData struct {
Form *store.Form
Fields []store.FormField
FieldTypes []string
Errors map[string]string
FormValues map[string]string
IsEdit bool
Language *store.Language // Current form language
AllLanguages []store.Language // All active languages for selection
Translations []FormTranslationInfo // Existing translations
MissingLanguages []store.Language // Languages without translations
}
FormFormData holds data for the form create/edit template.
type FormListItem ¶
FormListItem represents a form with submission counts.
type FormTemplateData ¶ added in v0.4.0
type FormTemplateData struct {
BaseTemplateData
Form store.Form
Fields []store.FormField
Errors map[string]string
Values map[string]string
Success bool
// CSRFToken is intentionally left unassigned so existing HTML theme
// templates that still reference {{.CSRFToken}} render an empty string
// instead of failing with "can't evaluate field CSRFToken". The session
// token must not be populated here — see PR #76.
CSRFToken template.HTML
}
FormTemplateData holds data for form template rendering.
type FormTranslationInfo ¶ added in v0.1.0
FormTranslationInfo holds information about a form translation.
type FormsHandler ¶
type FormsHandler struct {
// contains filtered or unexported fields
}
FormsHandler handles form management routes.
func NewFormsHandler ¶
func NewFormsHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager, hr *module.HookRegistry, tm *theme.Manager, cm *cache.Manager, ms *service.MenuService, fh *FrontendHandler) *FormsHandler
NewFormsHandler creates a new FormsHandler.
func (*FormsHandler) AddField ¶
func (h *FormsHandler) AddField(w http.ResponseWriter, r *http.Request)
AddField handles POST /admin/forms/{id}/fields - adds a form field.
func (*FormsHandler) BulkDeleteSubmissions ¶ added in v0.10.0
func (h *FormsHandler) BulkDeleteSubmissions(w http.ResponseWriter, r *http.Request)
BulkDeleteSubmissions handles POST /admin/forms/{id}/submissions/bulk-delete.
func (*FormsHandler) Create ¶
func (h *FormsHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /admin/forms - creates a new form.
func (*FormsHandler) Delete ¶
func (h *FormsHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /admin/forms/{id} - deletes a form.
func (*FormsHandler) DeleteField ¶
func (h *FormsHandler) DeleteField(w http.ResponseWriter, r *http.Request)
DeleteField handles DELETE /admin/forms/{id}/fields/{fieldId} - deletes a form field.
func (*FormsHandler) DeleteSubmission ¶
func (h *FormsHandler) DeleteSubmission(w http.ResponseWriter, r *http.Request)
DeleteSubmission handles DELETE /admin/forms/{id}/submissions/{subId} - deletes a submission.
func (*FormsHandler) EditForm ¶
func (h *FormsHandler) EditForm(w http.ResponseWriter, r *http.Request)
EditForm handles GET /admin/forms/{id} - displays the form builder.
func (*FormsHandler) ExportSubmissions ¶
func (h *FormsHandler) ExportSubmissions(w http.ResponseWriter, r *http.Request)
ExportSubmissions handles POST /admin/forms/{id}/submissions/export - exports submissions as CSV.
func (*FormsHandler) List ¶
func (h *FormsHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/forms - displays a list of forms.
func (*FormsHandler) NewForm ¶
func (h *FormsHandler) NewForm(w http.ResponseWriter, r *http.Request)
NewForm handles GET /admin/forms/new - displays the new form form.
func (*FormsHandler) ReorderFields ¶
func (h *FormsHandler) ReorderFields(w http.ResponseWriter, r *http.Request)
ReorderFields handles POST /admin/forms/{id}/fields/reorder - reorders form fields.
func (*FormsHandler) SetDispatcher ¶
func (h *FormsHandler) SetDispatcher(d *webhook.Dispatcher)
SetDispatcher sets the webhook dispatcher for event dispatching.
func (*FormsHandler) SetRequireCaptcha ¶ added in v0.9.0
func (h *FormsHandler) SetRequireCaptcha(required bool)
SetRequireCaptcha configures whether captcha is mandatory for all public form submissions.
func (*FormsHandler) SetWebhookFormDataMode ¶ added in v0.9.0
func (h *FormsHandler) SetWebhookFormDataMode(mode string)
SetWebhookFormDataMode configures how form.submitted webhook payload data is emitted. Supported modes: redacted, none, full.
func (*FormsHandler) Show ¶
func (h *FormsHandler) Show(w http.ResponseWriter, r *http.Request)
Show handles GET /forms/{slug} - displays a public form.
func (*FormsHandler) Submissions ¶
func (h *FormsHandler) Submissions(w http.ResponseWriter, r *http.Request)
Submissions handles GET /admin/forms/{id}/submissions - lists form submissions.
func (*FormsHandler) Submit ¶
func (h *FormsHandler) Submit(w http.ResponseWriter, r *http.Request)
Submit handles POST /forms/{slug} - processes form submission.
func (*FormsHandler) TranslateForm ¶ added in v0.1.0
func (h *FormsHandler) TranslateForm(w http.ResponseWriter, r *http.Request)
TranslateForm handles POST /admin/forms/{id}/translate/{langCode} - creates a translation.
func (*FormsHandler) Update ¶
func (h *FormsHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/forms/{id} - updates a form.
func (*FormsHandler) UpdateField ¶
func (h *FormsHandler) UpdateField(w http.ResponseWriter, r *http.Request)
UpdateField handles PUT /admin/forms/{id}/fields/{fieldId} - updates a form field.
func (*FormsHandler) ViewSubmission ¶
func (h *FormsHandler) ViewSubmission(w http.ResponseWriter, r *http.Request)
ViewSubmission handles GET /admin/forms/{id}/submissions/{subId} - views a submission.
type FormsListData ¶
type FormsListData struct {
Forms []FormListItem
}
FormsListData holds data for the forms list template.
type FrontendHandler ¶
type FrontendHandler struct {
// contains filtered or unexported fields
}
func NewFrontendHandler ¶
func NewFrontendHandler(db *sql.DB, themeManager *theme.Manager, cacheManager *cache.Manager, logger *slog.Logger, menuService *service.MenuService, eventService *service.EventService) *FrontendHandler
NewFrontendHandler creates a new FrontendHandler. If menuService is nil, a new one will be created. Pass a shared menuService for cache consistency.
func (*FrontendHandler) APICatalog ¶ added in v0.20.0
func (h *FrontendHandler) APICatalog(w http.ResponseWriter, r *http.Request)
APICatalog serves /.well-known/api-catalog per RFC 9727, advertising the oCMS v2 REST API surface (OpenAPI spec, Swagger UI, health endpoint). Content-Type is application/linkset+json as required by the RFC.
func (*FrontendHandler) AgentSkillsIndex ¶ added in v0.20.0
func (h *FrontendHandler) AgentSkillsIndex(w http.ResponseWriter, r *http.Request)
AgentSkillsIndex serves /.well-known/agent-skills/index.json per the Agent Skills Discovery RFC (v0.2.0). The declared skill references the live OpenAPI document; the sha256 field is currently empty because computing it would require pulling in the huma spec at request time (tracked as a follow-up in docs/agent-ready.md).
func (*FrontendHandler) Blog ¶
func (h *FrontendHandler) Blog(w http.ResponseWriter, r *http.Request)
Blog handles the blog listing page displaying all published posts.
func (*FrontendHandler) Category ¶
func (h *FrontendHandler) Category(w http.ResponseWriter, r *http.Request)
Category handles category archive display.
func (*FrontendHandler) Favicon ¶ added in v0.2.0
func (h *FrontendHandler) Favicon(w http.ResponseWriter, r *http.Request, defaultFavicon []byte)
Favicon serves the favicon from theme settings or falls back to the default. It checks the active theme's "favicon" setting first, then theme's static favicon, and finally falls back to the embedded default favicon.
func (*FrontendHandler) Home ¶
func (h *FrontendHandler) Home(w http.ResponseWriter, r *http.Request)
Home handles the homepage.
func (*FrontendHandler) MCPServerCard ¶ added in v0.20.0
func (h *FrontendHandler) MCPServerCard(w http.ResponseWriter, r *http.Request)
MCPServerCard serves /.well-known/mcp/server-card.json following the draft SEP-1649 schema. No MCP transport is published ("transport": null) — oCMS exposes a REST fallback via capabilities.rest.openapi. When a real MCP transport ships, update seo.BuildMCPServerCard accordingly.
func (*FrontendHandler) NotFound ¶
func (h *FrontendHandler) NotFound(w http.ResponseWriter, r *http.Request)
NotFound renders the 404 page.
func (*FrontendHandler) Page ¶
func (h *FrontendHandler) Page(w http.ResponseWriter, r *http.Request)
Page handles single page display.
func (*FrontendHandler) PageByID ¶
func (h *FrontendHandler) PageByID(w http.ResponseWriter, r *http.Request)
PageByID handles /page/{id} - redirects to the canonical slug URL. This provides a permanent, stable URL that won't break if the page slug changes.
func (*FrontendHandler) Robots ¶
func (h *FrontendHandler) Robots(w http.ResponseWriter, r *http.Request)
Robots generates and serves the robots.txt file.
func (*FrontendHandler) Search ¶
func (h *FrontendHandler) Search(w http.ResponseWriter, r *http.Request)
Search handles search results display using FTS5 full-text search.
func (*FrontendHandler) Security ¶
func (h *FrontendHandler) Security(w http.ResponseWriter, r *http.Request)
Security generates and serves the security.txt file (RFC 9116).
func (*FrontendHandler) SetModuleTemplateFuncsProvider ¶ added in v0.15.0
func (h *FrontendHandler) SetModuleTemplateFuncsProvider(p ModuleTemplateFuncsProvider)
SetModuleTemplateFuncsProvider sets the provider used to fetch module template functions per-request. This ensures toggled modules take effect immediately without server restart.
func (*FrontendHandler) SetOpenAPISpecProvider ¶ added in v0.20.0
func (h *FrontendHandler) SetOpenAPISpecProvider(fn func() ([]byte, error))
SetOpenAPISpecProvider wires in the v2 OpenAPI JSON bytes source used to compute the SHA-256 advertised in /.well-known/agent-skills/index.json. Called from main.go once the v2 docs server is ready.
func (*FrontendHandler) SetSanitizePageHTML ¶ added in v0.9.0
func (h *FrontendHandler) SetSanitizePageHTML(enabled bool)
SetSanitizePageHTML configures optional frontend sanitization of page HTML.
func (*FrontendHandler) Sitemap ¶
func (h *FrontendHandler) Sitemap(w http.ResponseWriter, r *http.Request)
Sitemap generates and serves the sitemap.xml file.
func (*FrontendHandler) Tag ¶
func (h *FrontendHandler) Tag(w http.ResponseWriter, r *http.Request)
Tag handles tag archive display.
type HealthHandler ¶
type HealthHandler struct {
// contains filtered or unexported fields
}
HealthHandler handles health check requests.
func NewHealthHandler ¶
func NewHealthHandler(db *sql.DB, sm *scs.SessionManager, uploadsDir string) *HealthHandler
NewHealthHandler creates a new health handler.
func (*HealthHandler) Health ¶
func (h *HealthHandler) Health(w http.ResponseWriter, r *http.Request)
Health handles GET /health requests. Returns minimal status for unauthenticated callers, full details for authenticated ones.
func (*HealthHandler) Liveness ¶
func (h *HealthHandler) Liveness(w http.ResponseWriter, _ *http.Request)
Liveness handles GET /health/live - simple liveness check.
func (*HealthHandler) Readiness ¶
func (h *HealthHandler) Readiness(w http.ResponseWriter, r *http.Request)
Readiness handles GET /health/ready - checks if the service is ready to accept traffic.
func (*HealthHandler) StartTime ¶
func (h *HealthHandler) StartTime() time.Time
StartTime returns when the handler (and application) was started.
type HealthStatus ¶
type HealthStatus struct {
Status string `json:"status"`
Timestamp time.Time `json:"timestamp"`
Uptime string `json:"uptime"`
Version string `json:"version"`
Checks map[string]Check `json:"checks"`
System *SystemInfo `json:"system,omitempty"`
Security *SecuritySummary `json:"security,omitempty"`
}
HealthStatus represents the overall health status (authenticated callers only).
type HealthStatusPublic ¶
type HealthStatusPublic struct {
Status string `json:"status"`
}
HealthStatusPublic is the minimal health response for unauthenticated callers.
type HomeData ¶
type HomeData struct {
BaseTemplateData
Page *PageView
FeaturedPages []PageView
RecentPages []PageView
Categories []CategoryView
Tags []TagView
RecentPosts []RecentPost // For sidebar widget
HeroEnabled bool
HeroTitle string
HeroSubtitle string
HeroCTA string
HeroCTAURL string
HeroImage string
ShowAllPostsLink bool
}
HomeData holds data for the homepage template.
type HrefLangLink ¶
type HrefLangLink struct {
Lang string // Language code (e.g., "en", "ru", "x-default")
Href string // Full URL
}
HrefLangLink represents an hreflang link for SEO.
type ImportExportHandler ¶
type ImportExportHandler struct {
// contains filtered or unexported fields
}
ImportExportHandler handles import/export routes.
func NewImportExportHandler ¶
func NewImportExportHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *ImportExportHandler
NewImportExportHandler creates a new ImportExportHandler.
func (*ImportExportHandler) Export ¶
func (h *ImportExportHandler) Export(w http.ResponseWriter, r *http.Request)
Export handles POST /admin/export - generates and downloads the export.
func (*ImportExportHandler) ExportForm ¶
func (h *ImportExportHandler) ExportForm(w http.ResponseWriter, r *http.Request)
ExportForm handles GET /admin/export - displays the export form.
func (*ImportExportHandler) Import ¶
func (h *ImportExportHandler) Import(w http.ResponseWriter, r *http.Request)
Import handles POST /admin/import - performs the actual import.
func (*ImportExportHandler) ImportForm ¶
func (h *ImportExportHandler) ImportForm(w http.ResponseWriter, r *http.Request)
ImportForm handles GET /admin/import - displays the import form.
func (*ImportExportHandler) ImportValidate ¶
func (h *ImportExportHandler) ImportValidate(w http.ResponseWriter, r *http.Request)
ImportValidate handles POST /admin/import/validate - validates the uploaded file.
func (*ImportExportHandler) SetBlockSuspiciousMarkup ¶ added in v0.9.0
func (h *ImportExportHandler) SetBlockSuspiciousMarkup(block bool)
SetBlockSuspiciousMarkup configures whether imports should reject page bodies containing suspicious HTML tokens.
type ImportFormData ¶
type ImportFormData struct {
ConflictStrategies []ConflictStrategyOption
ValidationResult *transfer.ValidationResult
ImportResult *transfer.ImportResult
UploadedData *transfer.ExportData
IsZipFile bool // Whether the uploaded file is a zip archive
HasMediaFiles bool // Whether the zip contains media files
}
ImportFormData holds data for the import form template.
type LanguageView ¶
type LanguageView struct {
ID int64
Code string
Name string
NativeName string
Direction string
IsDefault bool
IsCurrent bool
}
LanguageView represents a language for template rendering.
type LanguagesHandler ¶
type LanguagesHandler struct {
// contains filtered or unexported fields
}
LanguagesHandler handles language management in admin.
func NewLanguagesHandler ¶
func NewLanguagesHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *LanguagesHandler
NewLanguagesHandler creates a new LanguagesHandler.
func (*LanguagesHandler) Create ¶
func (h *LanguagesHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles creating a new language.
func (*LanguagesHandler) Delete ¶
func (h *LanguagesHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles deleting a language.
func (*LanguagesHandler) EditForm ¶
func (h *LanguagesHandler) EditForm(w http.ResponseWriter, r *http.Request)
EditForm displays the form to edit an existing language.
func (*LanguagesHandler) List ¶
func (h *LanguagesHandler) List(w http.ResponseWriter, r *http.Request)
List displays all languages.
func (*LanguagesHandler) NewForm ¶
func (h *LanguagesHandler) NewForm(w http.ResponseWriter, r *http.Request)
NewForm displays the form to create a new language.
func (*LanguagesHandler) SetDefault ¶
func (h *LanguagesHandler) SetDefault(w http.ResponseWriter, r *http.Request)
SetDefault handles setting a language as the default.
func (*LanguagesHandler) Update ¶
func (h *LanguagesHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles updating an existing language.
type ListData ¶
type ListData struct {
BaseTemplateData
Pages []PageView
Pagination Pagination
Description string // Optional description for list pages (blog, archives, etc.)
// Sidebar data for themes that show sidebar on list pages
Categories []CategoryView
Tags []TagView
RecentPages []PageView
}
ListData holds data for list templates (blog, archives).
type MediaEditData ¶
type MediaEditData struct {
Media MediaItem
Variants []store.MediaVariant
Folders []store.MediaFolder
Languages []store.Language // All active languages (except default)
Translations map[string]MediaTranslationData // Keyed by language code
Errors map[string]string
FormValues map[string]string
}
MediaEditData holds data for the media edit template.
type MediaHandler ¶
type MediaHandler struct {
// contains filtered or unexported fields
}
MediaHandler handles media library routes.
func NewMediaHandler ¶
func NewMediaHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager, uploadDir string) *MediaHandler
NewMediaHandler creates a new MediaHandler.
func (*MediaHandler) API ¶
func (h *MediaHandler) API(w http.ResponseWriter, r *http.Request)
API handles GET /admin/media/api - returns media items as JSON for the media picker.
func (*MediaHandler) BulkDelete ¶ added in v0.10.0
func (h *MediaHandler) BulkDelete(w http.ResponseWriter, r *http.Request)
BulkDelete handles POST /admin/media/bulk-delete - deletes multiple media items.
func (*MediaHandler) CreateFolder ¶
func (h *MediaHandler) CreateFolder(w http.ResponseWriter, r *http.Request)
CreateFolder handles POST /admin/media/folders - creates a new folder.
func (*MediaHandler) Delete ¶
func (h *MediaHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /admin/media/{id} - deletes media and files.
func (*MediaHandler) DeleteFolder ¶
func (h *MediaHandler) DeleteFolder(w http.ResponseWriter, r *http.Request)
DeleteFolder handles DELETE /admin/media/folders/{id} - deletes a folder.
func (*MediaHandler) EditForm ¶
func (h *MediaHandler) EditForm(w http.ResponseWriter, r *http.Request)
EditForm handles GET /admin/media/{id} - displays the edit form.
func (*MediaHandler) Library ¶
func (h *MediaHandler) Library(w http.ResponseWriter, r *http.Request)
Library handles GET /admin/media - displays the media library.
func (*MediaHandler) MoveMedia ¶
func (h *MediaHandler) MoveMedia(w http.ResponseWriter, r *http.Request)
MoveMedia handles POST /admin/media/{id}/move - moves media to a different folder.
func (*MediaHandler) RegenerateVariants ¶ added in v0.3.0
func (h *MediaHandler) RegenerateVariants(w http.ResponseWriter, r *http.Request)
RegenerateVariants handles POST /admin/media/{id}/regenerate - regenerates image variants.
func (*MediaHandler) SetDispatcher ¶
func (h *MediaHandler) SetDispatcher(d *webhook.Dispatcher)
SetDispatcher sets the webhook dispatcher for event dispatching.
func (*MediaHandler) Update ¶
func (h *MediaHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/media/{id} - updates media metadata.
func (*MediaHandler) UpdateFolder ¶
func (h *MediaHandler) UpdateFolder(w http.ResponseWriter, r *http.Request)
UpdateFolder handles PUT /admin/media/folders/{id} - renames or moves a folder.
func (*MediaHandler) Upload ¶
func (h *MediaHandler) Upload(w http.ResponseWriter, r *http.Request)
Upload handles POST /admin/media/upload - processes file upload.
func (*MediaHandler) UploadForm ¶
func (h *MediaHandler) UploadForm(w http.ResponseWriter, r *http.Request)
UploadForm handles GET /admin/media/upload - displays the upload form.
type MediaItem ¶
type MediaItem struct {
store.Medium
ThumbnailURL string
OriginalURL string
IsImage bool
TypeIcon string
}
MediaItem represents a media item with additional computed fields.
type MediaLibraryData ¶
type MediaLibraryData struct {
Media []MediaItem
Folders []store.MediaFolder
TotalCount int64
Filter string // images, documents, videos, all
FolderID *int64
Search string
Pagination AdminPagination
}
MediaLibraryData holds data for the media library template.
type MediaTranslationData ¶
type MediaTranslationData struct {
LanguageID int64
LanguageCode string
LanguageName string
NativeName string
Alt string
Caption string
}
MediaTranslationData holds translation data for a language.
type MenuItemNode ¶
type MenuItemNode struct {
Item store.MenuItem
Children []MenuItemNode
PageSlug string // If linked to a page
}
MenuItemNode represents a menu item with children for tree display.
func (MenuItemNode) MarshalJSON ¶
func (n MenuItemNode) MarshalJSON() ([]byte, error)
MarshalJSON implements custom JSON marshaling for MenuItemNode.
type MenusHandler ¶
type MenusHandler struct {
// contains filtered or unexported fields
}
MenusHandler handles menu management routes.
func NewMenusHandler ¶
func NewMenusHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *MenusHandler
NewMenusHandler creates a new MenusHandler.
func (*MenusHandler) AddItem ¶
func (h *MenusHandler) AddItem(w http.ResponseWriter, r *http.Request)
AddItem handles POST /admin/menus/{id}/items - adds a menu item.
func (*MenusHandler) Create ¶
func (h *MenusHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /admin/menus - creates a new menu.
func (*MenusHandler) Delete ¶
func (h *MenusHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /admin/menus/{id} - deletes a menu.
func (*MenusHandler) DeleteItem ¶
func (h *MenusHandler) DeleteItem(w http.ResponseWriter, r *http.Request)
DeleteItem handles DELETE /admin/menus/{id}/items/{itemId} - deletes a menu item.
func (*MenusHandler) EditForm ¶
func (h *MenusHandler) EditForm(w http.ResponseWriter, r *http.Request)
EditForm handles GET /admin/menus/{id} - displays the menu builder.
func (*MenusHandler) List ¶
func (h *MenusHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/menus - displays a list of menus.
func (*MenusHandler) NewForm ¶
func (h *MenusHandler) NewForm(w http.ResponseWriter, r *http.Request)
NewForm handles GET /admin/menus/new - displays the new menu form.
func (*MenusHandler) Reorder ¶
func (h *MenusHandler) Reorder(w http.ResponseWriter, r *http.Request)
Reorder handles POST /admin/menus/{id}/reorder - reorders menu items.
func (*MenusHandler) Update ¶
func (h *MenusHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/menus/{id} - updates a menu.
func (*MenusHandler) UpdateItem ¶
func (h *MenusHandler) UpdateItem(w http.ResponseWriter, r *http.Request)
UpdateItem handles PUT /admin/menus/{id}/items/{itemId} - updates a menu item.
type ModuleTemplateFuncsProvider ¶ added in v0.15.0
FrontendHandler handles public frontend routes. ModuleTemplateFuncsProvider returns template functions from active modules. Calling this per-request ensures toggled modules are reflected immediately.
type ModulesHandler ¶
type ModulesHandler struct {
// contains filtered or unexported fields
}
ModulesHandler handles module management routes.
func NewModulesHandler ¶
func NewModulesHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager, registry *module.Registry, hooks *module.HookRegistry) *ModulesHandler
NewModulesHandler creates a new ModulesHandler.
func (*ModulesHandler) List ¶
func (h *ModulesHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/modules - displays registered modules.
func (*ModulesHandler) ToggleActive ¶
func (h *ModulesHandler) ToggleActive(w http.ResponseWriter, r *http.Request)
ToggleActive handles POST /admin/modules/{name}/toggle - toggles module active status.
func (*ModulesHandler) ToggleSidebar ¶
func (h *ModulesHandler) ToggleSidebar(w http.ResponseWriter, r *http.Request)
ToggleSidebar handles POST /admin/modules/{name}/toggle-sidebar - toggles module sidebar visibility.
type ModulesListData ¶
ModulesListData holds data for the modules list template.
type MoveWidgetRequest ¶
type MoveWidgetRequest struct {
Area string `json:"area"`
}
MoveWidgetRequest represents the JSON request for moving a widget to a different area.
type NotFoundData ¶
type NotFoundData struct {
BaseTemplateData
SuggestedPages []PageView
}
NotFoundData holds data for 404 templates.
type PageCategoryNode ¶
PageCategoryNode represents a category with depth for tree display.
type PageData ¶
type PageData struct {
BaseTemplateData
Page *PageView
RelatedPages []PageView
ShowAuthorBox bool
// Sidebar data for themes that show sidebar on single pages
Categories []CategoryView
Tags []TagView
RecentPages []PageView
}
PageData holds data for single page templates.
type PageFormData ¶
type PageFormData struct {
Page *store.Page
Tags []store.Tag
Categories []store.Category // Selected categories for the page
AllCategories []PageCategoryNode // All categories for selection (with tree structure)
FeaturedImage *FeaturedImageData
OgImage *FeaturedImageData
Aliases []store.PageAlias // URL aliases for the page
Statuses []string
PageTypes []string
Errors map[string]string
FormValues map[string]string
IsEdit bool
// Language and translation support
Language *store.Language // Current page language
AllLanguages []store.Language // All active languages for selection
Translations []PageTranslationInfo // Existing translations
MissingLanguages []store.Language // Languages without translations
}
PageFormData holds data for the page form template.
type PageTranslationInfo ¶
PageTranslationInfo holds information about a page translation.
type PageVersionsData ¶
type PageVersionsData struct {
Page store.Page
Versions []store.ListPageVersionsWithUserRow
TotalCount int64
Pagination AdminPagination
}
PageVersionsData holds data for the page versions template.
type PageView ¶
type PageView struct {
ID int64
Title string
Slug string
Body template.HTML
Excerpt string
URL string
Status string
Type string // "page", "post", etc.
PublishedAt *time.Time
PublishedAtFormatted string
CreatedAt time.Time
UpdatedAt time.Time
FeaturedImage string
FeaturedImageSmall string // Small variant for grid views (~400px)
FeaturedImageMedium string // Medium variant for mobile grid views
FeaturedImageLarge string // Large variant for single page views
FeaturedImageOG string // OG variant optimized for social sharing (1200x630)
FeaturedImageOGWidth int
FeaturedImageOGHeight int
FeaturedImageID int64 // Media ID for translation lookup
FeaturedImageAlt string // Alt text (default language)
HideFeaturedImage bool // Show image below title instead of hero banner
VideoURL string // Original video URL
VideoTitle string // Optional video title/caption
VideoEmbedHTML template.HTML // Server-generated safe iframe embed
ReadingTime int // Estimated reading time in minutes
Highlight string // Search result highlight
Author *AuthorView
Category *CategoryView
Categories []CategoryView
Tags []TagView
// Language context for partials
LangCode string
LangPrefix string
// SEO fields
MetaTitle string
MetaDescription string
MetaKeywords string
OGImage string
OGImageWidth int
OGImageHeight int
OGImageType string
NoIndex bool
NoFollow bool
CanonicalURL string
}
PageView represents a page with computed fields for template rendering. SECURITY: Body is rendered as trusted HTML from admin-authored CMS content. Deployments can enable OCMS_SANITIZE_PAGE_HTML to sanitize page HTML before rendering for additional defense in depth.
type PagesHandler ¶
type PagesHandler struct {
// contains filtered or unexported fields
}
PagesHandler handles page management routes.
func NewPagesHandler ¶
func NewPagesHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *PagesHandler
NewPagesHandler creates a new PagesHandler.
func (*PagesHandler) BulkDelete ¶ added in v0.10.0
func (h *PagesHandler) BulkDelete(w http.ResponseWriter, r *http.Request)
BulkDelete handles POST /admin/pages/bulk-delete - deletes multiple pages.
func (*PagesHandler) Create ¶
func (h *PagesHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /admin/pages - creates a new page.
func (*PagesHandler) Delete ¶
func (h *PagesHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /admin/pages/{id} - deletes a page.
func (*PagesHandler) EditForm ¶
func (h *PagesHandler) EditForm(w http.ResponseWriter, r *http.Request)
EditForm handles GET /admin/pages/{id} - displays the edit page form.
func (*PagesHandler) List ¶
func (h *PagesHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/pages - displays a paginated list of pages.
func (*PagesHandler) NewForm ¶
func (h *PagesHandler) NewForm(w http.ResponseWriter, r *http.Request)
NewForm handles GET /admin/pages/new - displays the new page form.
func (*PagesHandler) RestoreVersion ¶
func (h *PagesHandler) RestoreVersion(w http.ResponseWriter, r *http.Request)
RestoreVersion handles POST /admin/pages/{id}/versions/{versionId}/restore - restores a version.
func (*PagesHandler) SetBlockSuspiciousMarkup ¶ added in v0.9.0
func (h *PagesHandler) SetBlockSuspiciousMarkup(block bool)
SetBlockSuspiciousMarkup configures whether page writes should be blocked when suspicious HTML tokens are detected in body content.
func (*PagesHandler) SetCacheManager ¶ added in v0.3.0
func (h *PagesHandler) SetCacheManager(cm *cache.Manager)
SetCacheManager sets the cache manager for cache invalidation.
func (*PagesHandler) SetDispatcher ¶
func (h *PagesHandler) SetDispatcher(d *webhook.Dispatcher)
SetDispatcher sets the webhook dispatcher for event dispatching.
func (*PagesHandler) SetSanitizePageHTML ¶ added in v0.9.0
func (h *PagesHandler) SetSanitizePageHTML(sanitize bool)
SetSanitizePageHTML configures whether page HTML is sanitized before write.
func (*PagesHandler) TogglePublish ¶
func (h *PagesHandler) TogglePublish(w http.ResponseWriter, r *http.Request)
TogglePublish handles POST /admin/pages/{id}/publish - toggles publish status.
func (*PagesHandler) Translate ¶
func (h *PagesHandler) Translate(w http.ResponseWriter, r *http.Request)
Translate handles POST /admin/pages/{id}/translate/{langCode} - creates a translation.
func (*PagesHandler) Update ¶
func (h *PagesHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/pages/{id} - updates an existing page.
func (*PagesHandler) Versions ¶
func (h *PagesHandler) Versions(w http.ResponseWriter, r *http.Request)
Versions handles GET /admin/pages/{id}/versions - displays version history.
type PagesListData ¶
type PagesListData struct {
Pages []store.Page
PageTags map[int64][]store.Tag // Map of page ID to tags
PageCategories map[int64][]store.Category // Map of page ID to categories
PageFeaturedImages map[int64]*FeaturedImageData // Map of page ID to featured image
PageLanguages map[int64]*store.Language // Map of page ID to language
TotalCount int64
StatusFilter string
PageTypeFilter string
CategoryFilter int64
LanguageFilter string // Language code filter
SearchFilter string // Search query filter
AllCategories []PageCategoryNode // For category filter dropdown
AllLanguages []store.Language // All active languages for filter dropdown
Statuses []string
PageTypes []string
Pagination AdminPagination
}
PagesListData holds data for the pages list template.
type Pagination ¶
type Pagination struct {
CurrentPage int
TotalPages int
TotalItems int64
PerPage int
HasPrev bool
HasNext bool
HasFirst bool
HasLast bool
PrevURL string
NextURL string
FirstURL string
LastURL string
Pages []PaginationPage
}
Pagination holds pagination data for templates.
type PaginationPage ¶
PaginationPage represents a single page link in pagination.
type PublicFormData ¶
type PublicFormData struct {
Form store.Form
Fields []store.FormField
Errors map[string]string
Values map[string]string
Success bool
CSRFToken string
SiteName string
}
PublicFormData holds data for the public form template.
type PublicFormField ¶ added in v0.9.0
type PublicFormField struct {
ID int64
Type string
Name string
Label string
Placeholder string
HelpText string
Options []string // parsed from JSON
IsRequired bool
}
PublicFormField holds pre-resolved field data for the templ template.
type PublicFormViewData ¶ added in v0.9.0
type PublicFormViewData struct {
Base BaseTemplateData
FormTitle string
FormSlug string
Description string
SuccessMessage string
Fields []PublicFormField
Errors map[string]string
Values map[string]string
Success bool
CaptchaWidget string // raw HTML from hCaptcha hook
Lang string // language code for i18n
}
PublicFormViewData holds all data needed to render the public form page.
type RecentFailedDelivery ¶
type RecentFailedDelivery struct {
ID int64
WebhookID int64
WebhookName string
Event string
Status string
CreatedAt string
}
RecentFailedDelivery represents a recent failed webhook delivery.
type RecentPost ¶
RecentPost holds minimal data for sidebar recent posts widget.
type RecentSubmission ¶
type RecentSubmission struct {
ID int64
FormID int64
FormName string
FormSlug string
IsRead bool
CreatedAt string
}
RecentSubmission represents a recent form submission for dashboard display.
type RedirectsHandler ¶ added in v0.5.0
type RedirectsHandler struct {
// contains filtered or unexported fields
}
RedirectsHandler handles redirect management routes.
func NewRedirectsHandler ¶ added in v0.5.0
func NewRedirectsHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager, rm *middleware.RedirectsMiddleware) *RedirectsHandler
NewRedirectsHandler creates a new RedirectsHandler.
func (*RedirectsHandler) Create ¶ added in v0.5.0
func (h *RedirectsHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /admin/redirects - creates a new redirect.
func (*RedirectsHandler) Delete ¶ added in v0.5.0
func (h *RedirectsHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /admin/redirects/{id} - deletes a redirect.
func (*RedirectsHandler) EditForm ¶ added in v0.5.0
func (h *RedirectsHandler) EditForm(w http.ResponseWriter, r *http.Request)
EditForm handles GET /admin/redirects/{id} - displays the redirect edit form.
func (*RedirectsHandler) List ¶ added in v0.5.0
func (h *RedirectsHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/redirects - displays a list of redirects.
func (*RedirectsHandler) NewForm ¶ added in v0.5.0
func (h *RedirectsHandler) NewForm(w http.ResponseWriter, r *http.Request)
NewForm handles GET /admin/redirects/new - displays the new redirect form.
func (*RedirectsHandler) Toggle ¶ added in v0.5.0
func (h *RedirectsHandler) Toggle(w http.ResponseWriter, r *http.Request)
Toggle handles POST /admin/redirects/{id}/toggle - toggles a redirect's enabled status.
func (*RedirectsHandler) Update ¶ added in v0.5.0
func (h *RedirectsHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/redirects/{id} - updates a redirect.
type ReorderFieldsRequest ¶
type ReorderFieldsRequest struct {
FieldIDs []int64 `json:"field_ids"`
}
ReorderFieldsRequest represents the JSON request for reordering form fields.
type ReorderItem ¶
type ReorderItem struct {
ID int64 `json:"id"`
ParentID *int64 `json:"parent_id"`
Children []ReorderItem `json:"children"`
}
ReorderItem represents an item in the reorder request.
type ReorderRequest ¶
type ReorderRequest struct {
Items []ReorderItem `json:"items"`
}
ReorderRequest represents the JSON request for reordering menu items.
type ReorderWidgetsRequest ¶
type ReorderWidgetsRequest struct {
Widgets []struct {
ID int64 `json:"id"`
Position int64 `json:"position"`
} `json:"widgets"`
}
ReorderWidgetsRequest represents the JSON request for reordering widgets.
type SchedulerHandler ¶ added in v0.8.0
type SchedulerHandler struct {
// contains filtered or unexported fields
}
SchedulerHandler handles scheduler admin routes.
func NewSchedulerHandler ¶ added in v0.8.0
func NewSchedulerHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager, registry *scheduler.Registry, taskExec *scheduler.TaskExecutor, es *service.EventService) *SchedulerHandler
NewSchedulerHandler creates a new SchedulerHandler.
func (*SchedulerHandler) List ¶ added in v0.8.0
func (h *SchedulerHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/scheduler - displays all scheduled jobs and custom tasks.
func (*SchedulerHandler) ResetSchedule ¶ added in v0.8.0
func (h *SchedulerHandler) ResetSchedule(w http.ResponseWriter, r *http.Request)
ResetSchedule handles POST /admin/scheduler/reset - resets job to default schedule.
func (*SchedulerHandler) TaskCreate ¶ added in v0.8.0
func (h *SchedulerHandler) TaskCreate(w http.ResponseWriter, r *http.Request)
TaskCreate handles POST /admin/scheduler/tasks - creates a new scheduled task.
func (*SchedulerHandler) TaskDelete ¶ added in v0.8.0
func (h *SchedulerHandler) TaskDelete(w http.ResponseWriter, r *http.Request)
TaskDelete handles POST /admin/scheduler/tasks/{id}/delete - deletes a scheduled task.
func (*SchedulerHandler) TaskForm ¶ added in v0.8.0
func (h *SchedulerHandler) TaskForm(w http.ResponseWriter, r *http.Request)
TaskForm handles GET /admin/scheduler/tasks/new and /admin/scheduler/tasks/{id}/edit.
func (*SchedulerHandler) TaskRuns ¶ added in v0.8.0
func (h *SchedulerHandler) TaskRuns(w http.ResponseWriter, r *http.Request)
TaskRuns handles GET /admin/scheduler/tasks/{id}/runs - shows run history.
func (*SchedulerHandler) TaskToggle ¶ added in v0.8.0
func (h *SchedulerHandler) TaskToggle(w http.ResponseWriter, r *http.Request)
TaskToggle handles POST /admin/scheduler/tasks/{id}/toggle - toggles task active state.
func (*SchedulerHandler) TaskTrigger ¶ added in v0.8.0
func (h *SchedulerHandler) TaskTrigger(w http.ResponseWriter, r *http.Request)
TaskTrigger handles POST /admin/scheduler/tasks/{id}/trigger - manually triggers a task.
func (*SchedulerHandler) TaskUpdate ¶ added in v0.8.0
func (h *SchedulerHandler) TaskUpdate(w http.ResponseWriter, r *http.Request)
TaskUpdate handles POST /admin/scheduler/tasks/{id} - updates a scheduled task.
func (*SchedulerHandler) TriggerNow ¶ added in v0.8.0
func (h *SchedulerHandler) TriggerNow(w http.ResponseWriter, r *http.Request)
TriggerNow handles POST /admin/scheduler/trigger/{source}/{name} - manually triggers a job.
func (*SchedulerHandler) UpdateSchedule ¶ added in v0.8.0
func (h *SchedulerHandler) UpdateSchedule(w http.ResponseWriter, r *http.Request)
UpdateSchedule handles POST /admin/scheduler/update - updates job schedule.
type SchedulerJobView ¶ added in v0.8.0
type SchedulerJobView struct {
Source string
Name string
Description string
DefaultSchedule string
Schedule string
IsOverridden bool
LastRun string
NextRun string
CanTrigger bool
}
SchedulerJobView represents a job for the template.
type SchedulerListData ¶ added in v0.8.0
type SchedulerListData struct {
Jobs []SchedulerJobView
Tasks []SchedulerTaskView
}
SchedulerListData holds all data for the scheduler list page.
type SchedulerTaskView ¶ added in v0.8.0
type SchedulerTaskView struct {
ID int64
Name string
URL string
Schedule string
IsActive bool
Timeout int64
LastRun string
}
SchedulerTaskView represents a custom task for the template.
type SearchData ¶
type SearchData struct {
BaseTemplateData
Query string
Pages []PageView
Pagination Pagination
ResultCount int
PopularSearches []string
// Sidebar data for themes that show sidebar on search page
Categories []CategoryView
Tags []TagView
RecentPages []PageView
}
SearchData holds data for search results templates.
type SecuritySummary ¶ added in v0.9.0
type SecuritySummary struct {
WindowHours int `json:"window_hours"`
Status string `json:"status"`
SecurityEvents int64 `json:"security_events"`
WarningEvents int64 `json:"warning_events"`
ErrorEvents int64 `json:"error_events"`
EmbedProxySignals int64 `json:"embed_proxy_signals"`
APIKeyAnomalySignals int64 `json:"api_key_anomaly_signals"`
}
SecuritySummary provides a compact security signal snapshot.
type SiteData ¶
type SiteData struct {
SiteName string
Description string
URL string
DefaultOGImage string
Theme *theme.Config
Settings map[string]string
CurrentYear int
}
SiteData holds site-wide data for templates.
type SlugExistsChecker ¶
SlugExistsChecker is a function that checks if a slug exists (returns count).
type SlugExistsFunc ¶
SlugExistsFunc is a function type for checking if a slug exists. Returns count of matching slugs and any error.
type SocialLink ¶
SocialLink represents a social media link.
type SortConfig ¶ added in v0.10.0
type SortConfig struct {
DefaultDir string
}
SortConfig describes an allowed sortable field.
type StatusCodeOption ¶ added in v0.5.0
StatusCodeOption represents a status code option for the form select.
type SubcategoryView ¶
type SubcategoryView struct {
ID int64
Name string
Slug string
Description string
URL string
Count int64
}
SubcategoryView represents a subcategory with page count for template rendering.
type SubmissionListItem ¶
type SubmissionListItem struct {
Submission store.FormSubmission
Data map[string]interface{}
Preview string
}
SubmissionListItem represents a submission with parsed data for display.
type SubmissionViewData ¶
type SubmissionViewData struct {
Form store.Form
Fields []store.FormField
Submission store.FormSubmission
Data map[string]interface{}
}
SubmissionViewData holds data for viewing a single submission.
type SubmissionsListData ¶
type SubmissionsListData struct {
Form store.Form
Fields []store.FormField
Submissions []SubmissionListItem
TotalCount int64
UnreadCount int64
Pagination AdminPagination
}
SubmissionsListData holds data for the submissions list template.
type SystemInfo ¶
type SystemInfo struct {
GoVersion string `json:"go_version"`
NumGoroutine int `json:"num_goroutines"`
NumCPU int `json:"num_cpus"`
MemAlloc string `json:"mem_alloc"`
MemSys string `json:"mem_sys"`
}
SystemInfo contains system-level information.
type TagFormData ¶
type TagFormData struct {
Tag *store.Tag
Errors map[string]string
FormValues map[string]string
IsEdit bool
Language *store.Language // Current tag language
AllLanguages []store.Language // All active languages for selection
Translations []TagTranslationInfo // Existing translations
MissingLanguages []store.Language // Languages without translations
}
TagFormData holds data for the tag form template.
type TagPageData ¶
type TagPageData struct {
BaseTemplateData
Tag TagView
Pages []PageView
Pagination Pagination
PageCount int
RelatedTags []TagView
// Sidebar data for themes that show sidebar on tag pages
Categories []CategoryView
Tags []TagView
RecentPages []PageView
}
TagPageData holds data for tag archive templates.
type TagTranslationInfo ¶
TagTranslationInfo holds information about a tag translation.
type TagView ¶
type TagView struct {
ID int64
Name string
Slug string
Description string
URL string
PageCount int64
}
TagView represents a tag for template rendering.
type TagsListData ¶
type TagsListData struct {
Tags []store.GetTagUsageCountsRow
TotalCount int64
Pagination AdminPagination
}
TagsListData holds data for the tags list template.
type TaxonomyHandler ¶
type TaxonomyHandler struct {
// contains filtered or unexported fields
}
TaxonomyHandler handles tag and category management routes.
func NewTaxonomyHandler ¶
func NewTaxonomyHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *TaxonomyHandler
NewTaxonomyHandler creates a new TaxonomyHandler.
func (*TaxonomyHandler) BulkDeleteTags ¶ added in v0.10.0
func (h *TaxonomyHandler) BulkDeleteTags(w http.ResponseWriter, r *http.Request)
BulkDeleteTags handles POST /admin/tags/bulk-delete - deletes multiple tags.
func (*TaxonomyHandler) CreateCategory ¶
func (h *TaxonomyHandler) CreateCategory(w http.ResponseWriter, r *http.Request)
CreateCategory handles POST /admin/categories - creates a new category.
func (*TaxonomyHandler) CreateTag ¶
func (h *TaxonomyHandler) CreateTag(w http.ResponseWriter, r *http.Request)
CreateTag handles POST /admin/tags - creates a new tag.
func (*TaxonomyHandler) DeleteCategory ¶
func (h *TaxonomyHandler) DeleteCategory(w http.ResponseWriter, r *http.Request)
DeleteCategory handles DELETE /admin/categories/{id} - deletes a category.
func (*TaxonomyHandler) DeleteTag ¶
func (h *TaxonomyHandler) DeleteTag(w http.ResponseWriter, r *http.Request)
DeleteTag handles DELETE /admin/tags/{id} - deletes a tag.
func (*TaxonomyHandler) EditCategoryForm ¶
func (h *TaxonomyHandler) EditCategoryForm(w http.ResponseWriter, r *http.Request)
EditCategoryForm handles GET /admin/categories/{id} - displays the edit category form.
func (*TaxonomyHandler) EditTagForm ¶
func (h *TaxonomyHandler) EditTagForm(w http.ResponseWriter, r *http.Request)
EditTagForm handles GET /admin/tags/{id} - displays the edit tag form.
func (*TaxonomyHandler) ListCategories ¶
func (h *TaxonomyHandler) ListCategories(w http.ResponseWriter, r *http.Request)
ListCategories handles GET /admin/categories - displays category tree.
func (*TaxonomyHandler) ListTags ¶
func (h *TaxonomyHandler) ListTags(w http.ResponseWriter, r *http.Request)
ListTags handles GET /admin/tags - displays a paginated list of tags.
func (*TaxonomyHandler) NewCategoryForm ¶
func (h *TaxonomyHandler) NewCategoryForm(w http.ResponseWriter, r *http.Request)
NewCategoryForm handles GET /admin/categories/new - displays the new category form.
func (*TaxonomyHandler) NewTagForm ¶
func (h *TaxonomyHandler) NewTagForm(w http.ResponseWriter, r *http.Request)
NewTagForm handles GET /admin/tags/new - displays the new tag form.
func (*TaxonomyHandler) SearchCategories ¶
func (h *TaxonomyHandler) SearchCategories(w http.ResponseWriter, r *http.Request)
SearchCategories handles GET /admin/categories/search - AJAX search.
func (*TaxonomyHandler) SearchTags ¶
func (h *TaxonomyHandler) SearchTags(w http.ResponseWriter, r *http.Request)
SearchTags handles GET /admin/tags/search - AJAX search for autocomplete.
func (*TaxonomyHandler) TranslateCategory ¶
func (h *TaxonomyHandler) TranslateCategory(w http.ResponseWriter, r *http.Request)
TranslateCategory handles POST /admin/categories/{id}/translate/{langCode} - creates a translation.
func (*TaxonomyHandler) TranslateTag ¶
func (h *TaxonomyHandler) TranslateTag(w http.ResponseWriter, r *http.Request)
TranslateTag handles POST /admin/tags/{id}/translate/{langCode} - creates a translation.
func (*TaxonomyHandler) UpdateCategory ¶
func (h *TaxonomyHandler) UpdateCategory(w http.ResponseWriter, r *http.Request)
UpdateCategory handles PUT /admin/categories/{id} - updates an existing category.
func (*TaxonomyHandler) UpdateTag ¶
func (h *TaxonomyHandler) UpdateTag(w http.ResponseWriter, r *http.Request)
UpdateTag handles PUT /admin/tags/{id} - updates an existing tag.
type ThemeListData ¶
ThemeListData holds data for the theme list template.
type ThemeSettingsData ¶
type ThemeSettingsData struct {
Theme theme.Info
Settings map[string]string
Errors map[string]string
}
ThemeSettingsData holds data for the theme settings template.
type ThemesHandler ¶
type ThemesHandler struct {
// contains filtered or unexported fields
}
ThemesHandler handles theme management routes.
func NewThemesHandler ¶
func NewThemesHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager, tm *theme.Manager, cm *cache.Manager) *ThemesHandler
NewThemesHandler creates a new ThemesHandler.
func (*ThemesHandler) Activate ¶
func (h *ThemesHandler) Activate(w http.ResponseWriter, r *http.Request)
Activate handles POST /admin/themes/activate - activates a theme.
func (*ThemesHandler) List ¶
func (h *ThemesHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/themes - displays available themes.
func (*ThemesHandler) SaveSettings ¶
func (h *ThemesHandler) SaveSettings(w http.ResponseWriter, r *http.Request)
SaveSettings handles PUT /admin/themes/{name}/settings - saves theme settings.
func (*ThemesHandler) Settings ¶
func (h *ThemesHandler) Settings(w http.ResponseWriter, r *http.Request)
Settings handles GET /admin/themes/{name}/settings - displays theme settings form.
type ToggleActiveRequest ¶
type ToggleActiveRequest struct {
Active bool `json:"active"`
}
ToggleActiveRequest represents the request body for toggling module active status.
type ToggleActiveResponse ¶
type ToggleActiveResponse struct {
Success bool `json:"success"`
Active bool `json:"active"`
Message string `json:"message,omitempty"`
}
ToggleActiveResponse represents the response for toggling module active status.
type ToggleSidebarRequest ¶
type ToggleSidebarRequest struct {
Show bool `json:"show"`
}
ToggleSidebarRequest represents the request body for toggling module sidebar visibility.
type ToggleSidebarResponse ¶
type ToggleSidebarResponse struct {
Success bool `json:"success"`
Show bool `json:"show"`
Message string `json:"message,omitempty"`
}
ToggleSidebarResponse represents the response for toggling module sidebar visibility.
type TranslatableConfigItem ¶
type TranslatableConfigItem struct {
Key string
Label string
Description string
Type string
Translations []ConfigTranslationValue // Values per language (includes default lang)
}
TranslatableConfigItem holds a translatable config item with its translations per language.
type TranslationCoverage ¶
type TranslationCoverage struct {
LanguageID int64
LanguageCode string
LanguageName string
TotalPages int64
IsDefault bool
}
TranslationCoverage represents translation coverage for a specific language.
type TranslationLink ¶
type TranslationLink struct {
Language LanguageView
URL string // Full URL to the translated page
PageTitle string // Title of the translated page
HasPage bool // Whether a translation exists for this language
}
TranslationLink represents a translation for the language switcher.
type UpdateFieldRequest ¶
type UpdateFieldRequest struct {
Type string `json:"type"`
Name string `json:"name"`
Label string `json:"label"`
Placeholder string `json:"placeholder"`
HelpText string `json:"help_text"`
Options string `json:"options"`
Validation string `json:"validation"`
IsRequired bool `json:"is_required"`
}
UpdateFieldRequest represents the JSON request for updating a form field.
type UpdateItemRequest ¶
type UpdateItemRequest struct {
Title string `json:"title"`
URL string `json:"url"`
Target string `json:"target"`
PageID *int64 `json:"page_id"`
ParentID *int64 `json:"parent_id"`
CSSClass string `json:"css_class"`
IsActive bool `json:"is_active"`
}
UpdateItemRequest represents the JSON request for updating a menu item.
type UpdateWidgetRequest ¶
type UpdateWidgetRequest struct {
WidgetType string `json:"widget_type"`
Title string `json:"title"`
Content string `json:"content"`
Settings string `json:"settings"`
IsActive bool `json:"is_active"`
}
UpdateWidgetRequest represents the JSON request for updating a widget.
type UploadFormData ¶
type UploadFormData struct {
Folders []store.MediaFolder
MaxSize int64
AllowedExt string
}
UploadFormData holds data for the upload form template.
type UsersHandler ¶
type UsersHandler struct {
// contains filtered or unexported fields
}
UsersHandler handles user management routes.
func NewUsersHandler ¶
func NewUsersHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *UsersHandler
NewUsersHandler creates a new UsersHandler.
func (*UsersHandler) BulkDelete ¶ added in v0.10.0
func (h *UsersHandler) BulkDelete(w http.ResponseWriter, r *http.Request)
BulkDelete handles POST /admin/users/bulk-delete - deletes multiple users.
func (*UsersHandler) Create ¶
func (h *UsersHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /admin/users - creates a new user.
func (*UsersHandler) Delete ¶
func (h *UsersHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /admin/users/{id} - deletes a user.
func (*UsersHandler) EditForm ¶
func (h *UsersHandler) EditForm(w http.ResponseWriter, r *http.Request)
EditForm handles GET /admin/users/{id} - displays the edit user form.
func (*UsersHandler) List ¶
func (h *UsersHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/users - displays a paginated list of users.
func (*UsersHandler) NewForm ¶
func (h *UsersHandler) NewForm(w http.ResponseWriter, r *http.Request)
NewForm handles GET /admin/users/new - displays the new user form.
func (*UsersHandler) SetDispatcher ¶
func (h *UsersHandler) SetDispatcher(d *webhook.Dispatcher)
SetDispatcher sets the webhook dispatcher for event dispatching.
func (*UsersHandler) Update ¶
func (h *UsersHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/users/{id} - updates an existing user.
type WebhookDeliveriesData ¶
type WebhookDeliveriesData struct {
Webhook store.Webhook
Deliveries []store.WebhookDelivery
TotalCount int64
Pagination AdminPagination
}
WebhookDeliveriesData holds data for the deliveries template.
type WebhookFormData ¶
type WebhookFormData struct {
Webhook *store.Webhook
Events []model.WebhookEventInfo
Errors map[string]string
FormValues map[string]string
FormEvents []string
FormHeaders map[string]string
IsEdit bool
}
WebhookFormData holds data for the webhook form template.
type WebhookHealthItem ¶
type WebhookHealthItem struct {
ID int64
Name string
IsActive bool
HealthStatus string // "green", "yellow", "red", "unknown"
SuccessRate float64
}
WebhookHealthItem represents a webhook's health for dashboard display.
type WebhookWithStats ¶
type WebhookWithStats struct {
store.Webhook
Events []string
TotalDelivered int64
TotalPending int64
TotalDead int64
SuccessRate float64
HealthStatus string // "green", "yellow", "red", "unknown"
Last24hDelivered int64
Last24hTotal int64
LastSuccessfulAt *time.Time // nil if never delivered
LastSuccessfulEvent string // event type of last successful delivery
}
WebhookWithStats includes webhook data and delivery stats.
type WebhooksHandler ¶
type WebhooksHandler struct {
// contains filtered or unexported fields
}
WebhooksHandler handles webhook management routes.
func NewWebhooksHandler ¶
func NewWebhooksHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager) *WebhooksHandler
NewWebhooksHandler creates a new WebhooksHandler.
func (*WebhooksHandler) Create ¶
func (h *WebhooksHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /admin/webhooks - creates a new webhook.
func (*WebhooksHandler) Delete ¶
func (h *WebhooksHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /admin/webhooks/{id} - deletes a webhook.
func (*WebhooksHandler) Deliveries ¶
func (h *WebhooksHandler) Deliveries(w http.ResponseWriter, r *http.Request)
Deliveries handles GET /admin/webhooks/{id}/deliveries - displays delivery history.
func (*WebhooksHandler) EditForm ¶
func (h *WebhooksHandler) EditForm(w http.ResponseWriter, r *http.Request)
EditForm handles GET /admin/webhooks/{id} - displays the edit webhook form.
func (*WebhooksHandler) List ¶
func (h *WebhooksHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/webhooks - displays all webhooks.
func (*WebhooksHandler) NewForm ¶
func (h *WebhooksHandler) NewForm(w http.ResponseWriter, r *http.Request)
NewForm handles GET /admin/webhooks/new - displays the new webhook form.
func (*WebhooksHandler) RetryDelivery ¶
func (h *WebhooksHandler) RetryDelivery(w http.ResponseWriter, r *http.Request)
RetryDelivery handles POST /admin/webhooks/{id}/deliveries/{did}/retry - retries a delivery.
func (*WebhooksHandler) Test ¶
func (h *WebhooksHandler) Test(w http.ResponseWriter, r *http.Request)
Test handles POST /admin/webhooks/{id}/test - sends a test event.
func (*WebhooksHandler) Update ¶
func (h *WebhooksHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/webhooks/{id} - updates an existing webhook.
type WebhooksListData ¶
type WebhooksListData struct {
Webhooks []WebhookWithStats
TotalWebhooks int64
}
WebhooksListData holds data for the webhooks list template.
type WidgetAreaWithWidgets ¶
type WidgetAreaWithWidgets struct {
Area theme.WidgetArea
Widgets []store.Widget
}
WidgetAreaWithWidgets represents a widget area with its widgets.
type WidgetsHandler ¶
type WidgetsHandler struct {
// contains filtered or unexported fields
}
WidgetsHandler handles widget management routes.
func NewWidgetsHandler ¶
func NewWidgetsHandler(db *sql.DB, renderer *render.Renderer, sm *scs.SessionManager, tm *theme.Manager) *WidgetsHandler
NewWidgetsHandler creates a new WidgetsHandler.
func (*WidgetsHandler) Create ¶
func (h *WidgetsHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /admin/widgets - creates a new widget.
func (*WidgetsHandler) Delete ¶
func (h *WidgetsHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /admin/widgets/{id} - deletes a widget.
func (*WidgetsHandler) GetWidget ¶
func (h *WidgetsHandler) GetWidget(w http.ResponseWriter, r *http.Request)
GetWidget handles GET /admin/widgets/{id} - gets a widget by ID.
func (*WidgetsHandler) List ¶
func (h *WidgetsHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /admin/widgets - displays widget management page.
func (*WidgetsHandler) MoveWidget ¶
func (h *WidgetsHandler) MoveWidget(w http.ResponseWriter, r *http.Request)
MoveWidget handles POST /admin/widgets/{id}/move - moves a widget to a different area.
func (*WidgetsHandler) Reorder ¶
func (h *WidgetsHandler) Reorder(w http.ResponseWriter, r *http.Request)
Reorder handles POST /admin/widgets/reorder - reorders widgets.
func (*WidgetsHandler) Update ¶
func (h *WidgetsHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PUT /admin/widgets/{id} - updates a widget.
type WidgetsListData ¶
type WidgetsListData struct {
Theme *theme.Theme
WidgetAreas []WidgetAreaWithWidgets
WidgetTypes []struct {
ID string
Name string
Description string
}
AllThemes []theme.Info
}
WidgetsListData holds data for the widgets list template.
Source Files
¶
- admin.go
- api_keys.go
- auth.go
- bulk.go
- cache.go
- config.go
- constants.go
- demo.go
- docs.go
- events.go
- forms.go
- forms_public_templ.go
- frontend.go
- frontend_error_templ.go
- frontend_layout_templ.go
- frontend_pages_templ.go
- handler_test_helper.go
- health.go
- helpers.go
- importexport.go
- json.go
- languages.go
- media.go
- menus.go
- modules.go
- pages.go
- pagination.go
- redirects.go
- response.go
- scheduler.go
- sort.go
- taxonomy.go
- templ.go
- themes.go
- users.go
- validation.go
- webhooks.go
- widgets.go