🐛 fix: fix client id

This commit is contained in:
Pauline 2024-07-27 02:52:25 +02:00
parent 36aa0b658f
commit bcb2d55b95
No known key found for this signature in database
GPG key ID: 722BB181973296AE
17 changed files with 53 additions and 59 deletions

View file

@ -17,7 +17,7 @@ authors = [
"Polyfrost",
"Polyfrost Contributors"
]
version = "1.0.0"
version = "1.0.0-alpha.1"
[workspace.dependencies]
onelauncher = { path = "./packages/core" }

View file

@ -1,7 +1,7 @@
[package]
name = "onelauncher_gui"
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 }
edition = { workspace = true }
repository = { workspace = true }

View file

@ -11,31 +11,25 @@ fn main() {
"get_users",
"get_user",
"remove_user",
// Cluster
"create_cluster",
"remove_cluster",
"get_cluster",
"get_clusters",
"run_cluster",
// Processor
"get_running_clusters",
"get_processes_by_path",
"kill_process",
// Settings
"get_settings",
"set_settings",
// Metadata
"get_minecraft_versions",
// Package
"random_mods",
"get_mod",
"download_mod",
// Other
"get_program_info",
]),

View file

@ -1,7 +1,8 @@
{
"name": "@onelauncher/desktop",
"type": "module",
"version": "1.0.0",
"version": "1.0.0-alpha.1",
"private": true,
"description": "Next-generation open source Minecraft launcher",
"license": "GPL-3.0-only",
"repository": {
@ -11,8 +12,7 @@
},
"scripts": {
"build": "tauri build",
"dev": "tauri dev",
"tauri": "tauri"
"dev": "tauri dev"
},
"dependencies": {
"@onelauncher/core": "workspace:*",

View file

@ -1,7 +1,8 @@
{
"name": "@onelauncher/frontend",
"type": "module",
"version": "1.0.0",
"version": "1.0.0-alpha.1",
"private": true,
"description": "Next-generation open source Minecraft launcher frontend",
"license": "GPL-3.0-only",
"repository": {
@ -10,7 +11,7 @@
"directory": "apps/frontend"
},
"scripts": {
"dev": "vite dev",
"dev": "vite",
"build": "vite build"
},
"dependencies": {

View file

@ -1,7 +1,7 @@
{
"name": "@onelauncher/testing",
"type": "module",
"version": "1.0.0",
"version": "1.0.0-alpha.1",
"private": true,
"description": "Next-generation open source Minecraft launcher playground",
"license": "GPL-3.0-only",
"repository": {

View file

@ -4,9 +4,19 @@
)]
use onelauncher::cluster::create::create_cluster;
use onelauncher::package::content::{self, Providers};
use onelauncher::package::content::Providers;
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> {
println!("a browser will open, follow login flow");
let login = minecraft::begin().await?;
@ -35,18 +45,8 @@ pub async fn authenticate_mc() -> onelauncher::Result<MinecraftCredentials> {
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<()> {
let state = State::get().await?;
let _state = State::get().await?;
let provider = Providers::Modrinth;
let result = provider.get("oneconfig").await?;
println!("{:#?}", result);

View file

@ -21,6 +21,6 @@ export default petal({
'*.rs',
'pnpm-lock.yaml',
'**/node_modules',
'apps/desktop/src/bindings.ts',
'apps/frontend/src/bindings.ts',
],
});

View file

@ -1,7 +1,8 @@
{
"name": "@onelauncher/root",
"type": "module",
"version": "1.0.0",
"version": "1.0.0-alpha.1",
"private": true,
"packageManager": "pnpm@9.6.0",
"description": "Next-generation open source Minecraft launcher and tools for interacting with Polyfrost",
"license": "GPL-3.0-only",
@ -22,18 +23,16 @@
"frontend": "pnpm --filter @onelauncher/frontend -- ",
"client": "pnpm --filter @onelauncher/client -- ",
"desktop": "pnpm --filter @onelauncher/desktop -- ",
"core": "cd packages/core && cargo",
"testing": "cd apps/testing && cargo",
"tauri": "cd apps/desktop && cargo",
"format": "pnpm format:es && pnpm format:rs",
"lint": "pnpm lint:es && pnpm lint:rs",
"lint:es": "pnpm eslint . --cache",
"lint:es": "eslint . --cache",
"format:es": "pnpm lint:es --fix",
"lint:rs": "cargo +nightly fmt --check && cargo clippy -- -D warnings",
"format:rs": "cargo +nightly fmt && cargo clippy --fix",
"release:node": "pnpm bumpp -r"
"release:node": "bumpp -r"
},
"devDependencies": {
"@flowr/eslint-config": "^3.10.1",

View file

@ -1,7 +1,7 @@
{
"name": "@onelauncher/client",
"type": "module",
"version": "1.0.0",
"version": "1.0.0-alpha.1",
"private": true,
"description": "RSPC Client for OneLauncher",
"license": "GPL-3.0-only",

View file

@ -17,8 +17,9 @@ default = []
tauri = [
"dep:tauri",
"dep:tauri-specta",
"dep:specta"
"specta"
]
specta = [ "dep:specta" ]
cli = [ "dep:indicatif" ]
[dependencies]

View file

@ -1,7 +1,6 @@
{
"name": "@onelauncher/core",
"type": "module",
"version": "1.0.0",
"version": "1.0.0-alpha.1",
"description": "Next-generation open source Minecraft launcher core",
"license": "GPL-3.0-only",
"repository": {

View file

@ -4,7 +4,6 @@ use crate::store::{ManagedVersionFile, PackageFile, PackageSide};
use crate::utils::http::fetch;
use crate::{Result, State};
use anyhow::anyhow;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use serde_json::Value;

View file

@ -7,18 +7,20 @@
/// The name of the launcher.
pub const NAME: &str = "OneLauncher";
/// 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 ===========
/// The Discord RPC client ID.
pub const DISCORD_RPC_CLIENT_ID: &str = "1234567890000000";
/// Microsoft client ID.
pub const MICROSOFT_CLIENT_ID: &str = "00000000402b5328";
/// Microsoft login redirect URI.
pub const REDIRECT_URL: &str = "https://login.live.com/oauth20_desktop.srf";
/// Microsoft login xboxlive scopes to get tokens.
pub const SCOPES: &str = "service::user.auth.xboxlive.com::MBI_SSL";
/// Our Microsoft client ID.
pub const MICROSOFT_CLIENT_ID: &str = "9eac3a4e-8cdd-43ef-863e-49cd601b1f03";
/// Mojang/Microsoft client ID.
pub const MINECRAFT_CLIENT_ID: &str = "00000000402b5328";
/// Mojang/Microsoft login redirect URI.
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 ===========
#[cfg(target_os = "windows")]

View file

@ -13,7 +13,7 @@ use std::collections::HashMap;
use std::fmt::Write;
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";
@ -447,16 +447,16 @@ async fn sisu_authenticate(
"https://sisu.xboxlive.com/authenticate",
"/authenticate",
json!({
"AppId": MICROSOFT_CLIENT_ID,
"AppId": MINECRAFT_CLIENT_ID,
"DeviceToken": token,
"Offers": [SCOPES],
"Offers": [MINECRAFT_SCOPES],
"Query": {
"code_challenge": challenge,
"code_challenge_method": "S256",
"state": generate_oauth_challenge(),
"prompt": "select_account"
},
"RedirectUri": REDIRECT_URL,
"RedirectUri": MINECRAFT_REDIRECT_URL,
"Sandbox": "RETAIL",
"TokenType": "code",
"TitleId": "1794566092"
@ -500,12 +500,12 @@ async fn oauth_token(
verify: &str,
) -> Result<RequestWithDate<OAuthToken>, MinecraftAuthError> {
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_verifier", verify);
query.insert("grant_type", "authorization_code");
query.insert("redirect_uri", REDIRECT_URL);
query.insert("scope", SCOPES);
query.insert("redirect_uri", MINECRAFT_REDIRECT_URL);
query.insert("scope", MINECRAFT_SCOPES);
let res = auth_retry(|| {
crate::utils::http::REQWEST_CLIENT
.post("https://login.live.com/oauth20_token.srf")
@ -548,11 +548,11 @@ async fn oauth_refresh(
refresh_token: &str,
) -> Result<RequestWithDate<OAuthToken>, MinecraftAuthError> {
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("grant_type", "refresh_token");
query.insert("redirect_uri", REDIRECT_URL);
query.insert("scope", SCOPES);
query.insert("redirect_uri", MINECRAFT_REDIRECT_URL);
query.insert("scope", MINECRAFT_SCOPES);
let res = auth_retry(|| {
crate::utils::http::REQWEST_CLIENT
.post("https://login.live.com/oauth20_token.srf")
@ -615,7 +615,7 @@ async fn sisu_authorize(
"/authorize",
json!({
"AccessToken": format!("t={access_token}"),
"AppId": MICROSOFT_CLIENT_ID,
"AppId": MINECRAFT_CLIENT_ID,
"DeviceToken": device_token,
"ProofKey": {
// kibty (kty)

View file

@ -1,7 +1,6 @@
{
"name": "@onelauncher/distribution",
"type": "module",
"version": "1.0.0",
"version": "1.0.0-alpha.1",
"private": true,
"description": "distribution files for OneLauncher",
"license": "GPL-3.0-only",

View file

@ -1,7 +1,7 @@
{
"name": "@onelauncher/scripts",
"type": "module",
"version": "1.0.0",
"version": "1.0.0-alpha.1",
"private": true,
"description": "Scripts for developing OneLauncher",
"license": "GPL-3.0-only",