mirror of
https://github.com/LightZirconite/Microsoft-Rewards-Bot.git
synced 2026-01-09 17:06:15 +00:00
refactor: remove legacy scheduling and analytics code
- Deleted the scheduler module and its associated functions, transitioning to OS-level scheduling. - Removed the Analytics module and its related interfaces, retaining only a placeholder for backward compatibility. - Updated ConfigValidator to warn about legacy schedule and analytics configurations. - Cleaned up StartupValidator to remove diagnostics and schedule validation logic. - Adjusted Load.ts to handle legacy flags for diagnostics and analytics. - Removed unused diagnostics capturing functionality.
This commit is contained in:
26
docs/FAQ.md
26
docs/FAQ.md
@@ -80,7 +80,7 @@ npm run setup
|
||||
|
||||
### Can I run this on a server 24/7?
|
||||
|
||||
Yes! Use Docker with the built-in scheduler for unattended operation. See the [Docker Guide](docker.md).
|
||||
Yes! Use Docker with your preferred scheduler (cron, Kubernetes CronJob, etc.) or enable the image's optional cron mode. See the [Docker Guide](docker.md).
|
||||
|
||||
---
|
||||
|
||||
@@ -97,27 +97,23 @@ In `src/accounts.jsonc`. Copy `src/accounts.example.jsonc` as a template.
|
||||
Not required, but **highly recommended** for:
|
||||
- Automated login without manual code entry
|
||||
- Better security
|
||||
- 24/7 scheduler compatibility
|
||||
- 24/7 automation compatibility
|
||||
|
||||
See the [Accounts & 2FA Guide](accounts.md).
|
||||
|
||||
### How do I schedule automatic runs?
|
||||
|
||||
Enable the built-in scheduler in `src/config.jsonc`:
|
||||
Use your operating system's scheduler. For example, Task Scheduler on Windows or `cron`/systemd timers on Linux:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"schedule": {
|
||||
"enabled": true,
|
||||
"time24": "09:00",
|
||||
"timeZone": "America/New_York"
|
||||
}
|
||||
}
|
||||
```bash
|
||||
# Windows Task Scheduler action (PowerShell)
|
||||
powershell.exe -NoProfile -Command "cd 'C:\\Path\\To\\Microsoft-Rewards-Script'; npm run start"
|
||||
|
||||
# Linux cron example (daily at 09:15)
|
||||
15 9 * * * cd /home/you/Microsoft-Rewards-Script && /usr/bin/env npm run start >> /home/you/rewards.log 2>&1
|
||||
```
|
||||
|
||||
Then run: `npm run start:schedule`
|
||||
|
||||
See the [Scheduling Guide](schedule.md).
|
||||
See the [External Scheduling Guide](schedule.md) for detailed steps.
|
||||
|
||||
### Can I run multiple accounts?
|
||||
|
||||
@@ -312,7 +308,7 @@ See [Configuration Guide](config.md#risk-management--security).
|
||||
- 💬 **[Join our Discord](https://discord.gg/k5uHkx9mne)** — Ask the community
|
||||
- 📖 **[Documentation Hub](index.md)** — Browse all guides
|
||||
- 🐛 **[GitHub Issues](https://github.com/Obsidian-wtf/Microsoft-Rewards-Bot/issues)** — Report problems
|
||||
- 📧 **[Diagnostics Guide](diagnostics.md)** — Debug issues
|
||||
- 📧 **[Troubleshooting Guide](diagnostics.md)** — Debug common issues
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
### Why Use TOTP?
|
||||
- ✅ **Automated login** — No manual code entry
|
||||
- ✅ **More secure** — Better than SMS
|
||||
- ✅ **Works 24/7** — Scheduler-friendly
|
||||
- ✅ **Works 24/7** — Ready for external schedulers
|
||||
|
||||
### How to Get Your TOTP Secret
|
||||
|
||||
@@ -178,7 +178,7 @@ export ACCOUNTS_JSON='{"accounts":[{"email":"test@example.com","password":"pass"
|
||||
→ **[Security Guide](./security.md)** for best practices
|
||||
|
||||
**Ready for automation?**
|
||||
→ **[Scheduler Setup](./schedule.md)**
|
||||
→ **[External Scheduling](./schedule.md)**
|
||||
|
||||
**Need proxies?**
|
||||
→ **[Proxy Guide](./proxy.md)**
|
||||
|
||||
@@ -115,7 +115,7 @@ curl -X POST -H "Content-Type: application/json" -d '{"content":"Test message"}'
|
||||
→ **[NTFY Push Notifications](./ntfy.md)**
|
||||
|
||||
**Need detailed logs?**
|
||||
→ **[Diagnostics Guide](./diagnostics.md)**
|
||||
→ **[Troubleshooting Guide](./diagnostics.md)**
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -40,22 +40,6 @@ This page mirrors the defaults that ship in `src/config.jsonc` and explains what
|
||||
|
||||
---
|
||||
|
||||
## Scheduler
|
||||
|
||||
| Key | Default | Notes |
|
||||
| --- | --- | --- |
|
||||
| `schedule.enabled` | `false` | Enable built-in scheduler loop. |
|
||||
| `schedule.useAmPm` | `false` | Toggle between `time12` (12h) and `time24` (24h). |
|
||||
| `schedule.time12` | `"9:00 AM"` | Used when `useAmPm` is `true`. |
|
||||
| `schedule.time24` | `"09:00"` | Used when `useAmPm` is `false`. |
|
||||
| `schedule.timeZone` | `Europe/Paris` | IANA timezone for scheduling. |
|
||||
| `schedule.runImmediatelyOnStart` | `true` | Execute one pass right after startup. |
|
||||
| `schedule.cron` | - | Optional cron expression(s).
|
||||
|
||||
See `docs/schedule.md` for jitter, cron patterns, and vacation integration.
|
||||
|
||||
---
|
||||
|
||||
## Workers
|
||||
|
||||
| Key | Default | Notes |
|
||||
@@ -133,13 +117,6 @@ See `docs/schedule.md` for jitter, cron patterns, and vacation integration.
|
||||
| `logging.excludeFunc` | `["SEARCH-CLOSE-TABS", "LOGIN-NO-PROMPT", "FLOW"]` | Buckets skipped locally. |
|
||||
| `logging.webhookExcludeFunc` | same | Buckets skipped in webhook payloads. |
|
||||
| `logging.redactEmails` | `true` | Mask email addresses in logs. |
|
||||
| `diagnostics.enabled` | `true` | Capture screenshots/HTML on failure. |
|
||||
| `diagnostics.maxPerRun` | `2` | Limit capture count per run. |
|
||||
| `diagnostics.retentionDays` | `7` | Auto-clean old diagnostics. |
|
||||
| `analytics.enabled` | `true` | Persist account metrics. |
|
||||
| `analytics.retentionDays` | `30` | Keep analytics data for N days. |
|
||||
| `analytics.exportMarkdown` | `true` | Write markdown summaries to `reports/`. |
|
||||
| `analytics.webhookSummary` | `true` | Send analytics summary via webhook.
|
||||
|
||||
---
|
||||
|
||||
@@ -160,7 +137,7 @@ See `docs/schedule.md` for jitter, cron patterns, and vacation integration.
|
||||
|
||||
1. Start from the default config and copy it if you need a local override.
|
||||
2. Leave `passesPerRun` at `1` so job-state can skip accounts automatically.
|
||||
3. Enable the scheduler only after testing manual runs.
|
||||
3. Configure your external scheduler after validating manual runs.
|
||||
4. Document any changes you make (without storing credentials in git).
|
||||
|
||||
Related docs: [`accounts.md`](./accounts.md), [`schedule.md`](./schedule.md), [`proxy.md`](./proxy.md), [`humanization.md`](./humanization.md), [`security.md`](./security.md).
|
||||
|
||||
@@ -20,7 +20,6 @@ This guide explains **how to adjust `src/config.jsonc` safely** and when to touc
|
||||
| Section | Keys to check | Why it matters |
|
||||
| --- | --- | --- |
|
||||
| `execution` | `parallel`, `runOnZeroPoints`, `clusters`, `passesPerRun` | Determines concurrency and whether accounts repeat during the same day. Leave `passesPerRun` at `1` unless you knowingly want additional passes (job-state skip is disabled otherwise). |
|
||||
| `schedule` | `enabled`, `time12`/`time24`, `timeZone`, `runImmediatelyOnStart` | Controls unattended runs. Test manual runs before enabling the scheduler. |
|
||||
| `workers` | `doDesktopSearch`, `doMobileSearch`, `doDailySet`, etc. | Disable tasks you never want to run to shorten execution time. |
|
||||
| `humanization` | `enabled`, `stopOnBan`, `actionDelay` | Keep enabled for safer automation. Tweaks here influence ban resilience. |
|
||||
| `proxy` | `proxyGoogleTrends`, `proxyBingTerms` | Tell the bot whether to route outbound API calls through your proxy. |
|
||||
@@ -29,19 +28,7 @@ Once these are set, most users can leave the rest alone.
|
||||
|
||||
---
|
||||
|
||||
## 3. Scheduler & Humanization Coordination
|
||||
|
||||
The scheduler honours humanization constraints:
|
||||
|
||||
- Weekly off-days: controlled by `humanization.randomOffDaysPerWeek` (defaults to 1). The scheduler samples new days each ISO week.
|
||||
- Allowed windows: if `humanization.allowedWindows` contains time ranges, the bot delays execution until the next window.
|
||||
- Vacation mode: `vacation.enabled` selects a random contiguous block (between `minDays` and `maxDays`) and skips the entire period.
|
||||
|
||||
If you enable the scheduler (`schedule.enabled: true`), review these limits so the run does not surprise you by skipping on specific days.
|
||||
|
||||
---
|
||||
|
||||
## 4. Handling Updates Safely
|
||||
## 3. Handling Updates Safely
|
||||
|
||||
The `update` block defines how the post-run updater behaves:
|
||||
|
||||
@@ -53,17 +40,15 @@ When running inside Docker, you can instead rely on `update.docker: true` so the
|
||||
|
||||
---
|
||||
|
||||
## 5. Diagnostics, Logging, and Analytics
|
||||
## 4. Logging and Notifications
|
||||
|
||||
Three sections determine observability:
|
||||
|
||||
- `logging`: adjust `excludeFunc` and `webhookExcludeFunc` if certain log buckets are too noisy. `redactEmails` should stay `true` in most setups.
|
||||
- `diagnostics`: captures screenshots/HTML when failures occur. Reduce `maxPerRun` or switch off entirely only if storage is constrained.
|
||||
- `analytics`: when enabled, daily metrics are persisted under `analytics/` and optional markdown summaries go to `reports/<date>/`. Disable if you do not want local history or webhook summaries.
|
||||
- `logging`: adjust `excludeFunc` and `webhookExcludeFunc` if certain log buckets are too noisy. Keeping `redactEmails: true` prevents leaks when sharing logs.
|
||||
- `notifications`: use `webhook`, `conclusionWebhook`, or `ntfy` for live updates. All three share the same `{ enabled, url }` structure.
|
||||
- The validator flags unknown keys automatically, so old sections can be trimmed safely.
|
||||
|
||||
---
|
||||
|
||||
## 6. Advanced Tips
|
||||
## 5. Advanced Tips
|
||||
|
||||
- **Risk management**: Leave `riskManagement.enabled` and `banPrediction` on unless you have a reason to reduce telemetry. Raising `riskThreshold` (>75) makes alerts rarer.
|
||||
- **Search pacing**: The delay window (`search.settings.delay.min` / `max`) accepts either numbers (ms) or strings like `"2min"`. Keep the range wide enough for natural behaviour.
|
||||
@@ -72,15 +57,15 @@ Three sections determine observability:
|
||||
|
||||
---
|
||||
|
||||
## 7. Validation & Troubleshooting
|
||||
## 6. Validation & Troubleshooting
|
||||
|
||||
- The startup validator (`StartupValidator`) emits warnings/errors when config or accounts look suspicious. It never blocks execution but should be read carefully.
|
||||
- For syntax issues, run `npm run typecheck` or open the JSONC file in VS Code to surface parsing errors immediately.
|
||||
- Diagnostics are written to `reports/` (failures) and `analytics/` (metrics). Clean up periodically or adjust `diagnostics.retentionDays` and `analytics.retentionDays`.
|
||||
- Keep `logging` focused on the buckets you care about and rely on external log storage if you need long-term retention.
|
||||
|
||||
---
|
||||
|
||||
## 8. Reference
|
||||
## 7. Reference
|
||||
|
||||
For complete field defaults and descriptions, open [`config-reference.md`](./config-reference.md). Additional topic-specific guides:
|
||||
|
||||
|
||||
@@ -1,103 +1,81 @@
|
||||
# 🔍 Diagnostics
|
||||
# 🛠️ Troubleshooting Guide
|
||||
|
||||
**Auto-capture errors with screenshots and HTML**
|
||||
Keep runs healthy by watching logs, catching alerts early, and validating your setup before enabling automation on a schedule.
|
||||
|
||||
---
|
||||
|
||||
## 💡 What Is It?
|
||||
## Quick Checklist
|
||||
|
||||
When errors occur, the script automatically saves:
|
||||
- 📸 **Screenshots** — Visual error capture
|
||||
- 📄 **HTML snapshots** — Page source
|
||||
|
||||
Helps you debug issues without re-running the script.
|
||||
- ✅ Run `npm run start` manually after every configuration change.
|
||||
- ✅ Confirm Node.js 20+ with `node -v` (22 LTS recommended).
|
||||
- ✅ Keep dependencies current: `npm install` then `npm run build`.
|
||||
- ✅ Double-check credentials, TOTP secrets, and recovery email values.
|
||||
- ✅ Review external scheduler logs (Task Scheduler, cron, etc.).
|
||||
|
||||
---
|
||||
|
||||
## ⚡ Quick Start
|
||||
## Capture Logs Reliably
|
||||
|
||||
**Already enabled by default!**
|
||||
### Terminal sessions
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"diagnostics": {
|
||||
"enabled": true,
|
||||
"saveScreenshot": true,
|
||||
"saveHtml": true,
|
||||
"maxPerRun": 2,
|
||||
"retentionDays": 7
|
||||
}
|
||||
}
|
||||
```
|
||||
- **PowerShell**
|
||||
```powershell
|
||||
npm run start *>&1 | Tee-Object -FilePath logs/rewards.txt
|
||||
```
|
||||
- **Bash / Linux / macOS**
|
||||
```bash
|
||||
mkdir -p logs
|
||||
npm run start >> logs/rewards.log 2>&1
|
||||
```
|
||||
|
||||
---
|
||||
### Verbose output
|
||||
|
||||
## 📁 Where Are Files Saved?
|
||||
|
||||
```
|
||||
reports/
|
||||
├── 2025-10-16/
|
||||
│ ├── error_abc123_001.png
|
||||
│ ├── error_abc123_001.html
|
||||
│ └── error_def456_002.png
|
||||
└── 2025-10-17/
|
||||
└── ...
|
||||
```
|
||||
|
||||
**Auto-cleanup:** Files older than 7 days are deleted automatically.
|
||||
|
||||
---
|
||||
|
||||
## 🎯 When It Captures
|
||||
|
||||
- ⏱️ **Timeouts** — Page navigation failures
|
||||
- 🎯 **Element not found** — Selector errors
|
||||
- 🔐 **Login failures** — Authentication issues
|
||||
- 🌐 **Network errors** — Request failures
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Configuration Options
|
||||
|
||||
| Setting | Default | Description |
|
||||
|---------|---------|-------------|
|
||||
| `enabled` | `true` | Enable diagnostics |
|
||||
| `saveScreenshot` | `true` | Capture PNG screenshots |
|
||||
| `saveHtml` | `true` | Save page HTML |
|
||||
| `maxPerRun` | `2` | Max captures per run |
|
||||
| `retentionDays` | `7` | Auto-delete after N days |
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Troubleshooting
|
||||
|
||||
| Problem | Solution |
|
||||
|---------|----------|
|
||||
| **No captures despite errors** | Check `enabled: true` |
|
||||
| **Too many files** | Reduce `retentionDays` |
|
||||
| **Permission denied** | Check `reports/` write access |
|
||||
|
||||
### Manual Cleanup
|
||||
Set `DEBUG_REWARDS_VERBOSE=1` for additional context around worker progress and risk scoring.
|
||||
|
||||
```powershell
|
||||
# Delete all diagnostic reports
|
||||
Remove-Item -Recurse -Force reports/
|
||||
|
||||
# Keep last 3 days only
|
||||
Get-ChildItem reports/ | Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-3)} | Remove-Item -Recurse
|
||||
$env:DEBUG_REWARDS_VERBOSE = "1"
|
||||
npm run start
|
||||
```
|
||||
|
||||
---
|
||||
Clear the variable afterwards (`Remove-Item Env:DEBUG_REWARDS_VERBOSE`).
|
||||
|
||||
## 📚 Next Steps
|
||||
### Structured alerts
|
||||
|
||||
**Need live notifications?**
|
||||
→ **[Discord Webhooks](./conclusionwebhook.md)**
|
||||
→ **[NTFY Push](./ntfy.md)**
|
||||
|
||||
**Security issues?**
|
||||
→ **[Security Guide](./security.md)**
|
||||
- Enable `conclusionWebhook` to receive a summary on completion.
|
||||
- Turn on `ntfy` for lightweight push alerts.
|
||||
- Pipe logs into observability tools (ELK, Loki, etc.) if you self-host them.
|
||||
|
||||
---
|
||||
|
||||
**[← Back to Hub](./index.md)** | **[Config Guide](./config.md)**
|
||||
## Common Issues & Fixes
|
||||
|
||||
| Symptom | Checks | Fix |
|
||||
|---------|--------|-----|
|
||||
| **Login loops or MFA prompts** | Ensure `totp` secret is correct, recovery email matches your Microsoft profile. | Regenerate TOTP from Microsoft Account, update `recoveryEmail`, retry manually. |
|
||||
| **Points not increasing** | Review `workers` section; confirm searches complete in logs. | Enable missing workers, increase `passesPerRun`, verify network connectivity. |
|
||||
| **Script stops early** | Look for `SECURITY` or `RISK` warnings. | Address ban alerts, adjust `riskManagement` thresholds, or pause for 24h. |
|
||||
| **Scheduler runs but nothing happens** | Confirm working directory, environment variables, file paths. | Use absolute paths in cron/Task Scheduler, ensure `npm` is available on PATH. |
|
||||
| **Proxy failures** | Check proxy URL/port/auth in logs. | Test with `curl`/`Invoke-WebRequest`, update credentials, or disable proxy temporarily. |
|
||||
|
||||
---
|
||||
|
||||
## Manual Investigation Tips
|
||||
|
||||
- **Single account test:** `npm run start -- --account email@example.com`
|
||||
- **Playwright Inspector:** set `PWDEBUG=1` to pause the browser for step-by-step review.
|
||||
- **Job state reset:** delete `sessions/job-state/` for a clean pass.
|
||||
- **Session reset:** remove `sessions/` to force fresh logins.
|
||||
- **Network tracing:** use the bundled Chromium DevTools (`--devtools`) when running locally.
|
||||
|
||||
---
|
||||
|
||||
## When to Revisit Config
|
||||
|
||||
- After Microsoft introduces new activities or login flows.
|
||||
- When risk alerts become frequent (tune delays, enable vacation mode).
|
||||
- If external schedulers overlap and cause concurrent runs.
|
||||
- When scaling to more accounts (consider proxies, increase `clusters`).
|
||||
|
||||
---
|
||||
|
||||
**Related guides:** [Configuration](./config.md) · [Notifications](./conclusionwebhook.md) · [Security](./security.md)
|
||||
|
||||
222
docs/docker.md
222
docs/docker.md
@@ -1,40 +1,33 @@
|
||||
# 🐳 Docker Guide
|
||||
|
||||
**Run the script in a container**
|
||||
Run the bot in a containerized environment with optional in-container cron support.
|
||||
|
||||
---
|
||||
|
||||
## ⚡ Quick Start
|
||||
|
||||
### 1. Create Required Files
|
||||
1. **Create required files**
|
||||
- `src/accounts.jsonc` with your credentials
|
||||
- `src/config.jsonc` (defaults apply if missing)
|
||||
2. **Start the container**
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
3. **Watch logs**
|
||||
```bash
|
||||
docker logs -f microsoft-rewards-bot
|
||||
```
|
||||
|
||||
Ensure you have:
|
||||
- `src/accounts.jsonc` with your credentials
|
||||
- `src/config.jsonc` (uses defaults if missing)
|
||||
|
||||
### 2. Start Container
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
### 3. View Logs
|
||||
|
||||
```bash
|
||||
docker logs -f microsoft-rewards-bot
|
||||
```
|
||||
|
||||
**That's it!** Script runs automatically.
|
||||
The container performs a single pass. Use cron, Task Scheduler, or another orchestrator to restart it on your desired cadence.
|
||||
|
||||
---
|
||||
|
||||
## 🎯 What's Included
|
||||
|
||||
The Docker setup:
|
||||
- ✅ **Chromium Headless Shell** — Lightweight browser
|
||||
- ✅ **Scheduler enabled** — Daily automation
|
||||
- ✅ **Volume mounts** — Persistent sessions
|
||||
- ✅ **Force headless** — Required for containers
|
||||
- ✅ Chromium Headless Shell (lightweight browser runtime)
|
||||
- ✅ Cron-ready entrypoint (`docker-entrypoint.sh`)
|
||||
- ✅ Volume mounts for persistent sessions and configs
|
||||
- ✅ Forced headless mode for container stability
|
||||
|
||||
---
|
||||
|
||||
@@ -42,34 +35,30 @@ The Docker setup:
|
||||
|
||||
| Host Path | Container Path | Purpose |
|
||||
|-----------|----------------|---------|
|
||||
| `./src/accounts.jsonc` | `/usr/src/.../src/accounts.jsonc` | Account credentials (read-only) |
|
||||
| `./src/config.jsonc` | `/usr/src/.../src/config.jsonc` | Configuration (read-only) |
|
||||
| `./sessions` | `/usr/src/.../sessions` | Cookies & fingerprints |
|
||||
| `./src/accounts.jsonc` | `/app/src/accounts.jsonc` | Account credentials (read-only) |
|
||||
| `./src/config.jsonc` | `/app/src/config.jsonc` | Configuration (read-only) |
|
||||
| `./sessions` | `/app/sessions` | Cookies, fingerprints, and job-state |
|
||||
|
||||
Edit `compose.yaml` to adjust paths or add additional mounts.
|
||||
|
||||
---
|
||||
|
||||
## 🌍 Environment Variables
|
||||
|
||||
### Set Timezone
|
||||
|
||||
```yaml
|
||||
services:
|
||||
rewards:
|
||||
microsoft-rewards-bot:
|
||||
environment:
|
||||
TZ: Europe/Paris
|
||||
TZ: "Europe/Paris" # Container timezone (cron + logging)
|
||||
NODE_ENV: "production"
|
||||
FORCE_HEADLESS: "1" # Required for Chromium in Docker
|
||||
#USE_CRON: "true" # Optional cron mode (see below)
|
||||
#CRON_SCHEDULE: "0 9 * * *"
|
||||
#RUN_ON_START: "true"
|
||||
```
|
||||
|
||||
### Use Inline JSON
|
||||
|
||||
```bash
|
||||
docker run -e ACCOUNTS_JSON='{"accounts":[...]}' ...
|
||||
```
|
||||
|
||||
### Custom Config Path
|
||||
|
||||
```bash
|
||||
docker run -e ACCOUNTS_FILE=/custom/path/accounts.json ...
|
||||
```
|
||||
- `ACCOUNTS_JSON` and `ACCOUNTS_FILE` can override account sources.
|
||||
- `ACCOUNTS_JSON` expects inline JSON; `ACCOUNTS_FILE` points to a mounted path.
|
||||
|
||||
---
|
||||
|
||||
@@ -94,17 +83,60 @@ docker compose restart
|
||||
|
||||
---
|
||||
|
||||
## 🎛️ Scheduling Options
|
||||
|
||||
### Use a host scheduler (recommended)
|
||||
|
||||
- Trigger `docker compose up --build` (or restart the container) with cron, systemd timers, Task Scheduler, Kubernetes CronJobs, etc.
|
||||
- Ensure persistent volumes are mounted so repeated runs reuse state.
|
||||
- See [External Scheduling](schedule.md) for host-level examples.
|
||||
|
||||
### Enable in-container cron (optional)
|
||||
|
||||
1. Set environment variables in `docker-compose.yml`:
|
||||
```yaml
|
||||
services:
|
||||
microsoft-rewards-bot:
|
||||
environment:
|
||||
USE_CRON: "true"
|
||||
CRON_SCHEDULE: "0 9,16,21 * * *" # Example: 09:00, 16:00, 21:00
|
||||
RUN_ON_START: "true" # Optional one-time run at container boot
|
||||
```
|
||||
2. Rebuild and redeploy:
|
||||
```bash
|
||||
docker compose down
|
||||
docker compose build --no-cache
|
||||
docker compose up -d
|
||||
```
|
||||
3. Confirm cron is active:
|
||||
```bash
|
||||
docker logs -f microsoft-rewards-bot
|
||||
```
|
||||
|
||||
#### Cron schedule examples
|
||||
|
||||
| Schedule | Description | Cron expression |
|
||||
|----------|-------------|-----------------|
|
||||
| Daily at 09:00 | Single run | `0 9 * * *` |
|
||||
| Twice daily | 09:00 & 21:00 | `0 9,21 * * *` |
|
||||
| Every 6 hours | Four runs/day | `0 */6 * * *` |
|
||||
| Weekdays at 08:00 | Monday–Friday | `0 8 * * 1-5` |
|
||||
|
||||
Validate expressions with [crontab.guru](https://crontab.guru).
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Troubleshooting
|
||||
|
||||
| Problem | Solution |
|
||||
|---------|----------|
|
||||
| **"accounts.json not found"** | Ensure `./src/accounts.jsonc` exists and is mounted in compose.yaml |
|
||||
| **"Browser launch failed"** | Ensure `FORCE_HEADLESS=1` is set |
|
||||
| **"accounts.json not found"** | Ensure `./src/accounts.jsonc` exists and is mounted read-only |
|
||||
| **"Browser launch failed"** | Verify `FORCE_HEADLESS=1` and Chromium dependencies installed |
|
||||
| **"Permission denied"** | Check file permissions (`chmod 644 accounts.jsonc config.jsonc`) |
|
||||
| **Scheduler not running** | Verify `schedule.enabled: true` in config |
|
||||
| **Cron not working** | See [Cron Troubleshooting](#-cron-troubleshooting) above |
|
||||
| **Automation not repeating** | Enable cron (`USE_CRON=true`) or use a host scheduler |
|
||||
| **Cron not working** | See [Cron troubleshooting](#-cron-troubleshooting) |
|
||||
|
||||
### Debug Container
|
||||
### Debug container
|
||||
|
||||
```bash
|
||||
# Enter container shell
|
||||
@@ -113,29 +145,78 @@ docker exec -it microsoft-rewards-bot /bin/bash
|
||||
# Check Node.js version
|
||||
docker exec -it microsoft-rewards-bot node --version
|
||||
|
||||
# View config (mounted in /src/)
|
||||
docker exec -it microsoft-rewards-bot cat src/config.jsonc
|
||||
# Inspect mounted config
|
||||
docker exec -it microsoft-rewards-bot cat /app/src/config.jsonc
|
||||
|
||||
# Check if cron is enabled
|
||||
docker exec -it microsoft-rewards-bot printenv | grep USE_CRON
|
||||
# Check env vars
|
||||
docker exec -it microsoft-rewards-bot printenv | grep -E "TZ|USE_CRON|CRON_SCHEDULE"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎛️ Custom Configuration
|
||||
## 🔄 Switching cron on or off
|
||||
|
||||
### Option 1: Built-in Scheduler (Default, Recommended)
|
||||
- **Enable cron:** set `USE_CRON=true`, provide `CRON_SCHEDULE`, rebuild, and redeploy.
|
||||
- **Disable cron:** remove `USE_CRON` (and related variables). The container will run once per start; handle recurrence externally.
|
||||
|
||||
**Pros:**
|
||||
- ✅ Lighter resource usage
|
||||
- ✅ Better integration with config.jsonc
|
||||
- ✅ No additional setup needed
|
||||
- ✅ Automatic jitter for natural timing
|
||||
---
|
||||
|
||||
**Default** `docker-compose.yml`:
|
||||
```yaml
|
||||
services:
|
||||
rewards:
|
||||
## 🐛 Cron troubleshooting
|
||||
|
||||
| Problem | Solution |
|
||||
|---------|----------|
|
||||
| **Cron not executing** | Check logs for "Cron mode enabled" and cron syntax errors |
|
||||
| **Wrong timezone** | Ensure `TZ` matches your location |
|
||||
| **Syntax error** | Validate expression at [crontab.guru](https://crontab.guru) |
|
||||
| **No logs generated** | Tail `/var/log/cron.log` inside the container |
|
||||
| **Duplicate runs** | Ensure only one cron entry is configured |
|
||||
|
||||
### Inspect cron inside the container
|
||||
|
||||
```bash
|
||||
docker exec -it microsoft-rewards-bot /bin/bash
|
||||
ps aux | grep cron
|
||||
crontab -l
|
||||
tail -100 /var/log/cron.log
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📚 Next steps
|
||||
|
||||
- [Configuration guide](config.md)
|
||||
- [External scheduling](schedule.md)
|
||||
- [Humanization guide](humanization.md)
|
||||
|
||||
---
|
||||
|
||||
**[← Back to Hub](index.md)** | **[Getting Started](getting-started.md)**# 🐳 Docker Guide
|
||||
|
||||
**Run the script in a container**
|
||||
|
||||
---
|
||||
|
||||
## ⚡ Quick Start
|
||||
|
||||
### 1. Create Required Files
|
||||
|
||||
Ensure you have:
|
||||
- `src/accounts.jsonc` with your credentials
|
||||
- `src/config.jsonc` (uses defaults if missing)
|
||||
|
||||
### 2. Start Container
|
||||
|
||||
## 🎛️ Scheduling Options
|
||||
|
||||
### Use a host scheduler (recommended)
|
||||
|
||||
- Trigger `docker compose up --build` on your preferred schedule (cron, systemd timers, Task Scheduler, Kubernetes CronJob, etc.).
|
||||
- Ensure volumes remain consistent so each run reuses accounts, config, and sessions.
|
||||
- See [External Scheduling](schedule.md) for concrete host examples.
|
||||
|
||||
### Enable in-container cron (optional)
|
||||
|
||||
1. Set environment variables in `docker-compose.yml` or `docker run`:
|
||||
build: .
|
||||
environment:
|
||||
TZ: "Europe/Paris"
|
||||
@@ -216,17 +297,10 @@ services:
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Switching Between Scheduler and Cron
|
||||
## 🔄 Switching Cron On or Off
|
||||
|
||||
**From Built-in → Cron:**
|
||||
1. Add `USE_CRON: "true"` to environment
|
||||
2. Add `CRON_SCHEDULE` with desired timing
|
||||
3. Rebuild: `docker compose up -d --build`
|
||||
|
||||
**From Cron → Built-in:**
|
||||
1. Remove or comment `USE_CRON` variable
|
||||
2. Configure `schedule` in `src/config.jsonc`
|
||||
3. Rebuild: `docker compose up -d --build`
|
||||
- **Enable cron:** set `USE_CRON=true`, provide `CRON_SCHEDULE`, rebuild the image, and redeploy.
|
||||
- **Disable cron:** remove `USE_CRON` (and related variables). The container will run once per start; use host automation to relaunch when needed.
|
||||
|
||||
---
|
||||
|
||||
@@ -269,8 +343,8 @@ printenv | grep -E 'TZ|NODE_ENV'
|
||||
**Want notifications?**
|
||||
→ **[Discord Webhooks](./conclusionwebhook.md)**
|
||||
|
||||
**Scheduler config?**
|
||||
→ **[Scheduler Guide](./schedule.md)**
|
||||
**Need scheduling tips?**
|
||||
→ **[External Scheduling](./schedule.md)**
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@ npm run build
|
||||
# Single run (test it works)
|
||||
npm start
|
||||
|
||||
# Automated daily scheduler (set and forget)
|
||||
npm run start:schedule
|
||||
# Schedule it (Task Scheduler, cron, etc.)
|
||||
# See docs/schedule.md for examples
|
||||
```
|
||||
|
||||
</details>
|
||||
@@ -113,7 +113,7 @@ Once running, explore these guides:
|
||||
| Priority | Guide | Why Important |
|
||||
|----------|-------|---------------|
|
||||
| **High** | **[Accounts & 2FA](./accounts.md)** | Set up TOTP for secure automation |
|
||||
| **High** | **[Scheduling](./schedule.md)** | Configure automated daily runs |
|
||||
| **High** | **[External Scheduling](./schedule.md)** | Automate with Task Scheduler or cron |
|
||||
| **Medium** | **[Notifications](./ntfy.md)** | Get alerts on your phone |
|
||||
| **Low** | **[Humanization](./humanization.md)** | Advanced anti-detection |
|
||||
|
||||
@@ -134,5 +134,5 @@ Once running, explore these guides:
|
||||
|
||||
- **[Accounts & 2FA](./accounts.md)** — Add Microsoft accounts with TOTP
|
||||
- **[Docker](./docker.md)** — Deploy with containers
|
||||
- **[Scheduler](./schedule.md)** — Automate daily execution
|
||||
- **[External Scheduling](./schedule.md)** — Automate daily execution
|
||||
- **[Discord Webhooks](./conclusionwebhook.md)** — Get run summaries
|
||||
|
||||
@@ -147,10 +147,10 @@ Skip random days per week:
|
||||
## 📚 Next Steps
|
||||
|
||||
**Need vacation mode?**
|
||||
→ See [Scheduler Vacation](./schedule.md#vacation-mode)
|
||||
→ See [Vacation settings](./config.md#vacation)
|
||||
|
||||
**Want scheduling?**
|
||||
→ **[Scheduler Guide](./schedule.md)**
|
||||
→ **[External Scheduling](./schedule.md)**
|
||||
|
||||
**More security?**
|
||||
→ **[Security Guide](./security.md)**
|
||||
|
||||
@@ -14,18 +14,18 @@
|
||||
|
||||
1. **[Setup Accounts](accounts.md)** — Add credentials + 2FA
|
||||
2. **[Configure Bot](config.md)** — Essential settings
|
||||
3. **[Enable Scheduler](schedule.md)** — Daily automation
|
||||
3. **[Schedule Runs](schedule.md)** — Use OS-level automation
|
||||
|
||||
**Done!** The bot will run automatically.
|
||||
|
||||
---
|
||||
|
||||
## <EFBFBD> Feature Guides
|
||||
## ✨ Feature Guides
|
||||
|
||||
| Feature | Description |
|
||||
|---------|-------------|
|
||||
| **[Configuration](config.md)** | All settings explained |
|
||||
| **[Scheduler](schedule.md)** | Automated daily runs |
|
||||
| **[External Scheduling](schedule.md)** | Automate with cron or Task Scheduler |
|
||||
| **[Humanization](humanization.md)** | Anti-detection system |
|
||||
| **[Webhooks](conclusionwebhook.md)** | Discord notifications |
|
||||
| **[NTFY Alerts](ntfy.md)** | Mobile push notifications |
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
| Issue | Solution |
|
||||
|-------|----------|
|
||||
| **Bot not working?** | [Diagnostics Guide](diagnostics.md) |
|
||||
| **Bot not working?** | [Troubleshooting Guide](diagnostics.md) |
|
||||
| **Login failed?** | [Accounts & 2FA](accounts.md#troubleshooting) |
|
||||
| **Account banned?** | [Security Guide](security.md) |
|
||||
| **Git conflicts?** | [Conflict Resolution](git-conflict-resolution.md) |
|
||||
|
||||
@@ -107,11 +107,11 @@ Get-ChildItem sessions/job-state -Recurse -Filter "*.json" | Where-Object {$_.La
|
||||
|
||||
## 📚 Next Steps
|
||||
|
||||
**Need scheduler?**
|
||||
→ **[Scheduler Guide](./schedule.md)**
|
||||
**Need automation?**
|
||||
→ **[External Scheduling](./schedule.md)**
|
||||
|
||||
**Want diagnostics?**
|
||||
→ **[Diagnostics Guide](./diagnostics.md)**
|
||||
**Need troubleshooting tips?**
|
||||
→ **[Troubleshooting Guide](./diagnostics.md)**
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -110,8 +110,8 @@ curl -d "Test from rewards script" https://ntfy.sh/your-topic
|
||||
**Want Discord too?**
|
||||
→ **[Discord Webhooks](./conclusionwebhook.md)**
|
||||
|
||||
**Need detailed logs?**
|
||||
→ **[Diagnostics Guide](./diagnostics.md)**
|
||||
**Need troubleshooting tips?**
|
||||
→ **[Troubleshooting Guide](./diagnostics.md)**
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ curl --proxy http://user:pass@proxy.com:8080 http://httpbin.org/ip
|
||||
## 📚 Next Steps
|
||||
|
||||
**Proxy working?**
|
||||
→ **[Setup Scheduler](./schedule.md)**
|
||||
→ **[Schedule Runs](./schedule.md)**
|
||||
|
||||
**Need humanization?**
|
||||
→ **[Humanization Guide](./humanization.md)**
|
||||
|
||||
BIN
docs/schedule.md
BIN
docs/schedule.md
Binary file not shown.
@@ -21,7 +21,7 @@ Your accounts **may be banned**. Use at your own risk.
|
||||
- **Run 1-2x daily max** — Don't be greedy
|
||||
- **Test on secondary accounts** — Never risk your main account
|
||||
- **Enable vacation mode** — Random off days look natural
|
||||
- **Monitor regularly** — Check diagnostics and logs
|
||||
- **Monitor regularly** — Check logs and webhook alerts
|
||||
|
||||
### ❌ DON'T
|
||||
|
||||
@@ -131,20 +131,6 @@ chmod 600 src/accounts.json
|
||||
|
||||
## 📊 Monitoring
|
||||
|
||||
### Enable Diagnostics
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"diagnostics": {
|
||||
"enabled": true,
|
||||
"saveScreenshot": true,
|
||||
"saveHtml": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
→ **[Diagnostics Guide](./diagnostics.md)**
|
||||
|
||||
### Enable Notifications
|
||||
|
||||
```jsonc
|
||||
@@ -187,7 +173,7 @@ chmod 600 src/accounts.json
|
||||
- 🚫 **No telemetry** — Script doesn't phone home
|
||||
- 📁 **File security** — Restrict permissions
|
||||
- 🔄 **Regular backups** — Keep config backups
|
||||
- 🗑️ **Clean logs** — Delete old diagnostics
|
||||
- 🗑️ **Clean logs** — Rotate or delete old log files
|
||||
|
||||
---
|
||||
|
||||
@@ -200,7 +186,7 @@ chmod 600 src/accounts.json
|
||||
→ **[Proxy Guide](./proxy.md)**
|
||||
|
||||
**Want monitoring?**
|
||||
→ **[Diagnostics](./diagnostics.md)**
|
||||
→ **[Notifications Guide](./conclusionwebhook.md)**
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -96,8 +96,8 @@ npm run build
|
||||
**Need security tips?**
|
||||
→ **[Security Guide](./security.md)**
|
||||
|
||||
**Setup scheduler?**
|
||||
→ **[Scheduler Guide](./schedule.md)**
|
||||
**Need automation?**
|
||||
→ **[External Scheduling](./schedule.md)**
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user