handler

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TemplateFuncMap

func TemplateFuncMap() template.FuncMap

TemplateFuncMap returns the template function map used by the web handler.

Types

type AdminHandler

type AdminHandler struct {
	// contains filtered or unexported fields
}

func NewAdminHandler

func NewAdminHandler(userRepo *repository.UserRepo) *AdminHandler

func (*AdminHandler) BanUser

func (h *AdminHandler) BanUser(c *gin.Context)

BanUser handles POST /api/v1/users/ban

func (*AdminHandler) CreateUser

func (h *AdminHandler) CreateUser(c *gin.Context)

CreateUser handles POST /api/v1/users (admin)

func (*AdminHandler) ListUsers

func (h *AdminHandler) ListUsers(c *gin.Context)

ListUsers handles GET /api/v1/users

func (*AdminHandler) SetRole

func (h *AdminHandler) SetRole(c *gin.Context)

SetRole handles POST /api/v1/users/role

type AuthHandler

type AuthHandler struct {
	// contains filtered or unexported fields
}

func NewAuthHandler

func NewAuthHandler(authSvc *auth.Service, userRepo *repository.UserRepo) *AuthHandler

func (*AuthHandler) CreateToken

func (h *AuthHandler) CreateToken(c *gin.Context)

CreateToken handles POST /api/v1/tokens

func (*AuthHandler) WhoAmI

func (h *AuthHandler) WhoAmI(c *gin.Context)

WhoAmI handles GET /api/v1/whoami

type DownloadHandler

type DownloadHandler struct {
	// contains filtered or unexported fields
}

func NewDownloadHandler

func NewDownloadHandler(svc *service.SkillService) *DownloadHandler

func (*DownloadHandler) Download

func (h *DownloadHandler) Download(c *gin.Context)

Download handles GET /api/v1/download

func (*DownloadHandler) Resolve

func (h *DownloadHandler) Resolve(c *gin.Context)

Resolve handles GET /api/v1/resolve

type SearchHandler

type SearchHandler struct {
	// contains filtered or unexported fields
}

func NewSearchHandler

func NewSearchHandler(sc *search.Client) *SearchHandler

func (*SearchHandler) Search

func (h *SearchHandler) Search(c *gin.Context)

Search handles GET /api/v1/search

type SkillHandler

type SkillHandler struct {
	// contains filtered or unexported fields
}

func NewSkillHandler

func NewSkillHandler(svc *service.SkillService) *SkillHandler

func (*SkillHandler) Delete

func (h *SkillHandler) Delete(c *gin.Context)

Delete handles DELETE /api/v1/skills/:slug

func (*SkillHandler) Get

func (h *SkillHandler) Get(c *gin.Context)

Get handles GET /api/v1/skills/:slug

func (*SkillHandler) GetFile

func (h *SkillHandler) GetFile(c *gin.Context)

GetFile handles GET /api/v1/skills/:slug/file

func (*SkillHandler) List

func (h *SkillHandler) List(c *gin.Context)

List handles GET /api/v1/skills

func (*SkillHandler) Publish

func (h *SkillHandler) Publish(c *gin.Context)

Publish handles POST /api/v1/skills

func (*SkillHandler) Undelete

func (h *SkillHandler) Undelete(c *gin.Context)

Undelete handles POST /api/v1/skills/:slug/undelete

func (*SkillHandler) Version

func (h *SkillHandler) Version(c *gin.Context)

Version handles GET /api/v1/skills/:slug/versions/:version

func (*SkillHandler) Versions

func (h *SkillHandler) Versions(c *gin.Context)

Versions handles GET /api/v1/skills/:slug/versions

type StarHandler

type StarHandler struct {
	// contains filtered or unexported fields
}

func NewStarHandler

func NewStarHandler(svc *service.SkillService) *StarHandler

func (*StarHandler) Star

func (h *StarHandler) Star(c *gin.Context)

Star handles POST /api/v1/stars/:slug

func (*StarHandler) Unstar

func (h *StarHandler) Unstar(c *gin.Context)

Unstar handles DELETE /api/v1/stars/:slug

type WebAuthHandler

