creditdaddy 1.7.2 → 1.8.0
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/LICENSE +21 -21
- package/README.md +445 -440
- package/build.json +3 -3
- package/package.json +34 -34
- package/src/accounts.js +15 -0
- package/src/assets/donate-alipay.svg +1 -1
- package/src/assets/donate-ifdian.svg +1 -1
- package/src/assets/donate-wechat.svg +1 -1
- package/src/assets/providers/catpaw.png +0 -0
- package/src/assets/providers/codebuddy-ide.png +0 -0
- package/src/assets/providers/dumate.png +0 -0
- package/src/assets/providers/loomy.png +0 -0
- package/src/assets/providers/meoo.png +0 -0
- package/src/assets/providers/mirasim.png +0 -0
- package/src/bgdaemon.js +341 -341
- package/src/buildInfo.js +65 -65
- package/src/catpawClient.js +103 -103
- package/src/catpawLocal.js +236 -236
- package/src/checkin.js +7 -2
- package/src/codebuddyIdeLocal.js +381 -381
- package/src/constants.js +121 -117
- package/src/cookieSites.js +340 -301
- package/src/daemon.js +2682 -2443
- package/src/doubaoClient.js +167 -167
- package/src/dumateClient.js +517 -0
- package/src/dumateLocal.js +298 -0
- package/src/dumateQr.js +337 -0
- package/src/externalQuota.js +577 -574
- package/src/formatDuration.js +17 -17
- package/src/i18n/en.json +161 -7
- package/src/i18n/ja.json +161 -7
- package/src/i18n/ko.json +161 -7
- package/src/i18n/zh-TW.json +161 -7
- package/src/i18n.js +47 -47
- package/src/lingxiClient.js +373 -373
- package/src/localDetect.js +147 -147
- package/src/longcatClient.js +260 -260
- package/src/loomyAuth.js +230 -230
- package/src/loomyClient.js +366 -366
- package/src/loomyLocal.js +206 -206
- package/src/meooAuth.js +246 -0
- package/src/meooClient.js +250 -0
- package/src/minimaxGateway.js +520 -520
- package/src/minimaxLocal.js +344 -344
- package/src/mirasimClient.js +211 -211
- package/src/mirasimLocal.js +392 -392
- package/src/modelscopeClient.js +275 -275
- package/src/panel.html +374 -48
- package/src/prodIcons.json +7 -5
- package/src/providers.js +34 -0
- package/src/qoderApp.js +578 -578
- package/src/qoderClient.js +266 -266
- package/src/qoderUmid.js +199 -199
- package/src/quotaRefresh.js +119 -119
- package/src/refreshGuard.js +75 -75
- package/src/riverClient.js +372 -372
- package/src/store.js +2 -1
- package/src/tenrouterAccounts.js +237 -232
- package/src/traeAuth.js +601 -599
- package/src/traeClient.js +356 -360
- package/src/traeGateway.js +875 -875
- package/src/traeLocal.js +463 -371
- package/src/transfer.js +4 -0
- package/src/usageSync.js +535 -523
- package/src/winProc.js +134 -134
- package/src/xiaomiMimoClient.js +206 -206
- package/src/zcodeAuth.js +131 -131
- package/src/zcodeGateway.js +850 -850
- package/src/zcodeLocal.js +340 -340
- package/src/zcrypto.js +160 -160
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meoo 秒悟(meoo.com,阿里云)每日首登积分 + 积分余额抓取。
|
|
3
|
+
*
|
|
4
|
+
* 接口(2026-11-13 网页端 bundle 与本机实测):
|
|
5
|
+
* GET https://meoo.com/api/mc/entitlement/init
|
|
6
|
+
* 网页前端登录后调用它触发「每日首次登录」积分发放(当前 2000 积分/天)。
|
|
7
|
+
* → { success: true, data: { initialized, dailyLoginGranted, dailyLoginGrantAmount, inviteRewardArrivals } }
|
|
8
|
+
* initialized=false 时前端按 500/1000/2000/4000ms 退避重查(账号权益尚在初始化)。
|
|
9
|
+
* GET https://meoo.com/api/mc/entitlement/get
|
|
10
|
+
* → data.userPointInfo.account.availableBalance(积分余额)、data.planCode、
|
|
11
|
+
* data.benefits[](typeCode=daily_login 的 quota = 每日首登额度)
|
|
12
|
+
* GET https://meoo.com/api/v1/user/me
|
|
13
|
+
* → data.user_id / username / email;未登录 data.need_login=true
|
|
14
|
+
*
|
|
15
|
+
* 凭据 = meoo.com 网页会话 Cookie(阿里云 SSO 手机号 + 短信登录后由浏览器写入),
|
|
16
|
+
* 不支持 Meoo CLI 的 OAuth Bearer(/api/mc/* 一律 NEED_LOGIN)。会话寿命未知——
|
|
17
|
+
* 失效统一表现为 HTTP 401 或 { success:false, errCode:'NEED_LOGIN' | 'LOGIN_INVALID' },
|
|
18
|
+
* 按「会话已失效,请重新登录捕获」处理,不重试、不猜。
|
|
19
|
+
*
|
|
20
|
+
* 首版边界:首登积分 + 余额展示;每日首登积分约 6~7 天后过期、Free 套餐无月度积分;
|
|
21
|
+
* 不推 10Router 外部配额卡(site.no10rSync),不做网关。
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { fetchJsonRace } from './zcodeClient.js';
|
|
25
|
+
import { FETCH_TIMEOUT_MS } from './constants.js';
|
|
26
|
+
import { t } from './i18n.js';
|
|
27
|
+
|
|
28
|
+
export const MEOO_BASE = 'https://meoo.com';
|
|
29
|
+
export const MEOO_INIT_URL = `${MEOO_BASE}/api/mc/entitlement/init`;
|
|
30
|
+
export const MEOO_ENTITLEMENT_URL = `${MEOO_BASE}/api/mc/entitlement/get`;
|
|
31
|
+
export const MEOO_USER_URL = `${MEOO_BASE}/api/v1/user/me`;
|
|
32
|
+
|
|
33
|
+
/** 前端同款退避(毫秒):initialized=false 时最多再查这几次 */
|
|
34
|
+
export const MEOO_INIT_RETRY_MS = [500, 1000, 2000];
|
|
35
|
+
|
|
36
|
+
const AUTH_CODES = new Set(['NEED_LOGIN', 'LOGIN_INVALID', 'LOGIN_REQUIRED', 'NOT_LOGIN', 'UNAUTHORIZED']);
|
|
37
|
+
|
|
38
|
+
function meooHeaders(cookie) {
|
|
39
|
+
return {
|
|
40
|
+
Cookie: String(cookie || '').trim(),
|
|
41
|
+
Referer: `${MEOO_BASE}/`,
|
|
42
|
+
Origin: MEOO_BASE,
|
|
43
|
+
Accept: 'application/json, text/plain, */*',
|
|
44
|
+
'User-Agent':
|
|
45
|
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* GET 一个 Meoo 网页端点,归一成 { auth, ok, status, data, code }。
|
|
51
|
+
* auth=false = 会话失效(401/403 或业务码 NEED_LOGIN 类,或 user/me 的 need_login=true)。
|
|
52
|
+
*/
|
|
53
|
+
async function meooGet(url, cookie, fetchImpl) {
|
|
54
|
+
const doIt = fetchImpl || ((u, init) => fetchJsonRace(u, { headers: init.headers, method: 'GET', timeoutMs: FETCH_TIMEOUT_MS }));
|
|
55
|
+
const r = await doIt(url, { headers: meooHeaders(cookie) });
|
|
56
|
+
const text = await r.text().catch(() => '');
|
|
57
|
+
let body = null;
|
|
58
|
+
try { body = text ? JSON.parse(text) : null; } catch { body = null; }
|
|
59
|
+
const code = String(body?.errCode ?? body?.error?.code ?? body?.code ?? '');
|
|
60
|
+
if (r.status === 401 || r.status === 403 || AUTH_CODES.has(code) || body?.data?.need_login === true) {
|
|
61
|
+
return { auth: false, ok: false, status: r.status, code: code || `HTTP ${r.status}` };
|
|
62
|
+
}
|
|
63
|
+
if (!r.ok) return { auth: true, ok: false, status: r.status, code: code || `HTTP ${r.status}`, message: body?.errMsg || body?.message || '' };
|
|
64
|
+
if (!body || typeof body !== 'object') return { auth: true, ok: false, status: r.status, code: 'non-json' };
|
|
65
|
+
if (body.success === false) return { auth: true, ok: false, status: r.status, code: code || 'success=false', message: body.errMsg || body.message || '' };
|
|
66
|
+
return { auth: true, ok: true, status: r.status, data: body.data ?? body };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function authError(msg) {
|
|
70
|
+
const e = new Error(msg);
|
|
71
|
+
e.auth = true;
|
|
72
|
+
return e;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 用户 id 展示脱敏(与灵犀 uid 同口径):≥7 位前 3 后 3,4~6 位前 1 后 1,更短全掩。
|
|
77
|
+
* 只用于行名等显示位;归户哈希 / 账号 uid 仍用原始值。
|
|
78
|
+
*/
|
|
79
|
+
export function maskMeooUserId(id) {
|
|
80
|
+
const s = String(id ?? '');
|
|
81
|
+
if (s.length >= 7) return s.slice(0, 3) + '****' + s.slice(-3);
|
|
82
|
+
if (s.length >= 4) return s.slice(0, 1) + '****' + s.slice(-1);
|
|
83
|
+
return '****';
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* 身份:GET /api/v1/user/me。
|
|
88
|
+
* @returns {Promise<{auth: boolean, ok?: boolean, userId?: string|null, code?: string}>}
|
|
89
|
+
* username / email 可能是手机号,不回传(只取稳定 user_id 做归户)。
|
|
90
|
+
*/
|
|
91
|
+
export async function fetchMeooIdentity(cookie, { fetchImpl } = {}) {
|
|
92
|
+
try {
|
|
93
|
+
const r = await meooGet(MEOO_USER_URL, cookie, fetchImpl);
|
|
94
|
+
if (!r.auth) return { auth: false, code: r.code };
|
|
95
|
+
if (!r.ok) return { auth: true, ok: false, code: r.code };
|
|
96
|
+
const id = r.data?.user_id ?? r.data?.userId ?? r.data?.open_id ?? null;
|
|
97
|
+
return { auth: true, ok: true, userId: id != null && String(id) ? String(id) : null };
|
|
98
|
+
} catch (e) {
|
|
99
|
+
return { auth: true, ok: false, code: e?.message || 'network' };
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** 把一条 activeGrants 记录拍平成 { source, remaining, total, effectiveAt, expireAt } 列表(形状尽力而为) */
|
|
104
|
+
function flattenGrants(grants) {
|
|
105
|
+
const out = [];
|
|
106
|
+
for (const g of Array.isArray(grants) ? grants : []) {
|
|
107
|
+
const source = String(g?.sourceType || g?.source || '');
|
|
108
|
+
const details = Array.isArray(g?.grantDetails) && g.grantDetails.length ? g.grantDetails : [g];
|
|
109
|
+
for (const d of details) {
|
|
110
|
+
const remaining = Number(d?.remainingAmount ?? d?.remaining ?? d?.availableAmount);
|
|
111
|
+
if (!Number.isFinite(remaining)) continue;
|
|
112
|
+
const total = Number(d?.grantAmount ?? d?.amount ?? d?.totalAmount);
|
|
113
|
+
out.push({
|
|
114
|
+
source,
|
|
115
|
+
remaining,
|
|
116
|
+
total: Number.isFinite(total) ? total : remaining,
|
|
117
|
+
effectiveAt: d?.effectiveDate || null,
|
|
118
|
+
expireAt: d?.expiresDate || d?.expireDate || null,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return out;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* 权益与积分余额:GET /api/mc/entitlement/get。
|
|
127
|
+
* @returns {Promise<{auth: boolean, ok?: boolean, balance?: number, planCode?: string, dailyLoginQuota?: number,
|
|
128
|
+
* grants?: Array<{source, remaining, total, effectiveAt, expireAt}>, code?: string}>}
|
|
129
|
+
*/
|
|
130
|
+
export async function fetchMeooEntitlement(cookie, { fetchImpl } = {}) {
|
|
131
|
+
try {
|
|
132
|
+
const r = await meooGet(MEOO_ENTITLEMENT_URL, cookie, fetchImpl);
|
|
133
|
+
if (!r.auth) return { auth: false, code: r.code };
|
|
134
|
+
if (!r.ok) return { auth: true, ok: false, code: r.code };
|
|
135
|
+
const d = r.data || {};
|
|
136
|
+
const upi = d.userPointInfo || {};
|
|
137
|
+
const out = { auth: true, ok: true };
|
|
138
|
+
const bal = Number(upi.account?.availableBalance);
|
|
139
|
+
if (Number.isFinite(bal)) out.balance = bal;
|
|
140
|
+
if (d.planCode) out.planCode = String(d.planCode).toLowerCase();
|
|
141
|
+
const daily = Array.isArray(d.benefits) ? d.benefits.find((b) => b?.typeCode === 'daily_login') : null;
|
|
142
|
+
const dq = Number(daily?.quota);
|
|
143
|
+
if (Number.isFinite(dq) && dq > 0) out.dailyLoginQuota = dq;
|
|
144
|
+
const grants = flattenGrants(upi.activeGrants);
|
|
145
|
+
if (grants.length) out.grants = grants;
|
|
146
|
+
return out;
|
|
147
|
+
} catch (e) {
|
|
148
|
+
return { auth: true, ok: false, code: e?.message || 'network' };
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function isoOrNull(v) {
|
|
153
|
+
if (!v) return null;
|
|
154
|
+
const d = new Date(v);
|
|
155
|
+
return Number.isFinite(d.getTime()) ? d.toISOString() : null;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const sleepMs = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* 每日首登积分:调 entitlement/init(网页端登录后同款调用)。
|
|
162
|
+
* - dailyLoginGranted=true 且金额>0 → checked-in(+N 积分)
|
|
163
|
+
* - initialized=true 但本次没有发放 → already(今日已发放,多为网页端已登录过)
|
|
164
|
+
* - initialized 一直为 false(前端同款退避后仍未就绪)→ failed,下轮自动重试
|
|
165
|
+
* - NEED_LOGIN / 401 → failed,提示重新登录捕获(不抛,签到轮记一次失败即可)
|
|
166
|
+
* @returns {Promise<{ status: 'checked-in'|'already'|'failed', message: string, claimedAmount?: number, amount?: number, balanceAfter?: number, authExpired?: boolean }>}
|
|
167
|
+
*/
|
|
168
|
+
export async function checkinMeoo(account, ctx = {}) {
|
|
169
|
+
const cookie = account?.meta?.cookieSiteSession?.cookie || account?.token;
|
|
170
|
+
if (!cookie) {
|
|
171
|
+
return { status: 'failed', authExpired: true, message: t('Meoo 会话缺失,请在「网页会话」页登录 meoo.com 后捕获') };
|
|
172
|
+
}
|
|
173
|
+
const fetchImpl = ctx?.fetchImpl;
|
|
174
|
+
const sleep = ctx?.sleep || sleepMs;
|
|
175
|
+
let r;
|
|
176
|
+
try {
|
|
177
|
+
r = await meooGet(MEOO_INIT_URL, cookie, fetchImpl);
|
|
178
|
+
for (const ms of MEOO_INIT_RETRY_MS) {
|
|
179
|
+
if (!r.auth || !r.ok || r.data?.initialized) break;
|
|
180
|
+
await sleep(ms);
|
|
181
|
+
r = await meooGet(MEOO_INIT_URL, cookie, fetchImpl);
|
|
182
|
+
}
|
|
183
|
+
} catch (e) {
|
|
184
|
+
return { status: 'failed', message: t('Meoo 首登积分领取失败:{err}', { err: e?.message || 'network' }) };
|
|
185
|
+
}
|
|
186
|
+
if (!r.auth) {
|
|
187
|
+
return { status: 'failed', authExpired: true, message: t('Meoo 会话已失效({code}),请到「网页会话」页重新登录 meoo.com 并捕获', { code: r.code || 'NEED_LOGIN' }) };
|
|
188
|
+
}
|
|
189
|
+
if (!r.ok) {
|
|
190
|
+
return { status: 'failed', message: t('Meoo 首登积分领取失败:{err}', { err: [r.code, r.message].filter(Boolean).join(' ').slice(0, 120) }) };
|
|
191
|
+
}
|
|
192
|
+
const data = r.data || {};
|
|
193
|
+
if (!data.initialized) {
|
|
194
|
+
return { status: 'failed', message: t('Meoo 账号权益仍在初始化,稍后自动重试') };
|
|
195
|
+
}
|
|
196
|
+
// 余额旁路(失败不影响领取结果)
|
|
197
|
+
let balanceAfter;
|
|
198
|
+
try {
|
|
199
|
+
const ent = await fetchMeooEntitlement(cookie, { fetchImpl });
|
|
200
|
+
if (ent.ok && Number.isFinite(ent.balance)) balanceAfter = ent.balance;
|
|
201
|
+
} catch { /* 余额拿不到不阻断 */ }
|
|
202
|
+
const amount = Number(data.dailyLoginGrantAmount);
|
|
203
|
+
if (data.dailyLoginGranted && Number.isFinite(amount) && amount > 0) {
|
|
204
|
+
ctx?.log?.(t('Meoo 首登积分领取成功'));
|
|
205
|
+
return {
|
|
206
|
+
status: 'checked-in',
|
|
207
|
+
message: t('首登积分已发放(+{n} 积分)', { n: amount }),
|
|
208
|
+
claimedAmount: amount,
|
|
209
|
+
amount,
|
|
210
|
+
...(balanceAfter !== undefined ? { balanceAfter } : {}),
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
return {
|
|
214
|
+
status: 'already',
|
|
215
|
+
message: t('今日首登积分已发放'),
|
|
216
|
+
...(balanceAfter !== undefined ? { balanceAfter } : {}),
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* 积分余额(quota 口径:remaining = 可用积分;parts 按发放来源逐笔,带到期日)
|
|
222
|
+
*/
|
|
223
|
+
export async function fetchMeooQuota(account, ctx = {}) {
|
|
224
|
+
const cookie = account?.meta?.cookieSiteSession?.cookie || account?.token;
|
|
225
|
+
if (!cookie) throw authError(t('Meoo 会话缺失,请在「网页会话」页登录 meoo.com 后捕获'));
|
|
226
|
+
const ent = await fetchMeooEntitlement(cookie, { fetchImpl: ctx?.fetchImpl });
|
|
227
|
+
if (!ent.auth) throw authError(t('Meoo 会话已失效({code}),请到「网页会话」页重新登录 meoo.com 并捕获', { code: ent.code || 'NEED_LOGIN' }));
|
|
228
|
+
if (!ent.ok) throw new Error(t('Meoo 积分查询失败:{err}', { err: ent.code || '' }));
|
|
229
|
+
const balance = Number.isFinite(ent.balance) ? ent.balance : 0;
|
|
230
|
+
const SOURCE_LABEL = { DAILY_LOGIN: '每日首登', INVITE_REWARD: '邀请奖励', SUBSCRIPTION: '订阅' };
|
|
231
|
+
const parts = (ent.grants || []).map((g) => ({
|
|
232
|
+
name: t(SOURCE_LABEL[g.source] || '积分包'),
|
|
233
|
+
total: g.total,
|
|
234
|
+
used: Math.max(0, g.total - g.remaining),
|
|
235
|
+
remaining: g.remaining,
|
|
236
|
+
expiresAt: isoOrNull(g.expireAt),
|
|
237
|
+
recurring: false,
|
|
238
|
+
unit: '秒悟积分',
|
|
239
|
+
}));
|
|
240
|
+
return {
|
|
241
|
+
total: balance,
|
|
242
|
+
used: 0,
|
|
243
|
+
remaining: balance,
|
|
244
|
+
exceeded: false,
|
|
245
|
+
plan: ent.planCode ? `Meoo ${ent.planCode}` : 'Meoo',
|
|
246
|
+
planExpiresAt: null,
|
|
247
|
+
parts: parts.length ? parts : [{ name: t('积分余额'), total: balance, used: 0, remaining: balance, recurring: true, unit: '秒悟积分' }],
|
|
248
|
+
empty: balance <= 0,
|
|
249
|
+
};
|
|
250
|
+
}
|