feat: instances v2 (#6431)

* feat: base of instances v2

* feat: use old profiles with compat layer

* prototype: instances v2

* fix: install_from using profile

* fix: skins migration fix

* fix: frontend still using profile path

* fix: add update proj multiselect guard

* fix: cargo fmt

* fix: content missing fields

* feat: break up app-lib/api/instance.rs

* fix: check_content_updates mismatch

* fix: updater modal cleanup w/new structure

* feat: better update all handling

* fix: remove preview_update_all

* fix: feedback on bulk update + lint

* fix: rem transitions

* fix: change to jsonb

* feat: app db backup after update

* fix: lint

* fix: sqlx prepare + use sqlx macros

* fix: lint

* fix: bugs

* feat: defuck the installing process up

* fix: bug of hell

* fix: shear

* fix: fmt

* fix: install progress spacing + change mc/content/overrides to bytes

* fix: lint

* fix: prepr

* fix: navtabs anim not working in app

* fix: worlds.vue improvements + browse page fixes

* feat: optimise queries + adapter fns

* fix: lint

* fix: lint

* feat: shared modrinth-content-management crate (#6469)

* feat: disable warnings setting

* feat: add instances shortcuts (#6329)

* Add modrinth://launch deep link to start a profile

Support external profile launching via modrinth://launch/{profile_path} for integrations such as Stream Deck.

* Change route to /launch/profile/{id} for future extensibility

* fix: ensure profile path is url decoded

* fix: URL-decode profile path from deep link

* fix: use urlencoding crate for URL decoding

* feat: implement app instance shortcuts

* feat: change windows shortcut creation to use windows api instead

* feat: implement creating a shortcut launching world/server

* format

* fmt

* fix multiline inline tables

* pnpm prepr

* feat: move create shortcut to last item

* refactor: split up shortcuts.rs for individual platforms

* refactor: turn profile launch url into url type

* use string literal and add safety comment

* pt2

* refactor: rename anything that's profile into instance

* update mac shortcut

---------

Co-authored-by: DJCheesusReal <134006619+DJCheesusReal@users.noreply.github.com>

---------

Co-authored-by: Truman Gao <106889354+tdgao@users.noreply.github.com>
Co-authored-by: DJCheesusReal <134006619+DJCheesusReal@users.noreply.github.com>
This commit is contained in:
Calum H.
2026-06-25 21:19:29 +00:00
committed by GitHub
co-authored by DJCheesusReal Truman Gao
parent ef4044534f
commit 734720e11e
353 changed files with 24745 additions and 9771 deletions
+45 -33
View File
@@ -2,7 +2,7 @@
use crate::LoadingBarType;
use crate::event::emit::{emit_loading, init_loading};
use crate::state::LAUNCHER_STATE;
use crate::state::{JavaVersion, Profile, Settings};
use crate::state::{JavaVersion, Settings};
use crate::util::fetch::IoSemaphore;
use dashmap::DashSet;
use std::path::{Path, PathBuf};
@@ -11,7 +11,7 @@ use tokio::fs;
pub const CACHES_FOLDER_NAME: &str = "caches";
pub const LAUNCHER_LOGS_FOLDER_NAME: &str = "launcher_logs";
pub const PROFILES_FOLDER_NAME: &str = "profiles";
pub const INSTANCES_FOLDER_NAME: &str = "profiles";
pub const METADATA_FOLDER_NAME: &str = "meta";
#[derive(Debug)]
@@ -148,22 +148,24 @@ impl DirectoryInfo {
self.config_dir.join("icons")
}
/// Get the profiles directory for created profiles
/// Get the instances directory
#[inline]
pub fn profiles_dir(&self) -> PathBuf {
self.config_dir.join(PROFILES_FOLDER_NAME)
pub fn instances_dir(&self) -> PathBuf {
self.config_dir.join(INSTANCES_FOLDER_NAME)
}
/// Gets the logs dir for a given profile
/// Gets the logs dir for a given instance path
#[inline]
pub fn profile_logs_dir(&self, profile_path: &str) -> PathBuf {
self.profiles_dir().join(profile_path).join("logs")
pub fn instance_logs_dir(&self, instance_path: &str) -> PathBuf {
self.instances_dir().join(instance_path).join("logs")
}
/// Gets the crash reports dir for a given profile
/// Gets the crash reports dir for a given instance path
#[inline]
pub fn crash_reports_dir(&self, profile_path: &str) -> PathBuf {
self.profiles_dir().join(profile_path).join("crash-reports")
pub fn crash_reports_dir(&self, instance_path: &str) -> PathBuf {
self.instances_dir()
.join(instance_path)
.join("crash-reports")
}
#[inline]
@@ -265,7 +267,7 @@ impl DirectoryInfo {
const MOVE_DIRS: &[&str] = &[
CACHES_FOLDER_NAME,
PROFILES_FOLDER_NAME,
INSTANCES_FOLDER_NAME,
METADATA_FOLDER_NAME,
];
@@ -472,27 +474,37 @@ impl DirectoryInfo {
java_version.upsert(exec).await?
}
let profiles = Profile::get_all(exec).await?;
for mut profile in profiles {
profile.icon_path = profile.icon_path.map(|x| {
x.replace(
prev_custom_dir,
new_dir
.trim_end_matches('/')
.trim_end_matches('\\'),
)
});
profile.java_path = profile.java_path.map(|x| {
x.replace(
prev_custom_dir,
new_dir
.trim_end_matches('/')
.trim_end_matches('\\'),
)
});
profile.upsert(exec).await?;
}
let new_dir = new_dir
.trim_end_matches('/')
.trim_end_matches('\\')
.to_string();
let new_dir = new_dir.as_str();
sqlx::query!(
"
UPDATE instances
SET icon_path = replace(icon_path, ?, ?)
WHERE icon_path IS NOT NULL
",
prev_custom_dir,
new_dir,
)
.execute(exec)
.await?;
sqlx::query!(
"
UPDATE instance_launch_overrides
SET overrides = jsonb(json_set(
overrides,
'$.java_path',
replace(json_extract(overrides, '$.java_path'), ?, ?)
))
WHERE json_type(overrides, '$.java_path') = 'text'
",
prev_custom_dir,
new_dir,
)
.execute(exec)
.await?;
}
settings.custom_dir = Some(new_dir);