linstrom/web/public/api/api.go
mstar 627926460c
All checks were successful
/ docker (push) Successful in 4m14s
Auth fetch verification (cavage) works now
- Verifying inbound requests signed with Cavage are now checked as
  expected
- Fixed a bug where the signature header is not generated correctly
- Extended config to include settings for what requests to verify
- Fixed new server in main not using internal port from config
2025-04-22 15:27:24 +02:00

33 lines
753 B
Go

package api
import (
"fmt"
"net/http"
webutils "git.mstar.dev/mstar/goutils/http"
"git.mstar.dev/mstar/linstrom/config"
"git.mstar.dev/mstar/linstrom/web/public/api/activitypub"
webmiddleware "git.mstar.dev/mstar/linstrom/web/public/middleware"
)
func BuildApiRouter() http.Handler {
router := http.NewServeMux()
router.Handle(
"/activitypub/",
http.StripPrefix(
"/activitypub",
webutils.ChainMiddlewares(
activitypub.BuildActivitypubRouter(),
webmiddleware.BuildAuthorizedFetchCheck(
config.GlobalConfig.Admin.AuthFetchForNonGet,
config.GlobalConfig.Admin.AuthFetchForGet,
),
),
),
)
router.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "in api")
})
return router
}