🐛 fix: fix client id
This commit is contained in:
parent
36aa0b658f
commit
bcb2d55b95
17 changed files with 53 additions and 59 deletions
|
|
@ -17,7 +17,7 @@ authors = [
|
||||||
"Polyfrost",
|
"Polyfrost",
|
||||||
"Polyfrost Contributors"
|
"Polyfrost Contributors"
|
||||||
]
|
]
|
||||||
version = "1.0.0"
|
version = "1.0.0-alpha.1"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
onelauncher = { path = "./packages/core" }
|
onelauncher = { path = "./packages/core" }
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "onelauncher_gui"
|
name = "onelauncher_gui"
|
||||||
description = "Next-generation open source Minecraft launcher"
|
description = "Next-generation open source Minecraft launcher"
|
||||||
version = "1.0.0" # todo: make it so tauri works with the ws
|
version = "1.0.0-alpha.1" # todo: make it so tauri works with the ws
|
||||||
license = { workspace = true }
|
license = { workspace = true }
|
||||||
edition = { workspace = true }
|
edition = { workspace = true }
|
||||||
repository = { workspace = true }
|
repository = { workspace = true }
|
||||||
|
|
|
||||||
|
|
@ -11,31 +11,25 @@ fn main() {
|
||||||
"get_users",
|
"get_users",
|
||||||
"get_user",
|
"get_user",
|
||||||
"remove_user",
|
"remove_user",
|
||||||
|
|
||||||
// Cluster
|
// Cluster
|
||||||
"create_cluster",
|
"create_cluster",
|
||||||
"remove_cluster",
|
"remove_cluster",
|
||||||
"get_cluster",
|
"get_cluster",
|
||||||
"get_clusters",
|
"get_clusters",
|
||||||
"run_cluster",
|
"run_cluster",
|
||||||
|
|
||||||
// Processor
|
// Processor
|
||||||
"get_running_clusters",
|
"get_running_clusters",
|
||||||
"get_processes_by_path",
|
"get_processes_by_path",
|
||||||
"kill_process",
|
"kill_process",
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
"get_settings",
|
"get_settings",
|
||||||
"set_settings",
|
"set_settings",
|
||||||
|
|
||||||
// Metadata
|
// Metadata
|
||||||
"get_minecraft_versions",
|
"get_minecraft_versions",
|
||||||
|
|
||||||
// Package
|
// Package
|
||||||
"random_mods",
|
"random_mods",
|
||||||
"get_mod",
|
"get_mod",
|
||||||
"download_mod",
|
"download_mod",
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
"get_program_info",
|
"get_program_info",
|
||||||
]),
|
]),
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"name": "@onelauncher/desktop",
|
"name": "@onelauncher/desktop",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0-alpha.1",
|
||||||
|
"private": true,
|
||||||
"description": "Next-generation open source Minecraft launcher",
|
"description": "Next-generation open source Minecraft launcher",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
@ -11,8 +12,7 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tauri build",
|
"build": "tauri build",
|
||||||
"dev": "tauri dev",
|
"dev": "tauri dev"
|
||||||
"tauri": "tauri"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@onelauncher/core": "workspace:*",
|
"@onelauncher/core": "workspace:*",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"name": "@onelauncher/frontend",
|
"name": "@onelauncher/frontend",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0-alpha.1",
|
||||||
|
"private": true,
|
||||||
"description": "Next-generation open source Minecraft launcher frontend",
|
"description": "Next-generation open source Minecraft launcher frontend",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
@ -10,7 +11,7 @@
|
||||||
"directory": "apps/frontend"
|
"directory": "apps/frontend"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite dev",
|
"dev": "vite",
|
||||||
"build": "vite build"
|
"build": "vite build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@onelauncher/testing",
|
"name": "@onelauncher/testing",
|
||||||
"type": "module",
|
"version": "1.0.0-alpha.1",
|
||||||
"version": "1.0.0",
|
"private": true,
|
||||||
"description": "Next-generation open source Minecraft launcher playground",
|
"description": "Next-generation open source Minecraft launcher playground",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,19 @@
|
||||||
)]
|
)]
|
||||||
|
|
||||||
use onelauncher::cluster::create::create_cluster;
|
use onelauncher::cluster::create::create_cluster;
|
||||||
use onelauncher::package::content::{self, Providers};
|
use onelauncher::package::content::Providers;
|
||||||
use onelauncher::prelude::*;
|
use onelauncher::prelude::*;
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() -> onelauncher::Result<()> {
|
||||||
|
let _logger = onelauncher::start_logger();
|
||||||
|
let _state = State::get().await?;
|
||||||
|
|
||||||
|
modrinth().await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn authenticate_mc() -> onelauncher::Result<MinecraftCredentials> {
|
pub async fn authenticate_mc() -> onelauncher::Result<MinecraftCredentials> {
|
||||||
println!("a browser will open, follow login flow");
|
println!("a browser will open, follow login flow");
|
||||||
let login = minecraft::begin().await?;
|
let login = minecraft::begin().await?;
|
||||||
|
|
@ -35,18 +45,8 @@ pub async fn authenticate_mc() -> onelauncher::Result<MinecraftCredentials> {
|
||||||
Ok(creds)
|
Ok(creds)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
|
||||||
async fn main() -> onelauncher::Result<()> {
|
|
||||||
let _logger = onelauncher::start_logger();
|
|
||||||
let state = State::get().await?;
|
|
||||||
|
|
||||||
modrinth().await?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn modrinth() -> onelauncher::Result<()> {
|
async fn modrinth() -> onelauncher::Result<()> {
|
||||||
let state = State::get().await?;
|
let _state = State::get().await?;
|
||||||
let provider = Providers::Modrinth;
|
let provider = Providers::Modrinth;
|
||||||
let result = provider.get("oneconfig").await?;
|
let result = provider.get("oneconfig").await?;
|
||||||
println!("{:#?}", result);
|
println!("{:#?}", result);
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,6 @@ export default petal({
|
||||||
'*.rs',
|
'*.rs',
|
||||||
'pnpm-lock.yaml',
|
'pnpm-lock.yaml',
|
||||||
'**/node_modules',
|
'**/node_modules',
|
||||||
'apps/desktop/src/bindings.ts',
|
'apps/frontend/src/bindings.ts',
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"name": "@onelauncher/root",
|
"name": "@onelauncher/root",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0-alpha.1",
|
||||||
|
"private": true,
|
||||||
"packageManager": "pnpm@9.6.0",
|
"packageManager": "pnpm@9.6.0",
|
||||||
"description": "Next-generation open source Minecraft launcher and tools for interacting with Polyfrost",
|
"description": "Next-generation open source Minecraft launcher and tools for interacting with Polyfrost",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
|
|
@ -22,18 +23,16 @@
|
||||||
"frontend": "pnpm --filter @onelauncher/frontend -- ",
|
"frontend": "pnpm --filter @onelauncher/frontend -- ",
|
||||||
"client": "pnpm --filter @onelauncher/client -- ",
|
"client": "pnpm --filter @onelauncher/client -- ",
|
||||||
"desktop": "pnpm --filter @onelauncher/desktop -- ",
|
"desktop": "pnpm --filter @onelauncher/desktop -- ",
|
||||||
|
|
||||||
"core": "cd packages/core && cargo",
|
"core": "cd packages/core && cargo",
|
||||||
"testing": "cd apps/testing && cargo",
|
"testing": "cd apps/testing && cargo",
|
||||||
"tauri": "cd apps/desktop && cargo",
|
"tauri": "cd apps/desktop && cargo",
|
||||||
"format": "pnpm format:es && pnpm format:rs",
|
"format": "pnpm format:es && pnpm format:rs",
|
||||||
"lint": "pnpm lint:es && pnpm lint:rs",
|
"lint": "pnpm lint:es && pnpm lint:rs",
|
||||||
|
"lint:es": "eslint . --cache",
|
||||||
"lint:es": "pnpm eslint . --cache",
|
|
||||||
"format:es": "pnpm lint:es --fix",
|
"format:es": "pnpm lint:es --fix",
|
||||||
"lint:rs": "cargo +nightly fmt --check && cargo clippy -- -D warnings",
|
"lint:rs": "cargo +nightly fmt --check && cargo clippy -- -D warnings",
|
||||||
"format:rs": "cargo +nightly fmt && cargo clippy --fix",
|
"format:rs": "cargo +nightly fmt && cargo clippy --fix",
|
||||||
"release:node": "pnpm bumpp -r"
|
"release:node": "bumpp -r"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@flowr/eslint-config": "^3.10.1",
|
"@flowr/eslint-config": "^3.10.1",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@onelauncher/client",
|
"name": "@onelauncher/client",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0-alpha.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "RSPC Client for OneLauncher",
|
"description": "RSPC Client for OneLauncher",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,9 @@ default = []
|
||||||
tauri = [
|
tauri = [
|
||||||
"dep:tauri",
|
"dep:tauri",
|
||||||
"dep:tauri-specta",
|
"dep:tauri-specta",
|
||||||
"dep:specta"
|
"specta"
|
||||||
]
|
]
|
||||||
|
specta = [ "dep:specta" ]
|
||||||
cli = [ "dep:indicatif" ]
|
cli = [ "dep:indicatif" ]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@onelauncher/core",
|
"name": "@onelauncher/core",
|
||||||
"type": "module",
|
"version": "1.0.0-alpha.1",
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "Next-generation open source Minecraft launcher core",
|
"description": "Next-generation open source Minecraft launcher core",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ use crate::store::{ManagedVersionFile, PackageFile, PackageSide};
|
||||||
use crate::utils::http::fetch;
|
use crate::utils::http::fetch;
|
||||||
use crate::{Result, State};
|
use crate::{Result, State};
|
||||||
|
|
||||||
use anyhow::anyhow;
|
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
|
||||||
|
|
@ -7,18 +7,20 @@
|
||||||
/// The name of the launcher.
|
/// The name of the launcher.
|
||||||
pub const NAME: &str = "OneLauncher";
|
pub const NAME: &str = "OneLauncher";
|
||||||
/// The version of the launcher
|
/// The version of the launcher
|
||||||
pub const VERSION: &str = "1.0.0"; // todo: env
|
pub const VERSION: &str = "1.0.0-alpha.1"; // todo: env
|
||||||
|
|
||||||
// =========== Authentication ===========
|
// =========== Authentication ===========
|
||||||
/// The Discord RPC client ID.
|
/// The Discord RPC client ID.
|
||||||
pub const DISCORD_RPC_CLIENT_ID: &str = "1234567890000000";
|
pub const DISCORD_RPC_CLIENT_ID: &str = "1234567890000000";
|
||||||
|
|
||||||
/// Microsoft client ID.
|
/// Our Microsoft client ID.
|
||||||
pub const MICROSOFT_CLIENT_ID: &str = "00000000402b5328";
|
pub const MICROSOFT_CLIENT_ID: &str = "9eac3a4e-8cdd-43ef-863e-49cd601b1f03";
|
||||||
/// Microsoft login redirect URI.
|
/// Mojang/Microsoft client ID.
|
||||||
pub const REDIRECT_URL: &str = "https://login.live.com/oauth20_desktop.srf";
|
pub const MINECRAFT_CLIENT_ID: &str = "00000000402b5328";
|
||||||
/// Microsoft login xboxlive scopes to get tokens.
|
/// Mojang/Microsoft login redirect URI.
|
||||||
pub const SCOPES: &str = "service::user.auth.xboxlive.com::MBI_SSL";
|
pub const MINECRAFT_REDIRECT_URL: &str = "https://login.live.com/oauth20_desktop.srf";
|
||||||
|
/// Mojang/Microsoft login xboxlive scopes to get tokens.
|
||||||
|
pub const MINECRAFT_SCOPES: &str = "service::user.auth.xboxlive.com::MBI_SSL";
|
||||||
|
|
||||||
// =========== Hacky Mojang-spec OS constants ===========
|
// =========== Hacky Mojang-spec OS constants ===========
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ use std::collections::HashMap;
|
||||||
use std::fmt::Write;
|
use std::fmt::Write;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::constants::{MICROSOFT_CLIENT_ID, REDIRECT_URL, SCOPES};
|
use crate::constants::{MINECRAFT_CLIENT_ID, MINECRAFT_REDIRECT_URL, MINECRAFT_SCOPES};
|
||||||
|
|
||||||
const AUTH_STORE: &str = "authentication.json";
|
const AUTH_STORE: &str = "authentication.json";
|
||||||
|
|
||||||
|
|
@ -447,16 +447,16 @@ async fn sisu_authenticate(
|
||||||
"https://sisu.xboxlive.com/authenticate",
|
"https://sisu.xboxlive.com/authenticate",
|
||||||
"/authenticate",
|
"/authenticate",
|
||||||
json!({
|
json!({
|
||||||
"AppId": MICROSOFT_CLIENT_ID,
|
"AppId": MINECRAFT_CLIENT_ID,
|
||||||
"DeviceToken": token,
|
"DeviceToken": token,
|
||||||
"Offers": [SCOPES],
|
"Offers": [MINECRAFT_SCOPES],
|
||||||
"Query": {
|
"Query": {
|
||||||
"code_challenge": challenge,
|
"code_challenge": challenge,
|
||||||
"code_challenge_method": "S256",
|
"code_challenge_method": "S256",
|
||||||
"state": generate_oauth_challenge(),
|
"state": generate_oauth_challenge(),
|
||||||
"prompt": "select_account"
|
"prompt": "select_account"
|
||||||
},
|
},
|
||||||
"RedirectUri": REDIRECT_URL,
|
"RedirectUri": MINECRAFT_REDIRECT_URL,
|
||||||
"Sandbox": "RETAIL",
|
"Sandbox": "RETAIL",
|
||||||
"TokenType": "code",
|
"TokenType": "code",
|
||||||
"TitleId": "1794566092"
|
"TitleId": "1794566092"
|
||||||
|
|
@ -500,12 +500,12 @@ async fn oauth_token(
|
||||||
verify: &str,
|
verify: &str,
|
||||||
) -> Result<RequestWithDate<OAuthToken>, MinecraftAuthError> {
|
) -> Result<RequestWithDate<OAuthToken>, MinecraftAuthError> {
|
||||||
let mut query = HashMap::new();
|
let mut query = HashMap::new();
|
||||||
query.insert("client_id", MICROSOFT_CLIENT_ID);
|
query.insert("client_id", MINECRAFT_CLIENT_ID);
|
||||||
query.insert("code", code);
|
query.insert("code", code);
|
||||||
query.insert("code_verifier", verify);
|
query.insert("code_verifier", verify);
|
||||||
query.insert("grant_type", "authorization_code");
|
query.insert("grant_type", "authorization_code");
|
||||||
query.insert("redirect_uri", REDIRECT_URL);
|
query.insert("redirect_uri", MINECRAFT_REDIRECT_URL);
|
||||||
query.insert("scope", SCOPES);
|
query.insert("scope", MINECRAFT_SCOPES);
|
||||||
let res = auth_retry(|| {
|
let res = auth_retry(|| {
|
||||||
crate::utils::http::REQWEST_CLIENT
|
crate::utils::http::REQWEST_CLIENT
|
||||||
.post("https://login.live.com/oauth20_token.srf")
|
.post("https://login.live.com/oauth20_token.srf")
|
||||||
|
|
@ -548,11 +548,11 @@ async fn oauth_refresh(
|
||||||
refresh_token: &str,
|
refresh_token: &str,
|
||||||
) -> Result<RequestWithDate<OAuthToken>, MinecraftAuthError> {
|
) -> Result<RequestWithDate<OAuthToken>, MinecraftAuthError> {
|
||||||
let mut query = HashMap::new();
|
let mut query = HashMap::new();
|
||||||
query.insert("client_id", MICROSOFT_CLIENT_ID);
|
query.insert("client_id", MINECRAFT_CLIENT_ID);
|
||||||
query.insert("refresh_token", refresh_token);
|
query.insert("refresh_token", refresh_token);
|
||||||
query.insert("grant_type", "refresh_token");
|
query.insert("grant_type", "refresh_token");
|
||||||
query.insert("redirect_uri", REDIRECT_URL);
|
query.insert("redirect_uri", MINECRAFT_REDIRECT_URL);
|
||||||
query.insert("scope", SCOPES);
|
query.insert("scope", MINECRAFT_SCOPES);
|
||||||
let res = auth_retry(|| {
|
let res = auth_retry(|| {
|
||||||
crate::utils::http::REQWEST_CLIENT
|
crate::utils::http::REQWEST_CLIENT
|
||||||
.post("https://login.live.com/oauth20_token.srf")
|
.post("https://login.live.com/oauth20_token.srf")
|
||||||
|
|
@ -615,7 +615,7 @@ async fn sisu_authorize(
|
||||||
"/authorize",
|
"/authorize",
|
||||||
json!({
|
json!({
|
||||||
"AccessToken": format!("t={access_token}"),
|
"AccessToken": format!("t={access_token}"),
|
||||||
"AppId": MICROSOFT_CLIENT_ID,
|
"AppId": MINECRAFT_CLIENT_ID,
|
||||||
"DeviceToken": device_token,
|
"DeviceToken": device_token,
|
||||||
"ProofKey": {
|
"ProofKey": {
|
||||||
// kibty (kty)
|
// kibty (kty)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@onelauncher/distribution",
|
"name": "@onelauncher/distribution",
|
||||||
"type": "module",
|
"version": "1.0.0-alpha.1",
|
||||||
"version": "1.0.0",
|
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "distribution files for OneLauncher",
|
"description": "distribution files for OneLauncher",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@onelauncher/scripts",
|
"name": "@onelauncher/scripts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0-alpha.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Scripts for developing OneLauncher",
|
"description": "Scripts for developing OneLauncher",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue