1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-11 17:50:58 +00:00

fix: external url and mac function matching

This commit is contained in:
Kwonunn 2025-01-26 15:56:55 +01:00 committed by Kwonunn
parent 57a2a56e32
commit 43f1298653
2 changed files with 3 additions and 1 deletions

View file

@ -45,7 +45,9 @@ func validateAge(ts string) bool {
func computeMac(secret, repo, run, ts string) string {
mac := hmac.New(sha256.New, []byte(secret))
mac.Write([]byte(repo))
mac.Write([]byte(">"))
mac.Write([]byte(run))
mac.Write([]byte(">"))
mac.Write([]byte(ts))
return hex.EncodeToString(mac.Sum(nil))
}

View file

@ -166,7 +166,7 @@ func (h *Handler) newReverseProxy(targetHost string) (*httputil.ReverseProxy, er
func (h *Handler) ExternalURL() string {
// TODO: make the external url configurable if necessary
return net.JoinHostPort(h.outboundIP, strconv.Itoa(h.listener.Addr().(*net.TCPAddr).Port))
return fmt.Sprintf("http://%s", net.JoinHostPort(h.outboundIP, strconv.Itoa(h.listener.Addr().(*net.TCPAddr).Port)))
}
// Informs the proxy of a workflow run that can make cache requests.