mirror of
https://github.com/TheNetsky/Microsoft-Rewards-Script.git
synced 2026-01-18 14:03:58 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef6ad569ff | ||
|
|
da9ba91c5c | ||
|
|
deb2d58b1b | ||
|
|
66a82c2584 | ||
|
|
8a022d5983 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,3 +6,4 @@ accounts.json
|
|||||||
notes
|
notes
|
||||||
accounts.dev.json
|
accounts.dev.json
|
||||||
accounts.main.json
|
accounts.main.json
|
||||||
|
.DS_Store
|
||||||
|
|||||||
24
README.md
24
README.md
@@ -17,9 +17,26 @@ Under development, however mainly for personal use!
|
|||||||
|
|
||||||
## Docker (Experimental) ##
|
## Docker (Experimental) ##
|
||||||
1. Download the source code
|
1. Download the source code
|
||||||
2. Make changes to your `accounts.json` and/or `config.json`
|
2. Make changes to your `accounts.json`
|
||||||
3. Run `docker build -t microsoft-rewards-script-docker .`
|
3. Make sure to change `"headless": false` to `"headless": true` in your `config.json`
|
||||||
- Docker container has to be recreated for any changes regarding the `config.json` and/or `accounts.json`!
|
4. Note, the container has to be recreated for any changes regarding the `config.json` and/or `accounts.json`!
|
||||||
|
### Option 1: build and run with docker run
|
||||||
|
|
||||||
|
1. Run `docker build -t microsoft-rewards-script-docker .` to build the container
|
||||||
|
2. Run the container with `docker run --name netsky -d microsoft-rewards-script-docker` or, omit the detached flag `-d` to view the script output in your terminal.
|
||||||
|
3. Optionally, change the name of the container by changing `--name netsky` to your preferred container name
|
||||||
|
4. The container will exit after completing the script, run it again using `docker start netsky`
|
||||||
|
5. If you are running the container `-d` detached, you can view logs with `docker logs netsky`
|
||||||
|
|
||||||
|
### Option 2: use docker compose
|
||||||
|
|
||||||
|
1. A basic docker compose.yaml has been provided, which can be run with `docker compose up -d` or, omit the detached flag `-d` to view the script output in your terminal.
|
||||||
|
|
||||||
|
2. The container will exit after completing the script, run it again using `docker start netsky`
|
||||||
|
|
||||||
|
3. If you are running the container `-d` detached, you can view logs with `docker logs netsky`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Config ##
|
## Config ##
|
||||||
| Setting | Description | Default |
|
| Setting | Description | Default |
|
||||||
@@ -35,6 +52,7 @@ Under development, however mainly for personal use!
|
|||||||
| workers.doPunchCards | Complete punchcards | `true` |
|
| workers.doPunchCards | Complete punchcards | `true` |
|
||||||
| workers.doDesktopSearch | Complete daily desktop searches | `true` |
|
| workers.doDesktopSearch | Complete daily desktop searches | `true` |
|
||||||
| workers.doMobileSearch | Complete daily mobile searches | `true` |
|
| workers.doMobileSearch | Complete daily mobile searches | `true` |
|
||||||
|
| globalTimeout | The length before the action gets timeout | 30 seconds (30.000 miliseconds) |
|
||||||
| searchSettings.useGeoLocaleQueries | Generate search queries based on your geo-location | `false` (Uses EN-US generated queries) |
|
| searchSettings.useGeoLocaleQueries | Generate search queries based on your geo-location | `false` (Uses EN-US generated queries) |
|
||||||
| scrollRandomResults | Scroll randomly in search results | `true` |
|
| scrollRandomResults | Scroll randomly in search results | `true` |
|
||||||
| searchSettings.clickRandomResults | Visit random website from search result| `true` |
|
| searchSettings.clickRandomResults | Visit random website from search result| `true` |
|
||||||
|
|||||||
8
compose.yaml
Normal file
8
compose.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
services:
|
||||||
|
microsoft-rewards-script:
|
||||||
|
build: .
|
||||||
|
container_name: netsky
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=production
|
||||||
|
volumes:
|
||||||
|
- .:/usr/src/microsoft-rewards-script
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "microsoft-rewards-script",
|
"name": "microsoft-rewards-script",
|
||||||
"version": "1.4.5",
|
"version": "1.4.6",
|
||||||
"description": "Automatically do tasks for Microsoft Rewards but in TS!",
|
"description": "Automatically do tasks for Microsoft Rewards but in TS!",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ class Browser {
|
|||||||
|
|
||||||
const context = await newInjectedContext(browser, { fingerprint: fingerpint })
|
const context = await newInjectedContext(browser, { fingerprint: fingerpint })
|
||||||
|
|
||||||
|
// Set timeout to preferred amount
|
||||||
|
context.setDefaultTimeout(this.bot.config?.globalTimeout ?? 30_000)
|
||||||
|
|
||||||
await context.addCookies(sessionData.cookies)
|
await context.addCookies(sessionData.cookies)
|
||||||
|
|
||||||
if (this.bot.config.saveFingerprint) {
|
if (this.bot.config.saveFingerprint) {
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ export default class BrowserFunc {
|
|||||||
if (data.morePromotions?.length) {
|
if (data.morePromotions?.length) {
|
||||||
data.morePromotions.forEach(x => {
|
data.morePromotions.forEach(x => {
|
||||||
// Only count points from supported activities
|
// Only count points from supported activities
|
||||||
if (['quiz', 'urlreward'].includes(x.activityType)) {
|
if (['quiz', 'urlreward'].includes(x.promotionType)) {
|
||||||
totalEarnablePoints += (x.pointProgressMax - x.pointProgress)
|
totalEarnablePoints += (x.pointProgressMax - x.pointProgress)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"doDesktopSearch": true,
|
"doDesktopSearch": true,
|
||||||
"doMobileSearch": true
|
"doMobileSearch": true
|
||||||
},
|
},
|
||||||
|
"globalTimeout": 30000,
|
||||||
"searchSettings": {
|
"searchSettings": {
|
||||||
"useGeoLocaleQueries": false,
|
"useGeoLocaleQueries": false,
|
||||||
"scrollRandomResults": true,
|
"scrollRandomResults": true,
|
||||||
|
|||||||
@@ -181,7 +181,8 @@ export class MicrosoftRewardsBot {
|
|||||||
await saveSessionData(this.config.sessionPath, browser, account.email, this.isMobile)
|
await saveSessionData(this.config.sessionPath, browser, account.email, this.isMobile)
|
||||||
|
|
||||||
// Close desktop browser
|
// Close desktop browser
|
||||||
return await this.closeBrowser(browser, account.email)
|
await this.closeBrowser(browser, account.email)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mobile
|
// Mobile
|
||||||
@@ -241,7 +242,8 @@ export class MicrosoftRewardsBot {
|
|||||||
log('MAIN-POINTS', `The script collected ${this.collectedPoints} points today`)
|
log('MAIN-POINTS', `The script collected ${this.collectedPoints} points today`)
|
||||||
|
|
||||||
// Close mobile browser
|
// Close mobile browser
|
||||||
return await this.closeBrowser(browser, account.email)
|
await this.closeBrowser(browser, account.email)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
private async closeBrowser(browser: BrowserContext, email: string) {
|
private async closeBrowser(browser: BrowserContext, email: string) {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ export interface Config {
|
|||||||
runOnZeroPoints: boolean;
|
runOnZeroPoints: boolean;
|
||||||
clusters: number;
|
clusters: number;
|
||||||
workers: Workers;
|
workers: Workers;
|
||||||
|
globalTimeout: number;
|
||||||
searchSettings: SearchSettings;
|
searchSettings: SearchSettings;
|
||||||
webhook: Webhook;
|
webhook: Webhook;
|
||||||
saveFingerprint: boolean;
|
saveFingerprint: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user