use old api for download, error on http status #4

Merged
Quaternions merged 6 commits from staging into master 2024-07-16 18:21:06 +00:00
Showing only changes of commit f32cd104b6 - Show all commits

View File

@ -58,12 +58,12 @@ struct DownloadHistorySubcommand{
}
#[derive(Args)]
struct DownloadSubcommand{
#[arg(long,group="api_key",required=true)]
api_key_literal:Option<String>,
#[arg(long,group="api_key",required=true)]
api_key_envvar:Option<String>,
#[arg(long,group="api_key",required=true)]
api_key_file:Option<PathBuf>,
#[arg(long,group="cookie",required=true)]
cookie_literal:Option<String>,
#[arg(long,group="cookie",required=true)]
cookie_envvar:Option<String>,
#[arg(long,group="cookie",required=true)]
cookie_file:Option<PathBuf>,
#[arg(long)]
output_folder:Option<PathBuf>,
#[arg(required=true)]
@ -358,10 +358,10 @@ async fn main()->AResult<()>{
Commands::Download(subcommand)=>{
let output_folder=subcommand.output_folder.unwrap_or_else(||std::env::current_dir().unwrap());
download_list(
api_key_from_args(
subcommand.api_key_literal,
subcommand.api_key_envvar,
subcommand.api_key_file,
cookie_from_args(
subcommand.cookie_literal,
subcommand.cookie_envvar,
subcommand.cookie_file,
).await?,
subcommand.asset_ids.into_iter().map(|asset_id|{
let mut path=output_folder.clone();
@ -645,13 +645,13 @@ async fn upload_place(config:UploadPlaceConfig)->AResult<()>{
Ok(())
}
async fn download_list(api_key:ApiKey,asset_id_file_map:AssetIDFileMap)->AResult<()>{
let context=CloudContext::new(api_key);
async fn download_list(cookie:Cookie,asset_id_file_map:AssetIDFileMap)->AResult<()>{
let context=CookieContext::new(cookie);
futures::stream::iter(asset_id_file_map.into_iter()
.map(|(asset_id,file)|{
let context=&context;
async move{
Ok((file,context.get_asset(rbx_asset::cloud::GetAssetRequest{asset_id,version:None}).await?))
Ok((file,context.get_asset(rbx_asset::cookie::GetAssetRequest{asset_id,version:None}).await?))
}
}))
.buffer_unordered(CONCURRENT_REQUESTS)