From 2dfac413913a3d3f0b316620f5d0403be59c4844 Mon Sep 17 00:00:00 2001 From: daopunk Date: Thu, 10 Sep 2026 03:28:53 -0500 Subject: [PATCH] chore: deploy --- scripts/register_phala_phone.sh | 39 ++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/scripts/register_phala_phone.sh b/scripts/register_phala_phone.sh index 7dbaf40..286b34a 100755 --- a/scripts/register_phala_phone.sh +++ b/scripts/register_phala_phone.sh @@ -1,22 +1,49 @@ #!/bin/bash -# Register the surviving Signal number (phone B) via proxy :8081. +# Register SIGNAL_PHONE from docker/.phala.env via the live CVM proxy :8081. # -# Phone B should already be registered on the live CVM — skip if -# accounts already lists it. Do not re-register phone A. +# Skip if /v1/debug/signal-accounts already lists that number. +# Do not point this at local docker/.env — that is a different number. # # Usage: # CAPTCHA_TR='signalcaptcha://...' ./scripts/register_phala_phone.sh # Then when SMS arrives: # SMS_TR=123456 ./scripts/register_phala_phone.sh --verify +# +# Optional overrides: PHONE_TR, APP_ID, TR_PROXY, ENV_FILE set -euo pipefail +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +ENV_FILE="${ENV_FILE:-$ROOT/docker/.phala.env}" + +if [[ ! -f "$ENV_FILE" ]]; then + echo "Error: missing $ENV_FILE (copy docker/.phala.env.example)" >&2 + exit 1 +fi + +# Load SIGNAL_PHONE from Phala env without sourcing the whole file. +SIGNAL_PHONE_FROM_ENV="$( + grep -E '^SIGNAL_PHONE=' "$ENV_FILE" | head -n1 | cut -d= -f2- | tr -d '\r' | tr -d '"' | tr -d "'" +)" +if [[ -z "${SIGNAL_PHONE_FROM_ENV}" ]]; then + echo "Error: SIGNAL_PHONE unset in $ENV_FILE" >&2 + exit 1 +fi + APP_ID="${APP_ID:-9adac7636fe255182f699940ffd1924960415507}" GATEWAY="${GATEWAY:-dstack-pha-prod9.phala.network}" TR_PROXY="${TR_PROXY:-https://${APP_ID}-8081.${GATEWAY}}" -PHONE_TR="${PHONE_TR:-+573107677679}" +# Prefer explicit PHONE_TR; otherwise always use docker/.phala.env SIGNAL_PHONE. +PHONE_TR="${PHONE_TR:-$SIGNAL_PHONE_FROM_ENV}" MODE="${1:-register}" +if [[ "$PHONE_TR" == "$SIGNAL_PHONE_FROM_ENV" ]]; then + echo "Using phone $PHONE_TR from $ENV_FILE" +else + echo "Using phone $PHONE_TR (PHONE_TR override; .phala.env has $SIGNAL_PHONE_FROM_ENV)" +fi +echo "Proxy: $TR_PROXY" + if [[ "$MODE" == "--verify" ]]; then if [[ -z "${SMS_TR:-}" ]]; then echo "Error: set SMS_TR" >&2 @@ -28,7 +55,7 @@ if [[ "$MODE" == "--verify" ]]; then echo else if [[ -z "${CAPTCHA_TR:-}" ]]; then - echo "Error: set CAPTCHA_TR (phone B / :8081)" >&2 + echo "Error: set CAPTCHA_TR (full signalcaptcha://… string)" >&2 exit 1 fi echo "Registering $PHONE_TR on :8081..." @@ -38,5 +65,5 @@ else echo fi -echo "Accounts (translation :8081):" +echo "Accounts (CVM :8081):" curl -sS "$TR_PROXY/v1/debug/signal-accounts"; echo