You've already forked AstralRinth
forked from didirus/AstralRinth
f48959a816
* basic framework. still has errors * added functionality for main endpoints + some structuring * formatting * unused code * mimicked CLI function with wait_for process * made PR changes, added playground * cargo fmt * removed missed println * misc tests fixes * cargo fmt * added windows support * cargo fmt * all OS use dunce * restructured profile slightly; fixed mac bug * profile changes, new main.rs * fixed requested pr + canonicaliation bug * fixed regressed bug in ui * fixed regressed bugs * fixed git error * typo * ran prettier * clippy * playground clippy * ported profile loading fix * profile change for real, url println and clippy * PR changes --------- Co-authored-by: Wyatt <wyatt@modrinth.com>
74 lines
2.0 KiB
JavaScript
74 lines
2.0 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/tauri'
|
|
|
|
// Add empty default instance
|
|
export async function addDefaultInstance() {
|
|
return await invoke('profile_create_empty')
|
|
}
|
|
|
|
// Add empty default instance
|
|
export async function create() {
|
|
return await invoke('profile_create')
|
|
}
|
|
|
|
// Add a profile to the in-memory state
|
|
export async function add(profile) {
|
|
return await invoke('profile_add', profile)
|
|
}
|
|
|
|
// Add a path as a profile in-memory
|
|
export async function add_path(path) {
|
|
return await invoke('profile_add_path', path)
|
|
}
|
|
|
|
// Remove a profile
|
|
export async function remove(path) {
|
|
return await invoke('profile_remove', path)
|
|
}
|
|
|
|
// Get a profile by path
|
|
export async function get(path) {
|
|
return await invoke('profile_get', path)
|
|
}
|
|
|
|
// Check if a pathed profile is already managed by Theseus
|
|
export async function is_managed(path) {
|
|
return await invoke('profile_is_managed', path)
|
|
}
|
|
|
|
// Check if a pathed profile is loaded
|
|
export async function is_loaded(path) {
|
|
return await invoke('profile_is_loaded', path)
|
|
}
|
|
|
|
// Get a copy of the profile set
|
|
export async function list() {
|
|
return await invoke('profile_list')
|
|
}
|
|
|
|
// Run Minecraft using a pathed profile
|
|
// Returns PID of child
|
|
export async function run(path, credentials) {
|
|
return await invoke('profile_run', path, credentials)
|
|
}
|
|
|
|
// Run Minecraft using a pathed profile
|
|
// Waits for end
|
|
export async function run_wait(path, credentials) {
|
|
return await invoke('run_wait', path, credentials)
|
|
}
|
|
|
|
// Tries to kill a running minecraft process (if PID is still stored)
|
|
export async function kill(child_pid) {
|
|
return await invoke('profile_kill', child_pid)
|
|
}
|
|
|
|
// Wait for a running minecraft process (a Child)
|
|
export async function wait_for(child_pid) {
|
|
return await invoke('profile_wait_for', child_pid)
|
|
}
|