Allow gitea_status_proxy to properly proxy statuses #88
Reference in New Issue
Block a user
Delete Branch "szarate/gitea_status_proxy"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In its current state, the
gitea_status_proxyis not able to forward requests it gets from authorized users, this PR fixes that by changing theAuthorizationandContentHeaders to what gitea expects.I'm also adding a quick readme file, with an usage example.
A result of setting the statuses can be seen at szarate/test-actions-gitea#1
Just some nit-picks, otherwise looks good, thanks!
@@ -19,3 +17,1 @@State string `json:"state"`TargetUrl string `json:"target_url"`}// type Status struct {I think we can remove this commented out stuct.
@@ -83,6 +89,7 @@ func StatusProxy(w http.ResponseWriter, r *http.Request) {token := token_arr[1]if !slices.Contains(config.Keys, token) {common.LogError("Provided token is not known")These pre-auth errors should probably use Debug() logging level instead of Error(). If someone spams this endpoint with garbage, it could generate a lot of useless logs here.
@@ -114,0 +117,4 @@// Context: statusinput.Context,// State: statusinput.State,// TargetUrl: statusinput.TargetUrl,// }this comment too can be removed
@@ -0,0 +11,4 @@```{"forge_url": "https://src.opensuse.org/api/v1","keys": ["some-application-key"]We should add that keys should be random and generated like
openssl rand -base64 48And the build section can probably be removed, as it's just
go buildUpdated the readme to reflect that
All comments have been addressed