From 09ddbee45a39745b28ff69174ee1329c7a37990c Mon Sep 17 00:00:00 2001 From: HMCDAT <90164248+hmcdat@users.noreply.github.com> Date: Wed, 2 Oct 2024 23:37:06 +0700 Subject: [PATCH] 1.4.11 (#146) * fix misspelling * fix: avoid skipping eligible items in "More Promotion" * remove unnecessary output * Fix Formatting * replace checking variable * decrease id length * revert previous commit * change condition for eligible promo * Other fixes --------- Co-authored-by: TheNetsky <56271887+TheNetsky@users.noreply.github.com> --- package.json | 6 +++--- src/browser/Browser.ts | 3 ++- src/browser/BrowserFunc.ts | 2 +- src/config.json | 2 +- src/functions/Workers.ts | 2 +- src/functions/activities/Search.ts | 17 +++++++---------- src/interface/DashboardData.ts | 2 ++ 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index e5c6701..742565a 100644 --- a/package.json +++ b/package.json @@ -34,9 +34,9 @@ "dependencies": { "axios": "^1.7.5", "cheerio": "^1.0.0", - "fingerprint-generator": "^2.1.54", - "fingerprint-injector": "^2.1.54", - "playwright": "^1.46.1", + "fingerprint-generator": "^2.1.56", + "fingerprint-injector": "^2.1.56", + "playwright": "^1.47.2", "ts-node": "^10.9.2" } } diff --git a/src/browser/Browser.ts b/src/browser/Browser.ts index dc4539e..293393f 100644 --- a/src/browser/Browser.ts +++ b/src/browser/Browser.ts @@ -13,6 +13,7 @@ import { AccountProxy } from '../interface/Account' https://abrahamjuliot.github.io/creepjs/ https://botcheck.luminati.io/ http://f.vision/ +https://pixelscan.net/ */ class Browser { @@ -61,7 +62,7 @@ class Browser { const fingerPrintData = new FingerprintGenerator().getFingerprint({ devices: this.bot.isMobile ? ['mobile'] : ['desktop'], operatingSystems: this.bot.isMobile ? ['android'] : ['windows'], - browsers: ['edge'] + browserListQuery: 'last 2 edge version' }) return fingerPrintData diff --git a/src/browser/BrowserFunc.ts b/src/browser/BrowserFunc.ts index 31b62f8..76b9c2c 100644 --- a/src/browser/BrowserFunc.ts +++ b/src/browser/BrowserFunc.ts @@ -160,7 +160,7 @@ export default class BrowserFunc { if (data.morePromotions?.length) { data.morePromotions.forEach(x => { // Only count points from supported activities - if (['quiz', 'urlreward'].includes(x.promotionType) && !x.attributes.is_unlocked) { + if (['quiz', 'urlreward'].includes(x.promotionType) && x.exclusiveLockedFeatureStatus !== 'locked') { totalEarnablePoints += (x.pointProgressMax - x.pointProgress) } }) diff --git a/src/config.json b/src/config.json index aa0a65b..72e27c0 100644 --- a/src/config.json +++ b/src/config.json @@ -16,7 +16,7 @@ }, "globalTimeout": 30000, "searchSettings": { - "useGeoLocaleQueries": false, + "useGeoLocaleQueries": true, "scrollRandomResults": true, "clickRandomResults": true, "searchDelay": { diff --git a/src/functions/Workers.ts b/src/functions/Workers.ts index 2951267..9812972 100644 --- a/src/functions/Workers.ts +++ b/src/functions/Workers.ts @@ -87,7 +87,7 @@ export class Workers { morePromotions.push(data.promotionalItem as unknown as MorePromotion) } - const activitiesUncompleted = morePromotions?.filter(x => !x.complete && x.pointProgressMax > 0 && !x.attributes.is_unlocked) ?? [] + const activitiesUncompleted = morePromotions?.filter(x => !x.complete && x.pointProgressMax > 0 && x.exclusiveLockedFeatureStatus !== 'locked') ?? [] if (!activitiesUncompleted.length) { this.bot.log('MORE-PROMOTIONS', 'All "More Promotion" items have already been completed') diff --git a/src/functions/activities/Search.ts b/src/functions/activities/Search.ts index b6990c6..fcac5e0 100644 --- a/src/functions/activities/Search.ts +++ b/src/functions/activities/Search.ts @@ -144,9 +144,6 @@ export class Search extends Workers { window.scrollTo(0, 0) }) - // Set it since params get added after visiting - this.searchPageURL = searchPage.url() - await this.bot.utils.wait(500) const searchBar = '#sb_form_q' @@ -259,7 +256,7 @@ export class Search extends Workers { return response.data[1] as string[] } catch (error) { - this.bot.log('SEARCH-BING-RELTATED', 'An error occurred:' + error, 'error') + this.bot.log('SEARCH-BING-RELATED', 'An error occurred:' + error, 'error') } return [] } @@ -291,13 +288,13 @@ export class Search extends Workers { try { await page.click('#b_results .b_algo h2', { timeout: 2000 }).catch(() => { }) // Since we don't really care if it did it or not + // Stay for 10 seconds for page to load and "visit" + await this.bot.utils.wait(10_000) + // Will get current tab if no new one is created, this will always be the visited site or the result page if it failed to click let lastTab = await this.bot.browser.utils.getLatestTab(page) - // Stay for 10 seconds - await this.bot.utils.wait(10_000) - - let lastTabURL = new URL(lastTab.url()) // Get new tab info, this is the website we've visited + let lastTabURL = new URL(lastTab.url()) // Get new tab info, this is the website we're visiting // Check if the URL is different from the original one, don't loop more than 5 times. let i = 0 @@ -332,10 +329,10 @@ export class Search extends Workers { await this.bot.utils.wait(3000) this.searchPageURL = newPage.url() - // Else reset the last tab back to the search listing + // Else reset the last tab back to the search listing or Bing.com } else { lastTab = await this.bot.browser.utils.getLatestTab(lastTab) - await lastTab.goto(this.searchPageURL) + await lastTab.goto(this.searchPageURL ? this.searchPageURL : this.bingHome) } } diff --git a/src/interface/DashboardData.ts b/src/interface/DashboardData.ts index 91bb642..fd8e349 100644 --- a/src/interface/DashboardData.ts +++ b/src/interface/DashboardData.ts @@ -351,6 +351,8 @@ export interface MorePromotion { legalText: string; legalLinkText: string; deviceType: string; + exclusiveLockedFeatureType: string; + exclusiveLockedFeatureStatus: string; } export interface PunchCard {