Release v0.1.13 2026-07-13
This commit is contained in:
+3
-3
@@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "i-want-to-heal",
|
||||
"private": true,
|
||||
"version": "0.1.12",
|
||||
"version": "0.1.13",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"predev": "pnpm assets:sync-basis-transcoder",
|
||||
"predev": "node scripts/sync_basis_transcoder.mjs",
|
||||
"dev": "vite --host 0.0.0.0",
|
||||
"dev:api": "HOST=127.0.0.1 PORT=4174 node server/production.mjs",
|
||||
"db:backup": "node scripts/backup-db.mjs",
|
||||
"db:init": "node scripts/init-db.mjs",
|
||||
"prebuild": "pnpm assets:sync-basis-transcoder",
|
||||
"prebuild": "node scripts/sync_basis_transcoder.mjs",
|
||||
"build": "tsc -b && vite build",
|
||||
"android:sync": "pnpm run build && cap sync android",
|
||||
"android:sync:truenas": "VITE_API_BASE_URL=https://iwanttoheal.phenomrom.com pnpm run android:sync",
|
||||
|
||||
+39
-20
@@ -8,7 +8,6 @@ import hashlib
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import secrets
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -339,17 +338,6 @@ def create_release(tag: str, commit: str, message: str, token: str) -> dict[str,
|
||||
return result
|
||||
|
||||
|
||||
def multipart_asset(path: Path, media_type: str) -> tuple[bytes, str]:
|
||||
boundary = f"----iwanttoheal{secrets.token_hex(12)}"
|
||||
prefix = (
|
||||
f"--{boundary}\r\n"
|
||||
f'Content-Disposition: form-data; name="attachment"; filename="{path.name}"\r\n'
|
||||
f"Content-Type: {media_type}\r\n\r\n"
|
||||
).encode()
|
||||
body = prefix + path.read_bytes() + f"\r\n--{boundary}--\r\n".encode()
|
||||
return body, f"multipart/form-data; boundary={boundary}"
|
||||
|
||||
|
||||
def upload_release_asset(
|
||||
release_id: int,
|
||||
path: Path,
|
||||
@@ -357,15 +345,46 @@ def upload_release_asset(
|
||||
media_type: str,
|
||||
token: str,
|
||||
) -> None:
|
||||
body, content_type = multipart_asset(path, media_type)
|
||||
gitea_request(
|
||||
f"/repos/{GITEA_OWNER}/{GITEA_REPO}/releases/{release_id}/assets"
|
||||
f"?name={urllib.parse.quote(path.name)}",
|
||||
token=token,
|
||||
method="POST",
|
||||
body=body,
|
||||
content_type=content_type,
|
||||
curl = shutil.which("curl")
|
||||
if not curl:
|
||||
raise SystemExit("curl is required to upload Gitea release assets")
|
||||
|
||||
url = (
|
||||
f"{GITEA_API}/repos/{GITEA_OWNER}/{GITEA_REPO}/releases/{release_id}/assets"
|
||||
f"?name={urllib.parse.quote(path.name)}"
|
||||
)
|
||||
headers = (
|
||||
"Accept: application/json\n"
|
||||
f"Authorization: token {token}\n"
|
||||
"Expect: 100-continue\n"
|
||||
)
|
||||
result = subprocess.run(
|
||||
[
|
||||
curl,
|
||||
"--silent",
|
||||
"--show-error",
|
||||
"--fail-with-body",
|
||||
"--connect-timeout",
|
||||
"30",
|
||||
"--max-time",
|
||||
"300",
|
||||
"--header",
|
||||
"@-",
|
||||
"--form",
|
||||
f"attachment=@{path};type={media_type}",
|
||||
url,
|
||||
],
|
||||
cwd=REPO_ROOT,
|
||||
input=headers,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
if result.returncode:
|
||||
details = result.stdout.strip() or result.stderr.strip()
|
||||
raise SystemExit(
|
||||
f"Gitea release asset upload failed (curl {result.returncode}): {details}"
|
||||
)
|
||||
print(f"Release asset uploaded: {path.name}")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user