Skip to content

Commit 87e3cbb

Browse files
committed
feat: Fix cookie check
1 parent f258b8f commit 87e3cbb

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ impl UserApi {
161161
.text()
162162
.await
163163
{
164-
Ok(data) => data,
164+
Ok(data) => {
165+
// println!("{}", data);
166+
data
167+
},
165168
Err(_err) => return Err("Can't take cookie info".into()),
166169
};
167170

@@ -170,6 +173,7 @@ impl UserApi {
170173
.userStatus
171174
.isSignedIn
172175
{
176+
println!("work");
173177
return Ok((true, String::from(token)));
174178
}
175179

src/source/cookie.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub struct Feature {
3535
#[derive(Debug, Deserialize, Serialize)]
3636
pub struct StreakCounter {
3737
pub streakCount: i32,
38-
pub daysSkipped: i32,
38+
pub daysSkipped: Option<i32>,
3939
pub currentDayCompleted: bool,
4040
pub __typename: String,
4141
}
@@ -57,18 +57,18 @@ pub struct UserStatus {
5757
pub isSuperuser: bool,
5858
pub isMockUser: bool,
5959
pub isTranslator: bool,
60-
pub isPremium: bool,
60+
pub isPremium: Option<bool>,
6161
pub isVerified: bool,
6262
pub checkedInToday: bool,
6363
pub username: String,
64-
pub realName: String,
65-
pub avatar: String,
64+
pub realName: Option<String>,
65+
pub avatar: Option<String>,
6666
pub optedIn: bool,
6767
pub requestRegion: String,
68-
pub region: String,
68+
pub region: Option<String>,
6969
pub activeSessionId: i32,
7070
pub permissions: Vec<String>,
71-
pub notificationStatus: NotificationStatus,
71+
pub notificationStatus: Option<NotificationStatus>,
7272
pub completedFeatureGuides: Vec<String>,
7373
pub __typename: String,
7474
}
@@ -77,7 +77,7 @@ pub struct UserStatus {
7777
#[derive(Debug, Deserialize, Serialize)]
7878
pub struct GlobalData {
7979
pub feature: Feature,
80-
pub streakCounter: StreakCounter,
80+
pub streakCounter: Option<StreakCounter>,
8181
pub currentTimestamp: f64,
8282
pub userStatus: UserStatus,
8383
pub siteRegion: String,

0 commit comments

Comments
 (0)