@@ -22,6 +22,7 @@ use std::{collections::HashMap, path::Path};
2222use crate :: minecraft:: java:: DistributionSelection ;
2323use crate :: { auth:: ClientAccount , minecraft:: auth:: MinecraftAccount } ;
2424use anyhow:: Result ;
25+ use rand:: distr:: { Alphanumeric , SampleString } ;
2526use serde:: { Deserialize , Serialize } ;
2627use tokio:: fs;
2728use tracing:: info;
@@ -72,6 +73,8 @@ pub(crate) struct LauncherOptions {
7273 pub concurrent_downloads : u32 ,
7374 #[ serde( rename = "keepLauncherOpen" ) ]
7475 pub keep_launcher_open : bool ,
76+ #[ serde( rename = "sessionToken" , default = "random_token" ) ]
77+ pub session_token : String ,
7578}
7679
7780#[ derive( Serialize , Deserialize ) ]
@@ -126,6 +129,7 @@ impl Options {
126129 keep_launcher_open : legacy. keep_launcher_open ,
127130 show_nightly_builds : legacy. show_nightly_builds ,
128131 concurrent_downloads : legacy. concurrent_downloads as u32 ,
132+ session_token : random_token ( )
129133 } ,
130134 premium_options : PremiumOptions {
131135 account : legacy. client_account ,
@@ -170,6 +174,7 @@ impl Default for LauncherOptions {
170174 show_nightly_builds : false ,
171175 keep_launcher_open : false ,
172176 concurrent_downloads : 10 ,
177+ session_token : random_token ( )
173178 }
174179 }
175180}
@@ -198,6 +203,10 @@ fn default_memory() -> u64 {
198203 4096
199204}
200205
206+ fn random_token ( ) -> String {
207+ Alphanumeric . sample_string ( & mut rand:: rng ( ) , 16 )
208+ }
209+
201210// Legacy format structure
202211#[ derive( Deserialize ) ]
203212#[ allow( unused) ]
0 commit comments