File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,12 @@ pub async fn login(Json(req): Json<CreateClientReq>) -> RCResult<Json<PasswordLo
117117 rand_seed = req. uin as u64 ;
118118 }
119119 let device = Device :: random_with_rng ( & mut StdRng :: seed_from_u64 ( rand_seed) ) ;
120+ tokio:: fs:: write (
121+ format ! ( "device-{}.json" , rand_seed) ,
122+ serde_json:: to_string ( & device) . unwrap ( ) ,
123+ )
124+ . await
125+ . ok ( ) ;
120126 let protocol = Protocol :: from_u8 ( req. protocol ) ;
121127 let ( sender, receiver) = tokio:: sync:: broadcast:: channel ( 10 ) ;
122128 let cli = Arc :: new ( Client :: new ( device, get_version ( protocol. clone ( ) ) , sender) ) ;
Original file line number Diff line number Diff line change @@ -72,6 +72,12 @@ pub struct CreateClientResp {
7272pub async fn create ( Json ( req) : Json < CreateClientReq > ) -> RCResult < Json < CreateClientResp > > {
7373 let rand_seed = req. device_seed . unwrap_or_else ( rand:: random) ;
7474 let device = Device :: random_with_rng ( & mut StdRng :: seed_from_u64 ( rand_seed) ) ;
75+ tokio:: fs:: write (
76+ format ! ( "device-{}.json" , rand_seed) ,
77+ serde_json:: to_string ( & device) . unwrap ( ) ,
78+ )
79+ . await
80+ . ok ( ) ;
7581 let protocol = match Protocol :: from_u8 ( req. protocol ) {
7682 Protocol :: MacOS => Protocol :: MacOS ,
7783 Protocol :: AndroidWatch => Protocol :: AndroidWatch ,
You can’t perform that action at this time.
0 commit comments