mirror of
https://github.com/LightZirconite/Microsoft-Rewards-Bot.git
synced 2026-01-11 17:56: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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user