From 9a547bdbab75e20e4144b81b5447f6c73b54fa32 Mon Sep 17 00:00:00 2001 From: LightZirconite Date: Sat, 29 Nov 2025 14:31:35 +0100 Subject: [PATCH] Fix link Acc --- README.md | 4 +-- docs/commands.md | 2 +- docs/index.md | 2 +- src/account-creation/README.md | 4 +-- src/account-creation/cli.ts | 47 ++++++++++++++++++++++++++++++---- 5 files changed, 48 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 59b8067..4e41d06 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,7 @@ npm start npm run creator # Quick mode with referral -npm run creator -- -y backup@gmail.com https://rewards.bing.com/welcome?rh=CODE +npm run creator -- -y backup@gmail.com "https://rewards.bing.com/welcome?rh=CODE&ref=..." ``` ### **Troubleshooting** (Issues) @@ -228,7 +228,7 @@ Automatically create new Microsoft accounts with advanced security features: npm run creator # 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 +npm run creator -- -y backup@gmail.com "https://rewards.bing.com/welcome?rh=YOUR_CODE" ``` **✨ Features:** diff --git a/docs/commands.md b/docs/commands.md index 8f4101b..d2437a2 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -246,7 +246,7 @@ npm run dashboard-dev npm run creator # 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 +npm run creator -- -y backup@gmail.com "https://rewards.bing.com/welcome?rh=YOUR_CODE" ``` **When to use:** diff --git a/docs/index.md b/docs/index.md index cbc43d0..0ad7c1c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -106,7 +106,7 @@ Explore advanced features and customization options:| **[NTFY Alerts](ntfy.md)** **Quick command:** ```bash -npm run creator -- -y backup@gmail.com https://rewards.bing.com/welcome?rh=YOUR_CODE +npm run creator -- -y backup@gmail.com "https://rewards.bing.com/welcome?rh=YOUR_CODE" ``` --- diff --git a/src/account-creation/README.md b/src/account-creation/README.md index 31ffd98..ec37fd6 100644 --- a/src/account-creation/README.md +++ b/src/account-creation/README.md @@ -36,7 +36,7 @@ npm run creator -- https://rewards.bing.com/welcome?rh=YOUR_CODE npm run creator -- -y https://rewards.bing.com/welcome?rh=YOUR_CODE # With specific recovery email (full automation) - RECOMMENDED ORDER -npm run creator -- -y backup@gmail.com https://rewards.bing.com/welcome?rh=YOUR_CODE +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 @@ -87,7 +87,7 @@ npm run creator -- -y npm run creator -- -y https://rewards.bing.com/welcome?rh=B395E9D7 # Full automation with specific recovery email (no prompts) -npm run creator -- -y backup@gmail.com https://rewards.bing.com/welcome?rh=B395E9D7 +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 diff --git a/src/account-creation/cli.ts b/src/account-creation/cli.ts index 8947846..5a76c96 100644 --- a/src/account-creation/cli.ts +++ b/src/account-creation/cli.ts @@ -3,6 +3,22 @@ import { MicrosoftRewardsBot } from '../index' import { log } from '../util/notifications/Logger' import { AccountCreator } from './AccountCreator' +import * as readline from 'readline' + +async function askForUrl(): Promise { + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout + }) + + return new Promise((resolve) => { + rl.question(' 👉 Please paste the FULL URL here: ', (answer) => { + rl.close() + resolve(answer.trim()) + }) + }) +} + async function main(): Promise { // Parse command line args const args = process.argv.slice(2) @@ -21,17 +37,37 @@ async function main(): Promise { } else if (arg.includes('@')) { // Auto-detect email addresses recoveryEmail = arg - } else if (arg.startsWith('ref=') || arg.startsWith('form=') || arg.startsWith('CREA=')) { + } else if (referralUrl && (arg.includes('=') || arg.startsWith('&'))) { // 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 + // We append these fragments back to the URL to preserve the full link + // Example: "https://...?rh=CODE&ref=X" becomes ["https://...?rh=CODE", "ref=X"] + const fragment = arg.startsWith('&') ? arg.substring(1) : arg + referralUrl += '&' + fragment + log(false, 'CREATOR-CLI', `🔗 Re-attached URL fragment: &${fragment}`, 'log', 'gray') } } // AUTO-FIX: Ensure referral URL has &new=1 parameter (REQUIRED for referral to work) if (referralUrl) { + // WARNING: Check for truncated URL (common issue with PowerShell/CMD) + if (referralUrl.includes('rh=') && !referralUrl.includes('ref=')) { + log(false, 'CREATOR-CLI', '', 'log') + log(false, 'CREATOR-CLI', '⚠️ POSSIBLE URL TRUNCATION DETECTED', 'warn', 'yellow') + log(false, 'CREATOR-CLI', ' The referral URL seems to be missing parameters (ref=, form=, etc.)', 'warn', 'yellow') + log(false, 'CREATOR-CLI', ' This usually happens because the "&" character cuts off the command.', 'warn', 'yellow') + + // INTERACTIVE FIX: Ask user to paste the full URL + log(false, 'CREATOR-CLI', ' 🛑 AUTOMATIC PAUSE: To prevent failure, please provide the full URL.', 'warn', 'yellow') + const newUrl = await askForUrl() + if (newUrl && newUrl.startsWith('http')) { + referralUrl = newUrl + log(false, 'CREATOR-CLI', '✅ URL updated successfully!', 'log', 'green') + } else { + log(false, 'CREATOR-CLI', '⚠️ Invalid URL provided, continuing with truncated URL...', 'warn', 'yellow') + } + } + // Remove any existing &new=1 to avoid duplication referralUrl = referralUrl.replace(/&new=1/g, '') @@ -61,9 +97,10 @@ async function main(): Promise { 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 -- -y email@gmail.com https://rewards... # Full automation', 'log', 'gray') + log(false, 'CREATOR-CLI', ' npm run creator -- -y email@gmail.com "https://rewards..." # Full automation (QUOTES REQUIRED!)', 'log', 'gray') log(false, 'CREATOR-CLI', '', 'log') log(false, 'CREATOR-CLI', '⚠️ IMPORTANT: Put -y and email BEFORE the URL!', 'warn', 'yellow') + log(false, 'CREATOR-CLI', '⚠️ IMPORTANT: Always put QUOTES around the URL if it contains "&"', 'warn', 'yellow') log(false, 'CREATOR-CLI', '', 'log') }