You've already forked AstralRinth
forked from didirus/AstralRinth
Migrate to SQLite for Internal Launcher Data (#1300)
* initial migration * barebones profiles * Finish profiles * Add back file watcher * UI support progress * Finish most of cache * Fix options page * Fix forge, finish modrinth auth * Accounts, process cache * Run SQLX prepare * Finish * Run lint + actions * Fix version to be compat with windows * fix lint * actually fix lint * actually fix lint again
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
use crate::api::Result;
|
||||
use theseus::logs::LogType;
|
||||
use theseus::{
|
||||
logs::{self, CensoredString, LatestLogCursor, Logs},
|
||||
prelude::ProfilePathId,
|
||||
};
|
||||
use theseus::logs::{self, CensoredString, LatestLogCursor, Logs};
|
||||
|
||||
/*
|
||||
A log is a struct containing the filename string, stdout, and stderr, as follows:
|
||||
@@ -31,7 +28,7 @@ pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
|
||||
/// Get all Logs for a profile, sorted by filename
|
||||
#[tauri::command]
|
||||
pub async fn logs_get_logs(
|
||||
profile_path: ProfilePathId,
|
||||
profile_path: &str,
|
||||
clear_contents: Option<bool>,
|
||||
) -> Result<Vec<Logs>> {
|
||||
let val = logs::get_logs(profile_path, clear_contents).await?;
|
||||
@@ -42,7 +39,7 @@ pub async fn logs_get_logs(
|
||||
/// Get a Log struct for a profile by profile id and filename string
|
||||
#[tauri::command]
|
||||
pub async fn logs_get_logs_by_filename(
|
||||
profile_path: ProfilePathId,
|
||||
profile_path: &str,
|
||||
log_type: LogType,
|
||||
filename: String,
|
||||
) -> Result<Logs> {
|
||||
@@ -52,37 +49,23 @@ pub async fn logs_get_logs_by_filename(
|
||||
/// Get the stdout for a profile by profile id and filename string
|
||||
#[tauri::command]
|
||||
pub async fn logs_get_output_by_filename(
|
||||
profile_path: ProfilePathId,
|
||||
profile_path: &str,
|
||||
log_type: LogType,
|
||||
filename: String,
|
||||
) -> Result<CensoredString> {
|
||||
let profile_path = if let Some(p) =
|
||||
crate::profile::get(&profile_path, None).await?
|
||||
{
|
||||
p.profile_id()
|
||||
} else {
|
||||
return Err(theseus::Error::from(
|
||||
theseus::ErrorKind::UnmanagedProfileError(profile_path.to_string()),
|
||||
)
|
||||
.into());
|
||||
};
|
||||
|
||||
Ok(
|
||||
logs::get_output_by_filename(&profile_path, log_type, &filename)
|
||||
.await?,
|
||||
)
|
||||
Ok(logs::get_output_by_filename(profile_path, log_type, &filename).await?)
|
||||
}
|
||||
|
||||
/// Delete all logs for a profile by profile id
|
||||
#[tauri::command]
|
||||
pub async fn logs_delete_logs(profile_path: ProfilePathId) -> Result<()> {
|
||||
pub async fn logs_delete_logs(profile_path: &str) -> Result<()> {
|
||||
Ok(logs::delete_logs(profile_path).await?)
|
||||
}
|
||||
|
||||
/// Delete a log for a profile by profile id and filename string
|
||||
#[tauri::command]
|
||||
pub async fn logs_delete_logs_by_filename(
|
||||
profile_path: ProfilePathId,
|
||||
profile_path: &str,
|
||||
log_type: LogType,
|
||||
filename: String,
|
||||
) -> Result<()> {
|
||||
@@ -95,7 +78,7 @@ pub async fn logs_delete_logs_by_filename(
|
||||
/// Get live log from a cursor
|
||||
#[tauri::command]
|
||||
pub async fn logs_get_latest_log_cursor(
|
||||
profile_path: ProfilePathId,
|
||||
profile_path: &str,
|
||||
cursor: u64, // 0 to start at beginning of file
|
||||
) -> Result<LatestLogCursor> {
|
||||
Ok(logs::get_latest_log_cursor(profile_path, cursor).await?)
|
||||
|
||||
Reference in New Issue
Block a user