Fix creator

This commit is contained in:
2025-11-11 15:25:21 +01:00
parent ffb77d3a28
commit 6069f2eba0
5 changed files with 35 additions and 64 deletions

View File

@@ -132,13 +132,8 @@ Automatically create new Microsoft accounts with advanced security features:
# Interactive mode (asks everything)
npm run creator
# With specific recovery email (simplified URL - recommended)
npm run creator -- https://rewards.bing.com/welcome?rh=YOUR_CODE -y backup@gmail.com
# If URL has & symbols (from Microsoft copy-paste), use quotes:
npm run creator -- "https://rewards.bing.com/welcome?rh=CODE&ref=..." -y backup@gmail.com
# ⚠️ IMPORTANT: URLs with & MUST be in quotes (CMD/PowerShell requirement)
# With auto-accept and recovery email (copy-paste URL directly from Microsoft)
npm run creator -- -y backup@gmail.com https://rewards.bing.com/welcome?rh=YOUR_CODE
```
**✨ Features:**
@@ -167,8 +162,8 @@ npm run creator -- "https://rewards.bing.com/welcome?rh=CODE&ref=..." -y backup@
| `npm run creator` | ❓ Prompts | ❓ Prompts | Interactive mode |
| `npm run creator -- -y` | ✅ Prompts for email | ✅ Enabled | Auto-accept all |
| `npm run creator -- -y backup@gmail.com` | ✅ Uses provided email | ✅ Enabled | Full automation |
| `npm run creator -- URL -y` | ✅ Prompts for email | ✅ Enabled | With referral |
| `npm run creator -- URL -y backup@gmail.com` | ✅ Uses provided email | ✅ Enabled | Complete setup |
| `npm run creator -- -y URL` | ✅ Prompts for email | ✅ Enabled | With referral |
| `npm run creator -- -y backup@gmail.com URL` | ✅ Uses provided email | ✅ Enabled | Complete setup |
**📋 What happens:**
1. Creates Microsoft account (email, password, birthdate, names)

View File

@@ -222,10 +222,8 @@ npm run dashboard-dev
# Interactive mode
npm run creator
# With referral URL and auto-accept mode
npm run creator -- https://rewards.bing.com/welcome?rh=YOUR_CODE -y backup@gmail.com
# Note: The -- is required to pass arguments to the script!
# With auto-accept and recovery email (copy-paste URL directly from Microsoft)
npm run creator -- -y backup@gmail.com https://rewards.bing.com/welcome?rh=YOUR_CODE
```
**When to use:**

View File

@@ -119,7 +119,7 @@ Explore advanced features and customization options:| **[NTFY Alerts](ntfy.md)**
**Quick command:**
```bash
npm run creator -- https://rewards.bing.com/welcome?rh=YOUR_CODE -y backup@gmail.com
npm run creator -- -y backup@gmail.com https://rewards.bing.com/welcome?rh=YOUR_CODE
```
---

View File

