You've already forked AstralRinth
forked from didirus/AstralRinth
Compiler improvements (#145)
* Initial bug fixes * fix compile error on non-mac * Fix even more bugs * Fix more * fix more * fix build * fix build * working basic * removed zip * working functions * merge fixes * fixed loadintg bar bug * changed to one layer deep * forge version numbers * improvements + refactoring * renamed things to fit plugin * fixed bugs * removed println * overrides dont include mrpack * merge * fixes * fixes * fixed deletion * merge errors * force sync before export * removed testing * missed line * removed console log * mac error reverted * incoreclty named helper * added to new register method * review changes * minor changes * moved create pack * renamed function --------- Co-authored-by: Jai A <jaiagr+gpg@pm.me>
This commit is contained in:
@@ -17,7 +17,7 @@ import { invoke } from '@tauri-apps/api/tauri'
|
||||
/// This begins the authentication flow quasi-synchronously
|
||||
/// This returns a URL to be opened in a browser
|
||||
export async function authenticate_begin_flow() {
|
||||
return await invoke('auth_authenticate_begin_flow')
|
||||
return await invoke('plugin:auth|auth_authenticate_begin_flow')
|
||||
}
|
||||
|
||||
/// Authenticate a user with Hydra - part 2
|
||||
@@ -25,11 +25,11 @@ export async function authenticate_begin_flow() {
|
||||
/// (and also adding the credentials to the state)
|
||||
/// This returns a Credentials object
|
||||
export async function authenticate_await_completion() {
|
||||
return await invoke('auth_authenticate_await_completion')
|
||||
return await invoke('plugin:auth|auth_authenticate_await_completion')
|
||||
}
|
||||
|
||||
export async function cancel_flow() {
|
||||
return await invoke('auth_cancel_flow')
|
||||
return await invoke('plugin:auth|auth_cancel_flow')
|
||||
}
|
||||
|
||||
/// Refresh some credentials using Hydra, if needed
|
||||
@@ -37,26 +37,26 @@ export async function cancel_flow() {
|
||||
/// update_name is bool
|
||||
/// Returns a Credentials object
|
||||
export async function refresh(user, update_name) {
|
||||
return await invoke('auth_refresh', { user, update_name })
|
||||
return await invoke('plugin:auth|auth_refresh', { user, update_name })
|
||||
}
|
||||
|
||||
/// Remove a user account from the database
|
||||
/// user is UUID
|
||||
export async function remove_user(user) {
|
||||
return await invoke('auth_remove_user', { user })
|
||||
return await invoke('plugin:auth|auth_remove_user', { user })
|
||||
}
|
||||
|
||||
// Add a path as a profile in-memory
|
||||
// user is UUID
|
||||
/// Returns a bool
|
||||
export async function has_user(user) {
|
||||
return await invoke('auth_has_user', { user })
|
||||
return await invoke('plugin:auth|auth_has_user', { user })
|
||||
}
|
||||
|
||||
/// Returns a list of users
|
||||
/// Returns an Array of Credentials
|
||||
export async function users() {
|
||||
return await invoke('auth_users')
|
||||
return await invoke('plugin:auth|auth_users')
|
||||
}
|
||||
|
||||
// Get a user by UUID
|
||||
@@ -64,5 +64,5 @@ export async function users() {
|
||||
// user is UUID
|
||||
// Returns Credentials (of user)
|
||||
export async function get_user(user) {
|
||||
return await invoke('auth_get_user', { user })
|
||||
return await invoke('plugin:auth|auth_get_user', { user })
|
||||
}
|
||||
|
||||
@@ -17,51 +17,63 @@ JavaVersion {
|
||||
/// Get all JREs that exist on the system
|
||||
// Returns an array of JavaVersion
|
||||
export async function get_all_jre() {
|
||||
return await invoke('jre_get_all_jre')
|
||||
return await invoke('plugin:jre|jre_get_all_jre')
|
||||
}
|
||||
|
||||
// Finds all the installation of Java 7, if it exists
|
||||
// Returns [JavaVersion]
|
||||
export async function find_jre_8_jres() {
|
||||
return await invoke('jre_find_jre_8_jres')
|
||||
const jres = await invoke('plugin:jre|jre_get_all_jre')
|
||||
const version = '1.8'
|
||||
const allowHigher = false
|
||||
return await invoke('plugin:jre|jre_find_filtered_jres', { jres, version, allowHigher })
|
||||
}
|
||||
|
||||
// Finds the installation of Java 17, if it exists
|
||||
// Returns [JavaVersion]
|
||||
export async function find_jre_17_jres() {
|
||||
return await invoke('jre_find_jre_17_jres')
|
||||
const jres = await invoke('plugin:jre|jre_get_all_jre')
|
||||
const version = '1.17'
|
||||
const allowHigher = false
|
||||
return await invoke('plugin:jre|jre_find_filtered_jres', { jres, version, allowHigher })
|
||||
}
|
||||
|
||||
// Finds the highest version of Java 18+, if it exists
|
||||
// Returns [JavaVersion]
|
||||
export async function find_jre_18plus_jres() {
|
||||
return await invoke('jre_find_jre_18plus_jres')
|
||||
const jres = await invoke('plugin:jre|jre_get_all_jre')
|
||||
const version = '1.18'
|
||||
const allowHigher = true
|
||||
return await invoke('plugin:jre|jre_find_filtered_jres', { jres, version, allowHigher })
|
||||
}
|
||||
|
||||
// Validates globals. Recommend directing the user to reassigned the globals if this returns false
|
||||
// Returns [JavaVersion]
|
||||
export async function validate_globals() {
|
||||
return await invoke('jre_validate_globals')
|
||||
return await invoke('plugin:jre|jre_validate_globals')
|
||||
}
|
||||
|
||||
// Gets java version from a specific path by trying to run 'java -version' on it.
|
||||
// This also validates it, as it returns null if no valid java version is found at the path
|
||||
export async function get_jre(path) {
|
||||
return await invoke('jre_get_jre', { path })
|
||||
return await invoke('plugin:jre|jre_get_jre', { path })
|
||||
}
|
||||
|
||||
// Autodetect Java globals, by searching the users computer.
|
||||
// Returns a *NEW* JavaGlobals that can be put into Settings
|
||||
export async function autodetect_java_globals() {
|
||||
return await invoke('jre_autodetect_java_globals')
|
||||
const java8 = await find_jre_8_jres()
|
||||
const java17 = await find_jre_17_jres()
|
||||
const java18plus = await find_jre_18plus_jres()
|
||||
return await invoke('plugin:jre|jre_autodetect_java_globals', { java8, java17, java18plus })
|
||||
}
|
||||
|
||||
// Automatically installs specified java version
|
||||
export async function auto_install_java(javaVersion) {
|
||||
return await invoke('jre_auto_install_java', { javaVersion })
|
||||
return await invoke('plugin:jre|jre_auto_install_java', { javaVersion })
|
||||
}
|
||||
|
||||
// Get max memory in KiB
|
||||
export async function get_max_memory() {
|
||||
return await invoke('jre_get_max_memory')
|
||||
return await invoke('plugin:jre|jre_get_max_memory')
|
||||
}
|
||||
|
||||
@@ -18,25 +18,25 @@ pub struct Logs {
|
||||
/// Get all logs that exist for a given profile
|
||||
/// This is returned as an array of Log objects, sorted by datetime_string (the folder name, when the log was created)
|
||||
export async function get_logs(profileUuid, clearContents) {
|
||||
return await invoke('logs_get_logs', { profileUuid, clearContents })
|
||||
return await invoke('plugin:logs|logs_get_logs', { profileUuid, clearContents })
|
||||
}
|
||||
|
||||
/// Get a profile's log by datetime_string (the folder name, when the log was created)
|
||||
export async function get_logs_by_datetime(profileUuid, datetimeString) {
|
||||
return await invoke('logs_get_logs_by_datetime', { profileUuid, datetimeString })
|
||||
return await invoke('plugin:logs|logs_get_logs_by_datetime', { profileUuid, datetimeString })
|
||||
}
|
||||
|
||||
/// Get a profile's stdout only by datetime_string (the folder name, when the log was created)
|
||||
export async function get_output_by_datetime(profileUuid, datetimeString) {
|
||||
return await invoke('logs_get_output_by_datetime', { profileUuid, datetimeString })
|
||||
return await invoke('plugin:logs|logs_get_output_by_datetime', { profileUuid, datetimeString })
|
||||
}
|
||||
|
||||
/// Delete a profile's log by datetime_string (the folder name, when the log was created)
|
||||
export async function delete_logs_by_datetime(profileUuid, datetimeString) {
|
||||
return await invoke('logs_delete_logs_by_datetime', { profileUuid, datetimeString })
|
||||
return await invoke('plugin:logs|logs_delete_logs_by_datetime', { profileUuid, datetimeString })
|
||||
}
|
||||
|
||||
/// Delete all logs for a given profile
|
||||
export async function delete_logs(profileUuid) {
|
||||
return await invoke('logs_delete_logs', { profileUuid })
|
||||
return await invoke('plugin:logs|logs_delete_logs', { profileUuid })
|
||||
}
|
||||
|
||||
@@ -3,23 +3,23 @@ import { invoke } from '@tauri-apps/api/tauri'
|
||||
/// Gets the game versions from daedalus
|
||||
// Returns a VersionManifest
|
||||
export async function get_game_versions() {
|
||||
return await invoke('metadata_get_game_versions')
|
||||
return await invoke('plugin:metadata|metadata_get_game_versions')
|
||||
}
|
||||
|
||||
// Gets the fabric versions from daedalus
|
||||
// Returns Manifest
|
||||
export async function get_fabric_versions() {
|
||||
return await invoke('metadata_get_fabric_versions')
|
||||
return await invoke('plugin:metadata|metadata_get_fabric_versions')
|
||||
}
|
||||
|
||||
// Gets the forge versions from daedalus
|
||||
// Returns Manifest
|
||||
export async function get_forge_versions() {
|
||||
return await invoke('metadata_get_forge_versions')
|
||||
return await invoke('plugin:metadata|metadata_get_forge_versions')
|
||||
}
|
||||
|
||||
// Gets the quilt versions from daedalus
|
||||
// Returns Manifest
|
||||
export async function get_quilt_versions() {
|
||||
return await invoke('metadata_get_quilt_versions')
|
||||
return await invoke('plugin:metadata|metadata_get_quilt_versions')
|
||||
}
|
||||
|
||||
@@ -4,13 +4,42 @@
|
||||
* and deserialized into a usable JS object.
|
||||
*/
|
||||
import { invoke } from '@tauri-apps/api/tauri'
|
||||
import { create } from './profile'
|
||||
|
||||
// Installs pack from a version ID
|
||||
export async function install(projectId, versionId, packTitle, packIcon) {
|
||||
return await invoke('pack_install_version_id', { projectId, versionId, packTitle, packIcon })
|
||||
export async function install(projectId, versionId, packTitle, iconUrl) {
|
||||
const location = {
|
||||
type: 'fromVersionId',
|
||||
project_id: projectId,
|
||||
version_id: versionId,
|
||||
title: packTitle,
|
||||
icon_url: iconUrl,
|
||||
}
|
||||
const profile_creator = await invoke('plugin:pack|pack_get_profile_from_pack', { location })
|
||||
const profile = await create(
|
||||
profile_creator.name,
|
||||
profile_creator.gameVersion,
|
||||
profile_creator.modloader,
|
||||
profile_creator.loaderVersion,
|
||||
profile_creator.icon
|
||||
)
|
||||
|
||||
return await invoke('plugin:pack|pack_install', { location, profile })
|
||||
}
|
||||
|
||||
// Installs pack from a path
|
||||
export async function install_from_file(path) {
|
||||
return await invoke('pack_install_file', { path })
|
||||
const location = {
|
||||
type: 'fromFile',
|
||||
path: path,
|
||||
}
|
||||
const profile_creator = await invoke('plugin:pack|pack_get_profile_from_pack', { location })
|
||||
const profile = await create(
|
||||
profile_creator.name,
|
||||
profile_creator.gameVersion,
|
||||
profile_creator.modloader,
|
||||
profile_creator.loaderVersion,
|
||||
profile_creator.icon
|
||||
)
|
||||
return await invoke('plugin:pack|pack_install', { location, profile })
|
||||
}
|
||||
|
||||
@@ -8,52 +8,52 @@ import { invoke } from '@tauri-apps/api/tauri'
|
||||
/// Gets if a process has finished by UUID
|
||||
/// Returns bool
|
||||
export async function has_finished_by_uuid(uuid) {
|
||||
return await invoke('process_has_finished_by_uuid', { uuid })
|
||||
return await invoke('plugin:process|process_has_finished_by_uuid', { uuid })
|
||||
}
|
||||
|
||||
/// Gets process exit status by UUID
|
||||
/// Returns u32
|
||||
export async function get_exit_status_by_uuid(uuid) {
|
||||
return await invoke('process_get_exit_status_by_uuid', { uuid })
|
||||
return await invoke('plugin:process|process_get_exit_status_by_uuid', { uuid })
|
||||
}
|
||||
|
||||
/// Gets all process IDs
|
||||
/// Returns [u32]
|
||||
export async function get_all_uuids() {
|
||||
return await invoke('process_get_all_uuids')
|
||||
return await invoke('plugin:process|process_get_all_uuids')
|
||||
}
|
||||
|
||||
/// Gets all running process IDs
|
||||
/// Returns [u32]
|
||||
export async function get_all_running_uuids() {
|
||||
return await invoke('process_get_all_running_uuids')
|
||||
return await invoke('plugin:process|process_get_all_running_uuids')
|
||||
}
|
||||
|
||||
/// Gets all running process IDs with a given profile path
|
||||
/// Returns [u32]
|
||||
export async function get_uuids_by_profile_path(profilePath) {
|
||||
return await invoke('process_get_uuids_by_profile_path', { profilePath })
|
||||
return await invoke('plugin:process|process_get_uuids_by_profile_path', { profilePath })
|
||||
}
|
||||
|
||||
/// Gets all running process IDs with a given profile path
|
||||
/// Returns [u32]
|
||||
export async function get_all_running_profile_paths(profilePath) {
|
||||
return await invoke('process_get_all_running_profile_paths', { profilePath })
|
||||
return await invoke('plugin:process|process_get_all_running_profile_paths', { profilePath })
|
||||
}
|
||||
|
||||
/// Gets all running process IDs with a given profile path
|
||||
/// Returns [u32]
|
||||
export async function get_all_running_profiles() {
|
||||
return await invoke('process_get_all_running_profiles')
|
||||
return await invoke('plugin:process|process_get_all_running_profiles')
|
||||
}
|
||||
|
||||
/// Gets process stdout by UUID
|
||||
/// Returns String
|
||||
export async function get_output_by_uuid(uuid) {
|
||||
return await invoke('process_get_output_by_uuid', { uuid })
|
||||
return await invoke('plugin:process|process_get_output_by_uuid', { uuid })
|
||||
}
|
||||
|
||||
/// Kills a process by UUID
|
||||
export async function kill_by_uuid(uuid) {
|
||||
return await invoke('process_kill_by_uuid', { uuid })
|
||||
return await invoke('plugin:process|process_kill_by_uuid', { uuid })
|
||||
}
|
||||
|
||||
@@ -5,11 +5,6 @@
|
||||
*/
|
||||
import { invoke } from '@tauri-apps/api/tauri'
|
||||
|
||||
// Add empty default instance
|
||||
export async function create_empty() {
|
||||
return await invoke('profile_create_empty')
|
||||
}
|
||||
|
||||
/// Add instance
|
||||
/*
|
||||
name: String, // the name of the profile, and relative path to create
|
||||
@@ -22,71 +17,81 @@ export async function create_empty() {
|
||||
*/
|
||||
|
||||
export async function create(name, gameVersion, modloader, loaderVersion, icon) {
|
||||
return await invoke('profile_create', { name, gameVersion, modloader, loaderVersion, icon })
|
||||
return await invoke('plugin:profile_create|profile_create', {
|
||||
name,
|
||||
gameVersion,
|
||||
modloader,
|
||||
loaderVersion,
|
||||
icon,
|
||||
})
|
||||
}
|
||||
|
||||
// Remove a profile
|
||||
export async function remove(path) {
|
||||
return await invoke('profile_remove', { path })
|
||||
return await invoke('plugin:profile|profile_remove', { path })
|
||||
}
|
||||
|
||||
// Get a profile by path
|
||||
// Returns a Profile
|
||||
export async function get(path, clearProjects) {
|
||||
return await invoke('profile_get', { path, clearProjects })
|
||||
return await invoke('plugin:profile|profile_get', { path, clearProjects })
|
||||
}
|
||||
|
||||
// Get optimal java version from profile
|
||||
// Returns a java version
|
||||
export async function get_optimal_jre_key(path) {
|
||||
return await invoke('profile_get_optimal_jre_key', { path })
|
||||
return await invoke('plugin:profile|profile_get_optimal_jre_key', { path })
|
||||
}
|
||||
|
||||
// Get a copy of the profile set
|
||||
// Returns hashmap of path -> Profile
|
||||
export async function list(clearProjects) {
|
||||
return await invoke('profile_list', { clearProjects })
|
||||
return await invoke('plugin:profile|profile_list', { clearProjects })
|
||||
}
|
||||
|
||||
export async function check_installed(path, projectId) {
|
||||
return await invoke('profile_check_installed', { path, projectId })
|
||||
return await invoke('plugin:profile|profile_check_installed', { path, projectId })
|
||||
}
|
||||
|
||||
// Installs/Repairs a profile
|
||||
export async function install(path) {
|
||||
return await invoke('profile_install', { path })
|
||||
return await invoke('plugin:profile|profile_install', { path })
|
||||
}
|
||||
|
||||
// Updates all of a profile's projects
|
||||
export async function update_all(path) {
|
||||
return await invoke('profile_update_all', { path })
|
||||
return await invoke('plugin:profile|profile_update_all', { path })
|
||||
}
|
||||
|
||||
// Updates a specified project
|
||||
export async function update_project(path, projectPath) {
|
||||
return await invoke('profile_update_project', { path, projectPath })
|
||||
return await invoke('plugin:profile|profile_update_project', { path, projectPath })
|
||||
}
|
||||
|
||||
// Add a project to a profile from a version
|
||||
// Returns a path to the new project file
|
||||
export async function add_project_from_version(path, versionId) {
|
||||
return await invoke('profile_add_project_from_version', { path, versionId })
|
||||
return await invoke('plugin:profile|profile_add_project_from_version', { path, versionId })
|
||||
}
|
||||
|
||||
// Add a project to a profile from a path + project_type
|
||||
// Returns a path to the new project file
|
||||
export async function add_project_from_path(path, projectPath, projectType) {
|
||||
return await invoke('profile_add_project_from_path', { path, projectPath, projectType })
|
||||
return await invoke('plugin:profile|profile_add_project_from_path', {
|
||||
path,
|
||||
projectPath,
|
||||
projectType,
|
||||
})
|
||||
}
|
||||
|
||||
// Toggle disabling a project
|
||||
export async function toggle_disable_project(path, projectPath) {
|
||||
return await invoke('profile_toggle_disable_project', { path, projectPath })
|
||||
return await invoke('plugin:profile|profile_toggle_disable_project', { path, projectPath })
|
||||
}
|
||||
|
||||
// Remove a project
|
||||
export async function remove_project(path, projectPath) {
|
||||
return await invoke('profile_remove_project', { path, projectPath })
|
||||
return await invoke('plugin:profile|profile_remove_project', { path, projectPath })
|
||||
}
|
||||
|
||||
// Export a profile to .mrpack
|
||||
@@ -116,21 +121,21 @@ export async function get_potential_override_folders(profilePath) {
|
||||
// Run Minecraft using a pathed profile
|
||||
// Returns PID of child
|
||||
export async function run(path) {
|
||||
return await invoke('profile_run', { path })
|
||||
return await invoke('plugin:profile|profile_run', { path })
|
||||
}
|
||||
|
||||
// Run Minecraft using a pathed profile
|
||||
// Waits for end
|
||||
export async function run_wait(path) {
|
||||
return await invoke('profile_run_wait', { path })
|
||||
return await invoke('plugin:profile|profile_run_wait', { path })
|
||||
}
|
||||
|
||||
// Edits a profile
|
||||
export async function edit(path, editProfile) {
|
||||
return await invoke('profile_edit', { path, editProfile })
|
||||
return await invoke('plugin:profile|profile_edit', { path, editProfile })
|
||||
}
|
||||
|
||||
// Edits a profile's icon
|
||||
export async function edit_icon(path, iconPath) {
|
||||
return await invoke('profile_edit_icon', { path, iconPath })
|
||||
return await invoke('plugin:profile|profile_edit_icon', { path, iconPath })
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@ Memorysettings {
|
||||
|
||||
// Get full settings object
|
||||
export async function get() {
|
||||
return await invoke('settings_get')
|
||||
return await invoke('plugin:settings|settings_get')
|
||||
}
|
||||
|
||||
// Set full settings object
|
||||
export async function set(settings) {
|
||||
return await invoke('settings_set', { settings })
|
||||
return await invoke('plugin:settings|settings_set', { settings })
|
||||
}
|
||||
|
||||
@@ -13,5 +13,5 @@ export async function initialize_state() {
|
||||
|
||||
// Gets active progress bars
|
||||
export async function progress_bars_list() {
|
||||
return await invoke('progress_bars_list')
|
||||
return await invoke('plugin:utils|progress_bars_list')
|
||||
}
|
||||
|
||||
@@ -7,30 +7,30 @@ import { invoke } from '@tauri-apps/api/tauri'
|
||||
|
||||
// Gets tag bundle of all tags
|
||||
export async function get_tag_bundle() {
|
||||
return await invoke('tags_get_tag_bundle')
|
||||
return await invoke('plugin:tags|tags_get_tag_bundle')
|
||||
}
|
||||
|
||||
// Gets cached category tags
|
||||
export async function get_categories() {
|
||||
return await invoke('tags_get_categories')
|
||||
return await invoke('plugin:tags|tags_get_categories')
|
||||
}
|
||||
|
||||
// Gets cached loaders tags
|
||||
export async function get_loaders() {
|
||||
return await invoke('tags_get_loaders')
|
||||
return await invoke('plugin:tags|tags_get_loaders')
|
||||
}
|
||||
|
||||
// Gets cached game_versions tags
|
||||
export async function get_game_versions() {
|
||||
return await invoke('tags_get_game_versions')
|
||||
return await invoke('plugin:tags|tags_get_game_versions')
|
||||
}
|
||||
|
||||
// Gets cached donation_platforms tags
|
||||
export async function get_donation_platforms() {
|
||||
return await invoke('tags_get_donation_platforms')
|
||||
return await invoke('plugin:tags|tags_get_donation_platforms')
|
||||
}
|
||||
|
||||
// Gets cached licenses tags
|
||||
export async function get_report_types() {
|
||||
return await invoke('tags_get_report_types')
|
||||
return await invoke('plugin:tags|tags_get_report_types')
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ export async function isDev() {
|
||||
}
|
||||
|
||||
export async function showInFolder(path) {
|
||||
return await invoke('show_in_folder', { path })
|
||||
return await invoke('plugin:utils|show_in_folder', { path })
|
||||
}
|
||||
|
||||
export const releaseColor = (releaseType) => {
|
||||
|
||||
@@ -9,7 +9,7 @@ export default {
|
||||
async checkDisableMouseover() {
|
||||
try {
|
||||
// Fetch the CSS content from the Rust backend
|
||||
const should_disable_mouseover = await invoke('should_disable_mouseover')
|
||||
const should_disable_mouseover = await invoke('plugin:utils|should_disable_mouseover')
|
||||
|
||||
if (should_disable_mouseover) {
|
||||
// Create a style element and set its content
|
||||
|
||||
Reference in New Issue
Block a user