Skip to content
Open
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
8 changes: 8 additions & 0 deletions .github/workflows/turbo-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ jobs:
restore-keys: |
pnpm-cache-

- name: Cache Gradle distribution
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
~/.gradle/wrapper/dists
~/.gradle/caches
key: ${{ runner.os }}-${{ runner.arch }}-gradle-${{ hashFiles('packages/app-lib/java/gradle/wrapper/gradle-wrapper.properties') }}

- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@2b1f5e9b395427c92ee4e3331786ca3c37afe2d7 # v1.16.0
with:
Expand Down
4 changes: 3 additions & 1 deletion apps/app-frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ import { get_user, get_version } from '@/helpers/cache.js'
import { command_listener, notification_listener, warning_listener } from '@/helpers/events.js'
import { cancelLogin, get as getCreds, login, logout } from '@/helpers/mr_auth.ts'
import { create_profile_and_install_from_file } from '@/helpers/pack'
import { list } from '@/helpers/profile.js'
import { list, run } from '@/helpers/profile.js'
import { mergeUrlQuery, parseModrinthLink } from '@/helpers/project-links.ts'
import { get as getSettings, set as setSettings } from '@/helpers/settings.ts'
import { get_opening_command, initialize_state } from '@/helpers/state'
Expand Down Expand Up @@ -862,6 +862,8 @@ async function handleCommand(e) {
source: 'CreationModalFileDrop',
})
}
} else if (e.event === 'LaunchProfile') {
await run(decodeURIComponent(e.path)).catch(handleError)
} else if (e.event === 'InstallServer') {
await router.push(`/project/${e.id}`)
await playServerProject(e.id).catch(handleError)
Expand Down
1 change: 1 addition & 0 deletions packages/app-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ tracing = { workspace = true }
tracing-error = { workspace = true }
tracing-subscriber = { workspace = true, features = ["chrono", "env-filter"] }
url = { workspace = true, features = ["serde"] }
urlencoding = { workspace = true }
uuid = { workspace = true, features = ["serde", "v4"] }
whoami = { workspace = true }
zbus = { workspace = true }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
networkTimeout=10000
networkTimeout=120000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
20 changes: 20 additions & 0 deletions packages/app-lib/src/api/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::{
},
util::io,
};
use urlencoding::decode;

/// Handles external functions (such as through URL deep linkage)
/// Link is extracted value (link) in somewhat URL format, such as
Expand All @@ -28,6 +29,25 @@ pub async fn handle_url(sublink: &str) -> crate::Result<CommandPayload> {
Some(("server", id)) => {
CommandPayload::InstallServer { id: id.to_string() }
}
// /launch/profile/{id} - Launches a profile
Some(("launch", rest)) if rest.starts_with("profile/") => {
let raw = rest.trim_start_matches("profile/");
match decode(raw) {
Ok(decoded) => CommandPayload::LaunchProfile {
path: decoded.to_string(),
},
Err(e) => {
emit_warning(&format!(
"Invalid UTF-8 in profile path: {e}"
))
.await?;
return Err(crate::ErrorKind::InputError(format!(
"Invalid UTF-8 in profile path: {e}"
))
.into());
}
}
}
_ => {
emit_warning(&format!(
"Invalid command, unrecognized path: {sublink}"
Expand Down
3 changes: 3 additions & 0 deletions packages/app-lib/src/event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ pub enum CommandPayload {
InstallServer {
id: String,
},
LaunchProfile {
path: String,
},
RunMRPack {
// run or install .mrpack
path: PathBuf,
Expand Down