Implement Nexus integration #54

Merged
lucas merged 15 commits from feat/nexus into master 2023-03-15 21:43:37 +01:00
2 changed files with 5 additions and 15 deletions
Showing only changes of commit ac44883199 - Show all commits

View file

@ -32,11 +32,7 @@ pub(crate) async fn import_mod(state: ActionState, info: FileInfo) -> Result<Mod
.file_name() .file_name()
.and_then(|s| s.to_str()) .and_then(|s| s.to_str())
.and_then(NexusApi::parse_file_name) .and_then(NexusApi::parse_file_name)
.map(|(_, id, version, updated)| NexusInfo { .map(|(_, id, version, _)| NexusInfo { id, version });
id,
version,
updated,
});
let mut archive = ZipArchive::new(data).wrap_err("Failed to open ZIP archive")?; let mut archive = ZipArchive::new(data).wrap_err("Failed to open ZIP archive")?;
@ -382,7 +378,6 @@ async fn check_mod_update(info: Arc<ModInfo>, api: Arc<NexusApi>) -> Result<Opti
let updated_nexus = NexusInfo { let updated_nexus = NexusInfo {
id: nexus.id, id: nexus.id,
version: updated_info.version, version: updated_info.version,
updated: updated_info.updated_timestamp,
}; };
let mut info = Arc::unwrap_or_clone(info); let mut info = Arc::unwrap_or_clone(info);

View file

@ -1,11 +1,9 @@
use std::{path::PathBuf, sync::Arc}; use std::path::PathBuf;
use std::sync::Arc;
use druid::{ use druid::im::{HashMap, Vector};
im::{HashMap, Vector}, use druid::{Data, ImageBuf, Lens, WindowHandle, WindowId};
Data, ImageBuf, Lens, WindowHandle, WindowId,
};
use dtmt_shared::ModConfig; use dtmt_shared::ModConfig;
use time::OffsetDateTime;
use super::SelectedModLens; use super::SelectedModLens;
@ -74,9 +72,6 @@ impl From<dtmt_shared::ModDependency> for ModDependency {
pub(crate) struct NexusInfo { pub(crate) struct NexusInfo {
pub id: u64, pub id: u64,
pub version: String, pub version: String,
#[data(ignore)]
#[serde(with = "time::serde::timestamp")]
pub updated: OffsetDateTime,
} }
#[derive(Clone, Data, Debug, Lens)] #[derive(Clone, Data, Debug, Lens)]