fix(ci): install dotnet without admin access and preserve public release links
Gitea CI / Check code and tests (pull_request) Successful in 6m21s
Gitea CI / Build Android APK (pull_request) Successful in 4m1s
Gitea CI / Build Windows x64 app (pull_request) Successful in 10m7s
Gitea CI / Assemble and validate CI artifacts (pull_request) Successful in 1m54s
Gitea CI / Gitea CI passed (pull_request) Successful in 2s
Gitea CI / Audit and package Windows x64 (pull_request) Successful in 1m58s
Gitea CI / Check code and tests (pull_request) Successful in 6m21s
Gitea CI / Build Android APK (pull_request) Successful in 4m1s
Gitea CI / Build Windows x64 app (pull_request) Successful in 10m7s
Gitea CI / Assemble and validate CI artifacts (pull_request) Successful in 1m54s
Gitea CI / Gitea CI passed (pull_request) Successful in 2s
Gitea CI / Audit and package Windows x64 (pull_request) Successful in 1m58s
This commit is contained in:
1 parent
8e523f0e89
commit
44cb452350
4 files changed
+22
-3
No files matched your search
@@ -53,12 +53,16 @@ def retry_read(operation):
|
||||
|
||||
|
||||
def request(url, data=None, method=None, content_type='application/json'):
|
||||
endpoint = transport_url(url)
|
||||
headers = {'Authorization': 'token ' + os.environ['GITEA_TOKEN']}
|
||||
if endpoint != url:
|
||||
# Gitea constructs response links from Host, even when reached locally.
|
||||
headers['Host'] = 'git.orangraph.com'
|
||||
if data is not None:
|
||||
headers['Content-Type'] = content_type
|
||||
if isinstance(data, dict):
|
||||
data = json.dumps(data).encode()
|
||||
req = urllib.request.Request(transport_url(url), data=data, headers=headers, method=method)
|
||||
req = urllib.request.Request(endpoint, data=data, headers=headers, method=method)
|
||||
with urllib.request.urlopen(req, timeout=300) as response:
|
||||
body = response.read()
|
||||
return json.loads(body) if body and 'application/json' in response.headers.get('Content-Type', '') else body
|
||||
@@ -74,8 +78,12 @@ def attachment_url(asset):
|
||||
def fingerprint(asset):
|
||||
"""Hash one remote attachment in chunks, keeping memory usage bounded."""
|
||||
sha256, sha1, size = hashlib.sha256(), hashlib.sha1(), 0
|
||||
req = urllib.request.Request(transport_url(attachment_url(asset)),
|
||||
headers={'Authorization': 'token ' + os.environ['GITEA_TOKEN']})
|
||||
url = attachment_url(asset)
|
||||
endpoint = transport_url(url)
|
||||
headers = {'Authorization': 'token ' + os.environ['GITEA_TOKEN']}
|
||||
if endpoint != url:
|
||||
headers['Host'] = 'git.orangraph.com'
|
||||
req = urllib.request.Request(endpoint, headers=headers)
|
||||
with urllib.request.urlopen(req, timeout=300) as response:
|
||||
while chunk := response.read(1024 * 1024):
|
||||
sha256.update(chunk)
|
||||
|
||||
Reference in new issue
Block a user