fix decompiling history into git; enable output-folder for git related features #7
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -110,7 +110,7 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asset-tool"
|
name = "asset-tool"
|
||||||
version = "0.4.2"
|
version = "0.4.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
workspace = { members = ["rbx_asset", "rox_compiler"] }
|
workspace = { members = ["rbx_asset", "rox_compiler"] }
|
||||||
[package]
|
[package]
|
||||||
name = "asset-tool"
|
name = "asset-tool"
|
||||||
version = "0.4.2"
|
version = "0.4.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
39
src/main.rs
39
src/main.rs
@ -193,12 +193,14 @@ struct CompileSubcommand{
|
|||||||
struct CompileUploadAssetSubcommand{
|
struct CompileUploadAssetSubcommand{
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
asset_id:AssetID,
|
asset_id:AssetID,
|
||||||
#[arg(long,group="api_key",required=true)]
|
#[arg(long,group="cookie",required=true)]
|
||||||
api_key_literal:Option<String>,
|
cookie_literal:Option<String>,
|
||||||
#[arg(long,group="api_key",required=true)]
|
#[arg(long,group="cookie",required=true)]
|
||||||
api_key_envvar:Option<String>,
|
cookie_envvar:Option<String>,
|
||||||
#[arg(long,group="api_key",required=true)]
|
#[arg(long,group="cookie",required=true)]
|
||||||
api_key_file:Option<PathBuf>,
|
cookie_file:Option<PathBuf>,
|
||||||
|
#[arg(long)]
|
||||||
|
group_id:Option<u64>,
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
input_folder:Option<PathBuf>,
|
input_folder:Option<PathBuf>,
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
@ -462,12 +464,13 @@ async fn main()->AResult<()>{
|
|||||||
input_folder:subcommand.input_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
|
input_folder:subcommand.input_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
|
||||||
template:subcommand.template,
|
template:subcommand.template,
|
||||||
style:subcommand.style.map(|s|s.rox()),
|
style:subcommand.style.map(|s|s.rox()),
|
||||||
api_key:api_key_from_args(
|
cookie:cookie_from_args(
|
||||||
subcommand.api_key_literal,
|
subcommand.cookie_literal,
|
||||||
subcommand.api_key_envvar,
|
subcommand.cookie_envvar,
|
||||||
subcommand.api_key_file,
|
subcommand.cookie_file,
|
||||||
).await?,
|
).await?,
|
||||||
asset_id:subcommand.asset_id,
|
asset_id:subcommand.asset_id,
|
||||||
|
group_id:subcommand.group_id,
|
||||||
}).await,
|
}).await,
|
||||||
Commands::CompileUploadPlace(subcommand)=>compile_upload_place(CompileUploadPlaceConfig{
|
Commands::CompileUploadPlace(subcommand)=>compile_upload_place(CompileUploadPlaceConfig{
|
||||||
input_folder:subcommand.input_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
|
input_folder:subcommand.input_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
|
||||||
@ -522,7 +525,7 @@ async fn cookie_from_args(literal:Option<String>,environment:Option<String>,file
|
|||||||
(Some(cookie_literal),None,None)=>cookie_literal,
|
(Some(cookie_literal),None,None)=>cookie_literal,
|
||||||
(None,Some(cookie_environment),None)=>std::env::var(cookie_environment)?,
|
(None,Some(cookie_environment),None)=>std::env::var(cookie_environment)?,
|
||||||
(None,None,Some(cookie_file))=>tokio::fs::read_to_string(cookie_file).await?,
|
(None,None,Some(cookie_file))=>tokio::fs::read_to_string(cookie_file).await?,
|
||||||
_=>Err(anyhow::Error::msg("Illegal api key argument triple"))?,
|
_=>Err(anyhow::Error::msg("Illegal cookie argument triple"))?,
|
||||||
};
|
};
|
||||||
Ok(Cookie::new(format!(".ROBLOSECURITY={cookie}")))
|
Ok(Cookie::new(format!(".ROBLOSECURITY={cookie}")))
|
||||||
}
|
}
|
||||||
@ -1137,7 +1140,8 @@ struct CompileUploadAssetConfig{
|
|||||||
input_folder:PathBuf,
|
input_folder:PathBuf,
|
||||||
template:Option<PathBuf>,
|
template:Option<PathBuf>,
|
||||||
style:Option<rox_compiler::Style>,
|
style:Option<rox_compiler::Style>,
|
||||||
api_key:ApiKey,
|
cookie:Cookie,
|
||||||
|
group_id:Option<u64>,
|
||||||
asset_id:AssetID,
|
asset_id:AssetID,
|
||||||
}
|
}
|
||||||
async fn compile_upload_asset(config:CompileUploadAssetConfig)->AResult<()>{
|
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())?;
|
rbx_binary::to_writer(std::io::Cursor::new(&mut data),&dom,dom.root().children())?;
|
||||||
|
|
||||||
//upload it
|
//upload it
|
||||||
let context=CloudContext::new(config.api_key);
|
let context=CookieContext::new(config.cookie);
|
||||||
let resp=context.update_asset(rbx_asset::cloud::UpdateAssetRequest{
|
let resp=context.upload(rbx_asset::cookie::UploadRequest{
|
||||||
assetId:config.asset_id,
|
groupId:config.group_id,
|
||||||
displayName:None,
|
assetid:config.asset_id,
|
||||||
|
name:None,
|
||||||
description:None,
|
description:None,
|
||||||
|
ispublic:None,
|
||||||
|
allowComments:None,
|
||||||
},data).await?;
|
},data).await?;
|
||||||
println!("UploadResponse={:?}",resp);
|
println!("UploadResponse={:?}",resp);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user