Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: nickname change page #16

Merged
merged 1 commit into from
Dec 15, 2023
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
2 changes: 1 addition & 1 deletion .yarn/releases/yarn-remote.cjs

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions app/entrypoint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
"dependencies": {
"@app/providers": "workspace:",
"@app/root": "workspace:",
"@mantine/core": "7.2.2",
"@mantine/hooks": "7.2.2",
"@mantine/notifications": "7.2.2",
"@mantine/vanilla-extract": "7.2.2",
"@tanstack/react-query": "5.9.0",
"@mantine/core": "7.3.2",
"@mantine/hooks": "7.3.2",
"@mantine/notifications": "7.3.2",
"@mantine/vanilla-extract": "7.3.2",
"@tanstack/react-query": "5.14.0",
"@theme/global": "workspace:",
"@vanilla-extract/css": "1.14.0",
"react": "canary",
"react-dom": "canary"
},
"devDependencies": {
"@tauri-apps/api": "1.5.1",
"@types/react": "18.2.39",
"@tauri-apps/api": "1.5.2",
"@types/react": "18.2.45",
"@types/react-dom": "18.2.17",
"@vanilla-extract/vite-plugin": "3.9.2",
"@vitejs/plugin-react": "4.2.0",
"postcss": "8.4.31",
"postcss-preset-mantine": "1.11.0",
"@vanilla-extract/vite-plugin": "3.9.3",
"@vitejs/plugin-react": "4.2.1",
"postcss": "8.4.32",
"postcss-preset-mantine": "1.11.1",
"postcss-simple-vars": "7.0.1",
"vite": "5.0.3"
"vite": "5.0.9"
}
}
10 changes: 5 additions & 5 deletions app/providers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"type": "module",
"main": "mod.tsx",
"dependencies": {
"@mantine/modals": "7.2.2",
"@mantine/notifications": "7.2.2",
"@mantine/modals": "7.3.2",
"@mantine/notifications": "7.3.2",
"@theme/provider": "workspace:",
"react-router-dom": "6.20.0"
"react-router-dom": "6.21.0"
},
"devDependencies": {
"@tanstack/react-query": "5.9.0",
"@types/react": "18.2.39"
"@tanstack/react-query": "5.14.0",
"@types/react": "18.2.45"
},
"peerDependencies": {
"@mantine/core": "*",
Expand Down
4 changes: 2 additions & 2 deletions app/root/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"@widget/sidebar": "workspace:"
},
"devDependencies": {
"@mantine/core": "7.2.2",
"@mantine/core": "7.3.2",
"@tauri-apps/api": "2.0.0-alpha.12",
"@types/react": "18.2.39"
"@types/react": "18.2.45"
},
"peerDependencies": {
"@mantine/core": "*",
Expand Down
2 changes: 2 additions & 0 deletions app/routes/mod.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import { Route } from 'react-router-dom'
import { Routes } from 'react-router-dom'

import { HomePage } from '@page/home'
import { ProfilesPage } from '@page/profiles'
import { SettingsPage } from '@page/settings'

export function AppRoutes() {
return (
<Routes>
<Route index element={<HomePage />} />
<Route path='/settings' element={<SettingsPage />} />
<Route path='/profiles' element={<ProfilesPage />} />
</Routes>
)
}
5 changes: 3 additions & 2 deletions app/routes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"main": "mod.tsx",
"dependencies": {
"@page/home": "workspace:",
"@page/profiles": "workspace:",
"@page/settings": "workspace:"
},
"devDependencies": {
"@types/react": "18.2.39",
"react-router-dom": "6.20.0"
"@types/react": "18.2.45",
"react-router-dom": "6.21.0"
},
"peerDependencies": {
"@mantine/core": "*",
Expand Down
2 changes: 1 addition & 1 deletion crates/download/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub async fn download(
match File::open(&item.path).await {
Ok(mut file) => {
if item.ignore_integrity {
return Ok(())
return Ok(());
}

if integrity::check(&mut file, &sha).await? {
Expand Down
22 changes: 22 additions & 0 deletions crates/ipc/src/launch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use {
path::PathBuf,
},
tauri::{
AppHandle,
Manager,
Window,
},
Expand All @@ -17,6 +18,7 @@ use {

#[tauri::command]
pub async fn launch(
handle: AppHandle,
window: Window,
root: PathBuf,
id: String,
Expand All @@ -29,6 +31,26 @@ pub async fn launch(
err.to_string()
})?;

// trace!("Getting authlib injector");
// let authlib_injector_path = handle
// .path()
// .resolve("athl.jar", BaseDirectory::Resource)
// .expect("Failed to resolve resource");
//
// debug!("Java Agent: {:?}", authlib_injector_path);
//
// let authlib_injector_path = authlib_injector_path.to_str().ok_or("Invalid
// path")?;
//
// launcher
// .extra_jvm_args
// .extend([
// format!("-javaagent:{authlib_injector_path}=https://nodium.ru:32717"),
// "-Dauthlibinjector.disableHttpd".into(),
// "-Dauthlibinjector.noShowServerName".into(),
// "-Dauthlibinjector.usernameCheck=enabled".into()
// ]);

trace!(?vars);
launcher.vars = vars;

Expand Down
2 changes: 1 addition & 1 deletion crates/ipc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mod lookup;
mod launch;
mod lookup;

pub use {
launch::*,
Expand Down
3 changes: 2 additions & 1 deletion crates/rsmc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ thiserror.workspace = true
tracing.workspace = true
serde_json.workspace = true
tokio.workspace = true
url = { version = "2.5", features = ["serde"], optional = true }

[features]
default = ["launcher", "tracing"]
spec = []
spec = ["url"]
launcher = ["spec"]
tracing = []
5 changes: 4 additions & 1 deletion crates/rsmc/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@ pub enum Error {
InvalidManifest(String),

#[error("{0}")]
Inconsistent(String)
Inconsistent(String),

#[error("Not yet supported feature: {0}")]
NotYetSupported(String),
}
94 changes: 19 additions & 75 deletions crates/rsmc/src/launcher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ use std::process::Stdio;
use {
crate::{
spec::*,
tracing::debug,
tracing::trace,
tracing::{
debug,
trace,
},
Error,
},
std::{
Expand Down Expand Up @@ -57,64 +59,25 @@ fn process_args(args: Vec<Argument>, to: &mut Vec<String>) {
Argument::Constant(it) => {
trace!("+arg: {}", it);
to.push(it)
},
}
Argument::Conditional { rules, value } => {
if rules.iter().all(unpack_rule) {
if Rule::unpack_all(&rules) {
match value {
ConditionalArgument::Single(it) => {
trace!("+arg: {}", it);
to.push(it)
},
}
ConditionalArgument::List(it) => {
trace!("+args: {:?}", it);
to.extend(it)
},
}
}
}
}
}
}
}

fn unpack_rule(rule: &Rule) -> bool {
let mut allow = true;

match &rule.condition {
Some(RuleCondition::Os { name, arch, .. }) => {
if let Some(os_name) = &name {
allow = match os_name {
#[cfg(target_os = "linux")]
Os::Linux => true,
#[cfg(target_os = "windows")]
Os::Windows => true,
#[cfg(target_os = "macos")]
Os::Osx => true,
#[allow(unreachable_patterns)]
_ => false,
};
}

if let Some(os_arch) = &arch {
allow = match os_arch {
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
Arch::X64 => true,
#[cfg(target_arch = "x86")]
Arch::X86 => true,
#[allow(unreachable_patterns)]
_ => false,
};
}
}
Some(RuleCondition::Features(_)) => allow = false,
_ => {}
};

match rule.action {
RuleAction::Allow => allow,
RuleAction::Disallow => !allow,
}
}

fn set_vars(vars: &HashMap<String, String>, target: &str) -> String {
let mut target = target.to_owned();

Expand Down Expand Up @@ -174,41 +137,22 @@ impl Launcher {
Custom(it) => {
trace!("Including (custom) : {}", it.name);
classpath.push(it.name.to_path());
},
}
Common(it) => {
trace!("Including : {}", it.name);
classpath.push(it.downloads.artifact.path);
}
Seminative(it) => {
if it.rules.iter().all(unpack_rule) {
if Rule::unpack_all(&it.rules) {
trace!("Including (native): {}", it.name);
classpath.push(it.downloads.artifact.path);
}
}
Native(mut it) => {
trace!(?it);
if it.rules.iter().all(unpack_rule) {
let platform = if cfg!(target_os = "windows") {
&Os::Windows
} else if cfg!(target_os = "linux") {
&Os::Linux
} else if cfg!(target_os = "macos") {
&Os::Osx
} else {
return Err(Error::UnsupportedPlatform);
};

let classifier = it
.natives
.get(platform)
.ok_or(Error::InvalidManifest("Missing native classifier".into()))?
.as_str();

let artifact = it
.downloads
.classifiers
.remove(classifier)
.ok_or(Error::InvalidManifest("Missing native classifier".into()))?;
if Rule::unpack_all(&it.rules) {
let classifier = it.natives.get_classifier_name()?;
let artifact = it.downloads.extract_artifact(classifier)?;

trace!("Including (base) : {}", it.name);
classpath.push(it.downloads.artifact.path);
Expand Down Expand Up @@ -237,12 +181,6 @@ impl Launcher {
// This is intentional! Do not remove without RFC
jvm_args.retain(|it| !it.starts_with("-Djava.library.path"));

macro vars($($name:ident:$value:expr,)*) {
HashMap::from([
$((stringify!($name).into(), { $value }.into()),)*
])
}

let mut classpath: Vec<_> = classpath
.into_iter()
.map(|it| libraries_dir.join(it))
Expand All @@ -269,6 +207,12 @@ impl Launcher {
":"
});

macro vars($($name:ident:$value:expr,)*) {
HashMap::from([
$((stringify!($name).into(), { $value }.into()),)*
])
}

let mut vars: HashMap<String, String> = vars! {
version_name: self.manifest.id,
version_type: self.manifest.version_type,
Expand Down
Loading