cursor-switch 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +16 -0
- package/dist/core/dashboard-launcher.d.ts +4 -4
- package/dist/core/dashboard-launcher.js +9 -9
- package/dist/core/outlook-launcher.d.ts +4 -0
- package/dist/core/outlook-launcher.js +162 -134
- package/dist/core/pure-login-service.d.ts +23 -2
- package/dist/core/pure-login-service.js +197 -73
- package/dist/core/welcome-offer-service.d.ts +52 -0
- package/dist/core/welcome-offer-service.js +369 -0
- package/dist/menu.js +14 -4
- package/package.json +1 -1
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor 老用户回归特权 (Welcome-Back Offer) 检测与免密直通服务
|
|
3
|
+
* 支持:
|
|
4
|
+
* 1. 携带已有 Token / SessionCookie 进行毫秒级轻量嗅探
|
|
5
|
+
* 2. 只有邮箱与密码时,自动通过纯净住宅专线代登获取新 Token,展示并复制到剪贴板后紧接着检测
|
|
6
|
+
* 3. 命中资格后,调用独立 Chromium 原生 CDP 注入 Cookie,免串号直达激活与结账页
|
|
7
|
+
*/
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import boxen from 'boxen';
|
|
10
|
+
import { TokenParser } from './token-parser.js';
|
|
11
|
+
import { OfficialApiClient } from './official-api.js';
|
|
12
|
+
import { DashboardLauncher } from './dashboard-launcher.js';
|
|
13
|
+
import { PureLoginService } from './pure-login-service.js';
|
|
14
|
+
import { copyToClipboard } from '../utils/clipboard.js';
|
|
15
|
+
import { safeInput, safeConfirm, safePressAnyKey } from '../utils/prompt-utils.js';
|
|
16
|
+
import { quickSelect, Separator } from '../utils/live-menu.js';
|
|
17
|
+
import { generateMachineIds, formatMachineIdSummary } from './fingerprint.js';
|
|
18
|
+
import { ProcessManager } from './process-manager.js';
|
|
19
|
+
export class WelcomeOfferService {
|
|
20
|
+
/**
|
|
21
|
+
* 携带 SessionToken 静默嗅探 Cursor 官方回归资格接口
|
|
22
|
+
*/
|
|
23
|
+
static async checkOffer(sessionToken) {
|
|
24
|
+
const cleanToken = sessionToken.trim().replace(/["\r\n]/g, '');
|
|
25
|
+
const url = 'https://cursor.com/api/auth/welcome-back-offer';
|
|
26
|
+
try {
|
|
27
|
+
const res = await fetch(url, {
|
|
28
|
+
method: 'GET',
|
|
29
|
+
headers: {
|
|
30
|
+
Cookie: `WorkosCursorSessionToken=${cleanToken}`,
|
|
31
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36',
|
|
32
|
+
Accept: 'application/json, text/plain, */*',
|
|
33
|
+
'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
|
|
34
|
+
Referer: 'https://cursor.com/activate/welcome-back/offer',
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
if (res.status === 401) {
|
|
38
|
+
return {
|
|
39
|
+
status: 'EXPIRED_TOKEN',
|
|
40
|
+
message: '登录凭据已失效或过期 (HTTP 401 Unauthorized)',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (!res.ok) {
|
|
44
|
+
return {
|
|
45
|
+
status: 'NOT_ELIGIBLE',
|
|
46
|
+
message: `未命中老用户回归资格 (官方响应 HTTP ${res.status})`,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const data = await res.json();
|
|
50
|
+
if (!data ||
|
|
51
|
+
data.canActivate !== true ||
|
|
52
|
+
data.redemptionFlow !== 'landing_page' ||
|
|
53
|
+
data.previousPlanTier === undefined) {
|
|
54
|
+
return {
|
|
55
|
+
status: 'NOT_ELIGIBLE',
|
|
56
|
+
message: '官方返回未命中回归资格 (条件不满足或已被领取)',
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
// 命中回归资格!按官方计费策略解析文案与价格
|
|
60
|
+
const tierMap = {
|
|
61
|
+
pro: { label: 'Pro', originalPrice: '$20' },
|
|
62
|
+
pro_plus: { label: 'Pro+', originalPrice: '$60' },
|
|
63
|
+
ultra: { label: 'Ultra', originalPrice: '$200' },
|
|
64
|
+
};
|
|
65
|
+
const pricesDiscounted = { pro: '$10', pro_plus: '$30', ultra: '$100' };
|
|
66
|
+
const pricesIncentiveAmount = { pro: '$6', pro_plus: '$18', ultra: '$60' };
|
|
67
|
+
const discountPercents = {
|
|
68
|
+
control: 50,
|
|
69
|
+
incentive_amount: 70,
|
|
70
|
+
incentive_duration: 50,
|
|
71
|
+
unallocated: 50,
|
|
72
|
+
};
|
|
73
|
+
const tier = String(data.previousPlanTier || 'pro').toLowerCase();
|
|
74
|
+
const treatment = String(data.incentiveTreatment || 'control');
|
|
75
|
+
const tierInfo = tierMap[tier] || { label: tier.toUpperCase(), originalPrice: '$20' };
|
|
76
|
+
const pct = discountPercents[treatment] ?? 50;
|
|
77
|
+
let discountedPrice = pricesDiscounted[tier] || '$10';
|
|
78
|
+
let headlineDiscount = `首月立享 ${pct}% 折扣 (${discountedPrice}/月)`;
|
|
79
|
+
let pricePeriodLabel = '首月';
|
|
80
|
+
let rolloverSentence = `之后恢复 ${tierInfo.originalPrice}/月。点击进入结账激活特权。`;
|
|
81
|
+
let footnote = '折扣仅适用于首月。随时可取消。';
|
|
82
|
+
if (treatment === 'incentive_amount') {
|
|
83
|
+
discountedPrice = pricesIncentiveAmount[tier] || '$6';
|
|
84
|
+
headlineDiscount = `立享 ${pct}% 首月超级折扣 (${discountedPrice}/月)`;
|
|
85
|
+
pricePeriodLabel = '首月';
|
|
86
|
+
rolloverSentence = `首月仅需 ${discountedPrice},次月恢复 ${tierInfo.originalPrice}/月。`;
|
|
87
|
+
footnote = '超级回归立减 70%,仅限本月有效。';
|
|
88
|
+
}
|
|
89
|
+
else if (treatment === 'incentive_duration') {
|
|
90
|
+
discountedPrice = pricesDiscounted[tier] || '$10';
|
|
91
|
+
headlineDiscount = `连续 3 个月立享 ${pct}% 折扣 (${discountedPrice}/月)`;
|
|
92
|
+
pricePeriodLabel = '每月 (连续 3 个月)';
|
|
93
|
+
rolloverSentence = `前 3 个月每月 ${discountedPrice},之后恢复 ${tierInfo.originalPrice}/月。`;
|
|
94
|
+
footnote = '特惠适用于连续 3 个月。随时可取消。';
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
status: 'ELIGIBLE',
|
|
98
|
+
canActivate: true,
|
|
99
|
+
redemptionFlow: data.redemptionFlow,
|
|
100
|
+
previousPlanTier: tier,
|
|
101
|
+
incentiveTreatment: treatment,
|
|
102
|
+
headlineDiscount,
|
|
103
|
+
discountedPrice,
|
|
104
|
+
originalPrice: tierInfo.originalPrice,
|
|
105
|
+
pricePeriodLabel,
|
|
106
|
+
rolloverSentence,
|
|
107
|
+
footnote,
|
|
108
|
+
agentRuns: data.stats?.agentRuns,
|
|
109
|
+
linesOfCodeWritten: data.stats?.linesOfCodeWritten,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
return {
|
|
114
|
+
status: 'ERROR',
|
|
115
|
+
message: `网络连接异常: ${err.message}`,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* 调起独立隔离浏览器免密直达激活结账页
|
|
121
|
+
*/
|
|
122
|
+
static async openOfferPage(token, email = 'Cursor User') {
|
|
123
|
+
const offerUrl = 'https://cursor.com/activate/welcome-back/offer';
|
|
124
|
+
return DashboardLauncher.openDashboardWithToken(token, email, undefined, offerUrl);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* 交互式运行回归资格检测主流程 (终端 TUI)
|
|
128
|
+
*/
|
|
129
|
+
static async runInteractiveFlow(store, storage, sqlite, executablePath, initialIdentifier) {
|
|
130
|
+
console.clear();
|
|
131
|
+
console.log(boxen([
|
|
132
|
+
chalk.bold.cyan('🎁 Cursor 老号回归资格检测雷达'),
|
|
133
|
+
chalk.dim('──────────────────────────────────────────────────────────────────'),
|
|
134
|
+
chalk.grey('解决老号痛点: 毫秒嗅探官方回归特权,中奖自动唤起独立无痕浏览器免密直达。'),
|
|
135
|
+
chalk.grey('资产安全保障: 无论是否中奖,获取的官方 Token 都会完整展示并自动复制到剪贴板!'),
|
|
136
|
+
].join('\n'), {
|
|
137
|
+
padding: { top: 0, bottom: 0, left: 1, right: 1 },
|
|
138
|
+
borderColor: 'cyan',
|
|
139
|
+
borderStyle: 'round',
|
|
140
|
+
}));
|
|
141
|
+
let mode = '';
|
|
142
|
+
let prefilledInput = '';
|
|
143
|
+
if (initialIdentifier) {
|
|
144
|
+
const parsed = TokenParser.parse(initialIdentifier);
|
|
145
|
+
if (parsed.isValid) {
|
|
146
|
+
mode = 'token';
|
|
147
|
+
prefilledInput = parsed.token;
|
|
148
|
+
}
|
|
149
|
+
else if (initialIdentifier.includes('@')) {
|
|
150
|
+
mode = 'pure_login';
|
|
151
|
+
prefilledInput = initialIdentifier;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (!mode) {
|
|
155
|
+
try {
|
|
156
|
+
mode = await quickSelect({
|
|
157
|
+
message: '请选择老号回归资格检测方式:',
|
|
158
|
+
choices: [
|
|
159
|
+
{
|
|
160
|
+
name: '1. 我已有 Token / SessionCookie (直接粘贴检测)',
|
|
161
|
+
value: 'token',
|
|
162
|
+
description: '已有新鲜有效的 SessionToken,跳过代登,毫秒级直接嗅探官方资格',
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: '2. 纯净代登新换 Token 并检测 (输入账号邮箱)',
|
|
166
|
+
value: 'pure_login',
|
|
167
|
+
description: '通过海外住宅专线发起代登,在终端填入邮箱 6 位验证码,秒提新 Token 并检测',
|
|
168
|
+
},
|
|
169
|
+
new Separator(),
|
|
170
|
+
{
|
|
171
|
+
name: '0. 返回上一级',
|
|
172
|
+
value: 'back',
|
|
173
|
+
description: '退出并返回主菜单',
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (mode === 'back')
|
|
183
|
+
return;
|
|
184
|
+
// ── 通道 1: 粘贴已有 Token ──────────────────────────────────────────
|
|
185
|
+
if (mode === 'token') {
|
|
186
|
+
let rawToken = prefilledInput;
|
|
187
|
+
if (!rawToken) {
|
|
188
|
+
rawToken = (await safeInput({
|
|
189
|
+
message: '请输入 WorkosCursorSessionToken (支持 user_xxx:: 或整段 Token):',
|
|
190
|
+
}))?.trim() || '';
|
|
191
|
+
}
|
|
192
|
+
if (!rawToken) {
|
|
193
|
+
console.log(chalk.grey('\n未输入 Token,操作已取消。\n'));
|
|
194
|
+
await safePressAnyKey();
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const parsed = TokenParser.parse(rawToken);
|
|
198
|
+
const cleanToken = parsed.token || rawToken;
|
|
199
|
+
let email = parsed.email;
|
|
200
|
+
if (!email) {
|
|
201
|
+
try {
|
|
202
|
+
email = (await OfficialApiClient.fetchEmail(cleanToken)) || undefined;
|
|
203
|
+
}
|
|
204
|
+
catch { }
|
|
205
|
+
}
|
|
206
|
+
if (!email)
|
|
207
|
+
email = 'Cursor User';
|
|
208
|
+
console.log(chalk.cyan(`\n🔍 正在嗅探 https://cursor.com/activate/welcome-back/offer ...`));
|
|
209
|
+
const res = await this.checkOffer(cleanToken);
|
|
210
|
+
// 处理 Token 过期 -> 引导无缝切到通道 2
|
|
211
|
+
if (res.status === 'EXPIRED_TOKEN') {
|
|
212
|
+
console.log(chalk.yellow(`\n⚠️ 检测到该 Token 已失效 (Session Expired)。`));
|
|
213
|
+
const tryPure = await safeConfirm({
|
|
214
|
+
message: '是否输入该账号的【邮箱+密码】自动通过纯净代登获取新 Token 继续检测?',
|
|
215
|
+
default: true,
|
|
216
|
+
});
|
|
217
|
+
if (tryPure) {
|
|
218
|
+
await this.handlePureLoginFlow(store, storage, sqlite, executablePath, email !== 'Cursor User' ? email : '');
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
await safePressAnyKey();
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// 处理检测结果
|
|
227
|
+
await this.handleOfferResult(res, cleanToken, email, store, storage, sqlite, executablePath);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
// ── 通道 2: 邮箱与密码纯净代登 ──────────────────────────────────────────
|
|
231
|
+
if (mode === 'pure_login') {
|
|
232
|
+
await this.handlePureLoginFlow(store, storage, sqlite, executablePath, prefilledInput);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* 执行纯净代登流程并衔接资格检测
|
|
237
|
+
*/
|
|
238
|
+
static async handlePureLoginFlow(store, storage, sqlite, executablePath, prefilledEmail) {
|
|
239
|
+
const pureService = new PureLoginService();
|
|
240
|
+
console.log(chalk.cyan('\n正在启动纯净住宅专线代登复活老号...\n'));
|
|
241
|
+
// 启动代登全流程
|
|
242
|
+
const loginAccount = await pureService.runInteractiveFlow(store, storage, sqlite, executablePath, {
|
|
243
|
+
prefilledInput: prefilledEmail,
|
|
244
|
+
skipSwitchPrompt: true, // 暂不打断去切换 IDE,优先执行资格检测
|
|
245
|
+
});
|
|
246
|
+
if (!loginAccount || !loginAccount.token) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
const email = loginAccount.email;
|
|
250
|
+
const token = loginAccount.workos_cursor_session_token || loginAccount.token;
|
|
251
|
+
console.log(chalk.cyan(`\n🔍 正在使用全新官方 Token 嗅探 https://cursor.com/activate/welcome-back/offer ...`));
|
|
252
|
+
const res = await this.checkOffer(token);
|
|
253
|
+
await this.handleOfferResult(res, token, email, store, storage, sqlite, executablePath);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* 统一处理资格判定结果与后续交互
|
|
257
|
+
*/
|
|
258
|
+
static async handleOfferResult(res, token, email, store, storage, sqlite, executablePath) {
|
|
259
|
+
if (res.status === 'ELIGIBLE') {
|
|
260
|
+
// 命中回归资格!大号高亮卡片
|
|
261
|
+
console.log(boxen([
|
|
262
|
+
chalk.bold.green('🎉 恭喜!该账号成功命中【Cursor 回归老用户专享礼包】!'),
|
|
263
|
+
chalk.dim('──────────────────────────────────────────────────────────────────'),
|
|
264
|
+
` 关联账号 : ${chalk.bold.white(email)}`,
|
|
265
|
+
` 优惠特权 : ${chalk.bold.yellow(res.headlineDiscount)}`,
|
|
266
|
+
` 价格周期 : ${chalk.green.bold(res.discountedPrice)} ${chalk.dim(`(原价 ${res.originalPrice})`)} / ${res.pricePeriodLabel}`,
|
|
267
|
+
` 资费说明 : ${chalk.grey(res.rolloverSentence)}`,
|
|
268
|
+
...(res.footnote ? [` 活动细则 : ${chalk.dim(res.footnote)}`] : []),
|
|
269
|
+
...(res.linesOfCodeWritten
|
|
270
|
+
? [` 历史战绩 : ${chalk.cyan(`编写了 ${res.linesOfCodeWritten} 行代码,启动了 ${res.agentRuns || 0} 次 Agent`)}`]
|
|
271
|
+
: []),
|
|
272
|
+
].join('\n'), {
|
|
273
|
+
padding: { top: 0, bottom: 0, left: 1, right: 1 },
|
|
274
|
+
borderColor: 'green',
|
|
275
|
+
borderStyle: 'round',
|
|
276
|
+
}));
|
|
277
|
+
// 自动写入剪贴板保障资产
|
|
278
|
+
const copied = await copyToClipboard(token);
|
|
279
|
+
console.log(copied
|
|
280
|
+
? chalk.green('📋 ✔ 官方 Token 已自动复制到系统剪贴板!可直接随时 Ctrl+V 粘贴保存。')
|
|
281
|
+
: chalk.yellow('○ 请手动保存 Token。'));
|
|
282
|
+
console.log(chalk.grey(`💾 ✔ 账号数据已保存至本地账号库 (accounts.json)。\n`));
|
|
283
|
+
// 询问是否打开独立隔离浏览器激活
|
|
284
|
+
const wantOpen = await safeConfirm({
|
|
285
|
+
message: '是否立即在独立隔离浏览器中打开激活页面?(已自动免密登录,绝不串号)',
|
|
286
|
+
default: true,
|
|
287
|
+
});
|
|
288
|
+
if (wantOpen) {
|
|
289
|
+
console.log(chalk.cyan('\n🚀 正在调起独立 Chromium 实例并注入 Cookie 直达结账/激活页...'));
|
|
290
|
+
await this.openOfferPage(token, email);
|
|
291
|
+
}
|
|
292
|
+
// 询问是否切换当前 IDE
|
|
293
|
+
const wantSwitch = await safeConfirm({
|
|
294
|
+
message: `是否将当前 Cursor IDE 切换为该账号 (${email})?`,
|
|
295
|
+
default: false,
|
|
296
|
+
});
|
|
297
|
+
if (wantSwitch) {
|
|
298
|
+
await this.switchCurrentIde(store, storage, sqlite, email, token, executablePath);
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
await safePressAnyKey();
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
else if (res.status === 'NOT_ELIGIBLE') {
|
|
305
|
+
console.log(boxen([
|
|
306
|
+
chalk.bold.white('⚪ 该账号有效,但暂未命中【回归老用户专享礼包】'),
|
|
307
|
+
chalk.dim('──────────────────────────────────────────────────────────────────'),
|
|
308
|
+
` 关联账号 : ${chalk.bold.white(email)}`,
|
|
309
|
+
` 官方反馈 : ${chalk.yellow('This offer is unavailable')}`,
|
|
310
|
+
` 状态说明 : ${chalk.grey('该特权可能已被领取,或该账号暂不在官方本批次召回名单中')}`,
|
|
311
|
+
` 资产保障 : ${chalk.green('● 官方 SessionToken 正常有效 (可正常在 Cursor 中使用)')}`,
|
|
312
|
+
].join('\n'), {
|
|
313
|
+
padding: { top: 0, bottom: 0, left: 1, right: 1 },
|
|
314
|
+
borderColor: 'gray',
|
|
315
|
+
borderStyle: 'round',
|
|
316
|
+
}));
|
|
317
|
+
// 自动写入剪贴板保障资产
|
|
318
|
+
const copied = await copyToClipboard(token);
|
|
319
|
+
console.log(copied
|
|
320
|
+
? chalk.green('📋 ✔ 官方 Token 已自动复制到系统剪贴板!可以直接 Ctrl+V 粘贴使用。')
|
|
321
|
+
: chalk.yellow('○ 请手动保存 Token。'));
|
|
322
|
+
console.log(chalk.grey(`💾 ✔ 账号已收录至本地 accounts.json,随时可切换使用。\n`));
|
|
323
|
+
// 对应官方网页的 [Go to dashboard] 按钮
|
|
324
|
+
const wantDash = await safeConfirm({
|
|
325
|
+
message: '是否在独立隔离浏览器中打开该账号后台控制台 (Dashboard)?',
|
|
326
|
+
default: false,
|
|
327
|
+
});
|
|
328
|
+
if (wantDash) {
|
|
329
|
+
console.log(chalk.cyan('\n🚀 正在调起独立 Chromium 实例直达 Cursor 控制台...'));
|
|
330
|
+
await DashboardLauncher.openDashboardWithToken(token, email);
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
await safePressAnyKey();
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
console.log(chalk.red(`\n✖ 资格检测未能完成: ${res.message || '网络连接超时'}\n`));
|
|
338
|
+
await safePressAnyKey();
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* 极速切换本机 Cursor IDE 为此账号
|
|
343
|
+
*/
|
|
344
|
+
static async switchCurrentIde(store, storage, sqlite, email, token, executablePath) {
|
|
345
|
+
console.log(chalk.cyan(`\n正在执行换号流程,目标: ${chalk.bold.white(email)} ...`));
|
|
346
|
+
if (ProcessManager.isCursorRunning()) {
|
|
347
|
+
console.log(chalk.grey('✔ [1/4] 发送退出信号,释放 SQLite 独占锁'));
|
|
348
|
+
await ProcessManager.closeCursor();
|
|
349
|
+
}
|
|
350
|
+
storage.createBackup();
|
|
351
|
+
sqlite.createBackup();
|
|
352
|
+
console.log(chalk.grey('✔ [2/4] 创建本地安全快照备份'));
|
|
353
|
+
const existing = store.getByEmail(email);
|
|
354
|
+
const machineIds = existing?.machine_ids || generateMachineIds();
|
|
355
|
+
storage.writeMachineIds(machineIds);
|
|
356
|
+
console.log(chalk.grey(`✔ [3/4] 换载专属机器指纹: ${formatMachineIdSummary(machineIds)}`));
|
|
357
|
+
const cleanToken = TokenParser.extractTokenPart(token);
|
|
358
|
+
storage.writeAuth(email, cleanToken, token);
|
|
359
|
+
await sqlite.injectAuth(email, cleanToken, token);
|
|
360
|
+
store.markCurrent(email);
|
|
361
|
+
console.log(chalk.grey('✔ [4/4] 原子注入认证凭据到 SQLite 数据库'));
|
|
362
|
+
console.log(chalk.green(`\n✔ 换号成功!当前已激活: ${chalk.bold.white(email)}\n`));
|
|
363
|
+
if (executablePath) {
|
|
364
|
+
ProcessManager.launchCursor(executablePath);
|
|
365
|
+
console.log(chalk.green('✔ Cursor 已在后台启动\n'));
|
|
366
|
+
}
|
|
367
|
+
await safePressAnyKey();
|
|
368
|
+
}
|
|
369
|
+
}
|
package/dist/menu.js
CHANGED
|
@@ -27,6 +27,7 @@ import { OfficialApiClient } from './core/official-api.js';
|
|
|
27
27
|
import { safeInput, safeConfirm, safeCheckbox, safePressAnyKey } from './utils/prompt-utils.js';
|
|
28
28
|
import { UpdateChecker, CURRENT_VERSION } from './core/update-checker.js';
|
|
29
29
|
import { copyToClipboard } from './utils/clipboard.js';
|
|
30
|
+
import { WelcomeOfferService } from './core/welcome-offer-service.js';
|
|
30
31
|
import fs from 'node:fs';
|
|
31
32
|
export async function runInteractiveMenu() {
|
|
32
33
|
const store = new AccountStore();
|
|
@@ -90,11 +91,17 @@ export async function runInteractiveMenu() {
|
|
|
90
91
|
},
|
|
91
92
|
{ name: '6. 提取 Token (本地浏览器)', value: 'extract', description: '智能读取本机 Cursor 已登 Token,或调起本地无痕浏览器抓取 Token 凭据' },
|
|
92
93
|
new Separator(),
|
|
93
|
-
{ name: '7.
|
|
94
|
-
{ name: '8.
|
|
94
|
+
{ name: '7. 奥仔退款', value: 'refund', description: '席位退款处理,账号退出并恢复为 Free 免费状态' },
|
|
95
|
+
{ name: '8. 纯净代登', value: 'pure_login', description: '远程调用海外纯净住宅 IP 云端代登,自动过盾收码并秒提 Token' },
|
|
96
|
+
{
|
|
97
|
+
name: '9. 回归资格检测',
|
|
98
|
+
value: 'welcome_offer',
|
|
99
|
+
key: 'o',
|
|
100
|
+
description: '检测老号是否命中 Cursor 回归优惠,支持粘贴 Token 或自动代登复活,免密直达激活 (按 o 快捷直达)',
|
|
101
|
+
},
|
|
95
102
|
new Separator(),
|
|
96
|
-
{ name: '
|
|
97
|
-
{ name: '
|
|
103
|
+
{ name: '10. 硬件指纹管理', value: 'fingerprint', description: '查看或重置专属防封虚拟硬件码' },
|
|
104
|
+
{ name: '11. 快照安全备份', value: 'backup', description: '安全备份本地配置与 SQLite 数据库' },
|
|
98
105
|
{
|
|
99
106
|
name: 'g. 打开 AI 折腾局官网 (getdoubao.com)',
|
|
100
107
|
value: 'website',
|
|
@@ -160,6 +167,9 @@ export async function runInteractiveMenu() {
|
|
|
160
167
|
const pureService = new PureLoginService();
|
|
161
168
|
await pureService.runInteractiveFlow(store, storage, sqlite, paths.executablePath);
|
|
162
169
|
}
|
|
170
|
+
else if (action === 'welcome_offer') {
|
|
171
|
+
await WelcomeOfferService.runInteractiveFlow(store, storage, sqlite, paths.executablePath);
|
|
172
|
+
}
|
|
163
173
|
else if (action === 'extract' || action === 'browser_token' || action === 'capture') {
|
|
164
174
|
await handleSmartExtractAction(store, storage, sqlite, paths.executablePath);
|
|
165
175
|
}
|