Skip to content

Commit 26db4d4

Browse files
committed
dump device
1 parent 2349b80 commit 26db4d4

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/handler/password.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff 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));

src/handler/qrcode.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ pub struct CreateClientResp {
7272
pub 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,

0 commit comments

Comments
 (0)