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
|
// append the repo owner / name to the hook url since gitlab
|
||||||
// doesn't send this detail in the post-commit hook
|
// 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
|
// add the hook
|
||||||
return client.AddProjectHook(path, link, true, false, true)
|
return client.AddProjectHook(path, link, true, false, true)
|
||||||
|
|
|
@ -25,7 +25,7 @@ import (
|
||||||
func PostHook(c web.C, w http.ResponseWriter, r *http.Request) {
|
func PostHook(c web.C, w http.ResponseWriter, r *http.Request) {
|
||||||
var ctx = context.FromC(c)
|
var ctx = context.FromC(c)
|
||||||
var host = c.URLParams["host"]
|
var host = c.URLParams["host"]
|
||||||
var token = r.FormValue("token")
|
var token = c.URLParams["token"]
|
||||||
var remote = remote.Lookup(host)
|
var remote = remote.Lookup(host)
|
||||||
if remote == nil {
|
if remote == nil {
|
||||||
w.WriteHeader(http.StatusNotFound)
|
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
|
// setup the post-commit hook with the remote system and
|
||||||
// if necessary, register the public key
|
// 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 {
|
if err := remote.Activate(user, repo, hook); err != nil {
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
|
|
|
@ -15,9 +15,17 @@ func New() *web.Mux {
|
||||||
mux.Post("/api/auth/:host", handler.GetLogin)
|
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/status.svg", handler.GetBadge)
|
||||||
mux.Get("/api/badge/:host/:owner/:name/cc.xml", handler.GetCC)
|
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.Get("/api/hook/:host", handler.PostHook)
|
||||||
mux.Put("/api/hook/:host", handler.PostHook)
|
mux.Put("/api/hook/:host", handler.PostHook)
|
||||||
mux.Post("/api/hook/:host", handler.PostHook)
|
mux.Post("/api/hook/:host", handler.PostHook)
|
||||||
|
////
|
||||||
|
|
||||||
streams := web.New()
|
streams := web.New()
|
||||||
streams.Get("/api/stream/stdout/:id", handler.WsConsole)
|
streams.Get("/api/stream/stdout/:id", handler.WsConsole)
|
||||||
|
|
Loading…
Reference in a new issue