From 6f361e24e2a4578e3d17910fc852177a883288f0 Mon Sep 17 00:00:00 2001 From: LightZirconite Date: Sat, 15 Nov 2025 17:27:28 +0100 Subject: [PATCH 1/3] feat: update README and package version; simplify bot startup process --- README.md | 134 ++++++++++++++++++++------------------------------- package.json | 9 +--- 2 files changed, 55 insertions(+), 88 deletions(-) diff --git a/README.md b/README.md index ec65e5b..a6b2014 100644 --- a/README.md +++ b/README.md @@ -52,66 +52,47 @@ A **TypeScript bot** that automatically earns Microsoft Rewards points by comple git clone https://github.com/LightZirconite/Microsoft-Rewards-Bot.git cd Microsoft-Rewards-Bot -# 2. Install dependencies -npm install - -# 3. Setup and run -npm run setup +# 2. Start the bot (does EVERYTHING automatically!) +npm start ``` -**That's it!** The wizard will guide you through account setup and start earning points. +**That's literally it!** 🎉 + +The `npm start` command will automatically: +- ✅ Install dependencies if needed +- ✅ Install Chromium browser if needed +- ✅ Build TypeScript if needed +- ✅ Launch the bot + +On first run, you'll be prompted to configure your accounts interactively. --- ## 🎮 Essential Commands -Here are the most useful commands for daily usage: - -### **🚀 Main Commands** - -| Command | Description | -|---------|-------------| -| `npm run go` | **⭐ Ultimate command** — Installs browser if needed, builds, and starts the bot | -| `npm start` | **Quick start** — Runs the bot (builds automatically if needed) | -| `npm run setup` | **Interactive wizard** — Guides you through initial setup | -| `npm run dev` | **Development mode** — Watch mode with auto-reload | - -### **🔧 Build & Maintenance** - -| Command | Description | -|---------|-------------| -| `npm run build` | Compile TypeScript to JavaScript (`dist/` folder) | -| `npm run typecheck` | Check TypeScript errors without building | -| `npm run clean` | Remove build artifacts (`dist/` folder) | -| `npm run install:browser` | Install Playwright Chromium (smart: only installs once) | - -### **🎯 Specialized Tools** - -| Command | Description | -|---------|-------------| -| `npm run dashboard` | Start web dashboard on `http://localhost:3000` | -| `npm run creator` | Launch account creation wizard | -| `npm run test` | Run test suite | - -### **💡 Quick Recipes** +### **🚀 Main Command** ```bash -# First time setup -npm run go - -# Daily usage (after first setup) npm start - -# Create new accounts -npm run creator -- -y backup@gmail.com https://rewards.bing.com/welcome?rh=CODE - -# Monitor with dashboard -npm run dashboard -# Then open http://localhost:3000 in your browser - -# Fix issues / rebuild -npm run clean ; npm run build ``` +**The ONLY command you need!** Automatically handles: +- 📦 Dependencies installation (if missing) +- 🌐 Browser installation (if missing) +- 🔨 TypeScript compilation (if missing) +- ▶️ Bot execution + +### **🔧 Optional Commands** + +| Command | Use When | +|---------|----------| +| `npm run build` | Force rebuild TypeScript | +| `npm run clean` | Clean build artifacts before rebuild | +| `npm run dev` | Development mode (hot reload) | +| `npm run creator` | Create new Microsoft accounts | +| `npm run dashboard` | Start web dashboard on port 3000 | +| `npm test` | Run test suite | + +**💡 Pro Tip:** For 99% of use cases, just use `npm start` — it's smart enough to figure out what needs to be done! **📖 [Complete Commands Reference →](docs/commands.md)** @@ -121,62 +102,53 @@ npm run clean ; npm run build ### **First-Time Setup** (New User) ```bash -# 1. Install dependencies -npm install - -# 2. Run the ultimate setup command -npm run go -# This will guide you through account setup, install browser, build, and start! -``` - -### **Daily Usage** (Regular User) -```bash -# Just start the bot - it builds automatically if needed +# Just run this - it does EVERYTHING! npm start ``` -Or use the ultimate command if you want to be extra safe: +On first run: +1. ✅ Installs all dependencies automatically +2. ✅ Installs Chromium browser automatically +3. ✅ Builds the TypeScript project automatically +4. ✅ Prompts you to configure accounts +5. ✅ Starts earning points! + +### **Daily Usage** (Regular User) ```bash -npm run go +# Same command - but skips already-done steps! +npm start ``` -### **After Git Pull** (Updating the Bot) +### **After Git Pull** (Updating) ```bash -# Quick method (recommended) -npm run go - -# Or manual method -npm install # Update dependencies (if package.json changed) -npm run build # Rebuild if code changed -npm start # Run +# Just this - it checks and updates what's needed +npm start ``` ### **Creating New Accounts** ```bash -# Interactive mode (asks everything) +# Interactive mode npm run creator -# Quick mode with recovery email + referral +# Quick mode with referral npm run creator -- -y backup@gmail.com https://rewards.bing.com/welcome?rh=CODE ``` -### **Troubleshooting** (When Things Break) +### **Troubleshooting** (Issues) ```bash # Clean rebuild npm run clean -npm run build +npm start -# Or full reset -rm -rf node_modules dist -npm install -npm run go +# Full reset (nuclear option) +rm -rf node_modules dist .playwright-chromium-installed +npm start ``` -### **Monitoring** (Check Status) +### **Monitoring** ```bash -# Start web dashboard npm run dashboard -# Then open http://localhost:3000 +# Open http://localhost:3000 ``` --- diff --git a/package.json b/package.json index e5e585f..e62a881 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "microsoft-rewards-bot", - "version": "2.60.0", + "version": "2.60.1", "description": "Automate Microsoft Rewards points collection", "private": true, "main": "index.js", @@ -16,21 +16,16 @@ }, "homepage": "https://github.com/LightZirconite/Microsoft-Rewards-Bot#readme", "scripts": { - "go": "node -e \"const fs = require('fs'); const cp = require('child_process'); console.log('🚀 Running complete setup and start...'); if (!fs.existsSync('.playwright-chromium-installed')) { console.log('📦 Installing Chromium...'); cp.execSync('npx playwright install chromium --with-deps', {stdio: 'inherit'}); fs.writeFileSync('.playwright-chromium-installed', new Date().toISOString()); } if (!fs.existsSync('dist/index.js')) { console.log('🔨 Building project...'); cp.execSync('npm run build', {stdio: 'inherit'}); } console.log('✅ Setup complete! Starting bot...'); cp.execSync('npm start', {stdio: 'inherit'});\"", + "start": "node -e \"const fs = require('fs'); const cp = require('child_process'); const path = require('path'); console.log('🚀 Starting Microsoft Rewards Bot...'); if (!fs.existsSync('node_modules')) { console.log('📦 Installing dependencies...'); cp.execSync('npm install', {stdio: 'inherit'}); } if (!fs.existsSync('.playwright-chromium-installed')) { console.log('🌐 Installing Chromium browser...'); cp.execSync('npx playwright install chromium --with-deps', {stdio: 'inherit'}); fs.writeFileSync('.playwright-chromium-installed', new Date().toISOString()); } if (!fs.existsSync('dist/index.js')) { console.log('🔨 Building TypeScript project...'); cp.execSync('npm run build', {stdio: 'inherit'}); } console.log('✅ All checks passed! Launching bot...\\n'); cp.execSync('node --enable-source-maps ./dist/index.js', {stdio: 'inherit'});\"", "clean": "rimraf dist", "typecheck": "tsc --noEmit", - "install:browser": "node -e \"const fs = require('fs'); if (!fs.existsSync('.playwright-chromium-installed')) { console.log('📦 Installing Chromium browser...'); require('child_process').execSync('npx playwright install chromium --with-deps', {stdio: 'inherit'}); fs.writeFileSync('.playwright-chromium-installed', new Date().toISOString()); } else { console.log('✓ Chromium already installed (use npm run install:browser:force to reinstall)'); }\"", - "install:browser:force": "npx playwright install chromium --with-deps", "build": "tsc", "build:clean": "npm run clean && npm run build", - "prestart": "node -e \"const fs = require('fs'); if (!fs.existsSync('dist/index.js')) { console.log('⚠️ Compiled files not found, building...'); require('child_process').execSync('npm run build', {stdio: 'inherit'}); }\"", - "start": "node --enable-source-maps ./dist/index.js", "dev": "ts-node ./src/index.ts -dev", "test": "node --test --require ts-node/register tests/**/*.test.ts", "creator": "ts-node ./src/account-creation/cli.ts", "dashboard": "node --enable-source-maps ./dist/index.js -dashboard", "dashboard:dev": "ts-node ./src/index.ts -dashboard", - "setup": "node ./scripts/installer/setup.mjs", "update": "node ./scripts/installer/update.mjs", "lint": "eslint \"src/**/*.{ts,tsx}\"", "lint:fix": "eslint \"src/**/*.{ts,tsx}\" --fix", From d47080523f37068b4702c174cebaaceb8ba2cd99 Mon Sep 17 00:00:00 2001 From: LightZirconite Date: Sat, 15 Nov 2025 17:48:34 +0100 Subject: [PATCH 2/3] fix: update package versions for stability; downgrade playwright to 1.52.0 --- package-lock.json | 54 ++++++++++++++++++++++++++++++----------------- package.json | 2 +- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7c5c185..eb25ad9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,18 +1,19 @@ { "name": "microsoft-rewards-bot", - "version": "2.60.0", + "version": "2.60.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "microsoft-rewards-bot", - "version": "2.60.0", + "version": "2.60.1", "license": "CC-BY-NC-SA-4.0", "dependencies": { "axios": "^1.8.4", "chalk": "^4.1.2", "cheerio": "^1.0.0", "express": "^4.21.2", + "express-rate-limit": "^8.2.1", "fingerprint-generator": "^2.1.66", "fingerprint-injector": "^2.1.66", "http-proxy-agent": "^7.0.2", @@ -20,7 +21,7 @@ "luxon": "^3.5.0", "ms": "^2.1.3", "node-cron": "3.0.3", - "playwright": "1.56.1", + "playwright": "1.52.0", "rebrowser-playwright": "1.52.0", "socks-proxy-agent": "^8.0.5", "ts-node": "^10.9.2", @@ -1794,6 +1795,33 @@ "url": "https://opencollective.com/express" } }, + "node_modules/express-rate-limit": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.2.1.tgz", + "integrity": "sha512-PCZEIEIxqwhzw4KF0n7QF4QqruVTcF73O5kFKUnGOyjbCCgizBBiFaYpd/fnBLUMPw/BWw9OsiN7GgrNYr7j6g==", + "license": "MIT", + "dependencies": { + "ip-address": "10.0.1" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": ">= 4.11" + } + }, + "node_modules/express-rate-limit/node_modules/ip-address": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.0.1.tgz", + "integrity": "sha512-NWv9YLW4PoW2B7xtzaS3NCot75m6nK7Icdv0o3lfMceJVRfSoQwqD4wEH5rLwoKJwUiZ/rfpiVBhnaF0FK4HoA==", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, "node_modules/express/node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -3181,12 +3209,12 @@ } }, "node_modules/playwright": { - "version": "1.56.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.56.1.tgz", - "integrity": "sha512-aFi5B0WovBHTEvpM3DzXTUaeN6eN0qWnTkKx4NQaH4Wvcmc153PdaY2UBdSYKaGYw+UyWXSVyxDUg5DoPEttjw==", + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.52.0.tgz", + "integrity": "sha512-JAwMNMBlxJ2oD1kce4KPtMkDeKGHQstdpFPcPH3maElAXon/QZeTvtsfXmTMRyO9TslfoYOXkSsvao2nE1ilTw==", "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.56.1" + "playwright-core": "1.52.0" }, "bin": { "playwright": "cli.js" @@ -3210,18 +3238,6 @@ "node": ">=18" } }, - "node_modules/playwright/node_modules/playwright-core": { - "version": "1.56.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.56.1.tgz", - "integrity": "sha512-hutraynyn31F+Bifme+Ps9Vq59hKuUCz7H1kDOcBs+2oGguKkWTU50bBWrtz34OUWmIwpBTWDxaRPXrIXkgvmQ==", - "license": "Apache-2.0", - "bin": { - "playwright-core": "cli.js" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", diff --git a/package.json b/package.json index e62a881..6ecc58b 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "luxon": "^3.5.0", "ms": "^2.1.3", "node-cron": "3.0.3", - "playwright": "1.56.1", + "playwright": "1.52.0", "rebrowser-playwright": "1.52.0", "socks-proxy-agent": "^8.0.5", "ts-node": "^10.9.2", From 85cab7250d60304215cb2fd694cb62cf2198ee29 Mon Sep 17 00:00:00 2001 From: LightZirconite Date: Sat, 15 Nov 2025 17:54:20 +0100 Subject: [PATCH 3/3] fix: update volume mounts in docker configuration; correct paths for accounts and config files --- docker/compose.yaml | 4 ++-- docs/docker-deployment.md | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/docker/compose.yaml b/docker/compose.yaml index 9862cb2..02d30fe 100644 --- a/docker/compose.yaml +++ b/docker/compose.yaml @@ -8,8 +8,8 @@ services: # Volume mounts: Specify a location where you want to save the files on your local machine. volumes: - - ../src/accounts.jsonc:/usr/src/microsoft-rewards-bot/dist/accounts.jsonc:ro - - ../src/config.jsonc:/usr/src/microsoft-rewards-bot/dist/config.jsonc:ro + - ../src/accounts.jsonc:/usr/src/microsoft-rewards-bot/accounts.jsonc:ro + - ../src/config.jsonc:/usr/src/microsoft-rewards-bot/config.jsonc:ro - ../sessions:/usr/src/microsoft-rewards-bot/sessions # Optional, saves your login session environment: diff --git a/docs/docker-deployment.md b/docs/docker-deployment.md index b31055a..e35353e 100644 --- a/docs/docker-deployment.md +++ b/docs/docker-deployment.md @@ -73,21 +73,21 @@ The container needs access to your configuration files via volume mounts: ```yaml volumes: # Read-only mounts for configuration (prevents accidental container edits) - - ./src/accounts.jsonc:/usr/src/microsoft-rewards-bot/dist/accounts.jsonc:ro - - ./src/config.jsonc:/usr/src/microsoft-rewards-bot/dist/config.jsonc:ro + - ../src/accounts.jsonc:/usr/src/microsoft-rewards-bot/accounts.jsonc:ro + - ../src/config.jsonc:/usr/src/microsoft-rewards-bot/config.jsonc:ro # Read-write mount for persistent login sessions - - ./sessions:/usr/src/microsoft-rewards-bot/dist/browser/sessions + - ../sessions:/usr/src/microsoft-rewards-bot/sessions ``` **Paths explained:** -- `./src/accounts.jsonc` = `docker/../src/accounts.jsonc` (relative from compose.yaml location) -- `./sessions` = `docker/sessions/` (local to docker folder) +- `../src/accounts.jsonc` = `docker/../src/accounts.jsonc` (relative from compose.yaml location, goes to project root) +- `../sessions` = `docker/../sessions/` (project root sessions folder) **Before starting:** 1. Create `src/accounts.jsonc` (copy from `src/accounts.example.jsonc`) 2. Edit `src/config.jsonc` with your settings -3. (Optional) Create `docker/sessions/` directory for persistent login +3. (Optional) Create `sessions/` directory at project root for persistent login --- @@ -334,8 +334,9 @@ docker inspect microsoft-rewards-bot | grep -A 10 Mounts ```yaml # Paths are relative to compose.yaml location (docker/) volumes: - - ./src/accounts.jsonc:/usr/src/microsoft-rewards-bot/dist/accounts.jsonc:ro + - ../src/accounts.jsonc:/usr/src/microsoft-rewards-bot/accounts.jsonc:ro # This resolves to: docker/../src/accounts.jsonc (project root) + # Note: Files mount to project root, NOT dist/ (Load.ts searches multiple locations) ``` ---