#!/bin/bash # 查看部署列表 # 用法: bash list.sh [contactId] CONFIG_FILE="$HOME/.openclaw/cloud-deploy.json" CONTACT_ID="$1" TOKEN=$(python3 -c "import json; t=json.load(open('$CONFIG_FILE')).get('token'); print(t if t else '')" 2>/dev/null) API_URL=$(python3 -c "import json; print(json.load(open('$CONFIG_FILE'))['apiUrl'])") if [ -z "$TOKEN" ]; then echo "错误:未注册,请先执行 register.sh" exit 1 fi URL="$API_URL/deployments" if [ -n "$CONTACT_ID" ]; then URL="$URL?contactId=$CONTACT_ID" fi RESPONSE=$(curl -s --max-time 10 \ -H "Authorization: Bearer $TOKEN" \ "$URL" 2>/dev/null) echo "$RESPONSE" | python3 -m json.tool 2>/dev/null || echo "$RESPONSE"