Skip to content

Commit

Permalink
Hotfix to remove my hardcoded user ID
Browse files Browse the repository at this point in the history
  • Loading branch information
jackTabsCode committed Mar 7, 2024
1 parent 1d25bc4 commit c83abef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ struct Args {
/// Generate a TypeScript definition file for roblox-ts users.
#[arg(short, long)]
typescript: bool,

#[arg(short, long)]
user_id: u64,
}

const LOCKFILE_PATH: &str = "asphalt.lock.toml";
Expand Down Expand Up @@ -102,7 +105,8 @@ async fn main() {
}

if asset_id.is_none() {
asset_id = Some(upload_asset(path.clone(), asset_type, api_key.clone()).await);
asset_id =
Some(upload_asset(path.clone(), asset_type, api_key.clone(), args.user_id).await);
println!("Uploaded {}", style(path_str).green());
}

Expand Down
9 changes: 7 additions & 2 deletions src/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ async fn get_image_id(asset_id: u64) -> u64 {
id_str.parse::<u64>().unwrap()
}

pub async fn upload_asset(path: PathBuf, asset_type: AssetType, api_key: String) -> u64 {
pub async fn upload_asset(
path: PathBuf,
asset_type: AssetType,
api_key: String,
user_id: u64,
) -> u64 {
let path_str = path.to_str().unwrap();

let create_params = CreateAssetParams {
Expand All @@ -74,7 +79,7 @@ pub async fn upload_asset(path: PathBuf, asset_type: AssetType, api_key: String)
display_name: path_str.to_string(),
creation_context: AssetCreationContext {
creator: AssetCreator::User(AssetUserCreator {
user_id: "9670971".to_string(),
user_id: user_id.to_string(),
}),
expected_price: None,
},
Expand Down

0 comments on commit c83abef

Please sign in to comment.