release/v1.3.2 #9

Merged
nvrl merged 5 commits from release/v1.3.2 into main 2026-02-21 04:39:17 +01:00
2 changed files with 30 additions and 7 deletions
Showing only changes of commit a5cc155ffc - Show all commits

View File

@@ -215,10 +215,10 @@ const scrapeAccountData = async (account: Account) => {
account.authError = false; account.lastScrapeTime = now.toISOString(); account.authError = false; account.lastScrapeTime = now.toISOString();
if (result.isActive) { if (result.isActive) {
account.cooldownExpiresAt = result.expiresAt ? result.expiresAt.toISOString() : new Date(Date.now() + 86400000).toISOString(); account.cooldownExpiresAt = result.expiresAt ? result.expiresAt.toISOString() : new Date(Date.now() + 86400000).toISOString();
if (backend) await backend.pushCooldown(account.steamId, account.cooldownExpiresAt); if (backend) await backend.pushCooldown(account.steamId, account.cooldownExpiresAt, now.toISOString());
} else { } else {
account.cooldownExpiresAt = undefined; account.cooldownExpiresAt = undefined;
if (backend) await backend.pushCooldown(account.steamId, undefined); if (backend) await backend.pushCooldown(account.steamId, undefined, now.toISOString());
} }
} catch (e: any) { } catch (e: any) {
if (e.message.includes('cookie') || e.message.includes('Sign In')) account.authError = true; if (e.message.includes('cookie') || e.message.includes('Sign In')) account.authError = true;
@@ -267,10 +267,29 @@ const syncAccounts = async (isManual = false) => {
exists.sessionUpdatedAt = s.sessionUpdatedAt; exists.sessionUpdatedAt = s.sessionUpdatedAt;
hasChanges = true; hasChanges = true;
} }
if (s.cooldownExpiresAt && (!exists.cooldownExpiresAt || new Date(s.cooldownExpiresAt) > new Date(exists.cooldownExpiresAt))) {
exists.cooldownExpiresAt = s.cooldownExpiresAt; // Metadata Sync (Pull)
const sMetaDate = s.lastMetadataCheck ? new Date(s.lastMetadataCheck) : new Date(0);
const lMetaDate = exists.lastBanCheck ? new Date(exists.lastBanCheck) : new Date(0);
if (sMetaDate > lMetaDate) {
exists.personaName = s.personaName;
exists.avatar = s.avatar;
exists.vacBanned = s.vacBanned;
exists.gameBans = s.gameBans;
exists.status = (s.vacBanned || s.gameBans > 0) ? 'banned' : 'none';
exists.lastBanCheck = s.lastMetadataCheck;
hasChanges = true; hasChanges = true;
} }
// Cooldown Sync (Pull)
const sScrapeDate = s.lastScrapeTime ? new Date(s.lastScrapeTime) : new Date(0);
const lScrapeDate = exists.lastScrapeTime ? new Date(exists.lastScrapeTime) : new Date(0);
if (sScrapeDate > lScrapeDate) {
exists.cooldownExpiresAt = s.cooldownExpiresAt;
exists.lastScrapeTime = s.lastScrapeTime;
hasChanges = true;
}
if (JSON.stringify(exists.sharedWith) !== JSON.stringify(s.sharedWith)) { if (JSON.stringify(exists.sharedWith) !== JSON.stringify(s.sharedWith)) {
exists.sharedWith = s.sharedWith; exists.sharedWith = s.sharedWith;
hasChanges = true; hasChanges = true;

View File

@@ -62,18 +62,22 @@ export class BackendService {
loginName: account.loginName, loginName: account.loginName,
steamLoginSecure: account.steamLoginSecure, steamLoginSecure: account.steamLoginSecure,
loginConfig: account.loginConfig, loginConfig: account.loginConfig,
sessionUpdatedAt: account.sessionUpdatedAt sessionUpdatedAt: account.sessionUpdatedAt,
lastMetadataCheck: account.lastBanCheck,
lastScrapeTime: account.lastScrapeTime,
cooldownExpiresAt: account.cooldownExpiresAt
}, { headers: this.headers }); }, { headers: this.headers });
} catch (e) { } catch (e) {
console.error('[Backend] Failed to share account'); console.error('[Backend] Failed to share account');
} }
} }
public async pushCooldown(steamId: string, cooldownExpiresAt?: string) { public async pushCooldown(steamId: string, cooldownExpiresAt?: string, lastScrapeTime?: string) {
if (!this.token) return; if (!this.token) return;
try { try {
await axios.patch(`${this.url}/api/sync/${steamId}/cooldown`, { await axios.patch(`${this.url}/api/sync/${steamId}/cooldown`, {
cooldownExpiresAt cooldownExpiresAt,
lastScrapeTime
}, { headers: this.headers }); }, { headers: this.headers });
} catch (e) { } catch (e) {
console.error(`[Backend] Failed to push cooldown for ${steamId}`); console.error(`[Backend] Failed to push cooldown for ${steamId}`);