mirror of
https://github.com/luckjiawei/podux.git
synced 2026-11-30 00:56:47 +00:00
30 lines
651 B
Go
30 lines
651 B
Go
package httphandler
|
|
|
|
import (
|
|
"podux/internal/application/github"
|
|
|
|
"github.com/pocketbase/pocketbase/core"
|
|
)
|
|
|
|
type GithubHandler struct {
|
|
app core.App
|
|
service *github.Service
|
|
}
|
|
|
|
func NewGithubHandler(app core.App, service *github.Service) *GithubHandler {
|
|
return &GithubHandler{
|
|
app: app,
|
|
service: service,
|
|
}
|
|
}
|
|
|
|
func (h *GithubHandler) RegisterHandlers(e *core.ServeEvent) {
|
|
e.Router.GET("/api/github/frp/releases", requireAuth(func(e *core.RequestEvent) error {
|
|
releases, err := h.service.GetFrpReleases()
|
|
if err != nil {
|
|
return e.JSON(500, map[string]string{"error": err.Error()})
|
|
}
|
|
return e.JSON(200, releases)
|
|
}))
|
|
}
|