thread-master/old/infra/start-ngrok.sh

24 lines
881 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# 本機 API OAuth callback 需 HTTPSMeta 會拒絕 http:// redirect錯誤碼 1349187
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
ENV_FILE="$ROOT/deploy/.env.dev"
: "${HAIXUN_API_PORT:=8890}"
if ! command -v ngrok >/dev/null 2>&1; then
echo "請先安裝 ngrokhttps://ngrok.com/download" >&2
exit 1
fi
echo "啟動 ngrok → 127.0.0.1:${HAIXUN_API_PORT}"
echo "完成後請把下列 URI 登記到 Meta App Dashboard → Redirect Callback URLs"
echo " https://<你的-ngrok網域>/api/v1/threads-accounts/oauth/callback"
echo ""
echo "並更新 deploy/.env.dev"
echo " THREADS_REDIRECT_URI=https://<你的-ngrok網域>/api/v1/threads-accounts/oauth/callback"
echo ""
echo "授權導回時若看到 ngrok「Visit Site」請點進去讓 callback 打到 API。"
echo ""
exec ngrok http "${HAIXUN_API_PORT}" --log=stdout