Compare commits

...

4 Commits

Author SHA1 Message Date
b8892b4737 chore: bump version 2026-09-02 19:34:17 +02:00
16977d6227 chore: bump version 2026-09-02 19:33:22 +02:00
7538ea8608 fix(release): refuse to run from a snap-sandboxed HOME
When release.sh is launched from VS Code's integrated terminal, podman
sees $HOME=/home/$USER/snap/code/<rev>/ and stores its database there.
If snapd auto-updates code mid-session (rev 258 -> 260), the next
podman invocation finds a stale static-dir pointer and aborts with:

  Error: database static dir ".../snap/code/258/.../libpod" does not
  match our static dir ".../snap/code/260/.../libpod"

Detect the pattern ($HOME under /home/*/snap/*) and bail out early
with an actionable message: re-run from a regular host terminal.
2026-09-02 19:24:30 +02:00
7da7668787 fix(release): write package.json and pyproject.toml versions correctly
The single-quoted bash string passed to sed -i prevented FRONT_VERSION from
being interpolated, so the file content was being silently rewritten to
the literal text "${FRONT_VERSION}". Likewise the double-quoted sed for
pyproject.toml would silently do nothing if the [project] section was
absent while still printing a misleading 'updated' success line.

Replace both with python: json.load/dump for package.json (so the JSON
remains well-formed and 2-space-indented), and a regex section-aware
edit for pyproject.toml that exits non-zero with a warning if no
`version = "..."` line is found, so the success message only prints
when something actually changed.
2026-09-02 19:23:42 +02:00
4 changed files with 91 additions and 11 deletions

View File

@@ -1 +1 @@
v1.5.7
v1.5.9

View File

@@ -59,9 +59,26 @@ else
err "Neither podman nor docker is installed."
fi
# ---------------------------------------------------------------------------
# -------------------------------------------------------------------
# Refuse to run from inside a confined snap sandbox (e.g. the VS Code
# integrated terminal). When the script is launched from such a
# sandbox, $HOME points under /home/$USER/snap/code/<rev>/ and podman
# stores its DB under that path. If a snap revision bump happens mid
# session, the next podman invocation finds a stale static-dir pointer
# and aborts with a confusing "database static dir ... does not match"
# error. Re-run the script from a regular host shell instead.
# -------------------------------------------------------------------
case "${HOME:-}" in
/home/*/snap/*)
err "Refusing to run inside a snap-sandboxed HOME (${HOME}). \
Re-run from a regular host terminal (e.g. gnome-terminal, konsole) \
so podman uses a stable storage path."
;;
esac
# -------------------------------------------------------------------
# Pre-flight checks
# ---------------------------------------------------------------------------
# -------------------------------------------------------------------
echo "============================================"
echo " AniWorld — Build & Push"
echo " Engine : ${ENGINE}"

View File

@@ -85,7 +85,20 @@ echo "Version file updated → ${VERSION_FILE}"
FRONT_VERSION="${NEW_TAG#v}"
FRONT_PKG="${SCRIPT_DIR}/../package.json"
if [[ -f "${FRONT_PKG}" ]]; then
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"${FRONT_VERSION}\"/" "${FRONT_PKG}"
# Use a python one-liner for portable, safe JSON editing. The previous
# `sed -i` used single-quoted bash strings, which prevented
# ${FRONT_VERSION} from being interpolated and silently rewrote the file
# to the literal string "${FRONT_VERSION}".
python3 - "$FRONT_PKG" "$FRONT_VERSION" <<'PY'
import json, sys
path, new_version = sys.argv[1], sys.argv[2]
with open(path, encoding="utf-8") as fh:
data = json.load(fh)
data["version"] = new_version
with open(path, "w", encoding="utf-8") as fh:
json.dump(data, fh, indent=2)
fh.write("\n")
PY
echo "package.json version updated → ${FRONT_VERSION}"
else
echo "Warning: package.json not found, skipping package.json version sync" >&2
@@ -94,13 +107,63 @@ fi
# Keep root pyproject.toml in sync.
BACKEND_PYPROJECT="${SCRIPT_DIR}/../pyproject.toml"
if [[ -f "${BACKEND_PYPROJECT}" ]]; then
# Update version under [project] section if present
if grep -q '^\[project\]' "${BACKEND_PYPROJECT}"; then
sed -i "/^\[project\]/,/^\[/ s/^version = \".*\"/version = \"${FRONT_VERSION}\"/" "${BACKEND_PYPROJECT}"
else
sed -i "s/^version = \".*\"/version = \"${FRONT_VERSION}\"/" "${BACKEND_PYPROJECT}"
# Use python instead of sed: the previous `sed -i` used double-quoted
# patterns whose `&` and `\` characters would have to be escaped, and
# more importantly it could silently do nothing if the [project] section
# was missing. python reads/writes the file as a string, preserving
# the existing format, and reports whether anything changed.
if FRONT_VERSION="$FRONT_VERSION" BACKEND_PYPROJECT="$BACKEND_PYPROJECT" python3 <<'PY'
import os, re, sys
path = os.environ["BACKEND_PYPROJECT"]
new_version = os.environ["FRONT_VERSION"]
with open(path, encoding="utf-8") as fh:
text = fh.read()
# If there is a [project] table, update only the `version = "..."` line
# inside it; otherwise update the first top-level `version = "..."` line.
project_match = re.search(r"^\[project\]\s*$", text, re.MULTILINE)
if project_match:
start = project_match.end()
end = re.search(r"^\[", text[start:], re.MULTILINE)
section_end = start + end.start() if end else len(text)
section = text[start:section_end]
new_section, n = re.subn(
r'^version = ".*"$',
f'version = "{new_version}"',
section,
count=1,
flags=re.MULTILINE,
)
if n == 0:
print(
f"Warning: no `version = ...` line found under [project] in {path}",
file=sys.stderr,
)
sys.exit(2)
text = text[:start] + new_section + text[section_end:]
else:
new_text, n = re.subn(
r'^version = ".*"$',
f'version = "{new_version}"',
text,
count=1,
flags=re.MULTILINE,
)
if n == 0:
print(
f"Warning: no `version = ...` line found in {path}",
file=sys.stderr,
)
sys.exit(2)
text = new_text
with open(path, "w", encoding="utf-8") as fh:
fh.write(text)
PY
then
echo "pyproject.toml version updated → ${FRONT_VERSION}"
fi
echo "pyproject.toml version updated → ${FRONT_VERSION}"
else
echo "Warning: pyproject.toml not found, skipping pyproject.toml version sync" >&2
fi

View File

@@ -1,6 +1,6 @@
{
"name": "aniworld-web",
"version": "1.5.7",
"version": "1.5.9",
"description": "Aniworld Anime Download Manager - Web Frontend",
"type": "module",
"scripts": {