Bugs again (#703)

* initial

* more fixes

* logs

* more fixes

* working rescuer

* minor log display fix

* mac fixes

* minor fix

* libsselinux1

* linux error

* actions test

* more bugs. Modpack page! BIG changes

* changed minimum 64 -> 8

* removed modpack page moved to modal

* removed unnecessary css

* mac compile

* many revs

* Merge colorful logs (#725)

* make implementation not dumb

* run prettier

* null -> true

* Add line numbers & make errors more robust.

* improvments

* changes; virtual scroll

---------

Co-authored-by: qtchaos <72168435+qtchaos@users.noreply.github.com>

* omorphia colors, comments fix

* fixes; _JAVA_OPTIONS

* revs

* mac specific

* more mac

* some fixes

* quick fix

* add java reinstall option

---------

Co-authored-by: qtchaos <72168435+qtchaos@users.noreply.github.com>
Co-authored-by: Jai A <jaiagr+gpg@pm.me>
This commit is contained in:
Wyatt Verchere
2023-09-12 09:27:03 -07:00
committed by GitHub
parent bc02192d80
commit 1e8852b540
63 changed files with 2677 additions and 719 deletions

View File

@@ -59,6 +59,12 @@ export async function get_jre(path) {
return await invoke('plugin:jre|jre_get_jre', { path })
}
// Tests JRE version by running 'java -version' on it.
// Returns true if the version is valid, and matches given (after extraction)
export async function test_jre(path, majorVersion, minorVersion) {
return await invoke('plugin:jre|jre_test_jre', { path, majorVersion, minorVersion })
}
// Autodetect Java globals, by searching the users computer.
// Returns a *NEW* JavaGlobals that can be put into Settings
export async function autodetect_java_globals() {

View File

@@ -6,37 +6,50 @@
import { invoke } from '@tauri-apps/api/tauri'
/*
A log is a struct containing the datetime string, stdout, and stderr, as follows:
A log is a struct containing the filename string, stdout, and stderr, as follows:
pub struct Logs {
pub datetime_string: String,
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 datetime_string (the folder name, when the log was created)
/// 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 datetime_string (the folder name, when the log was created)
export async function get_logs_by_datetime(profilePath, datetimeString) {
return await invoke('plugin:logs|logs_get_logs_by_datetime', { profilePath, datetimeString })
/// Get a profile's log by filename
export async function get_logs_by_filename(profilePath, filename) {
return await invoke('plugin:logs|logs_get_logs_by_filename', { profilePath, filename })
}
/// Get a profile's stdout only by datetime_string (the folder name, when the log was created)
export async function get_output_by_datetime(profilePath, datetimeString) {
return await invoke('plugin:logs|logs_get_output_by_datetime', { profilePath, datetimeString })
/// Get a profile's log text only by filename
export async function get_output_by_filename(profilePath, filename) {
return await invoke('plugin:logs|logs_get_output_by_filename', { profilePath, filename })
}
/// Delete a profile's log by datetime_string (the folder name, when the log was created)
export async function delete_logs_by_datetime(profilePath, datetimeString) {
return await invoke('plugin:logs|logs_delete_logs_by_datetime', { profilePath, datetimeString })
/// Delete a profile's log by filename
export async function delete_logs_by_filename(profilePath, filename) {
return await invoke('plugin:logs|logs_delete_logs_by_filename', { profilePath, 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.
}
*/
export async function get_latest_log_cursor(profilePath, cursor) {
return await invoke('plugin:logs|logs_get_latest_log_cursor', { profilePath, cursor })
}

View File

@@ -47,12 +47,6 @@ export async function 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('plugin:process|process_get_output_by_uuid', { uuid })
}
/// Kills a process by UUID
export async function kill_by_uuid(uuid) {
return await invoke('plugin:process|process_kill_by_uuid', { uuid })

View File

@@ -27,6 +27,11 @@ export async function create(name, gameVersion, modloader, loaderVersion, icon,
})
}
// duplicate a profile
export async function duplicate(path) {
return await invoke('plugin:profile_create|profile_duplicate', { path })
}
// Remove a profile
export async function remove(path) {
return await invoke('plugin:profile|profile_remove', { path })
@@ -44,6 +49,12 @@ export async function get_full_path(path) {
return await invoke('plugin:profile|profile_get_full_path', { path })
}
// Get's a mod's full fs path
// Returns a path
export async function get_mod_full_path(path, projectPath) {
return await invoke('plugin:profile|profile_get_mod_full_path', { path, projectPath })
}
// Get optimal java version from profile
// Returns a java version
export async function get_optimal_jre_key(path) {
@@ -101,9 +112,9 @@ export async function remove_project(path, projectPath) {
return await invoke('plugin:profile|profile_remove_project', { path, projectPath })
}
// Update a managed Modrinth profile
export async function update_managed_modrinth(path) {
return await invoke('plugin:profile|profile_update_managed_modrinth', { path })
// Update a managed Modrinth profile to a specific version
export async function update_managed_modrinth_version(path, versionId) {
return await invoke('plugin:profile|profile_update_managed_modrinth_version', { path, versionId })
}
// Repair a managed Modrinth profile
@@ -114,12 +125,21 @@ export async function update_repair_modrinth(path) {
// Export a profile to .mrpack
/// included_overrides is an array of paths to override folders to include (ie: 'mods', 'resource_packs')
// Version id is optional (ie: 1.1.5)
export async function export_profile_mrpack(path, exportLocation, includedOverrides, versionId) {
export async function export_profile_mrpack(
path,
exportLocation,
includedOverrides,
versionId,
description,
name
) {
return await invoke('plugin:profile|profile_export_mrpack', {
path,
exportLocation,
includedOverrides,
versionId,
description,
name,
})
}

View File

@@ -2,6 +2,7 @@ import {
add_project_from_version as installMod,
check_installed,
get_full_path,
get_mod_full_path,
} from '@/helpers/profile'
import { useFetch } from '@/helpers/fetch.js'
import { handleError } from '@/store/notifications.js'
@@ -20,12 +21,21 @@ export async function showInFolder(path) {
return await invoke('plugin:utils|show_in_folder', { path })
}
export async function showLauncherLogsFolder() {
return await invoke('plugin:utils|show_launcher_logs_folder', {})
}
// Opens a profile's folder in the OS file explorer
export async function showProfileInFolder(path) {
const fullPath = await get_full_path(path)
return await showInFolder(fullPath)
}
export async function highlightModInProfile(profilePath, projectPath) {
const fullPath = await get_mod_full_path(profilePath, projectPath)
return await showInFolder(fullPath)
}
export const releaseColor = (releaseType) => {
switch (releaseType) {
case 'release':