#!/bin/sh # 1. 启动 Telegram Bot API 本地服务器在后台 (监听 8081 端口) # 使用 HuggingFace Secrets 中配置的 TELEGRAM_API_ID 和 TELEGRAM_API_HASH # 开启 --local 选项以支持大文件(2GB)本地直传与下载 echo "Starting Telegram Bot API Server on port 8081..." /usr/local/bin/telegram-bot-api \ --api-id="${TELEGRAM_API_ID}" \ --api-hash="${TELEGRAM_API_HASH}" \ --local \ --http-port=8081 & # 2. 设置 Node.js 进程所需的环境变量 export IS_HF_SPACE="true" export PORT="7860" # 将 TG_PROXY_URL 设置为 localhost:8081,让 Node.js 服务使用本地运行的高限额 API 服务器 export TG_PROXY_URL="localhost:8081" # 3. 启动 fd-main Node.js 服务器 (监听 7860 端口,即 HuggingFace Space 指定的入口) echo "Starting fd-main Node.js server on port 7860..." exec node --import ./deploy/server/register.mjs deploy/server/index.js