mirror of
https://github.com/TheNetsky/Microsoft-Rewards-Script.git
synced 2026-01-21 23:43:57 +00:00
V2.3.0 Optimization (#380)
* Updated README.md to reflect version 2.1 and improve the presentation of Microsoft Rewards Automation features. * Updated version to 2.1.5 in README.md and package.json, added new license and legal notice sections, and improved the configuration script for a better user experience. * Mise à jour des messages de journalisation et ajout de vérifications pour le chargement des quiz et la présence des options avant de procéder. Suppression de fichiers de configuration obsolètes. * Added serial protection dialog management for message forwarding, including closing by button or escape. * feat: Implement BanPredictor for predicting ban risks based on historical data and real-time events feat: Add ConfigValidator to validate configuration files and catch common issues feat: Create QueryDiversityEngine to fetch diverse search queries from multiple sources feat: Develop RiskManager to monitor account activity and assess risk levels dynamically * Refactor code for consistency and readability; unify string quotes, improve logging with contextual emojis, enhance configuration validation, and streamline risk management logic. * feat: Refactor BrowserUtil and Login classes for improved button handling and selector management; implement unified selector system and enhance activity processing logic in Workers class. * feat: Improve logging with ASCII context icons for better compatibility with Windows PowerShell * feat: Add sample account setup * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * feat: Update Node.js engine requirement to >=20.0.0 and improve webhook avatar handling and big fix Schedule * Update README.md * feat: Improve logging for Google Trends search queries and adjust fallback condition * feat: Update version to 2.2.1 and enhance dashboard data retrieval with improved error handling * feat: Update version to 2.2.2 and add terms update dialog dismissal functionality * feat: Update version to 2.2.2 and require Node.js engine >=20.0.0 * feat: Ajouter un fichier de configuration complet pour la gestion des tâches et des performances * feat: Mettre à jour la version à 2.2.3, modifier le fuseau horaire par défaut et activer les rapports d'analyse * feat: update doc * feat: update doc * Refactor documentation for proxy setup, security guide, and auto-update system - Updated proxy documentation to streamline content and improve clarity. - Revised security guide to emphasize best practices and incident response. - Simplified auto-update documentation, enhancing user understanding of the update process. - Removed redundant sections and improved formatting for better readability. * feat: update version to 2.2.7 in package.json * feat: update version to 2.2.7 in README.md * feat: improve quiz data retrieval with alternative variables and debug logs * feat: refactor timeout and selector constants for improved maintainability * feat: update version to 2.2.8 in package.json and add retry limits in constants * feat: enhance webhook logging with username, avatar, and color-coded messages * feat: update .gitignore to include diagnostic folder and bump version to 2.2.8 in package-lock.json * feat: updated version to 2.3.0 and added new constants to improve the handling of delays and colors in logs
This commit is contained in:
421
docs/ntfy.md
421
docs/ntfy.md
@@ -1,86 +1,79 @@
|
||||
# 📱 NTFY Push Notifications
|
||||
|
||||
<div align="center">
|
||||
|
||||
**🔔 Real-time push notifications to your devices**
|
||||
*Stay informed wherever you are*
|
||||
|
||||
</div>
|
||||
**Get alerts on your phone instantly**
|
||||
|
||||
---
|
||||
|
||||
## 🎯 What is NTFY?
|
||||
## 💡 What Is NTFY?
|
||||
|
||||
NTFY is a **simple HTTP-based pub-sub notification service** that sends push notifications to your phone, desktop, or web browser. Perfect for real-time alerts about script events and errors.
|
||||
Simple push notification service that sends alerts to your phone/desktop.
|
||||
|
||||
### **Key Features**
|
||||
- 📱 **Mobile & Desktop** — Push to any device
|
||||
- 🆓 **Free & Open Source** — No vendor lock-in
|
||||
- 🏠 **Self-hostable** — Complete privacy control
|
||||
- ⚡ **Real-time delivery** — Instant notifications
|
||||
- 🔒 **Authentication support** — Secure topics
|
||||
|
||||
### **Official Links**
|
||||
- **Website** — [ntfy.sh](https://ntfy.sh)
|
||||
- **Documentation** — [docs.ntfy.sh](https://docs.ntfy.sh)
|
||||
- **GitHub** — [binwiederhier/ntfy](https://github.com/binwiederhier/ntfy)
|
||||
**Free to use:** No account required for basic features.
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ Configuration
|
||||
## ⚡ Quick Start
|
||||
|
||||
### **Basic Setup**
|
||||
```json
|
||||
### 1. Install NTFY App
|
||||
|
||||
- **Android:** [Google Play](https://play.google.com/store/apps/details?id=io.heckel.ntfy)
|
||||
- **iOS:** [App Store](https://apps.apple.com/app/ntfy/id1625396347)
|
||||
|
||||
### 2. Choose a Topic Name
|
||||
|
||||
Pick any unique name (e.g., `rewards-myname-2025`)
|
||||
|
||||
### 3. Subscribe in App
|
||||
|
||||
Open NTFY app → Add subscription → Enter your topic name
|
||||
|
||||
### 4. Configure Script
|
||||
|
||||
**Edit** `src/config.jsonc`:
|
||||
```jsonc
|
||||
{
|
||||
"notifications": {
|
||||
"ntfy": {
|
||||
"enabled": true,
|
||||
"url": "https://ntfy.sh",
|
||||
"topic": "rewards-script",
|
||||
"authToken": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### **Configuration Options**
|
||||
|
||||
| Setting | Description | Example |
|
||||
|---------|-------------|---------|
|
||||
| `enabled` | Enable NTFY notifications | `true` |
|
||||
| `url` | NTFY server URL | `"https://ntfy.sh"` |
|
||||
| `topic` | Notification topic name | `"rewards-script"` |
|
||||
| `authToken` | Authentication token (optional) | `"tk_abc123..."` |
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Setup Options
|
||||
|
||||
### **Option 1: Public Service (Easiest)**
|
||||
```json
|
||||
{
|
||||
"notifications": {
|
||||
"ntfy": {
|
||||
"enabled": true,
|
||||
"url": "https://ntfy.sh",
|
||||
"topic": "your-unique-topic-name"
|
||||
"topic": "rewards-myname-2025"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Pros:**
|
||||
- ✅ No server setup required
|
||||
- ✅ Always available
|
||||
- ✅ Free to use
|
||||
**That's it!** You'll get push notifications on your phone.
|
||||
|
||||
**Cons:**
|
||||
- ❌ Public server (less privacy)
|
||||
- ❌ Rate limits apply
|
||||
- ❌ Dependent on external service
|
||||
---
|
||||
|
||||
### **Option 2: Self-Hosted (Recommended)**
|
||||
```json
|
||||
## 🔔 What Notifications You Get
|
||||
|
||||
- 🚨 **Errors** — Script crashes, login failures
|
||||
- ⚠️ **Warnings** — Missing points, suspicious activity
|
||||
- 🏆 **Milestones** — Account completed successfully
|
||||
- 💳 **Buy mode** — Point spending detected
|
||||
- 📊 **Summary** — End-of-run report
|
||||
|
||||
---
|
||||
|
||||
## 🔒 Use Private Server (Optional)
|
||||
|
||||
### Self-Host NTFY
|
||||
|
||||
**Docker:**
|
||||
```yaml
|
||||
services:
|
||||
ntfy:
|
||||
image: binwiederhier/ntfy
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ./ntfy-data:/var/lib/ntfy
|
||||
command: serve
|
||||
```
|
||||
|
||||
**Then configure:**
|
||||
```jsonc
|
||||
{
|
||||
"notifications": {
|
||||
"ntfy": {
|
||||
@@ -93,315 +86,33 @@ NTFY is a **simple HTTP-based pub-sub notification service** that sends push not
|
||||
}
|
||||
```
|
||||
|
||||
**Self-Hosted Setup:**
|
||||
```yaml
|
||||
# docker-compose.yml
|
||||
version: '3.8'
|
||||
services:
|
||||
ntfy:
|
||||
image: binwiederhier/ntfy
|
||||
container_name: ntfy
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ./data:/var/lib/ntfy
|
||||
command: serve
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔒 Authentication
|
||||
|
||||
### **When You Need Auth**
|
||||
Authentication tokens are **optional** but required for:
|
||||
- 🔐 **Private topics** with username/password
|
||||
- 🏠 **Private NTFY servers** with authentication
|
||||
- 🛡️ **Preventing spam** on your topic
|
||||
|
||||
### **Getting an Auth Token**
|
||||
|
||||
#### **Method 1: Command Line**
|
||||
```bash
|
||||
ntfy token
|
||||
```
|
||||
|
||||
#### **Method 2: Web Interface**
|
||||
1. Visit your NTFY server (e.g., `https://ntfy.sh`)
|
||||
2. Go to **Account** section
|
||||
3. Generate **new access token**
|
||||
|
||||
#### **Method 3: API**
|
||||
```bash
|
||||
curl -X POST -d '{"label":"rewards-script"}' \
|
||||
-H "Authorization: Bearer YOUR_LOGIN_TOKEN" \
|
||||
https://ntfy.sh/v1/account/tokens
|
||||
```
|
||||
|
||||
### **Token Format**
|
||||
- Tokens start with `tk_` (e.g., `tk_abc123def456...`)
|
||||
- Use Bearer authentication format
|
||||
- Tokens are permanent until revoked
|
||||
|
||||
---
|
||||
|
||||
## 📲 Receiving Notifications
|
||||
|
||||
### **Mobile Apps**
|
||||
- **Android** — [NTFY on Google Play](https://play.google.com/store/apps/details?id=io.heckel.ntfy)
|
||||
- **iOS** — [NTFY on App Store](https://apps.apple.com/app/ntfy/id1625396347)
|
||||
- **F-Droid** — Available for Android
|
||||
|
||||
### **Desktop Options**
|
||||
- **Web Interface** — Visit your NTFY server URL
|
||||
- **Desktop Apps** — Available for Linux, macOS, Windows
|
||||
- **Browser Extension** — Chrome/Firefox extensions
|
||||
|
||||
### **Setup Steps**
|
||||
1. **Install** NTFY app on your device
|
||||
2. **Add subscription** to your topic name
|
||||
3. **Enter server URL** (if self-hosted)
|
||||
4. **Test** with a manual message
|
||||
|
||||
---
|
||||
|
||||
## 🔔 Notification Types
|
||||
|
||||
### **Error Notifications**
|
||||
**Priority:** Max 🚨 | **Trigger:** Script errors and failures
|
||||
```
|
||||
[ERROR] DESKTOP [LOGIN] Failed to login: Invalid credentials
|
||||
```
|
||||
|
||||
### **Warning Notifications**
|
||||
**Priority:** High ⚠️ | **Trigger:** Important warnings
|
||||
```
|
||||
[WARN] MOBILE [SEARCH] Didn't gain expected points from search
|
||||
```
|
||||
|
||||
### **Info Notifications**
|
||||
**Priority:** Default 🏆 | **Trigger:** Important milestones
|
||||
```
|
||||
[INFO] MAIN [TASK] Started tasks for account user@email.com
|
||||
```
|
||||
|
||||
### **Buy Mode Notifications**
|
||||
**Priority:** High 💳 | **Trigger:** Point spending detected
|
||||
```
|
||||
💳 Spend detected (Buy Mode)
|
||||
Account: user@email.com
|
||||
Spent: -500 points
|
||||
Current: 12,500 points
|
||||
Session spent: 1,200 points
|
||||
```
|
||||
|
||||
### **Conclusion Summary**
|
||||
**End-of-run summary with rich formatting:**
|
||||
```
|
||||
🎯 Microsoft Rewards Summary
|
||||
Accounts: 3 • 0 with issues
|
||||
Total: 15,230 -> 16,890 (+1,660)
|
||||
Average Duration: 8m 32s
|
||||
Cumulative Runtime: 25m 36s
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🤝 Integration with Discord
|
||||
|
||||
### **Complementary Setup**
|
||||
Use **both** NTFY and Discord for comprehensive monitoring:
|
||||
|
||||
```json
|
||||
{
|
||||
"notifications": {
|
||||
"webhook": {
|
||||
"enabled": true,
|
||||
"url": "https://discord.com/api/webhooks/..."
|
||||
},
|
||||
"conclusionWebhook": {
|
||||
"enabled": true,
|
||||
"url": "https://discord.com/api/webhooks/..."
|
||||
},
|
||||
"ntfy": {
|
||||
"enabled": true,
|
||||
"url": "https://ntfy.sh",
|
||||
"topic": "rewards-script"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### **Coverage Comparison**
|
||||
|
||||
| Feature | NTFY | Discord |
|
||||
|---------|------|---------|
|
||||
| **Mobile push** | ✅ Instant | ❌ App required |
|
||||
| **Rich formatting** | ❌ Text only | ✅ Embeds + colors |
|
||||
| **Desktop alerts** | ✅ Native | ✅ App notifications |
|
||||
| **Offline delivery** | ✅ Queued | ❌ Real-time only |
|
||||
| **Self-hosted** | ✅ Easy | ❌ Complex |
|
||||
|
||||
---
|
||||
|
||||
## 🎛️ Advanced Configuration
|
||||
|
||||
### **Custom Topic Names**
|
||||
Use descriptive, unique topic names:
|
||||
```json
|
||||
{
|
||||
"topic": "rewards-production-server1"
|
||||
}
|
||||
{
|
||||
"topic": "msn-rewards-home-pc"
|
||||
}
|
||||
{
|
||||
"topic": "rewards-dev-testing"
|
||||
}
|
||||
```
|
||||
|
||||
### **Environment-Specific**
|
||||
```json
|
||||
{
|
||||
"notifications": {
|
||||
"ntfy": {
|
||||
"enabled": true,
|
||||
"url": "https://ntfy.internal.lan",
|
||||
"topic": "homelab-rewards",
|
||||
"authToken": "tk_homelab_token"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🧪 Testing & Debugging
|
||||
|
||||
### **Manual Test Message**
|
||||
```bash
|
||||
# Public server (no auth)
|
||||
curl -d "Test message from rewards script" https://ntfy.sh/your-topic
|
||||
|
||||
# With authentication
|
||||
curl -H "Authorization: Bearer tk_your_token" \
|
||||
-d "Authenticated test message" \
|
||||
https://ntfy.sh/your-topic
|
||||
```
|
||||
|
||||
### **Script Debug Mode**
|
||||
```powershell
|
||||
$env:DEBUG_REWARDS_VERBOSE=1; npm start
|
||||
```
|
||||
|
||||
### **Server Health Check**
|
||||
```bash
|
||||
# Check NTFY server status
|
||||
curl -s https://ntfy.sh/v1/health
|
||||
|
||||
# List your topics (with auth)
|
||||
curl -H "Authorization: Bearer tk_your_token" \
|
||||
https://ntfy.sh/v1/account/topics
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Troubleshooting
|
||||
|
||||
| Problem | Solution |
|
||||
|---------|----------|
|
||||
| **No notifications** | Check topic spelling; verify app subscription |
|
||||
| **Auth failures** | Verify token format (`tk_`); check token validity |
|
||||
| **Wrong server** | Test server URL in browser; check HTTPS/HTTP |
|
||||
| **Rate limits** | Switch to self-hosted; reduce notification frequency |
|
||||
| **No notifications** | Check topic name matches exactly |
|
||||
| **Wrong server** | Verify URL includes `https://` |
|
||||
| **Auth failures** | Token must start with `tk_` |
|
||||
|
||||
### **Common Fixes**
|
||||
- ✅ **Topic name** — Must match exactly between config and app
|
||||
- ✅ **Server URL** — Include `https://` and check accessibility
|
||||
- ✅ **Token format** — Must start with `tk_` for authentication
|
||||
- ✅ **Network** — Verify firewall/proxy settings
|
||||
### Test Manually
|
||||
|
||||
---
|
||||
|
||||
## 🏠 Homelab Integration
|
||||
|
||||
### **Official Support**
|
||||
NTFY is included in:
|
||||
- **Debian Trixie** (testing)
|
||||
- **Ubuntu** (latest versions)
|
||||
|
||||
### **Popular Integrations**
|
||||
- **Sonarr/Radarr** — Download completion notifications
|
||||
- **Prometheus** — Alert manager integration
|
||||
- **Home Assistant** — Automation notifications
|
||||
- **Portainer** — Container status alerts
|
||||
|
||||
### **Docker Stack Example**
|
||||
```yaml
|
||||
version: '3.8'
|
||||
services:
|
||||
ntfy:
|
||||
image: binwiederhier/ntfy
|
||||
container_name: ntfy
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ./ntfy-data:/var/lib/ntfy
|
||||
environment:
|
||||
- NTFY_BASE_URL=https://ntfy.yourdomain.com
|
||||
command: serve
|
||||
|
||||
rewards:
|
||||
build: .
|
||||
depends_on:
|
||||
- ntfy
|
||||
environment:
|
||||
- NTFY_URL=http://ntfy:80
|
||||
```bash
|
||||
# Send test message
|
||||
curl -d "Test from rewards script" https://ntfy.sh/your-topic
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔒 Privacy & Security
|
||||
## 📚 Next Steps
|
||||
|
||||
### **Public Server (ntfy.sh)**
|
||||
- ⚠️ Messages pass through public infrastructure
|
||||
- ⚠️ Topic names visible in logs
|
||||
- ✅ Suitable for non-sensitive notifications
|
||||
**Want Discord too?**
|
||||
→ **[Discord Webhooks](./conclusionwebhook.md)**
|
||||
|
||||
### **Self-Hosted Server**
|
||||
- ✅ Complete control over data
|
||||
- ✅ Private network deployment possible
|
||||
- ✅ Recommended for sensitive information
|
||||
|
||||
### **Best Practices**
|
||||
- 🔐 Use **unique, non-guessable** topic names
|
||||
- 🔑 Enable **authentication** for sensitive notifications
|
||||
- 🏠 Use **self-hosted server** for maximum privacy
|
||||
- 🔄 **Regularly rotate** authentication tokens
|
||||
|
||||
### **Data Retention**
|
||||
- 📨 Messages are **not permanently stored**
|
||||
- ⏱️ Delivery attempts **retried** for short periods
|
||||
- 🗑️ **No long-term** message history
|
||||
**Need detailed logs?**
|
||||
→ **[Diagnostics Guide](./diagnostics.md)**
|
||||
|
||||
---
|
||||
|
||||
## ⚡ Performance Impact
|
||||
|
||||
### **Script Performance**
|
||||
- ✅ **Minimal overhead** — Fire-and-forget notifications
|
||||
- ✅ **Non-blocking** — Failed notifications don't affect script
|
||||
- ✅ **Asynchronous** — No execution delays
|
||||
|
||||
### **Network Usage**
|
||||
- 📊 **Low bandwidth** — Text-only messages
|
||||
- ⚡ **HTTP POST** — Simple, efficient protocol
|
||||
- 🔄 **Retry logic** — Automatic failure recovery
|
||||
|
||||
---
|
||||
|
||||
## 🔗 Related Guides
|
||||
|
||||
- **[Discord Webhooks](./conclusionwebhook.md)** — Rich notification embeds
|
||||
- **[Getting Started](./getting-started.md)** — Initial setup and configuration
|
||||
- **[Buy Mode](./buy-mode.md)** — Manual purchasing notifications
|
||||
- **[Security](./security.md)** — Privacy and data protection
|
||||
**[← Back to Hub](./index.md)** | **[Config Guide](./config.md)**
|
||||
|
||||
Reference in New Issue
Block a user