fix: improve h5 payment return flow

This commit is contained in:
wushumin
2026-06-04 16:12:59 +08:00
parent 13c21ac67f
commit 46dae160be
13 changed files with 328 additions and 8 deletions

54
scripts/gitnexus-refresh.sh Executable file
View File

@@ -0,0 +1,54 @@
#!/bin/sh
set -eu
if [ "${GITNEXUS_AUTO_REFRESH:-1}" = "0" ]; then
echo "GitNexus auto refresh disabled by GITNEXUS_AUTO_REFRESH=0"
exit 0
fi
repo_root=$(git rev-parse --show-toplevel 2>/dev/null) || {
echo "Not inside a git repository"
exit 1
}
cd "$repo_root"
git_dir=$(git rev-parse --git-dir)
case "$git_dir" in
/*) ;;
*) git_dir="$repo_root/$git_dir" ;;
esac
head_commit=$(git rev-parse HEAD 2>/dev/null || true)
if [ -z "$head_commit" ]; then
echo "No HEAD commit found; skip GitNexus refresh"
exit 0
fi
stamp_file="$git_dir/gitnexus-indexed-head"
lock_dir="$git_dir/gitnexus-refresh.lock"
if [ -f "$stamp_file" ] && [ "$(cat "$stamp_file" 2>/dev/null || true)" = "$head_commit" ]; then
echo "GitNexus index already refreshed for $head_commit"
exit 0
fi
if ! mkdir "$lock_dir" 2>/dev/null; then
echo "GitNexus refresh already running; skip"
exit 0
fi
cleanup() {
rmdir "$lock_dir" 2>/dev/null || true
}
trap cleanup EXIT HUP INT TERM
echo "GitNexus refresh started for $head_commit"
if npx gitnexus analyze --index-only --name anxinyan .; then
printf '%s\n' "$head_commit" > "$stamp_file"
echo "GitNexus refresh completed for $head_commit"
else
status=$?
echo "GitNexus refresh failed with exit code $status"
exit "$status"
fi