@@ -33,21 +33,15 @@ npm run creator
npm run creator -- https://rewards.bing.com/welcome?rh=YOUR_CODE
# Auto-accept mode (enables recovery email + 2FA automatically)
npm run creator -- https://rewards.bing.com/welcome?rh=YOUR_CODE -y
npm run creator -- -y https://rewards.bing.com/welcome?rh=YOUR_CODE
# With specific recovery email (auto-detected)
npm run creator -- https://rewards.bing.com/welcome?rh=YOUR_CODE -y backup@gmail.com
# If URL from Microsoft has &ref= or &form=, use quotes:
npm run creator -- "https://rewards.bing.com/welcome?rh=CODE&ref=..." -y backup@gmail.com
# With specific recovery email (full automation) - RECOMMENDED ORDER
npm run creator -- -y backup@gmail.com https://rewards.bing.com/welcome?rh=YOUR_CODE
# Minimal - just recovery email without referral
npm run creator -- -y myrecovery@gmail.com
# ⚠️ CRITICAL NOTES:
# - The -- is REQUIRED to pass arguments via npm
# - URLs with & MUST be in quotes (CMD/PowerShell cuts at & otherwise)
# - You can simplify URLs to just ?rh=CODE (other params are optional)
# ⚠️ IMPORTANT: Put -y and email BEFORE the URL to avoid issues with & in URLs
```
### 🎛️ Command Line Arguments
@@ -67,8 +61,8 @@ npm run creator -- -y myrecovery@gmail.com
| `npm run creator` | ❓ Ask user | ❓ Ask user | Fully interactive |
| `npm run creator -- -y` | ✅ Prompt for email | ✅ Enabled | Auto-accept all |
| `npm run creator -- -y backup@gmail.com` | ✅ Use provided email | ✅ Enabled | Full automation |
| `npm run creator -- URL -y` | ✅ Prompt for email | ✅ Enabled | With referral |
| `npm run creator -- URL -y backup@gmail.com` | ✅ Use provided email | ✅ Enabled | Complete setup |
| `npm run creator -- -y URL` | ✅ Prompt for email | ✅ Enabled | With referral |
| `npm run creator -- -y backup@gmail.com URL` | ✅ Use provided email | ✅ Enabled | Complete setup |
**⚠️ Important: How `-y` Works**
@@ -90,10 +84,10 @@ npm run creator -- https://rewards.bing.com/welcome?rh=B395E9D7
npm run creator -- -y
# Auto with referral (enables 2FA, prompts for recovery)
npm run creator -- https://rewards.bing.com/welcome?rh=B395E9D7 -y
npm run creator -- -y https://rewards.bing.com/welcome?rh=B395E9D7
# Full automation with specific recovery email (no prompts)
npm run creator -- https://rewards.bing.com/welcome?rh=B395E9D7 -y backup@gmail.com
npm run creator -- -y backup@gmail.com https://rewards.bing.com/welcome?rh=B395E9D7
# Just with recovery email, no referral
npm run creator -- -y myrecovery@example.com
@@ -440,6 +434,9 @@ When you use `--2fa` argument OR answer 'y' to "Enable 2FA?" prompt:
**Q: How do I provide a recovery email?**
A: Just add it as an argument: `npm run creator -- -y myemail@gmail.com` - it's auto-detected!
**Q: Do I need to modify the URL from Microsoft?**
A: No! Just copy-paste it directly. The script automatically handles special characters and optional parameters.
**Q: What does `-y` do exactly?**
A: It enables EVERYTHING automatically (recovery email prompt + 2FA). One flag, full automation.

View File

@@ -1,4 +1,3 @@
import * as readline from 'readline'
import Browser from '../browser/Browser'
import { MicrosoftRewardsBot } from '../index'
import { log } from '../util/notifications/Logger'
@@ -22,42 +21,24 @@ async function main(): Promise<void> {
} else if (arg.includes('@')) {
// Auto-detect email addresses
recoveryEmail = arg
} else if (arg.startsWith('ref=') || arg.startsWith('form=') || arg.startsWith('CREA=')) {
// SMART FIX: Detect leftover URL fragments from CMD/PowerShell & splitting
// When user forgets quotes, CMD splits at & and passes fragments as separate args
// We silently ignore these fragments (only the rh= code matters anyway)
// Example: "https://...?rh=CODE&ref=X&form=Y" becomes ["https://...?rh=CODE", "ref=X", "form=Y"]
continue // Ignore these - they're optional tracking parameters
}
}
// CRITICAL: Detect truncated URLs (PowerShell/CMD cut at & character)
// If URL detected but no -y flag AND no email, likely the URL was cut
if (referralUrl && !autoAccept && !recoveryEmail && args.length === 1) {
// Check if URL looks truncated (ends with parameter but no value after &)
if (referralUrl.includes('?') && !referralUrl.includes('&')) {
log(false, 'CREATOR-CLI', '', 'log')
log(false, 'CREATOR-CLI', '⚠️ WARNING: URL may be truncated!', 'warn', 'yellow')
log(false, 'CREATOR-CLI', ' The & character is special in CMD/PowerShell and cuts the URL.', 'warn', 'yellow')
log(false, 'CREATOR-CLI', '', 'log')
log(false, 'CREATOR-CLI', '✅ SOLUTION: Put the URL in quotes:', 'log', 'green')
log(false, 'CREATOR-CLI', ' npm run creator -- "https://rewards.bing.com/...full-url..." -y email@gmail.com', 'log', 'cyan')
log(false, 'CREATOR-CLI', '', 'log')
log(false, 'CREATOR-CLI', '💡 TIP: Only the rh= code matters. You can simplify to:', 'log', 'gray')
log(false, 'CREATOR-CLI', ' npm run creator -- https://rewards.bing.com/welcome?rh=YOUR_CODE -y email@gmail.com', 'log', 'cyan')
log(false, 'CREATOR-CLI', '', 'log')
// Ask user if they want to continue anyway
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
})
await new Promise<void>((resolve) => {
rl.question('Continue with this URL anyway? (y/N): ', (answer: string) => {
rl.close()
if (answer.toLowerCase() !== 'y' && answer.toLowerCase() !== 'yes') {
log(false, 'CREATOR-CLI', '❌ Aborted. Please retry with the URL in quotes.', 'error')
process.exit(0)
}
resolve()
})
})
}
// AUTO-FIX: Clean up URL if it contains & parameters that might cause issues
// Only keep the part up to the first & to ensure compatibility even without quotes
if (referralUrl && referralUrl.includes('&')) {
const originalUrl = referralUrl
referralUrl = referralUrl.split('&')[0] // Keep only base URL + first parameter (rh=CODE)
log(false, 'CREATOR-CLI', '<EFBFBD> Auto-cleaned URL (removed optional tracking parameters)', 'log', 'gray')
log(false, 'CREATOR-CLI', ` Original: ${originalUrl}`, 'log', 'gray')
log(false, 'CREATOR-CLI', ` Using: ${referralUrl}`, 'log', 'cyan')
log(false, 'CREATOR-CLI', '', 'log')
}
// Banner
@@ -76,9 +57,9 @@ async function main(): Promise<void> {
log(false, 'CREATOR-CLI', '📖 Usage Examples:', 'log', 'cyan')
log(false, 'CREATOR-CLI', ' npm run creator -- -y # Auto mode', 'log', 'gray')
log(false, 'CREATOR-CLI', ' npm run creator -- -y email@gmail.com # With recovery email', 'log', 'gray')
log(false, 'CREATOR-CLI', ' npm run creator -- https://rewards.bing.com/... -y # With referral URL', 'log', 'gray')
log(false, 'CREATOR-CLI', ' npm run creator -- -y email@gmail.com https://rewards... # Full automation', 'log', 'gray')
log(false, 'CREATOR-CLI', '', 'log')
log(false, 'CREATOR-CLI', '⚠️ IMPORTANT: The -- is required to pass arguments via npm!', 'warn', 'yellow')
log(false, 'CREATOR-CLI', '⚠️ IMPORTANT: Put -y and email BEFORE the URL!', 'warn', 'yellow')
log(false, 'CREATOR-CLI', '', 'log')
}