feat: persist learning map images and upload skill

This commit is contained in:
ittoview
2026-05-22 08:06:03 +01:00
parent 11dd75d0cc
commit 828ee0c1c0
17 changed files with 140 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -euo pipefail
if [ "$#" -ne 2 ]; then
echo "用法: $0 <source-image> <target-filename>" >&2
exit 2
fi
SRC="$1"
NAME="$2"
IMG_DIR="/home/ittoview/src/data/image"
BASE_URL="https://itto.topwind.top/learning-images/"
if [ ! -f "$SRC" ]; then
echo "源文件不存在: $SRC" >&2
exit 1
fi
mkdir -p "$IMG_DIR"
cp "$SRC" "$IMG_DIR/$NAME"
echo "--- 本地目录确认 ---"
ls -lh "$IMG_DIR/$NAME"
echo "--- 公网线上挂载目录确认 ---"
HTML="$(curl -sS --max-time 8 "$BASE_URL")"
NUMBER_PREFIX="${NAME%%-*}-"
if printf '%s\n' "$HTML" | grep -F "$NAME" >/dev/null || printf '%s\n' "$HTML" | grep -F "$NUMBER_PREFIX" >/dev/null; then
printf '%s\n' "$HTML" | grep -F "$NAME" || printf '%s\n' "$HTML" | grep -F "$NUMBER_PREFIX"
echo "线上可见: $NAME"
else
echo "线上未确认可见: $NAME" >&2
exit 1
fi