#!/bin/bash # Instalar o aria2 sudo apt-get update sudo apt-get install aria2 -y # Instalar o Node.js (se necessário) # sudo apt-get install curl -y # curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - # sudo apt-get install nodejs -y # Instalar o AriaNg mkdir ariang cd ariang wget https://github.com/mayswind/AriaNg/releases/download/1.2.2/AriaNg-1.2.2.zip unzip AriaNg-1.2.2.zip cd .. # Instalar o http-server sudo npm install -g http-server # Instalar o localtunnel sudo npm install -g localtunnel # Iniciar o servidor aria2c aria2c --enable-rpc \ --rpc-listen-port=6800 \ -D "fr" \ -d {OUTPUT_DIR} \ -j 20 \ -c \ $(if [ res.ok ]; then echo "--bt-tracker=${res.text}"; fi) \ --bt-request-peer-speed-limit=0 \ --bt-max-peers=0 \ --seed-ratio=0.0 \ --max-connection-per-server=10 \ --min-split-size=10M \ --follow-torrent=mem \ --disable-ipv6=true \ --user-agent=Transmission/2.77 \ --peer-agent=Transmission/2.77 \ --peer-id-prefix=-TR2770- \ --split=20 # Aguardar alguns segundos para garantir que o servidor aria2c tenha iniciado completamente sleep 5 # Obter o hostname do sistema HOST=$(hostname) # Porta para WebSocket PORT="80" # Caminho para o arquivo index.html do AriaNg INDEX_FILE="ariang/index.html" # Atualizar as configurações no arquivo index.html do AriaNg sed -i "s/rpcHost:\"[^\"]\+./rpcHost:\"$HOST\"/" $INDEX_FILE sed -i "s/protocol:\"\\w+./protocol:\"ws\"/" $INDEX_FILE sed -i "s/rpcPort:\"\\d+./rpcPort:\"$PORT\"/" $INDEX_FILE # Iniciar o http-server para servir o AriaNg http-server /content/ariang --port 8080 & # Iniciar o LocalTunnel para encaminhar as solicitações HTTP lt --port 8080