diff --git a/src/main.rs b/src/main.rs index d258ee8..b014d63 100644 --- a/src/main.rs +++ b/src/main.rs @@ -193,12 +193,14 @@ struct CompileSubcommand{ struct CompileUploadAssetSubcommand{ #[arg(long)] asset_id:AssetID, - #[arg(long,group="api_key",required=true)] - api_key_literal:Option, - #[arg(long,group="api_key",required=true)] - api_key_envvar:Option, - #[arg(long,group="api_key",required=true)] - api_key_file:Option, + #[arg(long,group="cookie",required=true)] + cookie_literal:Option, + #[arg(long,group="cookie",required=true)] + cookie_envvar:Option, + #[arg(long,group="cookie",required=true)] + cookie_file:Option, + #[arg(long)] + group_id:Option, #[arg(long)] input_folder:Option, #[arg(long)] @@ -462,12 +464,13 @@ async fn main()->AResult<()>{ input_folder:subcommand.input_folder.unwrap_or_else(||std::env::current_dir().unwrap()), template:subcommand.template, style:subcommand.style.map(|s|s.rox()), - api_key:api_key_from_args( - subcommand.api_key_literal, - subcommand.api_key_envvar, - subcommand.api_key_file, + cookie:cookie_from_args( + subcommand.cookie_literal, + subcommand.cookie_envvar, + subcommand.cookie_file, ).await?, asset_id:subcommand.asset_id, + group_id:subcommand.group_id, }).await, Commands::CompileUploadPlace(subcommand)=>compile_upload_place(CompileUploadPlaceConfig{ input_folder:subcommand.input_folder.unwrap_or_else(||std::env::current_dir().unwrap()), @@ -1137,7 +1140,8 @@ struct CompileUploadAssetConfig{ input_folder:PathBuf, template:Option, style:Option, - api_key:ApiKey, + cookie:Cookie, + group_id:Option, asset_id:AssetID, } async fn compile_upload_asset(config:CompileUploadAssetConfig)->AResult<()>{ @@ -1157,11 +1161,14 @@ async fn compile_upload_asset(config:CompileUploadAssetConfig)->AResult<()>{ rbx_binary::to_writer(std::io::Cursor::new(&mut data),&dom,dom.root().children())?; //upload it - let context=CloudContext::new(config.api_key); - let resp=context.update_asset(rbx_asset::cloud::UpdateAssetRequest{ - assetId:config.asset_id, - displayName:None, + let context=CookieContext::new(config.cookie); + let resp=context.upload(rbx_asset::cookie::UploadRequest{ + groupId:config.group_id, + assetid:config.asset_id, + name:None, description:None, + ispublic:None, + allowComments:None, },data).await?; println!("UploadResponse={:?}",resp); Ok(())