Add Khanegi SMS sync inventory, batch import, and rollout helpers.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-08 15:30:43 +03:30
co-authored by Cursor
parent b9a33505e4
commit 448dc444c9
11 changed files with 693 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
# Run on the Khanegi install for ONE sold version (its own .env).
# Never point multiple installs on the same server at the same SUPERADMIN_SMS_DOMAIN.
#
# Usage:
# bash deploy/khanegi-sms-enable-remote.sh /path/to/khanegi/server DOMAIN SHARED_SECRET
set -euo pipefail
INSTALL_SERVER_DIR="${1:-}"
DOMAIN="${2:-}"
SHARED_SECRET="${3:-}"
BASE_URL="${SUPERADMIN_SMS_BASE_URL:-https://adm.montzar.ir/api/remote/sms}"
if [[ -z "$INSTALL_SERVER_DIR" || -z "$DOMAIN" || -z "$SHARED_SECRET" ]]; then
echo "Usage: $0 /path/to/khanegi/server DOMAIN SHARED_SECRET" >&2
exit 1
fi
ENV_FILE="$INSTALL_SERVER_DIR/.env"
if [[ ! -f "$ENV_FILE" ]]; then
echo "Missing .env: $ENV_FILE" >&2
exit 1
fi
backup="$ENV_FILE.bak.sms-sync.$(date +%Y%m%d%H%M%S)"
cp "$ENV_FILE" "$backup"
echo "Backup: $backup"
tmp="$(mktemp)"
grep -vE '^(SUPERADMIN_SMS_BASE_URL|SUPERADMIN_SMS_SHARED_SECRET|SUPERADMIN_SMS_DOMAIN|SUPERADMIN_REMOTE_TOKEN)=' "$ENV_FILE" > "$tmp" || true
mv "$tmp" "$ENV_FILE"
{
echo ""
echo "# SuperAdmin SMS sync — per sold version (domain=$DOMAIN)"
echo "SUPERADMIN_SMS_BASE_URL=$BASE_URL"
echo "SUPERADMIN_SMS_SHARED_SECRET=$SHARED_SECRET"
echo "SUPERADMIN_SMS_DOMAIN=$DOMAIN"
} >> "$ENV_FILE"
cd "$INSTALL_SERVER_DIR"
php artisan config:clear
php artisan config:cache || true
if php artisan list --raw 2>/dev/null | grep -q '^sms:superadmin-probe'; then
php artisan sms:superadmin-probe
else
echo "Env written. Deploy code with sms:superadmin-probe, then run: php artisan sms:superadmin-probe"
fi
echo "OK: remote enabled for domain=$DOMAIN in $ENV_FILE"