feat(theseus): Update to Tauri v2 (#2178)

* 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>
This commit is contained in:
Norbiros
2024-08-27 21:49:36 +02:00
committed by GitHub
parent 396f737612
commit d6a72fbfc4
83 changed files with 15614 additions and 2013 deletions

View File

@@ -6,12 +6,12 @@
{
"name": "max_concurrent_writes",
"ordinal": 0,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "max_concurrent_downloads",
"ordinal": 1,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "theme",
@@ -26,37 +26,37 @@
{
"name": "collapsed_navigation",
"ordinal": 4,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "advanced_rendering",
"ordinal": 5,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "native_decorations",
"ordinal": 6,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "discord_rpc",
"ordinal": 7,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "developer_mode",
"ordinal": 8,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "telemetry",
"ordinal": 9,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "onboarded",
"ordinal": 10,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "extra_launch_args",
@@ -71,27 +71,27 @@
{
"name": "mc_memory_max",
"ordinal": 13,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "mc_force_fullscreen",
"ordinal": 14,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "mc_game_resolution_x",
"ordinal": 15,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "mc_game_resolution_y",
"ordinal": 16,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "hide_on_process_start",
"ordinal": 17,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "hook_pre_launch",
@@ -121,7 +121,7 @@
{
"name": "migrated",
"ordinal": 23,
"type_info": "Int64"
"type_info": "Integer"
}
],
"parameters": {

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n DELETE FROM processes WHERE pid = $1\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
},
"hash": "1769b7033985bfdd04ee8912d9f28e0d15a8b893db47aca3aec054c7134f1f3f"
}

View File

@@ -11,7 +11,7 @@
{
"name": "active",
"ordinal": 1,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "session_id",
@@ -21,7 +21,7 @@
{
"name": "expires",
"ordinal": 3,
"type_info": "Int64"
"type_info": "Integer"
}
],
"parameters": {

View File

@@ -6,7 +6,7 @@
{
"name": "major_version",
"ordinal": 0,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "full_version",

View File

@@ -26,7 +26,7 @@
{
"name": "expires",
"ordinal": 4,
"type_info": "Int64"
"type_info": "Integer"
}
],
"parameters": {

View File

@@ -1,50 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n pid, start_time, name, executable, profile_path, post_exit_command\n FROM processes\n WHERE 1=$1",
"describe": {
"columns": [
{
"name": "pid",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "start_time",
"ordinal": 1,
"type_info": "Int64"
},
{
"name": "name",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "executable",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "profile_path",
"ordinal": 4,
"type_info": "Text"
},
{
"name": "post_exit_command",
"ordinal": 5,
"type_info": "Text"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
false,
true
]
},
"hash": "3cac786ad15ef1167bc50ca846d98facb3dee35c9e421209c1161ee7380b7a74"
}

View File

@@ -56,32 +56,32 @@
{
"name": "locked",
"ordinal": 10,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "created",
"ordinal": 11,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "modified",
"ordinal": 12,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "last_played",
"ordinal": 13,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "submitted_time_played",
"ordinal": 14,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "recent_time_played",
"ordinal": 15,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "override_java_path",
@@ -101,22 +101,22 @@
{
"name": "override_mc_memory_max",
"ordinal": 19,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "override_mc_force_fullscreen",
"ordinal": 20,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "override_mc_game_resolution_x",
"ordinal": 21,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "override_mc_game_resolution_y",
"ordinal": 22,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "override_hook_pre_launch",

View File

@@ -56,32 +56,32 @@
{
"name": "locked",
"ordinal": 10,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "created",
"ordinal": 11,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "modified",
"ordinal": 12,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "last_played",
"ordinal": 13,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "submitted_time_played",
"ordinal": 14,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "recent_time_played",
"ordinal": 15,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "override_java_path",
@@ -101,22 +101,22 @@
{
"name": "override_mc_memory_max",
"ordinal": 19,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "override_mc_force_fullscreen",
"ordinal": 20,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "override_mc_game_resolution_x",
"ordinal": 21,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "override_mc_game_resolution_y",
"ordinal": 22,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "override_hook_pre_launch",

View File

@@ -1,50 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n pid, start_time, name, executable, profile_path, post_exit_command\n FROM processes\n WHERE profile_path = $1",
"describe": {
"columns": [
{
"name": "pid",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "start_time",
"ordinal": 1,
"type_info": "Int64"
},
{
"name": "name",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "executable",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "profile_path",
"ordinal": 4,
"type_info": "Text"
},
{
"name": "post_exit_command",
"ordinal": 5,
"type_info": "Text"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
false,
true
]
},
"hash": "5f07a8b45063167074db8b3da51e220a7a0f5879fb8978d4033e259102ae3790"
}

View File

@@ -11,7 +11,7 @@
{
"name": "active",
"ordinal": 1,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "session_id",
@@ -21,7 +21,7 @@
{
"name": "expires",
"ordinal": 3,
"type_info": "Int64"
"type_info": "Integer"
}
],
"parameters": {

View File

@@ -26,12 +26,12 @@
{
"name": "issue_instant",
"ordinal": 4,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "not_after",
"ordinal": 5,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "token",
@@ -41,7 +41,7 @@
{
"name": "display_claims!: serde_json::Value",
"ordinal": 7,
"type_info": "Null"
"type_info": "Text"
}
],
"parameters": {

View File

@@ -11,7 +11,7 @@
{
"name": "active",
"ordinal": 1,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "username",
@@ -31,7 +31,7 @@
{
"name": "expires",
"ordinal": 5,
"type_info": "Int64"
"type_info": "Integer"
}
],
"parameters": {

View File

@@ -11,7 +11,7 @@
{
"name": "active",
"ordinal": 1,
"type_info": "Int64"
"type_info": "Integer"
},
{
"name": "username",
@@ -31,7 +31,7 @@
{
"name": "expires",
"ordinal": 5,
"type_info": "Int64"
"type_info": "Integer"
}
],
"parameters": {

View File

@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n INSERT INTO processes (pid, start_time, name, executable, profile_path, post_exit_command)\n VALUES ($1, $2, $3, $4, $5, $6)\n ON CONFLICT (pid) DO UPDATE SET\n start_time = $2,\n name = $3,\n executable = $4,\n profile_path = $5,\n post_exit_command = $6\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 6
},
"nullable": []
},
"hash": "d1b8f27c8150f9ae514a7c9ddc68f4a59f08b7df1c65758539220d7211ade682"
}

View File

@@ -1,50 +0,0 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n pid, start_time, name, executable, profile_path, post_exit_command\n FROM processes\n WHERE pid = $1",
"describe": {
"columns": [
{
"name": "pid",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "start_time",
"ordinal": 1,
"type_info": "Int64"
},
{
"name": "name",
"ordinal": 2,
"type_info": "Text"
},
{
"name": "executable",
"ordinal": 3,
"type_info": "Text"
},
{
"name": "profile_path",
"ordinal": 4,
"type_info": "Text"
},
{
"name": "post_exit_command",
"ordinal": 5,
"type_info": "Text"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false,
false,
true
]
},
"hash": "e18e960d33a140e522ca20b91d63560b921b922701b69d868dc231f6b0f4cf1c"
}

View File

@@ -2,9 +2,7 @@
name = "theseus"
version = "0.8.3-1"
authors = ["Jai A <jaiagr+gpg@pm.me>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
edition = "2021"
[dependencies]
bytes = "1"
@@ -38,14 +36,13 @@ tracing-error = "0.2.0"
paste = { version = "1.0" }
tauri = { version = "1.7.1", optional = true }
tauri = { version = "2.0.0-rc.4", optional = true }
indicatif = { version = "0.17.3", optional = true }
async-tungstenite = { version = "0.27.0", features = ["tokio-runtime", "tokio-rustls-webpki-roots"] }
futures = "0.3"
reqwest = { version = "0.12.3", features = ["json", "stream", "deflate", "gzip", "brotli", "rustls-tls", "charset", "http2", "macos-system-configuration"], default-features = false }
tokio = { version = "1", features = ["full"] }
tokio-stream = { version = "0.1", features = ["fs"] }
async-recursion = "1.0.4"
notify = { version = "6.1.1", default-features = false }
@@ -63,10 +60,7 @@ rand = "0.8"
byteorder = "1.5.0"
base64 = "0.22.0"
# TODO: Remove when new SQLX version is released
# We force-upgrade SQLite so JSONB support is added (theseus)
# https://github.com/launchbadge/sqlx/commit/352b02de6af70f1ff1bfbd15329120589a0f7337
sqlx = { git = "https://github.com/launchbadge/sqlx.git", rev = "352b02de6af70f1ff1bfbd15329120589a0f7337", features = [ "runtime-tokio", "sqlite", "macros"] }
sqlx = { version = "0.8.0", features = [ "runtime-tokio", "sqlite", "macros" ] }
[target.'cfg(windows)'.dependencies]
winreg = "0.52.0"

View File

@@ -3,14 +3,13 @@ use crate::event::{
CommandPayload, EventError, LoadingBar, LoadingBarType, ProcessPayloadType,
ProfilePayloadType,
};
use futures::prelude::*;
#[cfg(feature = "tauri")]
use crate::event::{
LoadingPayload, ProcessPayload, ProfilePayload, WarningPayload,
};
use futures::prelude::*;
#[cfg(feature = "tauri")]
use tauri::Manager;
use tauri::Emitter;
use uuid::Uuid;
#[cfg(feature = "cli")]
@@ -187,7 +186,7 @@ pub async fn emit_loading(
#[cfg(feature = "tauri")]
event_state
.app
.emit_all(
.emit(
"loading",
LoadingPayload {
fraction: opt_display_frac,
@@ -215,7 +214,7 @@ pub async fn emit_warning(message: &str) -> crate::Result<()> {
let event_state = crate::EventState::get().await?;
event_state
.app
.emit_all(
.emit(
"warning",
WarningPayload {
message: message.to_string(),
@@ -239,7 +238,7 @@ pub async fn emit_command(command: CommandPayload) -> crate::Result<()> {
let event_state = crate::EventState::get().await?;
event_state
.app
.emit_all("command", command)
.emit("command", command)
.map_err(EventError::from)?;
}
Ok(())
@@ -258,7 +257,7 @@ pub async fn emit_process(
let event_state = crate::EventState::get().await?;
event_state
.app
.emit_all(
.emit(
"process",
ProcessPayload {
profile_path_id: profile_path.to_string(),
@@ -283,7 +282,7 @@ pub async fn emit_profile(
let event_state = crate::EventState::get().await?;
event_state
.app
.emit_all(
.emit(
"profile",
ProfilePayload {
profile_path_id: profile_path_id.to_string(),

View File

@@ -2,6 +2,8 @@
use dashmap::DashMap;
use serde::{Deserialize, Serialize};
use std::{path::PathBuf, sync::Arc};
#[cfg(feature = "tauri")]
use tauri::Emitter;
use tokio::sync::OnceCell;
use uuid::Uuid;
@@ -62,10 +64,11 @@ impl EventState {
}
#[cfg(feature = "tauri")]
pub async fn get_main_window() -> crate::Result<Option<tauri::Window>> {
pub async fn get_main_window() -> crate::Result<Option<tauri::WebviewWindow>>
{
use tauri::Manager;
let value = Self::get().await?;
Ok(value.app.get_window("main"))
Ok(value.app.get_webview_window("main"))
}
}
@@ -103,8 +106,7 @@ impl Drop for LoadingBarId {
let event = bar.bar_type.clone();
let fraction = bar.current / bar.total;
use tauri::Manager;
let _ = event_state.app.emit_all(
let _ = event_state.app.emit(
"loading",
LoadingPayload {
fraction: None,

View File

@@ -217,7 +217,7 @@ where
let file_name = format!(
"{}/{}",
profile.path,
path.replace("\\", "/")
path.replace('\\', "/")
.replace(".disabled", "")
);

View File

@@ -68,11 +68,13 @@ impl Settings {
onboarded: res.onboarded == 1,
extra_launch_args: res
.extra_launch_args
.and_then(|x| serde_json::from_str(&x).ok())
.as_ref()
.and_then(|x| serde_json::from_str(x).ok())
.unwrap_or_default(),
custom_env_vars: res
.custom_env_vars
.and_then(|x| serde_json::from_str(&x).ok())
.as_ref()
.and_then(|x| serde_json::from_str(x).ok())
.unwrap_or_default(),
memory: MemorySettings {
maximum: res.mc_memory_max as u32,

View File

@@ -3,18 +3,20 @@ import { DropdownIcon } from '@modrinth/assets'
import { reactive } from 'vue'
import Button from './Button.vue'
const props = withDefaults(
defineProps<{
collapsible: boolean
defaultCollapsed: boolean
noAutoBody: boolean
}>(),
{
collapsible: false,
defaultCollapsed: false,
noAutoBody: false,
const props = defineProps({
collapsible: {
type: Boolean,
default: false,
},
)
defaultCollapsed: {
type: Boolean,
default: false,
},
noAutoBody: {
type: Boolean,
default: false,
},
})
const state = reactive({
collapsed: props.defaultCollapsed,