Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export DIRENV_WARN_TIMEOUT=20s
export __NV_DISABLE_EXPLICIT_SYNC=1
eval "$(devenv direnvrc)"
use devenv
4 changes: 4 additions & 0 deletions app/src-tauri/src/account/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ impl AccountStore {
let auth = ms_mc_login(&self.client, &self.handle).await?;
let profile = get_profile_info(&self.client, &auth.mc_token).await?;

if self.active.is_empty() {
self.active = profile.id.clone();
}

self
.accounts
.insert(profile.id.clone(), Some(AccountInfo { auth, profile }));
Expand Down
22 changes: 18 additions & 4 deletions app/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use profiles::commands::{
profile_repair, profile_runs_list, profile_update, profile_update_icon,
};
use settings::{settings_get, settings_set};
use tauri::{AppHandle, Emitter, Manager, webview::PageLoadEvent};
use tauri::{AppHandle, Emitter, Manager, Url, webview::PageLoadEvent};
use tauri_plugin_log::{RotationStrategy, Target, TargetKind, TimezoneStrategy};
use tokio::sync::Mutex;
use versions::{
Expand All @@ -30,7 +30,7 @@ use versions::{

use crate::{
offline::{MANIFEST_REFRESH_ERROR, OfflineState, is_offline, try_reconnect},
settings::{MaxMem, SettingsExt},
settings::{MaxMem, SETTINGS_KEY, SettingsExt},
utils::{log::ResultLogExt, updater::default_client},
versions::{event::UpdateLimiterStore, loader::LoaderType, paths::MCVersionPath},
};
Expand Down Expand Up @@ -153,16 +153,30 @@ pub fn run() {
if view.label() == "main"
&& payload.event() == PageLoadEvent::Started
&& let Ok(current_url) = view.url()
&& let Ok(settings) = view.app_handle().app_settings()
&& let Ok(mut settings) = view.app_handle().app_settings()
&& let Some(url) = settings.url
&& url != current_url
{
#[cfg(debug_assertions)]
if url.scheme() == "tauri" {
let url = Url::parse("http://localhost:1420").unwrap();
settings.url = Some(url.clone());
let _ = view.navigate(url);

if let Ok(store) = view.app_handle().app_store() {
let _ = store.set(SETTINGS_KEY, &settings);
}
return;
}
#[cfg(not(debug_assertions))]
if url.scheme() != "http" && url.scheme() != "https" {
if url.scheme() == "http" || url.scheme() == "https" {
let url = Url::parse("tauri://localhost").unwrap();
settings.url = Some(url.clone());
let _ = view.navigate(url);

if let Ok(store) = view.app_handle().app_store() {
let _ = store.set(SETTINGS_KEY, &settings);
}
return;
}
let _ = view.navigate(url);
Expand Down
2 changes: 1 addition & 1 deletion app/src-tauri/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
utils::updater::{UpdateType, update_data},
};

const SETTINGS_KEY: &str = "settings";
pub const SETTINGS_KEY: &str = "settings";

pub struct MaxMem {
max_mem: u64,
Expand Down
1 change: 1 addition & 0 deletions app/src-tauri/src/versions/download/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ pub async fn check_java_manifest(
Component::JavaRuntimeAlpha => &version.java_runtime_alpha,
Component::JavaRuntimeBeta => &version.java_runtime_beta,
Component::JavaRuntimeDelta => &version.java_runtime_delta,
Component::JavaRuntimeEpsilon => &version.java_runtime_epsilon,
Component::JavaRuntimeGamma => &version.java_runtime_gamma,
Component::JavaRuntimeGammaSnapshot => &version.java_runtime_gamma_snapshot,
Component::JreLegacy => &version.jre_legacy,
Expand Down
2 changes: 2 additions & 0 deletions app/src-tauri/src/versions/meta/java.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub enum Component {
JavaRuntimeAlpha,
JavaRuntimeBeta,
JavaRuntimeDelta,
JavaRuntimeEpsilon,
JavaRuntimeGamma,
JavaRuntimeGammaSnapshot,
JreLegacy,
Expand Down Expand Up @@ -99,6 +100,7 @@ pub struct PlatformVersion {
pub java_runtime_alpha: Vec<Version>,
pub java_runtime_beta: Vec<Version>,
pub java_runtime_delta: Vec<Version>,
pub java_runtime_epsilon: Vec<Version>,
pub java_runtime_gamma: Vec<Version>,
pub java_runtime_gamma_snapshot: Vec<Version>,
pub jre_legacy: Vec<Version>,
Expand Down
8 changes: 4 additions & 4 deletions app/src/routes/profiles/info/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@
</Button>
{/snippet}
</DropdownMenu.Trigger>
<DropdownMenu.Content>
<DropdownMenu.Content class="w-auto">
<DropdownMenu.Item
onclick={() => profile_open_path(profile.id)}
class="cursor-pointer"
class="cursor-pointer text-nowrap"
>
<FolderOpen />
Open Directory</DropdownMenu.Item
Expand All @@ -142,14 +142,14 @@
}
profile_repair(profile.id, profile.name);
}}
class="cursor-pointer"
class="cursor-pointer text-nowrap"
>
<Wrench />
Repair Profile
</DropdownMenu.Item>
<DropdownMenu.Item
variant="destructive"
class="cursor-pointer"
class="cursor-pointer text-nowrap"
onclick={() => (deleteOpen = true)}
>
<Trash />
Expand Down
4 changes: 4 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ let
webkitgtk_4_1
wayland
libxkbcommon
glib-networking
gsettings-desktop-schemas
];
in
{
Expand All @@ -73,6 +75,8 @@ in
};

env = {
XDG_DATA_DIRS = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:$XDG_DATA_DIRS";
GIO_MODULE_DIR = "${pkgs.glib-networking}/lib/gio/modules";
LD_LIBRARY_PATH = "${lib.makeLibraryPath mcLibs}:$LD_LIBRARY_PATH";
};
}
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
${pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isLinux ''
--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.xrandr ]}
--set LD_LIBRARY_PATH ${runtimeDependencies}
--set __NV_DISABLE_EXPLICIT_SYNC 1
''}
)

Expand Down
Loading