fix: make display_name an Option so parsing doesn't fail
Some checks failed
FanslySync Build & Test / FanslySync Test Runner (push) Failing after 24m12s
Some checks failed
FanslySync Build & Test / FanslySync Test Runner (push) Failing after 24m12s
This commit is contained in:
parent
d4d9d2ebce
commit
a0649911fe
@ -117,15 +117,19 @@ impl Fansly {
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
if !response.status().is_success() {
|
if !response.status().is_success() {
|
||||||
eprintln!("[sync::process::get_profile] No successful response from API. Setting error state.");
|
log::error!("[sync::process::get_profile] No successful response from API. Setting error state.");
|
||||||
return Err(response.error_for_status().unwrap_err());
|
return Err(response.error_for_status().unwrap_err());
|
||||||
} else {
|
} else {
|
||||||
println!("[sync::process::get_profile] Got successful response from API.");
|
log::info!("[sync::process::get_profile] Successfully fetched profile data.");
|
||||||
}
|
}
|
||||||
|
|
||||||
let profile = response
|
let profile = response
|
||||||
.json::<FanslyBaseResponse<FanslyAccountResponse>>()
|
.json::<FanslyBaseResponse<FanslyAccountResponse>>()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
// Show the profile data
|
||||||
|
log::info!("[sync::process::get_profile] Profile data: {:?}", profile);
|
||||||
|
|
||||||
Ok(profile)
|
Ok(profile)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,12 +161,12 @@ impl Fansly {
|
|||||||
let response = self.client.get(url).headers(headers).send().await?;
|
let response = self.client.get(url).headers(headers).send().await?;
|
||||||
|
|
||||||
if !response.status().is_success() {
|
if !response.status().is_success() {
|
||||||
eprintln!("[sync::process::fetch_followers] No successful response from API. Setting error state.");
|
log::error!("[sync::process::fetch_followers] No successful response from API. Setting error state.");
|
||||||
return Err(response.error_for_status().unwrap_err());
|
return Err(response.error_for_status().unwrap_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
let followers: FanslyBaseResponseList<FanslyFollowersResponse> = response.json().await?;
|
let followers: FanslyBaseResponseList<FanslyFollowersResponse> = response.json().await?;
|
||||||
println!(
|
log::info!(
|
||||||
"[sync::process::fetch_followers] Got {} followers from API.",
|
"[sync::process::fetch_followers] Got {} followers from API.",
|
||||||
followers.response.len()
|
followers.response.len()
|
||||||
);
|
);
|
||||||
@ -423,7 +427,7 @@ impl Fansly {
|
|||||||
.await;
|
.await;
|
||||||
|
|
||||||
// Every 10 requests, sleep for a bit to avoid rate limiting
|
// Every 10 requests, sleep for a bit to avoid rate limiting
|
||||||
if total_requests % 10 == 0 {
|
if total_requests % 50 == 0 {
|
||||||
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
|
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,7 +467,7 @@ impl Fansly {
|
|||||||
.await;
|
.await;
|
||||||
|
|
||||||
// Every 10 requests, sleep for a bit to avoid rate limiting
|
// Every 10 requests, sleep for a bit to avoid rate limiting
|
||||||
if total_requests % 10 == 0 {
|
if total_requests % 50 == 0 {
|
||||||
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
|
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ pub struct Account {
|
|||||||
pub id: String,
|
pub id: String,
|
||||||
pub email: String,
|
pub email: String,
|
||||||
pub username: String,
|
pub username: String,
|
||||||
pub display_name: String,
|
pub display_name: Option<String>,
|
||||||
pub flags: i64,
|
pub flags: i64,
|
||||||
pub version: i64,
|
pub version: i64,
|
||||||
pub created_at: i64,
|
pub created_at: i64,
|
||||||
|
@ -53,7 +53,7 @@ export interface AccountInfoResponse {
|
|||||||
export interface AccountInfo {
|
export interface AccountInfo {
|
||||||
id: string;
|
id: string;
|
||||||
username: string;
|
username: string;
|
||||||
displayName: string;
|
displayName: string | null;
|
||||||
flags: number;
|
flags: number;
|
||||||
version: number;
|
version: number;
|
||||||
createdAt: number;
|
createdAt: number;
|
||||||
@ -76,8 +76,6 @@ export interface AccountInfo {
|
|||||||
banner: Avatar;
|
banner: Avatar;
|
||||||
postLikes: number;
|
postLikes: number;
|
||||||
streaming: Streaming;
|
streaming: Streaming;
|
||||||
subscriptionTiers: SubscriptionTier[];
|
|
||||||
profileAccess: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SubscriptionTier {
|
export interface SubscriptionTier {
|
||||||
|
@ -54,6 +54,9 @@
|
|||||||
unknown
|
unknown
|
||||||
];
|
];
|
||||||
if (err || !me?.success) {
|
if (err || !me?.success) {
|
||||||
|
if (err) {
|
||||||
|
console.error('Error fetching account info:', err);
|
||||||
|
}
|
||||||
validationErrors.fanslyToken =
|
validationErrors.fanslyToken =
|
||||||
'Authentication failed. Please check your token and try again.';
|
'Authentication failed. Please check your token and try again.';
|
||||||
step = 1;
|
step = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user