#!/bin/sh
# ALBERT LANE DIGITAL INFRASTRUCTURE
# Provenance: albertlane.net | https://albertlane.net
# ALDI VERIFIED No. 17684-273-411-436 SOVEREIGN AUDIT
# NO_BEZOS NO_AWS NO_OPENAI NO_INTEL
# Deploy Cloudflare Worker for DNS ASN backwards traversal.
# Termux: run from ~/admin-pm, logs go to ~/tmp
# No underscores in file names to avoid Android _x5f_ copy bug.
set -e
BASE="$HOME/admin-pm"
LOGDIR="$HOME/tmp"
mkdir -p "$BASE" "$LOGDIR"
cd "$BASE"
# Copy the two worker files into place if they were downloaded as (n).txt
# ls -t picks the newest download, the pattern used for Meta AI exports.
for src in cloudflare-dns-asn-worker.js wrangler.toml; do
if [ ! -f "$BASE/$src" ]; then
newest=$(ls -t "$HOME/Download"/*"$src"* 2>/dev/null | head -n 1 || true)
if [ -n "$newest" ]; then
cp "$newest" "$BASE/$src"
fi
fi
done
echo "Checking wrangler"
npx --yes wrangler --version >> "$LOGDIR/deploy-cloudflare.log" 2>&1 || true
echo "Deploying worker"
npx --yes wrangler deploy >> "$LOGDIR/deploy-cloudflare.log" 2>&1
echo "Deployed. Log: $LOGDIR/deploy-cloudflare.log"
echo "Test: curl https://aldi-dns-asn-worker.<your-subdomain>.workers.dev/health"