video thumbnails

This commit is contained in:
2025-11-25 22:34:05 +01:00
parent c4603a0b3a
commit 757abe9a0f
9 changed files with 389 additions and 15 deletions
+7 -6
View File
@@ -3,22 +3,22 @@ use axum::http::StatusCode;
use papercrate::test_support::{acquire_db_lock, body_to_vec, TestApp, TestUserRole};
use serde::Deserialize;
#[derive(Deserialize)]
#[derive(Clone, Deserialize)]
struct DocumentDetail {
document: DocumentInfo,
}
#[derive(Deserialize)]
#[derive(Clone, Deserialize)]
struct DocumentInfo {
current_version: Option<DocumentVersion>,
}
#[derive(Deserialize)]
#[derive(Clone, Deserialize)]
struct DocumentVersion {
download: DownloadLink,
}
#[derive(Deserialize)]
#[derive(Clone, Deserialize)]
struct DownloadLink {
url: String,
expires_at: i64,
@@ -47,14 +47,15 @@ async fn document_download_redirects_when_proxy_disabled() -> Result<()> {
assert_eq!(upload.status(), StatusCode::CREATED);
let body = body_to_vec(upload.into_body()).await?;
let detail: DocumentDetail = serde_json::from_slice(&body)?;
let download_path = detail
let download_link = detail
.document
.current_version
.as_ref()
.expect("missing version")
.download
.url
.clone();
assert!(download_link.expires_at > 0);
let download_path = download_link.url.clone();
let redirect = app.get(&download_path, None).await?;
assert_eq!(redirect.status(), StatusCode::TEMPORARY_REDIRECT);