Support the old upload format for compatibility

This commit is contained in:
Melon 2025-01-08 20:07:10 +00:00
parent d3c52c3d35
commit e778f6c855
Signed by: melon
GPG Key ID: 6C9D970C50D26A25

View File

@ -26,6 +26,13 @@ func New(upload *upload.Handler, keyStore *mjwt.KeyStore, db apiDB) *httprouter.
// Site upload endpoint
router.POST("/u/:site/:branch", upload.Handle)
router.POST("/u", func(rw http.ResponseWriter, req *http.Request, _ httprouter.Params) {
q := req.URL.Query()
upload.Handle(rw, req, httprouter.Params{
{"site", q.Get("site")},
{"branch", q.Get("branch")},
})
})
// Site creation endpoint
router.PUT("/sites/:host", checkAuth(keyStore, func(rw http.ResponseWriter, req *http.Request, params httprouter.Params, b AuthClaims) {