Handle NXM URIs #150
2 changed files with 35 additions and 2 deletions
|
@ -468,7 +468,7 @@ pub(crate) async fn import_from_nxm(state: ActionState, uri: String) -> Result<M
|
||||||
import_mod(state, Some((nexus, file_info.version)), data).await
|
import_mod(state, Some((nexus, file_info.version)), data).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(state))]
|
#[tracing::instrument(skip(state, data), fields(data = data.len()))]
|
||||||
pub(crate) async fn import_mod(
|
pub(crate) async fn import_mod(
|
||||||
state: ActionState,
|
state: ActionState,
|
||||||
nexus: Option<(NexusInfo, String)>,
|
nexus: Option<(NexusInfo, String)>,
|
||||||
|
|
|
@ -95,7 +95,7 @@ impl From<NexusMod> for NexusInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Data, Debug, Lens)]
|
#[derive(Clone, Data, Lens)]
|
||||||
pub(crate) struct ModInfo {
|
pub(crate) struct ModInfo {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
@ -118,6 +118,39 @@ pub(crate) struct ModInfo {
|
||||||
pub nexus: Option<NexusInfo>,
|
pub nexus: Option<NexusInfo>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl std::fmt::Debug for ModInfo {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
f.debug_struct("ModInfo")
|
||||||
|
.field("id", &self.id)
|
||||||
|
.field("name", &self.name)
|
||||||
|
.field("summary", &self.summary)
|
||||||
|
.field(
|
||||||
|
"description",
|
||||||
|
&(match &self.description {
|
||||||
|
Some(desc) => format!("Some(String[0..{}])", desc.len()),
|
||||||
|
None => "None".to_string(),
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.field("categories", &self.categories)
|
||||||
|
.field("author", &self.author)
|
||||||
|
.field(
|
||||||
|
"image",
|
||||||
|
&(match &self.image {
|
||||||
|
Some(image) => format!("Some(ImageBuf[{}x{}])", image.width(), image.height()),
|
||||||
|
None => "None".to_string(),
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.field("version", &self.version)
|
||||||
|
.field("enabled", &self.enabled)
|
||||||
|
.field("packages", &format!("Vec[0..{}]", self.packages.len()))
|
||||||
|
.field("resources", &self.resources)
|
||||||
|
.field("depends", &self.depends)
|
||||||
|
.field("bundled", &self.bundled)
|
||||||
|
.field("nexus", &self.nexus)
|
||||||
|
.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ModInfo {
|
impl ModInfo {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
cfg: ModConfig,
|
cfg: ModConfig,
|
||||||
|
|
Loading…
Add table
Reference in a new issue