Move versions/filelocker into dedicated subpackages, and consistent headers in http requests (#888)

- move filelocker logic into dedicated subpackage
- consistent useragent in requests

Reviewed-on: https://gitea.com/gitea/tea/pulls/888
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-committed-by: techknowlogick <techknowlogick@gitea.com>
This commit is contained in:
techknowlogick
2026-02-05 18:05:43 +00:00
committed by techknowlogick
parent 982adb4d02
commit 49a9032d8a
15 changed files with 277 additions and 127 deletions

View File

@@ -18,6 +18,7 @@ import (
"time"
"code.gitea.io/tea/modules/config"
"code.gitea.io/tea/modules/httputil"
"code.gitea.io/tea/modules/task"
"code.gitea.io/tea/modules/utils"
@@ -196,15 +197,11 @@ func performBrowserOAuthFlow(opts OAuthOptions) (serverURL string, token *oauth2
// createHTTPClient creates an HTTP client with optional insecure setting
func createHTTPClient(insecure bool) *http.Client {
client := &http.Client{}
if insecure {
client = &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
},
}
return &http.Client{
Transport: httputil.WrapTransport(&http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: insecure},
}),
}
return client
}
// generateCodeVerifier creates a cryptographically random string for PKCE