diff --git a/Cargo.lock b/Cargo.lock index 474feb1..b79e7b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -657,12 +657,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -1237,12 +1231,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" -[[package]] -name = "data-encoding" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" - [[package]] name = "deflate64" version = "0.1.9" @@ -1505,15 +1493,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" -[[package]] -name = "encoding_rs" -version = "0.8.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" -dependencies = [ - "cfg-if", -] - [[package]] name = "endi" version = "1.1.0" @@ -2098,16 +2077,16 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.26" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" dependencies = [ + "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "futures-util", - "http 0.2.12", + "http", "indexmap", "slab", "tokio", @@ -2156,30 +2135,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "headers" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" -dependencies = [ - "base64 0.21.7", - "bytes", - "headers-core", - "http 0.2.12", - "httpdate", - "mime", - "sha1", -] - -[[package]] -name = "headers-core" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" -dependencies = [ - "http 0.2.12", -] - [[package]] name = "heck" version = "0.5.0" @@ -2228,17 +2183,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - [[package]] name = "http" version = "1.1.0" @@ -2250,17 +2194,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http 0.2.12", - "pin-project-lite", -] - [[package]] name = "http-body" version = "1.0.1" @@ -2268,7 +2201,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.1.0", + "http", ] [[package]] @@ -2279,8 +2212,8 @@ checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", "futures-util", - "http 1.1.0", - "http-body 1.0.1", + "http", + "http-body", "pin-project-lite", ] @@ -2304,42 +2237,20 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.30" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" +checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", "h2", - "http 0.2.12", - "http-body 0.4.6", + "http", + "http-body", "httparse", "httpdate", "itoa", "pin-project-lite", - "socket2 0.5.7", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http 1.1.0", - "http-body 1.0.1", - "httparse", - "itoa", - "pin-project-lite", "smallvec", "tokio", "want", @@ -2352,8 +2263,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", - "http 1.1.0", - "hyper 1.4.1", + "http", + "hyper", "hyper-util", "rustls", "rustls-pki-types", @@ -2372,9 +2283,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.1.0", - "http-body 1.0.1", - "hyper 1.4.1", + "http", + "http-body", + "hyper", "pin-project-lite", "socket2 0.5.7", "tokio", @@ -2626,6 +2537,9 @@ dependencies = [ "egui_extras", "flate2", "futures", + "http-body-util", + "hyper", + "hyper-util", "image", "lazy_static", "log", @@ -2638,13 +2552,13 @@ dependencies = [ "self-replace", "serde", "serde_json", + "serde_urlencoded", "sha1", "shared", "tar", "thiserror", "tokio", "tokio-util", - "warp", "winapi", "winreg", "winres", @@ -2859,16 +2773,6 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" -[[package]] -name = "mime_guess" -version = "2.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" -dependencies = [ - "mime", - "unicase", -] - [[package]] name = "mime_guess2" version = "2.0.5" @@ -2937,24 +2841,6 @@ dependencies = [ "winreg", ] -[[package]] -name = "multer" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01acbdc23469fd8fe07ab135923371d5f5a422fbf9c522158677c8eb15bc51c2" -dependencies = [ - "bytes", - "encoding_rs", - "futures-util", - "http 0.2.12", - "httparse", - "log", - "memchr", - "mime", - "spin", - "version_check", -] - [[package]] name = "naga" version = "0.20.0" @@ -3440,26 +3326,6 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" -[[package]] -name = "pin-project" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf123a161dde1e524adf36f90bc5d8d3462824a9c43553ad07a8183161189ec" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.79", -] - [[package]] name = "pin-project-lite" version = "0.2.14" @@ -3893,14 +3759,14 @@ version = "0.12.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" dependencies = [ - "base64 0.22.1", + "base64", "bytes", "futures-core", "futures-util", - "http 1.1.0", - "http-body 1.0.1", + "http", + "http-body", "http-body-util", - "hyper 1.4.1", + "hyper", "hyper-rustls", "hyper-util", "ipnet", @@ -4625,18 +4491,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-tungstenite" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" -dependencies = [ - "futures-util", - "log", - "tokio", - "tungstenite", -] - [[package]] name = "tokio-util" version = "0.7.12" @@ -4716,7 +4570,6 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4754,25 +4607,6 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5902c5d130972a0000f60860bfbf46f7ca3db5391eddfedd1b8728bd9dc96c0e" -[[package]] -name = "tungstenite" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" -dependencies = [ - "byteorder", - "bytes", - "data-encoding", - "http 1.1.0", - "httparse", - "log", - "rand", - "sha1", - "thiserror", - "url", - "utf-8", -] - [[package]] name = "type-map" version = "0.5.0" @@ -4871,12 +4705,6 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - [[package]] name = "utf8parse" version = "0.2.2" @@ -4931,35 +4759,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "warp" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4378d202ff965b011c64817db11d5829506d3404edeadb61f190d111da3f231c" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "headers", - "http 0.2.12", - "hyper 0.14.30", - "log", - "mime", - "mime_guess", - "multer", - "percent-encoding", - "pin-project", - "scoped-tls", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", - "tokio-tungstenite", - "tokio-util", - "tower-service", - "tracing", -] - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" diff --git a/launcher/Cargo.toml b/launcher/Cargo.toml index ea49cec..c2bcc09 100644 --- a/launcher/Cargo.toml +++ b/launcher/Cargo.toml @@ -29,10 +29,13 @@ tar = "0.4.41" thiserror = "1.0.63" tokio = { version = "1.39.1", features = ["full"] } tokio-util = "0.7.12" -warp = "0.3.7" zip = "2.2.0" async-trait = "0.1.83" log = "0.4.22" +hyper = { version = "1.5.0", features = ["full"] } +hyper-util = { version = "0.1.9", features = ["full"] } +http-body-util = "0.1.2" +serde_urlencoded = "0.7.1" [target.'cfg(windows)'.dependencies] winapi = { version = "0.3.9", features = ["fileapi", "winbase"] } diff --git a/launcher/src/auth/base.rs b/launcher/src/auth/base.rs index 6cdad65..e801839 100644 --- a/launcher/src/auth/base.rs +++ b/launcher/src/auth/base.rs @@ -30,7 +30,6 @@ pub trait AuthProvider { pub fn get_auth_provider(auth_data: &AuthData) -> Arc { match auth_data { AuthData::ElyBy(auth_data) => Arc::new(ElyByAuthProvider::new( - &auth_data.app_name, &auth_data.client_id, &auth_data.client_secret, )), diff --git a/launcher/src/auth/elyby.rs b/launcher/src/auth/elyby.rs index e7fc429..040028d 100644 --- a/launcher/src/auth/elyby.rs +++ b/launcher/src/auth/elyby.rs @@ -1,15 +1,21 @@ use async_trait::async_trait; +use http_body_util::Full; +use hyper::body::Bytes; +use hyper::server::conn::http1; +use hyper::service::service_fn; +use hyper::{Request, Response}; +use hyper_util::rt::TokioIo; use reqwest::Client; use serde::Deserialize; -use std::sync::mpsc::channel; +use tokio::net::TcpListener; +use std::net::SocketAddr; use std::{ error::Error, - sync::{Arc, Mutex}, + sync::Arc, }; -use tokio::sync::{mpsc::unbounded_channel, oneshot}; -use warp::Filter; -use warp::{http::Uri, reply::Reply}; +use tokio::sync::mpsc; +use crate::config::build_config; use crate::lang::LangMessage; use crate::message_provider::MessageProvider; @@ -17,20 +23,19 @@ use super::base::{AuthProvider, UserInfo}; const ELY_BY_BASE: &str = "https://ely.by/"; -// TODO: rewrite this horrible code -#[derive(Debug)] -struct InvalidCodeError; - -impl std::error::Error for InvalidCodeError {} - -impl std::fmt::Display for InvalidCodeError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "Invalid code error") - } +#[derive(thiserror::Error, Debug)] +pub enum AuthError { + #[error("Invalid code")] + InvalidCode, + #[error("Invalid token type")] + InvalidTokenType, + #[error("Missing access token")] + MissingAccessToken, + #[error("Request error")] + RequestError, } pub struct ElyByAuthProvider { - app_name: String, client_id: String, client_secret: String, } @@ -40,10 +45,114 @@ struct AuthQuery { code: String, } +#[derive(Clone)] +pub struct TokioExecutor; + +impl hyper::rt::Executor for TokioExecutor +where + F: std::future::Future + Send + 'static, + F::Output: Send + 'static, +{ + fn execute(&self, fut: F) { + tokio::task::spawn(fut); + } +} + +async fn exchange_code( + client_id: &str, + client_secret: &str, + code: &str, + redirect_uri: &str, +) -> Result> { + let client = Client::new(); + let resp = client + .post("https://account.ely.by/api/oauth2/v1/token") + .form(&[ + ("client_id", client_id), + ("client_secret", client_secret), + ("redirect_uri", redirect_uri), + ("grant_type", "authorization_code"), + ("code", code), + ]) + .send() + .await?; + + let status = resp.status(); + let data: serde_json::Value = resp.json().await?; + if status != 200 { + if data.get("error") == Some(&"invalid_request".into()) { + return Err(Box::new(AuthError::InvalidCode)); + } + } + + if data.get("token_type") != Some(&"Bearer".into()) { + return Err(Box::new(AuthError::InvalidTokenType)); + } + + if let Some(access_token) = data.get("access_token") { + if let Some(access_token) = access_token.as_str() { + return Ok(access_token.to_string()); + } + } + + Err(Box::new(AuthError::MissingAccessToken)) +} + +enum TokenResult { + Token(String), + InvalidCode, + Error(Box), +} + +async fn handle_request( + client_id: String, + client_secret: String, + redirect_uri: String, + req: Request, + token_tx: Arc>, +) -> Result>, Box> { + let query = req.uri().query().ok_or("Missing query string")?; + let auth_query: AuthQuery = serde_urlencoded::from_str(query)?; + + let token_result = match exchange_code(&client_id, &client_secret, &auth_query.code, &redirect_uri).await { + Ok(token) => TokenResult::Token(token), + Err(e) => match e.downcast::() { + Ok(e) => { + match *e { + AuthError::InvalidCode => TokenResult::InvalidCode, + _ => TokenResult::Error(e), + } + } + Err(e) => TokenResult::Error(e), + } + }; + + let response = match &token_result { + TokenResult::Token(_) => Response::builder() + .status(302) + .header("Location", format!( + "https://account.ely.by/oauth2/code/success?appName={}", + &build_config::get_launcher_name(), + )) + .body(Full::new(Bytes::from("")))?, + + TokenResult::InvalidCode => Response::builder() + .status(400) + .body(Full::new(Bytes::from("Invalid code")))?, + + TokenResult::Error(_) => Response::builder() + .status(500) + .body(Full::new(Bytes::from("Internal server error")))?, + }; + + let _ = token_tx.send(token_result); + + Ok(response) +} + impl ElyByAuthProvider { - pub fn new(elyby_app_name: &str, elyby_client_id: &str, elyby_client_secret: &str) -> Self { + pub fn new(elyby_client_id: &str, elyby_client_secret: &str) -> Self { ElyByAuthProvider { - app_name: elyby_app_name.to_string(), client_id: elyby_client_id.to_string(), client_secret: elyby_client_secret.to_string(), } @@ -57,39 +166,6 @@ impl ElyByAuthProvider { let _ = open::that(&url); message_provider.set_message(LangMessage::AuthMessage { url }); } - - async fn exchange_code( - &self, - code: &str, - redirect_uri: &str, - ) -> Result> { - let client = Client::new(); - let resp = client - .post("https://account.ely.by/api/oauth2/v1/token") - .form(&[ - ("client_id", self.client_id.as_str()), - ("client_secret", self.client_secret.as_str()), - ("redirect_uri", redirect_uri), - ("grant_type", "authorization_code"), - ("code", code), - ]) - .send() - .await?; - - let status = resp.status(); - let data: serde_json::Value = resp.json().await?; - if status != 200 { - if data["error"] == "invalid_request" { - return Err(Box::new(InvalidCodeError)); - } - } - - if data["token_type"] != "Bearer" { - return Err("Invalid token type".into()); - } - - Ok(data["access_token"].as_str().unwrap().to_string()) - } } #[async_trait] @@ -98,62 +174,41 @@ impl AuthProvider for ElyByAuthProvider { &self, message_provider: Arc, ) -> Result> { - let (code_tx, mut code_rx) = unbounded_channel(); - let code_tx = Arc::new(Mutex::new(code_tx)); - - let (error_tx, error_rx) = channel::<()>(); - let error_rx = Arc::new(Mutex::new(error_rx)); - - let handle = { - let code_tx = Arc::clone(&code_tx); - let app_name = self.app_name.clone(); - warp::any() - .and(warp::query::()) - .map(move |query: AuthQuery| { - let code_tx = code_tx.lock().unwrap(); - code_tx.send(query.code.clone()).unwrap(); - - let error_rx = error_rx.lock().unwrap(); - let error = error_rx.recv(); - if error.is_ok() { - Box::new(warp::http::StatusCode::INTERNAL_SERVER_ERROR) as Box - } else { - Box::new(warp::redirect::temporary( - Uri::from_maybe_shared(format!( - "https://account.ely.by/oauth2/code/success?appName={}", - &app_name - )) - .unwrap(), - )) - } - }) - }; - - let (shutdown_tx, shutdown_rx) = oneshot::channel::<()>(); - let (addr, server) = - warp::serve(handle).bind_with_graceful_shutdown(([127, 0, 0, 1], 0), async { - shutdown_rx.await.ok(); - }); + let addr = SocketAddr::from(([127, 0, 0, 1], 0)); + let listener = TcpListener::bind(addr).await?; - let redirect_uri = format!("http://localhost:{}/", addr.port()); - - tokio::spawn(server); + let redirect_uri = format!("http://localhost:{}/", listener.local_addr()?.port()); self.print_auth_url(&redirect_uri, message_provider); + let http = http1::Builder::new(); loop { - let code = code_rx.recv().await.unwrap(); - match self.exchange_code(&code, &redirect_uri).await { - Ok(token) => { - shutdown_tx.send(()).unwrap(); - return Ok(token); - } - Err(e) => { - if e.downcast_ref::().is_none() { - shutdown_tx.send(()).unwrap(); - return Err(e); + let (stream, _) = listener.accept().await?; + let io = TokioIo::new(stream); + + let (token_tx, mut token_rx) = mpsc::unbounded_channel(); + let token_tx = Arc::new(token_tx); + + http.serve_connection(io, service_fn(|req: Request| { + let token_tx = token_tx.clone(); + handle_request( + self.client_id.clone(), + self.client_secret.clone(), + redirect_uri.clone(), + req, + token_tx, + ) + })).await?; + + if let Some(token) = token_rx.recv().await { + match token { + TokenResult::Token(token) => return Ok(token), + TokenResult::InvalidCode => { + continue; } - error_tx.send(()).unwrap(); + TokenResult::Error(e) => return Err(e), } + } else { + return Err(Box::new(AuthError::RequestError)); } } } diff --git a/modpack_builder/README.md b/modpack_builder/README.md index 630a111..4a87d2a 100644 --- a/modpack_builder/README.md +++ b/modpack_builder/README.md @@ -46,7 +46,7 @@ The `spec.json` file is used to define the specifications for generating modpack - **name**: The name of the version. - **minecraft_version**: The Minecraft version for this modpack. -- **loader_name**: The name of the mod loader (e.g., "vanilla", "fabric", "forge"). +- **loader_name**: The name of the mod loader ("vanilla", "fabric", "forge" or "neoforge"; "vanilla" by default). - **loader_version**: The version of the mod loader (optional; latest for fabric and `recommended` for forge if not set). - **include**: A list of additional files or directories to include in the modpack (optional; e.g., mods). - **include_no_overwrite**: A list of files or directories to include without overwriting existing files (optional; e.g., configs). @@ -58,4 +58,20 @@ The `spec.json` file is used to define the specifications for generating modpack - **exec_before**: A command to execute before processing this version (optional). - **exec_after**: A command to execute after processing this version (optional). -[Example](spec.json.example) +For more details on configuring the `spec.json` file, refer to the [spec.json.example](spec.json.example) file. + +# Running Modpack Builder + +To build modpacks for the launcher, follow these steps: + +1. **Prepare the Configuration**: Ensure that your `spec.json` file is properly configured. You can use the provided [spec.json.example](modpack_builder/spec.json.example) as a reference. + +2. **Run the Builder**: Execute the Modpack Builder with the following command: + + ```sh + cargo run --release -p modpack_builder -- -s + ``` + +This will process the versions specified in your `spec.json` file and generate the modpack files accordingly. + +3. **Deploy the Generated Files**: If you have specified any `exec_after_all` commands in your `spec.json`, they will be executed after all versions are processed. You can use this to deploy the generated files, for example, by using `rsync` to upload them to a server. diff --git a/modpack_builder/src/generate/extra.rs b/modpack_builder/src/generate/extra.rs index 43f581e..2b87069 100644 --- a/modpack_builder/src/generate/extra.rs +++ b/modpack_builder/src/generate/extra.rs @@ -239,10 +239,6 @@ impl ExtraMetadataGenerator { self.version_name ); - if self.include_from.is_none() && self.resources_url_base.is_none() { - return Ok(()); - } - let extra_forge_libs = get_extra_forge_libs( &self.extra_forge_libs_paths, output_dir, diff --git a/shared/src/version/extra_version_metadata.rs b/shared/src/version/extra_version_metadata.rs index 4a4b62f..49aa1bc 100644 --- a/shared/src/version/extra_version_metadata.rs +++ b/shared/src/version/extra_version_metadata.rs @@ -20,7 +20,6 @@ pub struct TelegramAuthData { #[derive(Deserialize, Serialize, Clone)] pub struct ElyByAuthData { - pub app_name: String, pub client_id: String, pub client_secret: String, } @@ -30,7 +29,7 @@ pub struct ElyByAuthData { pub enum AuthData { None, Telegram(TelegramAuthData), - #[serde(rename = "ely_by")] + #[serde(rename = "ely.by")] ElyBy(ElyByAuthData), } @@ -45,8 +44,8 @@ impl AuthData { match self { AuthData::Telegram(auth_data) => format!("telegram_{}", auth_data.auth_base_url), AuthData::ElyBy(auth_data) => format!( - "elyby_{}_{}_{}", - auth_data.app_name, auth_data.client_id, auth_data.client_secret + "elyby_{}_{}", + auth_data.client_id, auth_data.client_secret ), AuthData::None => "none".to_string(), }