feat: add XPublicReader for fetching public posts from X via Nitter RSS

This commit is contained in:
Sarto
2026-04-12 16:58:03 +03:30
parent ca54375e5e
commit a828f314ef
19 changed files with 1286 additions and 424 deletions
+20 -10
View File
@@ -25,6 +25,8 @@ func main() {
domain := flag.String("domain", "", "DNS domain (e.g., t.example.com)")
key := flag.String("key", "", "Encryption passphrase")
channelsFile := flag.String("channels", "", "Path to channels file (default: {data-dir}/channels.txt)")
xAccountsFile := flag.String("x-accounts", "", "Path to X accounts file (default: {data-dir}/x_accounts.txt)")
xRSSInstances := flag.String("x-rss-instances", "", "Comma-separated X RSS base URLs (e.g., http://nitter.net,https://nitter.net)")
apiID := flag.String("api-id", "", "Telegram API ID (optional if --no-telegram)")
apiHash := flag.String("api-hash", "", "Telegram API Hash (optional if --no-telegram)")
phone := flag.String("phone", "", "Telegram phone number (optional if --no-telegram)")
@@ -37,7 +39,7 @@ func main() {
debug := flag.Bool("debug", false, "Log every decoded DNS query")
showVersion := flag.Bool("version", false, "Show version and exit")
flag.Usage = func() {
fmt.Fprintf(os.Stderr, "thefeed-server %s\n\nServes Telegram channel content over encrypted DNS for censorship-resistant access.\n\nUsage:\n thefeed-server [flags]\n\nFlags:\n", version.Version)
fmt.Fprintf(os.Stderr, "thefeed-server %s\n\nServes Telegram/X feed content over encrypted DNS for censorship-resistant access.\n\nUsage:\n thefeed-server [flags]\n\nFlags:\n", version.Version)
flag.PrintDefaults()
}
flag.Parse()
@@ -56,6 +58,9 @@ func main() {
if *channelsFile == "" {
*channelsFile = filepath.Join(*dataDir, "channels.txt")
}
if *xAccountsFile == "" {
*xAccountsFile = filepath.Join(*dataDir, "x_accounts.txt")
}
if *sessionPath == "" {
*sessionPath = filepath.Join(*dataDir, "session.json")
}
@@ -89,6 +94,9 @@ func main() {
if *phone == "" {
*phone = os.Getenv("TELEGRAM_PHONE")
}
if *xRSSInstances == "" {
*xRSSInstances = os.Getenv("THEFEED_X_RSS_INSTANCES")
}
if *domain == "" || *key == "" {
fmt.Fprintln(os.Stderr, "Error: --domain and --key are required")
@@ -133,15 +141,17 @@ func main() {
}
cfg := server.Config{
ListenAddr: *listen,
Domain: *domain,
Passphrase: *key,
ChannelsFile: *channelsFile,
MaxPadding: *maxPadding,
MsgLimit: *msgLimit,
NoTelegram: *noTelegram,
AllowManage: *allowManage,
Debug: *debug,
ListenAddr: *listen,
Domain: *domain,
Passphrase: *key,
ChannelsFile: *channelsFile,
XAccountsFile: *xAccountsFile,
XRSSInstances: *xRSSInstances,
MaxPadding: *maxPadding,
MsgLimit: *msgLimit,
NoTelegram: *noTelegram,
AllowManage: *allowManage,
Debug: *debug,
Telegram: server.TelegramConfig{
APIID: id,
APIHash: *apiHash,