Added yt-dlp cookies

This commit is contained in:
Ultradesu
2026-09-01 12:47:01 +01:00
parent 34e90b33f6
commit 39d75b07f6
7 changed files with 903 additions and 31 deletions
+45
View File
@@ -81,6 +81,11 @@ struct PathId {
id: i64,
}
#[derive(Debug, Deserialize)]
struct PathStringId {
id: String,
}
#[derive(Debug, Deserialize)]
struct PathName {
name: String,
@@ -415,6 +420,43 @@ impl App for AdminApp {
}),
"admin_v2_settings_probe",
),
Route::with_handler_and_name(
"/v2/api/settings/youtube-cookies",
{
let pool = Arc::clone(&pool);
let pool_config = Arc::clone(&pool_config);
cot::router::method::post(
move |session: Session,
db: Database,
json: Json<v2::UploadYoutubeCookieFileRequest>| {
let pool = Arc::clone(&pool);
let pool_config = Arc::clone(&pool_config);
async move {
let pg_pool = pool
.get_or_init(|| async {
sqlx::postgres::PgPoolOptions::new()
.max_connections(5)
.connect(&pool_config.database_url)
.await
.expect("admin pool")
})
.await;
v2::upload_youtube_cookie_file(session, db, pg_pool, json).await
}
},
)
},
"admin_v2_youtube_cookie_upload",
),
Route::with_handler_and_name(
"/v2/api/settings/youtube-cookies/{id}",
cot::router::method::delete(
move |session: Session, db: Database, path: Path<PathStringId>| async move {
v2::delete_youtube_cookie_file(session, db, &path.0.id).await
},
),
"admin_v2_youtube_cookie_delete",
),
Route::with_handler_and_name(
"/v2/api/federation",
get(move |session: Session, db: Database| async move {
@@ -1442,6 +1484,9 @@ impl App for AdminApp {
all.extend(cot::db::migrations::wrap_migrations(
crate::auth::db_migrations::MIGRATIONS,
));
all.extend(cot::db::migrations::wrap_migrations(
crate::youtube::db_migrations::MIGRATIONS,
));
all
}
}