Prefix api with '/api/v1'

This commit is contained in:
Melon 2025-03-25 00:09:53 +00:00
parent 850299d927
commit e227284177
Signed by: melon
GPG Key ID: 6C9D970C50D26A25

View File

@ -39,7 +39,7 @@ func New(upload *upload.Handler, keyStore *mjwt.KeyStore, db apiDB) *httprouter.
}) })
// Site creation endpoint // Site creation endpoint
router.PUT("/sites/:host", checkAuth(keyStore, func(rw http.ResponseWriter, req *http.Request, params httprouter.Params, b AuthClaims) { router.PUT("/api/v1/sites/:host", checkAuth(keyStore, func(rw http.ResponseWriter, req *http.Request, params httprouter.Params, b AuthClaims) {
host := params.ByName("host") host := params.ByName("host")
if !validation.IsValidSite(host) { if !validation.IsValidSite(host) {
@ -74,7 +74,7 @@ func New(upload *upload.Handler, keyStore *mjwt.KeyStore, db apiDB) *httprouter.
})) }))
// Reset site token endpoint // Reset site token endpoint
router.POST("/sites/:host/reset-token", checkAuth(keyStore, func(rw http.ResponseWriter, req *http.Request, params httprouter.Params, b AuthClaims) { router.POST("/api/v1/sites/:host/reset-token", checkAuth(keyStore, func(rw http.ResponseWriter, req *http.Request, params httprouter.Params, b AuthClaims) {
host := params.ByName("host") host := params.ByName("host")
if !validation.IsValidSite(host) { if !validation.IsValidSite(host) {
@ -109,10 +109,10 @@ func New(upload *upload.Handler, keyStore *mjwt.KeyStore, db apiDB) *httprouter.
})) }))
// Enable/disable site branch // Enable/disable site branch
router.PUT("/sites/:host/:branch/enable", checkAuth(keyStore, func(rw http.ResponseWriter, req *http.Request, params httprouter.Params, b AuthClaims) { router.PUT("/api/v1/sites/:host/:branch/enable", checkAuth(keyStore, func(rw http.ResponseWriter, req *http.Request, params httprouter.Params, b AuthClaims) {
setEnabled(rw, req, params, b, db, true) setEnabled(rw, req, params, b, db, true)
})) }))
router.DELETE("/sites/:host/:branch/enable", checkAuth(keyStore, func(rw http.ResponseWriter, req *http.Request, params httprouter.Params, b AuthClaims) { router.DELETE("/api/v1/sites/:host/:branch/enable", checkAuth(keyStore, func(rw http.ResponseWriter, req *http.Request, params httprouter.Params, b AuthClaims) {
setEnabled(rw, req, params, b, db, false) setEnabled(rw, req, params, b, db, false)
})) }))