Skip to content

Commit 5b46861

Browse files
Merge pull request #1 from oragejuice/main
Added timeleft and expiry to the data saved in the struct when logging in or registering
2 parents 78cf043 + a56d83f commit 5b46861

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/v1_2.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ also if you want to use an obfuscator for rust i recommend using [obfstr](https:
1313

1414
use uuid::Uuid;
1515
use std::collections::HashMap;
16-
use std::io::Read;
17-
use std::net::TcpListener;
1816
use reqwest::blocking::Client;
1917
use reqwest::blocking::Response;
2018
use hmac_sha256::HMAC;
@@ -42,6 +40,8 @@ pub struct KeyauthApi {
4240
pub create_date: String,
4341
pub last_login: String,
4442
pub subscription: String,
43+
pub sub_time_left: i64,
44+
pub expiry: String,
4545
pub message: String,
4646
pub success: bool,
4747
pub blacklisted: bool,
@@ -71,6 +71,8 @@ impl KeyauthApi {
7171
create_date: String::new(),
7272
last_login: String::new(),
7373
subscription: String::new(),
74+
sub_time_left: 0,
75+
expiry: String::new(),
7476
message: String::new(),
7577
success: false,
7678
blacklisted: false,
@@ -195,6 +197,8 @@ impl KeyauthApi {
195197
self.create_date = json_rep["info"]["createdate"].as_str().unwrap().to_string();
196198
self.last_login = json_rep["info"]["lastlogin"].as_str().unwrap().to_string();
197199
self.subscription = json_rep["info"]["subscriptions"][0]["subscription"].as_str().unwrap().to_string();
200+
self.sub_time_left = json_rep["info"]["subscriptions"][0]["timeleft"].as_i64().unwrap();
201+
self.expiry = json_rep["info"]["subscriptions"][0]["expiry"].as_str().unwrap().to_string();
198202
Ok(())
199203
} else {
200204
Err(json_rep["message"].as_str().unwrap().to_string())
@@ -294,6 +298,8 @@ impl KeyauthApi {
294298
self.create_date = json_rep["info"]["createdate"].as_str().unwrap().to_string();
295299
self.last_login = json_rep["info"]["lastlogin"].as_str().unwrap().to_string();
296300
self.subscription = json_rep["info"]["subscriptions"][0]["subscription"].as_str().unwrap().to_string();
301+
self.sub_time_left = json_rep["info"]["subscriptions"][0]["timeleft"].as_i64().unwrap();
302+
self.expiry = json_rep["info"]["subscriptions"][0]["expiry"].as_str().unwrap().to_string();
297303
Ok(())
298304
} else {
299305
Err(json_rep["message"].as_str().unwrap().to_string())
@@ -349,6 +355,8 @@ impl KeyauthApi {
349355
self.create_date = json_rep["info"]["createdate"].as_str().unwrap().to_string();
350356
self.last_login = json_rep["info"]["lastlogin"].as_str().unwrap().to_string();
351357
self.subscription = json_rep["info"]["subscriptions"][0]["subscription"].as_str().unwrap().to_string();
358+
self.sub_time_left = json_rep["info"]["subscriptions"][0]["timeleft"].as_i64().unwrap();
359+
self.expiry = json_rep["info"]["subscriptions"][0]["expiry"].as_str().unwrap().to_string();
352360
Ok(())
353361
} else {
354362
Err(json_rep["message"].as_str().unwrap().to_string())

0 commit comments

Comments
 (0)