#!/usr/bin/env bash # Schneller Zustandscheck fuer den Boot: Was ist wirklich live? # Verifiziert direkt an der Quelle statt Notizen zu glauben. set -uo pipefail cd "$(dirname "$0")/.." OWNER="5-NRCJ8Jg1fqtcvKaFYLsHBQ37_gyqsR9cOsxuzM748" POINTER="BUprgAw-XbRvvQPDcpL6Kds6-xPa2vmJfzmf7OLiLT4" code() { curl -s -o /dev/null -w "%{http_code}" -L --max-time 20 "$1"; } echo "== Pointer (permanente Adresse)" echo " https://arweave.net/$POINTER -> HTTP $(code "https://arweave.net/$POINTER")" echo "== Neuestes Site-Manifest laut GraphQL (arweave.net, Zeiger-Logik: Block+Published-At)" LATEST=$(curl -s --max-time 20 https://arweave.net/graphql -H 'content-type: application/json' -d "{\"query\":\"query { transactions(owners: [\\\"$OWNER\\\"], tags: [{name: \\\"App-Name\\\", values: [\\\"kiel-site\\\"]}, {name: \\\"Content-Type\\\", values: [\\\"application/x.arweave-manifest+json\\\"]}], sort: HEIGHT_DESC, first: 10) { edges { node { id block { height } tags { name value } } } } }\"}" \ | python3 -c " import sys, json edges = json.load(sys.stdin)['data']['transactions']['edges'] best, bh, bt = 'KEINS', -1, -1 for e in edges: n = e['node'] h = n['block']['height'] if n['block'] else float('inf') t = next((int(tag['value']) for tag in n['tags'] if tag['name'] == 'Published-At'), -1) if h > bh or (h == bh and t > bt): best, bh, bt = n['id'], h, t print(best)") echo " $LATEST" if [ "$LATEST" != "KEINS" ]; then echo " https://arweave.net/$LATEST/ -> HTTP $(code "https://arweave.net/$LATEST/")" fi echo "== Letzter lokaler Upload (publish/last-upload.json)" python3 -c "import json; print(' ' + json.load(open('publish/last-upload.json'))['manifestResponse']['id'])" 2>/dev/null || echo " (keine Datei)" echo "== Subdomain (Redirect-Kette: 80->https->Zeiger v2)" echo " http://kiel.overlkd.com -> HTTP $(code "http://kiel.overlkd.com")" SUBTARGET=$(curl -s --max-time 20 -o /dev/null -w '%{redirect_url}' https://kiel.overlkd.com/ || true) if [ "$SUBTARGET" = "https://arweave.net/BUprgAw-XbRvvQPDcpL6Kds6-xPa2vmJfzmf7OLiLT4" ]; then echo " https -> 302 auf Zeiger v2 (korrekt)" else echo " ACHTUNG: https-Redirect zeigt auf: ${SUBTARGET:-nichts/Fehler}" fi echo "== Briefkasten (App-Name=kiel-briefkasten, neueste 10; From ist unverifiziert!)" curl -s --max-time 20 https://arweave.net/graphql -H 'content-type: application/json' \ -d '{"query":"query { transactions(tags: [{name: \"App-Name\", values: [\"kiel-briefkasten\"]}], sort: HEIGHT_DESC, first: 10) { edges { node { id owner { address } data { size } block { height timestamp } tags { name value } } } } }"}' \ | python3 -c " import sys, json, datetime try: edges = json.load(sys.stdin)['data']['transactions']['edges'] except Exception: edges = None if edges is None: print(' (GraphQL nicht erreichbar)') elif not edges: print(' (keine Nachrichten im Index)') else: for e in edges: n = e['node'] tags = {t['name']: t['value'] for t in n['tags']} frm = tags.get('From', 'anonym')[:40] own = 'KIEL-KEY' if n['owner']['address'] == '$OWNER' else 'fremd' when = datetime.datetime.fromtimestamp(n['block']['timestamp'], datetime.UTC).strftime('%m-%d %H:%M') if n['block'] else 'pending' print(f\" {n['id'][:12]}... {when} {n['data']['size']}B From={frm!r} [{own}]\")" echo "== Solana-Wallet (sollte 0 sein, kein Geld angefordert)" curl -s --max-time 20 https://api.mainnet-beta.solana.com -H 'content-type: application/json' \ -d '{"jsonrpc":"2.0","id":1,"method":"getBalance","params":["8Ln1zb7vUqLuHbEVg3rPBWUaoor2YJsucMtHzYCd5E6Z"]}' \ | python3 -c "import sys,json; print(' ' + str(json.load(sys.stdin)['result']['value']/1e9) + ' SOL')" 2>/dev/null || echo " (RPC nicht erreichbar)"