mirror of
https://github.com/kristoferssolo/tg-relay-rs.git
synced 2025-12-20 11:04:41 +00:00
feat(yt): add cookies env flag
This commit is contained in:
parent
e11223fa75
commit
5ad4aea252
@ -41,5 +41,6 @@ RUN uv tool install instaloader \
|
|||||||
&& uv tool install yt-dlp[default] \
|
&& uv tool install yt-dlp[default] \
|
||||||
&& yt-dlp --version
|
&& yt-dlp --version
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
COPY --from=builder-rs /app/target/release/tg-relay-rs /usr/local/bin/tg-relay-rs
|
COPY --from=builder-rs /app/target/release/tg-relay-rs /usr/local/bin/tg-relay-rs
|
||||||
CMD ["/usr/local/bin/tg-relay-rs"]
|
CMD ["/usr/local/bin/tg-relay-rs"]
|
||||||
|
|||||||
@ -8,8 +8,9 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
TELOXIDE_TOKEN: ${TELOXIDE_TOKEN}
|
TELOXIDE_TOKEN: ${TELOXIDE_TOKEN}
|
||||||
COOKIES_PATH: ${COOKIES_PATH:-/app/yt-cookies.txt}
|
COOKIES_PATH: ${COOKIES_PATH:-/app/yt-cookies.txt}
|
||||||
|
COOKIES: ${COOKIES:-false}
|
||||||
RUST_LOG: ${RUST_LOG:-info}
|
RUST_LOG: ${RUST_LOG:-info}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- ./comments.txt:/app/comments.txt:ro
|
- ./comments.txt:/app/comments.txt:ro
|
||||||
- /etc/secrets/yt-cookies.txt:/app/yt-cookies.txt
|
- /etc/secrets/yt-cookies.txt:/app/yt-cookies.txt:ro
|
||||||
|
|||||||
@ -144,7 +144,11 @@ pub async fn download_ytdlp(url: &str, cookies: Option<&str>) -> Result<Download
|
|||||||
"--quiet",
|
"--quiet",
|
||||||
];
|
];
|
||||||
|
|
||||||
if let Some(cookie_path) = cookies {
|
let with_cookies = env::var("COOKIES")
|
||||||
|
.unwrap_or_else(|_| "false".into())
|
||||||
|
.parse::<bool>()
|
||||||
|
.unwrap_or(false);
|
||||||
|
if with_cookies && let Some(cookie_path) = cookies {
|
||||||
if Path::new(cookie_path).exists() {
|
if Path::new(cookie_path).exists() {
|
||||||
args.extend(["--cookies", cookie_path]);
|
args.extend(["--cookies", cookie_path]);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user