feat: align motrix-style download UI/actions and stabilize aria2 ops

This commit is contained in:
tongki078
2026-02-24 12:00:30 +09:00
parent 845d5ca65c
commit 552f27c002
29 changed files with 2164 additions and 226 deletions

View File

@@ -0,0 +1,41 @@
#!/bin/bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
MOTRIX_DIR="${1:-/Users/A/Work/Motrix}"
SRC_BASE="$MOTRIX_DIR/extra"
DST_BASE="$ROOT_DIR/src-tauri/resources/engine"
if [ ! -d "$SRC_BASE" ]; then
echo "[sync-aria2] Motrix extra directory not found: $SRC_BASE"
exit 1
fi
rm -rf "$DST_BASE"
mkdir -p "$DST_BASE"
copy_engine_dir() {
local src="$1"
local dst="$2"
if [ -d "$src" ]; then
mkdir -p "$dst"
cp "$src"/aria2c* "$dst"/ 2>/dev/null || true
cp "$src"/aria2.conf "$dst"/ 2>/dev/null || true
echo "[sync-aria2] copied $src -> $dst"
fi
}
# macOS
copy_engine_dir "$SRC_BASE/darwin/arm64/engine" "$DST_BASE/darwin/arm64"
copy_engine_dir "$SRC_BASE/darwin/x64/engine" "$DST_BASE/darwin/x64"
# Linux aliases
copy_engine_dir "$SRC_BASE/linux/x64/engine" "$DST_BASE/linux/x64"
copy_engine_dir "$SRC_BASE/linux/arm64/engine" "$DST_BASE/linux/arm64"
copy_engine_dir "$SRC_BASE/linux/armv7l/engine" "$DST_BASE/linux/armv7l"
# Windows
copy_engine_dir "$SRC_BASE/win32/x64/engine" "$DST_BASE/win32/x64"
copy_engine_dir "$SRC_BASE/win32/ia32/engine" "$DST_BASE/win32/ia32"
echo "[sync-aria2] done"

54
scripts/version-bump.sh Executable file
View File

@@ -0,0 +1,54 @@
#!/bin/bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT_DIR"
TAURI_CONF="src-tauri/tauri.conf.json"
PKG_JSON="package.json"
CARGO_TOML="src-tauri/Cargo.toml"
if [ ! -f "$TAURI_CONF" ] || [ ! -f "$PKG_JSON" ] || [ ! -f "$CARGO_TOML" ]; then
echo "[version-bump] required files are missing"
exit 1
fi
CURRENT_VERSION="$(node -e "const fs=require('fs');const j=JSON.parse(fs.readFileSync('$TAURI_CONF','utf8'));process.stdout.write(String(j.version||''));")"
if ! echo "$CURRENT_VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "[version-bump] invalid version format in $TAURI_CONF: $CURRENT_VERSION"
exit 1
fi
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
echo "[version-bump] $CURRENT_VERSION -> $NEW_VERSION"
node -e "
const fs = require('fs');
const files = ['$PKG_JSON', '$TAURI_CONF'];
for (const file of files) {
const json = JSON.parse(fs.readFileSync(file, 'utf8'));
json.version = '$NEW_VERSION';
fs.writeFileSync(file, JSON.stringify(json, null, 2) + '\n');
}
"
awk -v new_ver="$NEW_VERSION" '
BEGIN { in_package=0; done=0 }
/^\[package\]/ { in_package=1; print; next }
/^\[/ {
if ($0 != "[package]") in_package=0
}
{
if (in_package && !done && $1 == "version") {
sub(/"[^"]+"/, "\"" new_ver "\"")
done=1
}
print
}
' "$CARGO_TOML" > "$CARGO_TOML.tmp"
mv "$CARGO_TOML.tmp" "$CARGO_TOML"
echo "[version-bump] updated package.json / tauri.conf.json / Cargo.toml"