diff --git a/packages/client/src/hooks/usePlausible.ts b/packages/client/src/hooks/usePlausible.ts index af16b7cf..a7bacab8 100644 --- a/packages/client/src/hooks/usePlausible.ts +++ b/packages/client/src/hooks/usePlausible.ts @@ -249,7 +249,7 @@ export interface PlausibleMonitorProps { } /** - * Submits a Plausible Analytics `pageview` event with a hook. + * Submits a Plausible Analytics `'pageview'` event with a hook. * * This should watch the Solid router's current path, and send an event if the path is changed. * @@ -274,7 +274,7 @@ export function usePlausiblePageview({ currentPath }: PlausibleMonitorProps): vo } /** - * Submits a Plausible Analytics `ping` event with a hook. + * Submits a Plausible Analytics `'ping'` event with a hook. * * This should watch the Solid router's current path, and send an event if the path is changed. * diff --git a/packages/core/src/store/package.rs b/packages/core/src/store/package.rs index b28cf7df..e4b3e3f7 100644 --- a/packages/core/src/store/package.rs +++ b/packages/core/src/store/package.rs @@ -1,15 +1,10 @@ //! Handlers for Mod metadata that can be displayed in a GUI mod list or exported as a mod pack -#[allow(clippy::all)] use async_zip::tokio::read::fs::ZipFileReader; use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; -use sha2::Digest; use std::collections::HashMap; use std::path::{Path, PathBuf}; -use tokio::io::AsyncReadExt; - -use crate::prelude::IOError; use crate::utils::http::{self, write_icon, FetchSemaphore, IoSemaphore}; use crate::State; @@ -19,65 +14,17 @@ use super::{Cluster, PackagePath}; /// Creates [`Package`] data for a given [`Cluster`] from on-device files and APIs. /// Paths must be the full paths and not relative paths. -#[tracing::instrument(skip(paths, _cluster, _io_semaphore, _fetch_semaphore))] +#[tracing::instrument(skip(_paths, _cluster, _io_semaphore, _fetch_semaphore))] #[onelauncher_macros::memory] pub async fn generate_context( _cluster: Cluster, - paths: Vec, + _paths: Vec, _cache_path: PathBuf, _io_semaphore: &IoSemaphore, _fetch_semaphore: &FetchSemaphore, // credentials: &Credentials, ) -> crate::Result> { - let mut handles = vec![]; - - for path in paths { - if !path.exists() { - continue; - } - if let Some(ext) = path.extension() { - if ext == "txt" { - continue; - } - } - - let handle = tokio::spawn(async move { - let mut file = tokio::fs::File::open(path.clone()) - .await - .map_err(|e| IOError::with_path(e, &path))?; - - let mut buffer = [0u8; 65536]; - let mut hasher = sha2::Sha512::new(); - - loop { - let read = file.read(&mut buffer).await.map_err(IOError::from)?; - if read == 0 { - break; - } - hasher.update(&buffer[..read]); - } - - let hash = format!("{:x}", hasher.finalize()); - Ok::<_, crate::Error>((hash, path)) - }); - - handles.push(handle); - } - - let mut file_path_hashes = HashMap::new(); - - for handle in handles { - let (hash, path) = handle.await??; - file_path_hashes.insert(hash, path); - } - let result = HashMap::new(); - // TODO(pauline): Finish this - // let mut stream = tokio_stream::iter(result_packages); - // while let Some((k, v)) = stream.next().await { - // let k = PackagePath::from_path(k).await?; - // result.insert(k, v); - // } Ok(result) }