feat: convert client from TUI to Web UI

This commit is contained in:
Sarto
2026-03-25 19:40:53 +03:30
parent ca0ad05880
commit 6753c541e7
12 changed files with 1623 additions and 868 deletions
+17 -2
View File
@@ -8,6 +8,7 @@ import (
"log"
"os"
"os/signal"
"path/filepath"
"strconv"
"strings"
"syscall"
@@ -19,15 +20,16 @@ import (
)
func main() {
dataDir := flag.String("data-dir", "./data", "Data directory for channels, session, and config")
listen := flag.String("listen", ":5300", "DNS listen address (host:port)")
domain := flag.String("domain", "", "DNS domain (e.g., t.example.com)")
key := flag.String("key", "", "Encryption passphrase")
channelsFile := flag.String("channels", "channels.txt", "Path to channels file")
channelsFile := flag.String("channels", "", "Path to channels file (default: {data-dir}/channels.txt)")
apiID := flag.String("api-id", "", "Telegram API ID")
apiHash := flag.String("api-hash", "", "Telegram API Hash")
phone := flag.String("phone", "", "Telegram phone number")
loginOnly := flag.Bool("login-only", false, "Authenticate to Telegram, save session, and exit")
sessionPath := flag.String("session", "session.json", "Path to Telegram session file")
sessionPath := flag.String("session", "", "Path to Telegram session file (default: {data-dir}/session.json)")
maxPadding := flag.Int("padding", 32, "Max random padding bytes in DNS responses (anti-DPI, 0=disabled)")
showVersion := flag.Bool("version", false, "Show version and exit")
flag.Parse()
@@ -37,6 +39,19 @@ func main() {
os.Exit(0)
}
// Create data directory
if err := os.MkdirAll(*dataDir, 0700); err != nil {
log.Fatalf("Create data dir: %v", err)
}
// Default paths relative to data directory
if *channelsFile == "" {
*channelsFile = filepath.Join(*dataDir, "channels.txt")
}
if *sessionPath == "" {
*sessionPath = filepath.Join(*dataDir, "session.json")
}
if *domain == "" {
*domain = os.Getenv("THEFEED_DOMAIN")
}