type WebAuthHandler struct {
	// contains filtered or unexported fields
}

WebAuthHandler handles login/logout for the SPA frontend. These remain server-side to manage httpOnly session cookies.

func NewWebAuthHandler

func NewWebAuthHandler(authSvc *auth.Service) *WebAuthHandler

func (*WebAuthHandler) LoginSubmit

func (h *WebAuthHandler) LoginSubmit(c *gin.Context)

LoginSubmit handles POST /login — validates credentials and sets session cookie.

func (*WebAuthHandler) Logout

func (h *WebAuthHandler) Logout(c *gin.Context)

Logout clears the session cookie.

type WebHandler

type WebHandler struct {
	// contains filtered or unexported fields
}

func NewWebHandler

func NewWebHandler(svc WebSkillService, searchCli WebSearchService, authSvc *auth.Service, templateDir string, baseURL string) *WebHandler

func NewWebHandlerWithTemplate

func NewWebHandlerWithTemplate(svc WebSkillService, searchCli WebSearchService, templates map[string]*template.Template) *WebHandler

NewWebHandlerWithTemplate creates a WebHandler with pre-parsed templates (for testing).

func (*WebHandler) Index

func (h *WebHandler) Index(c *gin.Context)

Index renders the homepage with popular skills.

func (*WebHandler) LoginPage

func (h *WebHandler) LoginPage(c *gin.Context)

LoginPage renders the login form (GET /login).

func (*WebHandler) LoginSubmit

func (h *WebHandler) LoginSubmit(c *gin.Context)

LoginSubmit handles the login form submission (POST /login).

func (*WebHandler) Logout

func (h *WebHandler) Logout(c *gin.Context)

Logout clears the session cookie (POST /logout).

func (*WebHandler) Publish

func (h *WebHandler) Publish(c *gin.Context)

Publish renders the publish guide page.

func (*WebHandler) Search

func (h *WebHandler) Search(c *gin.Context)

Search renders the search page with results.

func (*WebHandler) SkillDetail

func (h *WebHandler) SkillDetail(c *gin.Context)

SkillDetail renders the detail page for a single skill.

func (*WebHandler) Skills

func (h *WebHandler) Skills(c *gin.Context)

Skills renders the paginated skills list.

type WebSearchService

type WebSearchService interface {
	Search(ctx context.Context, query string, limit, offset int, sort []string, filters string) (*search.SearchResult, error)
}

WebSearchService defines the search operations needed by the web UI.

type WebSkillService

type WebSkillService interface {
	ListSkills(ctx context.Context, limit int, cursor, sort string) ([]model.SkillWithOwner, string, error)
	GetSkill(ctx context.Context, slug string) (*model.SkillWithOwner, error)
	GetVersions(ctx context.Context, slug string) ([]model.SkillVersion, error)
	GetFile(ctx context.Context, slug, version, path string) ([]byte, error)
}

WebSkillService defines the skill operations needed by the web UI.

type WebhookHandler

type WebhookHandler struct {
	// contains filtered or unexported fields
}

func NewWebhookHandler

func NewWebhookHandler(importSvc *gitstore.ImportService) *WebhookHandler

func (*WebhookHandler) GitHubWebhook

func (h *WebhookHandler) GitHubWebhook(c *gin.Context)

GitHubWebhook handles POST /api/v1/webhooks/github

func (*WebhookHandler) GitLabWebhook

func (h *WebhookHandler) GitLabWebhook(c *gin.Context)

GitLabWebhook handles POST /api/v1/webhooks/gitlab

func (*WebhookHandler) GiteaWebhook

func (h *WebhookHandler) GiteaWebhook(c *gin.Context)

GiteaWebhook handles POST /api/v1/webhooks/gitea

type WellKnownHandler

type WellKnownHandler struct {
	// contains filtered or unexported fields
}

func NewWellKnownHandler

func NewWellKnownHandler(cfg *config.Config) *WellKnownHandler

func (*WellKnownHandler) ClawHubJSON

func (h *WellKnownHandler) ClawHubJSON(c *gin.Context)

ClawHubJSON handles GET /.well-known/clawhub.json

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL