mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
slightly altered the URL token format
This commit is contained in:
parent
f6cbb7244b
commit
601e3e6d48
4 changed files with 11 additions and 3 deletions
|
@ -135,7 +135,7 @@ func (r *Gitlab) Activate(user *model.User, repo *model.Repo, link string) error
|
|||
|
||||
// append the repo owner / name to the hook url since gitlab
|
||||
// doesn't send this detail in the post-commit hook
|
||||
link += "&owner=" + repo.Owner + "&name=" + repo.Name
|
||||
link += "?owner=" + repo.Owner + "&name=" + repo.Name
|
||||
|
||||
// add the hook
|
||||
return client.AddProjectHook(path, link, true, false, true)
|
||||
|
|
|
@ -25,7 +25,7 @@ import (
|
|||
func PostHook(c web.C, w http.ResponseWriter, r *http.Request) {
|
||||
var ctx = context.FromC(c)
|
||||
var host = c.URLParams["host"]
|
||||
var token = r.FormValue("token")
|
||||
var token = c.URLParams["token"]
|
||||
var remote = remote.Lookup(host)
|
||||
if remote == nil {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
|
|
|
@ -99,7 +99,7 @@ func PostRepo(c web.C, w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
// setup the post-commit hook with the remote system and
|
||||
// if necessary, register the public key
|
||||
var hook = fmt.Sprintf("%s/api/hook/%s?token=%s", httputil.GetURL(r), repo.Remote, repo.Token)
|
||||
var hook = fmt.Sprintf("%s/api/hook/%s/%s", httputil.GetURL(r), repo.Remote, repo.Token)
|
||||
if err := remote.Activate(user, repo, hook); err != nil {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
return
|
||||
|
|
|
@ -15,9 +15,17 @@ func New() *web.Mux {
|
|||
mux.Post("/api/auth/:host", handler.GetLogin)
|
||||
mux.Get("/api/badge/:host/:owner/:name/status.svg", handler.GetBadge)
|
||||
mux.Get("/api/badge/:host/:owner/:name/cc.xml", handler.GetCC)
|
||||
mux.Get("/api/hook/:host/:token", handler.PostHook)
|
||||
mux.Put("/api/hook/:host/:token", handler.PostHook)
|
||||
mux.Post("/api/hook/:host/:token", handler.PostHook)
|
||||
|
||||
// these routes are here for backward compatibility
|
||||
// to help people troubleshoot why their upgrade isn't
|
||||
// working correctly. remove at some point
|
||||
mux.Get("/api/hook/:host", handler.PostHook)
|
||||
mux.Put("/api/hook/:host", handler.PostHook)
|
||||
mux.Post("/api/hook/:host", handler.PostHook)
|
||||
////
|
||||
|
||||
streams := web.New()
|
||||
streams.Get("/api/stream/stdout/:id", handler.WsConsole)
|
||||
|
|
Loading…
Reference in a new issue