Analytics + more bug fixes (#144)

* Analytics + more bug fixes

* debug deadlock

* Fix mostly everything

* merge fixes

* fix rest

* final fixeS
This commit is contained in:
Geometrically
2023-06-19 14:59:06 -07:00
committed by GitHub
parent 84d731b670
commit 1e78a7b6a8
51 changed files with 1285 additions and 491 deletions

View File

@@ -3,7 +3,9 @@ import { handleError } from '@/store/state.js'
export const useFetch = async (url, item) => {
try {
return await ofetch(url)
return await ofetch(url, {
headers: { 'User-Agent': 'modrinth/theseus (support@modrinth.com)' },
})
} catch (err) {
handleError({ message: `Error fetching ${item}` })
console.error(err)

View File

@@ -27,13 +27,8 @@ export async function 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_stdout_by_datetime(profileUuid, datetimeString) {
return await invoke('logs_get_stdout_by_datetime', { profileUuid, datetimeString })
}
/// Get a profile's stderr only by datetime_string (the folder name, when the log was created)
export async function get_stderr_by_datetime(profileUuid, datetimeString) {
return await invoke('logs_get_stderr_by_datetime', { profileUuid, datetimeString })
export async function get_output_by_datetime(profileUuid, datetimeString) {
return await invoke('logs_get_output_by_datetime', { profileUuid, datetimeString })
}
/// Delete a profile's log by datetime_string (the folder name, when the log was created)

View File

@@ -47,16 +47,10 @@ export async function get_all_running_profiles() {
return await invoke('process_get_all_running_profiles')
}
/// Gets process stderr by UUID
/// Returns String
export async function get_stderr_by_uuid(uuid) {
return await invoke('process_get_stderr_by_uuid', { uuid })
}
/// Gets process stdout by UUID
/// Returns String
export async function get_stdout_by_uuid(uuid) {
return await invoke('process_get_stdout_by_uuid', { uuid })
export async function get_output_by_uuid(uuid) {
return await invoke('process_get_output_by_uuid', { uuid })
}
/// Kills a process by UUID

View File

@@ -3,6 +3,10 @@ import { useFetch } from '@/helpers/fetch.js'
import { handleError } from '@/store/notifications.js'
import { invoke } from '@tauri-apps/api/tauri'
export async function isDev() {
return await invoke('is_dev')
}
export async function showInFolder(path) {
return await invoke('show_in_folder', { path })
}
@@ -23,6 +27,8 @@ export const releaseColor = (releaseType) => {
export const installVersionDependencies = async (profile, version) => {
for (const dep of version.dependencies) {
if (dep.dependency_type !== 'required') continue
// disallow fabric api install on quilt
if (dep.project_id === 'P7dR8mSH' && profile.metadata.loader === 'quilt') continue
if (dep.version_id) {
if (
dep.project_id &&
@@ -45,7 +51,9 @@ export const installVersionDependencies = async (profile, version) => {
v.game_versions.includes(profile.metadata.game_version) &&
v.loaders.includes(profile.metadata.loader)
)
await installMod(profile.path, latest.id).catch(handleError)
if (latest) {
await installMod(profile.path, latest.id).catch(handleError)
}
}
}
}