69 lines
2.3 KiB
Bash
Executable File
69 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Setup Script for Beeper Bridge Manager (The "Official" Way)
|
|
# Based on rhinot/beeper-bridges
|
|
|
|
echo "=== Beeper Bridge Manager Setup ==="
|
|
echo "This setup uses the official Beeper Bridge Manager Docker image."
|
|
echo "It requires your Beeper Account Access Token (NOT the AS/HS tokens)."
|
|
|
|
# Prompt for Access Token
|
|
echo ""
|
|
echo "Please paste your Beeper Access Token."
|
|
echo "You can find it in ~/.config/beeper/bbctl.json (if you used bbctl)"
|
|
echo "OR in the Beeper Desktop App (Help -> Copy Access Token)."
|
|
echo ""
|
|
read -p "Access Token: " ACCESS_TOKEN
|
|
|
|
if [ -z "$ACCESS_TOKEN" ]; then
|
|
echo "Error: Access Token is required."
|
|
exit 1
|
|
fi
|
|
|
|
echo ""
|
|
echo "Setting up docker-compose.yml..."
|
|
|
|
# Create .env file
|
|
cat <<EOF > .env
|
|
MATRIX_ACCESS_TOKEN=$ACCESS_TOKEN
|
|
EOF
|
|
|
|
# Create docker-compose.yml using bridge-manager
|
|
cat <<EOF > docker-compose.yml
|
|
services:
|
|
telegram:
|
|
image: ghcr.io/beeper/bridge-manager:latest
|
|
container_name: beeper-telegram
|
|
restart: unless-stopped
|
|
environment:
|
|
- BRIDGE_NAME=telegram
|
|
- MATRIX_ACCESS_TOKEN=\${MATRIX_ACCESS_TOKEN}
|
|
# Optional: Explicitly set the bridge type if needed, but 'telegram' usually suffices
|
|
# - BRIDGE_TYPE=telegram
|
|
volumes:
|
|
- ./data/telegram:/data
|
|
# Network mode host is sometimes easier for websockets, but bridge should work
|
|
# We stick to default bridge network
|
|
|
|
EOF
|
|
|
|
echo "Cleaning up old data (config/registration) to let Bridge Manager handle it..."
|
|
# We backup just in case, but usually manager wants a clean slate or compatible format
|
|
if [ -d "data/telegram" ]; then
|
|
mkdir -p data/telegram_backup
|
|
cp data/telegram/config.yaml data/telegram_backup/config.yaml.bak 2>/dev/null
|
|
cp data/telegram/registration.yaml data/telegram_backup/registration.yaml.bak 2>/dev/null
|
|
|
|
# Actually, the manager might re-use the registration if valid.
|
|
# But to be safe and fix the "502" issue, let's rename config.yaml so it regenerates it properly
|
|
mv data/telegram/config.yaml data/telegram/config.yaml.old 2>/dev/null
|
|
echo "Moved old config.yaml to config.yaml.old"
|
|
fi
|
|
|
|
echo ""
|
|
echo "Setup Ready."
|
|
echo "1. Run: docker compose up -d telegram"
|
|
echo "2. Check logs: docker compose logs -f telegram"
|
|
echo ""
|
|
echo "Note: The Bridge Manager handles downloading the correct bridge version and configuring Websockets automatically."
|