mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-23 23:32:05 +00:00
fix: trim CRLF from TWITTER_AUTH_TOKEN
This commit is contained in:
@@ -26,9 +26,12 @@ use crate::site::FetchError;
|
|||||||
use super::interface::Tweet;
|
use super::interface::Tweet;
|
||||||
|
|
||||||
/// `auth_token` cookie of a logged-in x.com session; enables the fallback.
|
/// `auth_token` cookie of a logged-in x.com session; enables the fallback.
|
||||||
|
/// Trimmed: a CRLF `.env` (Windows) leaves a trailing `\r` on the value,
|
||||||
|
/// which would make the Cookie header invalid.
|
||||||
static AUTH_TOKEN: LazyLock<Option<String>> = LazyLock::new(|| {
|
static AUTH_TOKEN: LazyLock<Option<String>> = LazyLock::new(|| {
|
||||||
std::env::var("TWITTER_AUTH_TOKEN")
|
std::env::var("TWITTER_AUTH_TOKEN")
|
||||||
.ok()
|
.ok()
|
||||||
|
.map(|s| s.trim().to_string())
|
||||||
.filter(|s| !s.is_empty())
|
.filter(|s| !s.is_empty())
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user