mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-03 00:47:53 +00:00
replace reqwest with wreq in web
This commit is contained in:
1 parent
69adc0d95a
commit
56d40c7800
4 files changed
+6
-37
No files matched your search
Generated
+1
-32
@@ -10334,37 +10334,6 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "seedance2-pro-job"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"actix-web",
|
||||
"actix_helpers",
|
||||
"anyhow",
|
||||
"bootstrap",
|
||||
"bucket_paths",
|
||||
"cloud_storage",
|
||||
"concurrency",
|
||||
"config",
|
||||
"easyenv",
|
||||
"enums",
|
||||
"errors",
|
||||
"hashing",
|
||||
"jobs_common",
|
||||
"log",
|
||||
"mysql_queries",
|
||||
"reqwest 0.12.23",
|
||||
"seedance2pro",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"server_environment",
|
||||
"sqlx",
|
||||
"tokens",
|
||||
"tokio",
|
||||
"workspace-build-acceleration",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "seedance2pro"
|
||||
version = "0.0.1"
|
||||
@@ -11479,7 +11448,6 @@ dependencies = [
|
||||
"redis_common",
|
||||
"redis_schema",
|
||||
"regex",
|
||||
"reqwest 0.12.23",
|
||||
"resend-rs",
|
||||
"reusable_types",
|
||||
"rust-s3",
|
||||
@@ -11510,6 +11478,7 @@ dependencies = [
|
||||
"utoipa-swagger-ui",
|
||||
"videos",
|
||||
"workspace-build-acceleration",
|
||||
"wreq",
|
||||
"zip 0.6.6",
|
||||
]
|
||||
|
||||
|
||||
@@ -112,7 +112,8 @@ language-tags = "0.3.2" # Parsing single tags richly
|
||||
|
||||
# HTTP
|
||||
# TODO/NB: This is just for Twitch, but we might need it later.
|
||||
reqwest.workspace = true
|
||||
# reqwest.workspace = true
|
||||
wreq.workspace = true
|
||||
|
||||
# Email
|
||||
resend-rs = "0.21.0"
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
use bytes::Bytes;
|
||||
use errors::AnyhowResult;
|
||||
use reqwest::{Client, IntoUrl};
|
||||
use wreq::Client;
|
||||
|
||||
const USER_AGENT: &str = "storyteller-web/1.0";
|
||||
|
||||
// TODO(bt, 2025-06-03): Don't load the entire file into memory!
|
||||
|
||||
/// Downloads a (binary) file to memory. Good for images, etc. Not great for large files.
|
||||
pub async fn http_download_url_to_bytes<U: IntoUrl>(url: U) -> AnyhowResult<Bytes> {
|
||||
pub async fn http_download_url_to_bytes(url: &str) -> AnyhowResult<Bytes> {
|
||||
let client = Client::builder()
|
||||
.gzip(true)
|
||||
.build()?;
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
use crate::util::http_download_url_to_bytes::http_download_url_to_bytes;
|
||||
use errors::AnyhowResult;
|
||||
use reqwest::IntoUrl;
|
||||
use std::io::Write;
|
||||
use tempfile::NamedTempFile;
|
||||
|
||||
const USER_AGENT: &str = "storyteller-web/1.0";
|
||||
|
||||
/// Downloads a (binary) file to a filesystem path. Good for images, etc. Not great for large files.
|
||||
pub async fn http_download_url_to_tempfile<U: IntoUrl>(url: U, temp_file: &mut NamedTempFile) -> AnyhowResult<()> {
|
||||
pub async fn http_download_url_to_tempfile(url: &str, temp_file: &mut NamedTempFile) -> AnyhowResult<()> {
|
||||
let bytes = http_download_url_to_bytes(url).await?;
|
||||
temp_file.write_all(&bytes)?;
|
||||
Ok(())
|
||||
|
||||
Reference in new issue
Block a user