diff --git a/README.md b/README.md index 039c4ae..1bd01aa 100644 --- a/README.md +++ b/README.md @@ -132,9 +132,13 @@ Automatically create new Microsoft accounts with advanced security features: # Interactive mode (asks everything) npm run creator -# With specific recovery email (auto-detected, no flag needed!) +# 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) ``` **✨ Features:** diff --git a/src/account-creation/README.md b/src/account-creation/README.md index d379537..8a6d8e2 100644 --- a/src/account-creation/README.md +++ b/src/account-creation/README.md @@ -38,10 +38,16 @@ npm run creator -- https://rewards.bing.com/welcome?rh=YOUR_CODE -y # 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 + # Minimal - just recovery email without referral npm run creator -- -y myrecovery@gmail.com -# Note: The -- is REQUIRED to pass arguments to the script via npm! +# ⚠️ 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) ``` ### 🎛️ Command Line Arguments diff --git a/src/account-creation/cli.ts b/src/account-creation/cli.ts index a99a3d6..cda2a4e 100644 --- a/src/account-creation/cli.ts +++ b/src/account-creation/cli.ts @@ -1,3 +1,4 @@ +import * as readline from 'readline' import Browser from '../browser/Browser' import { MicrosoftRewardsBot } from '../index' import { log } from '../util/notifications/Logger' @@ -24,6 +25,41 @@ async function main(): Promise { } } + // 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((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() + }) + }) + } + } + // Banner log(false, 'CREATOR-CLI', '', 'log') // Empty line log(false, 'CREATOR-CLI', '='.repeat(60), 'log', 'cyan')