Enhance Roblox API integration and refactor CLI commands

- Updated the `clap` dependency in `Cargo.toml` to include the "env" feature for improved command-line argument handling.
- Introduced a new `roblox_api` module to encapsulate Roblox API interactions, including authentication and asset downloading.
- Refactored the `CloneCommand` and `StudioCommand` to utilize the new `roblox_api` functions for fetching experience names and universe IDs, enhancing code clarity and reducing duplication.
- Removed obsolete functions related to Roblox API calls from the CLI commands, streamlining the codebase.
- Added error handling for authentication failures, ensuring better user feedback when required credentials are missing.

These changes aim to improve the overall structure and functionality of the CLI while enhancing the integration with the Roblox API.
This commit is contained in:
Joe 2026-03-01 20:03:40 -06:00
parent fb46515913
commit 9934094dbc
22 changed files with 2427 additions and 161 deletions

View file

@ -12,7 +12,7 @@ use serde_json::Value;
use crate::serve_session::ServeSession;
use super::resolve_path;
use super::{resolve_path, GlobalOptions};
const ASSETS_API_BASE: &str = "https://apis.roblox.com/assets/v1";
const MAX_OPERATION_RETRIES: u32 = 10;
@ -50,7 +50,7 @@ pub struct UploadCommand {
}
impl UploadCommand {
pub fn run(self) -> Result<(), anyhow::Error> {
pub fn run(self, global: GlobalOptions) -> Result<(), anyhow::Error> {
let project_path = resolve_path(&self.project);
let vfs = Vfs::new_default();
@ -71,7 +71,9 @@ impl UploadCommand {
log::trace!("Encoding binary model");
rbx_binary::to_writer(&mut buffer, tree.inner(), &encode_ids)?;
match (self.cookie, self.api_key, self.universe_id) {
let api_key = self.api_key.or(global.opencloud);
match (self.cookie, api_key, self.universe_id) {
(cookie, None, universe) => {
// Legacy cookie auth
if universe.is_some() {