Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
258 changes: 241 additions & 17 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ image = "0.25.2"
webp = "0.3"
slug = "0.1"

reqwest = { version = "0.12", features = ["blocking"] }
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reqwest dependency is configured with only the "blocking" feature, which is appropriate for the current blocking implementation. However, if you convert the import_from_git_repo function to async (as recommended in another comment), you should remove the "blocking" feature and let reqwest use its default async implementation, or explicitly enable the necessary features for async operation.

Suggested change
reqwest = { version = "0.12", features = ["blocking"] }
reqwest = "0.12"

Copilot uses AI. Check for mistakes.
flate2 = "1"
tar = "0.4"

tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tracing-appender = "0.2"
Expand Down
38 changes: 36 additions & 2 deletions src-tauri/src/commands/workshop.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::error::{AppResult, IpcResult, MutexResultExt};
use crate::state::SettingsState;
use crate::workshop::{
CreateProjectArgs, PackProjectArgs, PackResult, SaveProjectConfigArgs, ValidationResult,
WorkshopProject, WorkshopState,
CreateProjectArgs, FantomePeekResult, ImportFantomeArgs, ImportGitRepoArgs, PackProjectArgs,
PackResult, SaveProjectConfigArgs, ValidationResult, WorkshopProject, WorkshopState,
};
use std::collections::HashMap;
use tauri::State;
Expand Down Expand Up @@ -86,6 +86,40 @@ pub fn import_from_modpkg(
result.into()
}

#[tauri::command]
pub fn peek_fantome(
file_path: String,
workshop: State<WorkshopState>,
) -> IpcResult<FantomePeekResult> {
workshop.0.peek_fantome(&file_path).into()
}

#[tauri::command]
pub fn import_from_fantome(
args: ImportFantomeArgs,
workshop: State<WorkshopState>,
settings: State<SettingsState>,
) -> IpcResult<WorkshopProject> {
let result: AppResult<WorkshopProject> = (|| {
let settings = settings.0.lock().mutex_err()?.clone();
workshop.0.import_from_fantome(&settings, args)
})();
result.into()
}

#[tauri::command]
pub fn import_from_git_repo(
args: ImportGitRepoArgs,
workshop: State<WorkshopState>,
settings: State<SettingsState>,
) -> IpcResult<WorkshopProject> {
let result: AppResult<WorkshopProject> = (|| {
let settings = settings.0.lock().mutex_err()?.clone();
workshop.0.import_from_git_repo(&settings, args)
})();
result.into()
}

#[tauri::command]
pub fn validate_project(
project_path: String,
Expand Down
7 changes: 7 additions & 0 deletions src-tauri/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ pub enum ErrorCode {
ProjectAlreadyExists,
/// Failed to pack workshop project
PackFailed,
/// Error processing a .fantome file
Fantome,
/// WAD file error
Wad,
/// Operation blocked because the patcher is running
Expand Down Expand Up @@ -184,6 +186,9 @@ pub enum AppError {
#[error("Failed to pack project: {0}")]
PackFailed(String),

#[error("Fantome error: {0}")]
Fantome(String),

#[error("WAD error: {0}")]
WadError(#[from] ltk_wad::WadError),

Expand Down Expand Up @@ -253,6 +258,8 @@ impl From<AppError> for AppErrorResponse {

AppError::PackFailed(msg) => AppErrorResponse::new(ErrorCode::PackFailed, msg),

AppError::Fantome(msg) => AppErrorResponse::new(ErrorCode::Fantome, msg),

AppError::WadError(e) => AppErrorResponse::new(ErrorCode::Wad, e.to_string()),

AppError::WadBuilderError(e) => AppErrorResponse::new(ErrorCode::Wad, e.to_string()),
Expand Down
3 changes: 3 additions & 0 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ fn main() {
commands::delete_workshop_project,
commands::pack_workshop_project,
commands::import_from_modpkg,
commands::peek_fantome,
commands::import_from_fantome,
commands::import_from_git_repo,
commands::validate_project,
commands::set_project_thumbnail,
commands::get_project_thumbnail,
Expand Down
48 changes: 47 additions & 1 deletion src-tauri/src/workshop/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use tauri::AppHandle;
/// Holds the `AppHandle` for consistency with `ModLibrary`.
/// Settings are passed per-call since they can change at runtime.
pub struct Workshop {
#[allow(dead_code)]
app_handle: AppHandle,
}

Expand Down Expand Up @@ -87,6 +86,53 @@ pub struct WorkshopLayer {
pub string_overrides: HashMap<String, HashMap<String, String>>,
}

/// Metadata peeked from a .fantome archive without extracting content.
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct FantomePeekResult {
pub name: String,
pub author: String,
pub version: String,
pub description: String,
pub wad_files: Vec<String>,
pub suggested_name: String,
}

/// Arguments for importing a .fantome archive.
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ImportFantomeArgs {
pub file_path: String,
pub name: String,
pub display_name: String,
}

/// Progress event emitted during fantome import.
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct FantomeImportProgress {
pub stage: String,
pub current_wad: Option<String>,
pub current: u32,
pub total: u32,
}

/// Arguments for importing a project from a GitHub repository.
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ImportGitRepoArgs {
pub url: String,
pub branch: Option<String>,
}

/// Progress event emitted during git repo import.
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct GitImportProgress {
pub stage: String,
pub message: Option<String>,
}

/// Arguments for creating a new project.
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
Expand Down
Loading