forked from didirus/AstralRinth
* feat(theseus): Initial migration to Tauri v2 * feat(theseus): Added a way to zoom / scale UI * chore(theseus): Started cleaning up some plugins * fix(theseus): Github Actions * refactor(theseus): Reduced boilerplate & more work * feat(theseus): Allow multiple app instances to be open at once (#995) * fix(theseus): Lint & more * fix(theseus): App Release github action * fix(theseus): Open links in browser & macos builds * fix(theseus): Rebase fixes * fix(theseus): Updater & app release action * fix(theseus): Fixed definitions in `build.rs` * Fix MacOS deep linking, window decorations * fix(theseus): Closing & maximizing app * Fix macos build * add back release conf * acc fix build * make updater for release builds only * focus window on startup --------- Co-authored-by: Jai A <jaiagr+gpg@pm.me> Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
62 lines
2.1 KiB
JavaScript
62 lines
2.1 KiB
JavaScript
/**
|
|
* All theseus API calls return serialized values (both return values and errors);
|
|
* So, for example, addDefaultInstance creates a blank Profile object, where the Rust struct is serialized,
|
|
* and deserialized into a usable JS object.
|
|
*/
|
|
import { invoke } from '@tauri-apps/api/core'
|
|
|
|
/*
|
|
A log is a struct containing the filename string, stdout, and stderr, as follows:
|
|
|
|
pub struct Logs {
|
|
pub filename: String,
|
|
pub stdout: String,
|
|
pub stderr: String,
|
|
}
|
|
*/
|
|
|
|
/// Get all logs that exist for a given profile
|
|
/// This is returned as an array of Log objects, sorted by filename (the folder name, when the log was created)
|
|
export async function get_logs(profilePath, clearContents) {
|
|
return await invoke('plugin:logs|logs_get_logs', { profilePath, clearContents })
|
|
}
|
|
|
|
/// Get a profile's log by filename
|
|
export async function get_logs_by_filename(profilePath, logType, filename) {
|
|
return await invoke('plugin:logs|logs_get_logs_by_filename', { profilePath, logType, filename })
|
|
}
|
|
|
|
/// Get a profile's log text only by filename
|
|
export async function get_output_by_filename(profilePath, logType, filename) {
|
|
return await invoke('plugin:logs|logs_get_output_by_filename', { profilePath, logType, filename })
|
|
}
|
|
|
|
/// Delete a profile's log by filename
|
|
export async function delete_logs_by_filename(profilePath, logType, filename) {
|
|
return await invoke('plugin:logs|logs_delete_logs_by_filename', {
|
|
profilePath,
|
|
logType,
|
|
filename,
|
|
})
|
|
}
|
|
|
|
/// Delete all logs for a given profile
|
|
export async function delete_logs(profilePath) {
|
|
return await invoke('plugin:logs|logs_delete_logs', { profilePath })
|
|
}
|
|
|
|
/// Get the latest log for a given profile and cursor (startpoint to read withi nthe file)
|
|
/// Returns:
|
|
/*
|
|
{
|
|
cursor: u64
|
|
output: String
|
|
new_file: bool <- the cursor was too far, meaning that the file was likely rotated/reset. This signals to the frontend to clear the log and start over with this struct.
|
|
}
|
|
*/
|
|
|
|
// From latest.log directly
|
|
export async function get_latest_log_cursor(profilePath, cursor) {
|
|
return await invoke('plugin:logs|logs_get_latest_log_cursor', { profilePath, cursor })
|
|
}
|