mirror of
https://github.com/TheNetsky/Microsoft-Rewards-Script.git
synced 2026-01-13 03:37:42 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f015649d16 | ||
|
|
034359019c | ||
|
|
09ddbee45a | ||
|
|
7939196e88 |
12
Dockerfile
12
Dockerfile
@@ -24,17 +24,23 @@ RUN apt-get install -y \
|
||||
# Install application dependencies
|
||||
RUN npm install
|
||||
|
||||
# Ensure correct permissions for node_modules
|
||||
RUN chmod -R 755 /usr/src/microsoft-rewards-script/node_modules
|
||||
|
||||
# Install Playwright Chromium directly from local node_modules
|
||||
RUN ./node_modules/.bin/playwright install chromium
|
||||
|
||||
# Build the script
|
||||
RUN npm run build
|
||||
|
||||
# Install playwright chromium
|
||||
RUN npx playwright install chromium
|
||||
|
||||
# Copy cron file to cron directory
|
||||
COPY src/crontab.template /etc/cron.d/microsoft-rewards-cron.template
|
||||
|
||||
# Create the log file to be able to run tail
|
||||
RUN touch /var/log/cron.log
|
||||
|
||||
# Ensure correct permissions for the working directory
|
||||
RUN chmod -R 755 /usr/src/microsoft-rewards-script
|
||||
|
||||
# Define the command to run your application with cron optionally
|
||||
CMD sh -c 'node src/updateConfig.js && echo "$TZ" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata && if [ "$RUN_ON_START" = "true" ]; then npm start; fi && envsubst < /etc/cron.d/microsoft-rewards-cron.template > /etc/cron.d/microsoft-rewards-cron && crontab /etc/cron.d/microsoft-rewards-cron && cron && tail -f /var/log/cron.log'
|
||||
|
||||
@@ -68,8 +68,10 @@ Under development, however mainly for personal use!
|
||||
| workers.doPunchCards | Complete punchcards | `true` | DO_PUNCH_CARDS |
|
||||
| workers.doDesktopSearch | Complete daily desktop searches | `true` | DO_DESKTOP_SEARCH |
|
||||
| workers.doMobileSearch | Complete daily mobile searches | `true` | DO_MOBILE_SEARCH |
|
||||
| workers.doDailyCheckIn | Complete daily check-in activity | `true` | DO_DAILY_CHECK_IN |
|
||||
| workers.doReadToEarn | Complete read to earn activity | `true` | DO_READ_TO_EARN |
|
||||
| globalTimeout | The length before the action gets timeout | `30000` (30 seconds) | GLOBAL_TIMEOUT |
|
||||
| searchSettings.useGeoLocaleQueries | Generate search queries based on your geo-location | `false` (Uses EN-US generated queries) | USE_GEO_LOCALE_QUERIES |
|
||||
| searchSettings.useGeoLocaleQueries | Generate search queries based on your geo-location | `true` (Uses EN-US generated queries) | USE_GEO_LOCALE_QUERIES |
|
||||
| scrollRandomResults | Scroll randomly in search results | `true` | SCROLL_RANDOM_RESULTS |
|
||||
| searchSettings.clickRandomResults | Visit random website from search result| `true` | CLICK_RANDOM_RESULTS |
|
||||
| searchSettings.searchDelay | Minimum and maximum time in miliseconds between search queries | `min: 10000` (10 seconds) `max: 20000` (20 seconds) | SEARCH_DELAY_MIN SEARCH_DELAY_MAX |
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
},
|
||||
"globalTimeout": 30000,
|
||||
"searchSettings": {
|
||||
"useGeoLocaleQueries": false,
|
||||
"useGeoLocaleQueries": true,
|
||||
"scrollRandomResults": true,
|
||||
"clickRandomResults": true,
|
||||
"searchDelay": {
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -351,6 +351,8 @@ export interface MorePromotion {
|
||||
legalText: string;
|
||||
legalLinkText: string;
|
||||
deviceType: string;
|
||||
exclusiveLockedFeatureType: string;
|
||||
exclusiveLockedFeatureStatus: string;
|
||||
}
|
||||
|
||||
export interface PunchCard {
|
||||
|
||||
Reference in New Issue
Block a user