@curless/hotel-storefront 0.71.5 → 0.72.1
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/account/fake-ota.d.ts +11 -1
- package/dist/account/fake-ota.d.ts.map +1 -1
- package/dist/account/fake-ota.js +107 -28
- package/dist/account/fake-ota.js.map +1 -1
- package/dist/account/index.d.ts +14 -5
- package/dist/account/index.d.ts.map +1 -1
- package/dist/account/index.js +173 -49
- package/dist/account/index.js.map +1 -1
- package/dist/account/ota-member.d.ts +39 -10
- package/dist/account/ota-member.d.ts.map +1 -1
- package/dist/account/ota-member.js +48 -12
- package/dist/account/ota-member.js.map +1 -1
- package/dist/account/store.d.ts +7 -1
- package/dist/account/store.d.ts.map +1 -1
- package/dist/account/store.js.map +1 -1
- package/dist/otaless/booking.d.ts +3 -0
- package/dist/otaless/booking.d.ts.map +1 -1
- package/dist/otaless/booking.js +236 -81
- package/dist/otaless/booking.js.map +1 -1
- package/dist/otaless/client.d.ts +54 -12
- package/dist/otaless/client.d.ts.map +1 -1
- package/dist/otaless/client.js +60 -1
- package/dist/otaless/client.js.map +1 -1
- package/dist/otaless/fake.d.ts +29 -7
- package/dist/otaless/fake.d.ts.map +1 -1
- package/dist/otaless/fake.js +59 -15
- package/dist/otaless/fake.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
package/dist/account/index.js
CHANGED
|
@@ -36,10 +36,16 @@ import { AccountStore, WEB_IDLE_MS, WebSessions, nameShown, profileOf, profileSh
|
|
|
36
36
|
// an answer or the card - only back to the backend, and (`bookingAuth`) to this
|
|
37
37
|
// process's own booking calls for the same conversation.
|
|
38
38
|
//
|
|
39
|
-
// ⚠️
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
//
|
|
39
|
+
// ⚠️ THE ACCOUNT SIGNS IN WITH NO providerCode (0.72.0, robin 11-16 through 总线程:
|
|
40
|
+
// 「不带 providerCode 是平台登录,带 providerCode 是关联酒店集团会员的登录」) - the
|
|
41
|
+
// Otaless account at no group. The backend before the 11-16 document wants a
|
|
42
|
+
// providerCode on every sign-in: where it refuses one because it has none - its words say
|
|
43
|
+
// the providerCode is missing (0.72.1, `asksForProviderCode`) - the same sign-in is
|
|
44
|
+
// asked again on `ascott` (FALLBACK_SIGN_IN_PROVIDER, the one their own Postman sign-in
|
|
45
|
+
// worked on), and the log says which way it went; any other no is the answer. A deployment that sets
|
|
46
|
+
// `account.signInProvider` (or `<envPrefix>_SIGN_IN_PROVIDER`) signs in on that channel
|
|
47
|
+
// alone, as before 0.72.0. Signed in at no group, Ascott is linked like any other group
|
|
48
|
+
// before it is booked (`bookingAuth`).
|
|
43
49
|
//
|
|
44
50
|
// ⚠️ FORWARDED PHISHING (Nexva's review P1-1): a link passed on to someone else
|
|
45
51
|
// signs THEIR account into the conversation it came from. Against it: the short
|
|
@@ -61,6 +67,28 @@ import { AccountStore, WEB_IDLE_MS, WebSessions, nameShown, profileOf, profileSh
|
|
|
61
67
|
// ⚠️ NO MEMBER PRICE YET (robin, 2026-11-06): what signing in buys is waiting
|
|
62
68
|
// on the backend (docs/otaless-backend-questions.md, 「会员」). Nothing here says
|
|
63
69
|
// it changes a price, and the words say it does not.
|
|
70
|
+
/**
|
|
71
|
+
* The channel a sign-in with no providerCode is asked again on, where the backend
|
|
72
|
+
* refuses it (0.72.0 - the backend before the 11-16 document wants one on every sign-in).
|
|
73
|
+
*/
|
|
74
|
+
export const FALLBACK_SIGN_IN_PROVIDER = 'ascott';
|
|
75
|
+
/**
|
|
76
|
+
* A refused sign-in whose words say the providerCode is missing - the backend before
|
|
77
|
+
* the 11-16 document, which wants one on every sign-in (0.72.1, 总线程's review of
|
|
78
|
+
* 0.72.0, P3). ⚠️ ONLY THAT IS ASKED AGAIN ON FALLBACK_SIGN_IN_PROVIDER: a wrong
|
|
79
|
+
* password, an account not found or a limit reached, asked again, hands the same
|
|
80
|
+
* password over twice and may cost the guest a second strike towards a lock-out. Its
|
|
81
|
+
* words, not its code: the backend answers every no as `code: 500` (said.ts). The
|
|
82
|
+
* old backend's own words were never seen on apidev (it was the new one by 11-16);
|
|
83
|
+
* the fake's v4 answers 「providerCode 不能为空」, and a Bean Validation message
|
|
84
|
+
* would say "must not be blank / null". Words we cannot read are not that.
|
|
85
|
+
*/
|
|
86
|
+
const PROVIDER_CODE_NAMED = /provider[\s_-]?code|渠道(?:编码|代码|编号)/i;
|
|
87
|
+
const MISSING = /不能为空|不可为空|不得为空|为空|必填|必须|缺少|缺失|未传|未填|\b(?:required|missing|empty|blank|is null)\b|\b(?:must not|cannot|can't|may not) be (?:null|blank|empty)\b/i;
|
|
88
|
+
export const asksForProviderCode = (e) => e instanceof OtaMemberError &&
|
|
89
|
+
typeof e.said === 'string' &&
|
|
90
|
+
PROVIDER_CODE_NAMED.test(e.said) &&
|
|
91
|
+
MISSING.test(e.said);
|
|
64
92
|
/** An email as the pages check one: something@something.something, no spaces. */
|
|
65
93
|
const EMAIL_SHAPE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
66
94
|
/**
|
|
@@ -311,13 +339,11 @@ export const makeAccount = (opts) => {
|
|
|
311
339
|
// config still naming it is a mistake to stop on, not to guess past.
|
|
312
340
|
if (opts.account.source !== 'ota')
|
|
313
341
|
throw new Error(`account: source must be "ota" (the backend's /api/v1/ota/*), not ${JSON.stringify(opts.account.source)}`);
|
|
314
|
-
// The channel the account signs in on - see the top of this file
|
|
315
|
-
const signInProvider = (env[`${prefix}_SIGN_IN_PROVIDER`] ||
|
|
316
|
-
opts.account.signInProvider ||
|
|
317
|
-
'ascott')
|
|
342
|
+
// The channel the account signs in on, where one is set - see the top of this file.
|
|
343
|
+
const signInProvider = (env[`${prefix}_SIGN_IN_PROVIDER`] || opts.account.signInProvider || '')
|
|
318
344
|
.trim()
|
|
319
345
|
.toLowerCase();
|
|
320
|
-
if (!/^[a-z0-9_-]{1,32}$/.test(signInProvider))
|
|
346
|
+
if (signInProvider && !/^[a-z0-9_-]{1,32}$/.test(signInProvider))
|
|
321
347
|
throw new Error('account: signInProvider is not a channel code');
|
|
322
348
|
// What the account signs in with (0.66.0, 总线程 11-11) - see `signInIdentity`.
|
|
323
349
|
if ((opts.account.signInIdentity ?? 'email') !== 'email')
|
|
@@ -437,7 +463,9 @@ export const makeAccount = (opts) => {
|
|
|
437
463
|
};
|
|
438
464
|
/**
|
|
439
465
|
* Unlinked: forgotten here, and the group's session ended at the backend - the
|
|
440
|
-
* promise of that, or null where there was no link.
|
|
466
|
+
* promise of that, or null where there was no link. ⚠️ WITH ITS providerCode, AND THE
|
|
467
|
+
* CONVERSATION'S LATEST TOKEN (0.72.0, 总线程 11-16): one channel ended, the token kept
|
|
468
|
+
* good for the rest (the 11-16 document) - a link has no token of its own any more.
|
|
441
469
|
*
|
|
442
470
|
* ⚠️ NOT THE ACCOUNT'S OWN CHANNEL SESSION: a group linked on the channel the
|
|
443
471
|
* account signed in on may come back with the account's own `mcpToken` (one
|
|
@@ -451,7 +479,11 @@ export const makeAccount = (opts) => {
|
|
|
451
479
|
if (l.session && l.session === s.platform.mcpToken)
|
|
452
480
|
return Promise.resolve();
|
|
453
481
|
return ota
|
|
454
|
-
.signOut({
|
|
482
|
+
.signOut({
|
|
483
|
+
group: code,
|
|
484
|
+
...(l.session ? { session: l.session } : {}),
|
|
485
|
+
auth: s.platform.access,
|
|
486
|
+
})
|
|
455
487
|
.catch((e) => log(`[account] a membership's sign-out did not answer (${codeOf(e)})`));
|
|
456
488
|
};
|
|
457
489
|
const unlink = (s, code) => dropLink(s, code) !== null;
|
|
@@ -517,23 +549,58 @@ export const makeAccount = (opts) => {
|
|
|
517
549
|
termsRequests.cancelFor(key);
|
|
518
550
|
return store.set(key, shown, platform, profile);
|
|
519
551
|
};
|
|
520
|
-
/** A channel session of the account's own, ended at the backend (not waited for). */
|
|
521
|
-
const endSession = (p) => ota
|
|
522
|
-
.signOut({
|
|
523
|
-
group: p.provider,
|
|
524
|
-
...(p.mcpToken ? { session: p.mcpToken } : {}),
|
|
525
|
-
auth: p.access,
|
|
526
|
-
})
|
|
527
|
-
.catch((e) => log(`[account] the backend's sign-out did not answer (${codeOf(e)})`));
|
|
528
552
|
/**
|
|
529
|
-
*
|
|
530
|
-
*
|
|
531
|
-
*
|
|
553
|
+
* Signed out at the backend, EVERY CHANNEL OF THE TOKEN AT ONCE (0.72.0, 总线程 11-16):
|
|
554
|
+
* `/ota/signOut` with no providerCode - the 11-16 document's way. With a providerCode
|
|
555
|
+
* it ends that channel alone and the token stays good until it runs out: the
|
|
556
|
+
* `ascott` this used to send left the guest's other groups signed in.
|
|
557
|
+
*
|
|
558
|
+
* ⚠️ THE BACKEND BEFORE 11-16 refuses a sign-out with no providerCode (when it goes
|
|
559
|
+
* live is not known): where it answers no, one channel at a time - `each` first (the
|
|
560
|
+
* memberships: they share the account's local session, their document, so it is
|
|
561
|
+
* ended only after theirs), then `own`, the account's own channel. A backend that
|
|
562
|
+
* did not answer at all is not asked again. Never throws; nothing waits for it.
|
|
563
|
+
*/
|
|
564
|
+
const signOutAll = async (token, own, each = []) => {
|
|
565
|
+
try {
|
|
566
|
+
await ota.signOut({ auth: token });
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
catch (e) {
|
|
570
|
+
if (e instanceof OtaMemberError && (e.code === 'timeout' || e.code === 'unreachable')) {
|
|
571
|
+
log(`[account] the backend's sign-out did not answer (${codeOf(e)})`);
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
log(`[account] signing out every channel at once was refused (${codeOf(e)}): one at a time`);
|
|
575
|
+
}
|
|
576
|
+
await Promise.allSettled(each.map((l) => ota
|
|
577
|
+
.signOut({ group: l.group, ...(l.session ? { session: l.session } : {}), auth: token })
|
|
578
|
+
.catch((e) => log(`[account] a membership's sign-out did not answer (${codeOf(e)})`))));
|
|
579
|
+
// The platform's own sign-in (no channel) has no channel session of its own to end.
|
|
580
|
+
if (!own.provider)
|
|
581
|
+
return;
|
|
582
|
+
await ota
|
|
583
|
+
.signOut({
|
|
584
|
+
group: own.provider,
|
|
585
|
+
...(own.mcpToken ? { session: own.mcpToken } : {}),
|
|
586
|
+
auth: token,
|
|
587
|
+
})
|
|
588
|
+
.catch((e) => log(`[account] the backend's sign-out did not answer (${codeOf(e)})`));
|
|
589
|
+
};
|
|
590
|
+
/** A session of the account's own - with no memberships of ours on it - ended at the backend (not waited for). */
|
|
591
|
+
const endSession = (p) => signOutAll(p.access, p);
|
|
592
|
+
/**
|
|
593
|
+
* A sign-in that is over: its pages closed, its memberships forgotten, every channel
|
|
594
|
+
* of its token ended at the backend (not waited for, `signOutAll`).
|
|
532
595
|
*/
|
|
533
596
|
const end = (s) => {
|
|
534
597
|
web.dropFor(s.sid);
|
|
535
|
-
|
|
536
|
-
|
|
598
|
+
// A membership that came back with the account's own channel session is ended with it.
|
|
599
|
+
const each = [...(s.links?.values() ?? [])]
|
|
600
|
+
.filter((l) => !(l.session && l.session === s.platform.mcpToken))
|
|
601
|
+
.map((l) => ({ group: l.group, ...(l.session ? { session: l.session } : {}) }));
|
|
602
|
+
s.links?.clear();
|
|
603
|
+
void signOutAll(s.platform.access, s.platform, each);
|
|
537
604
|
};
|
|
538
605
|
const signOut = (key) => {
|
|
539
606
|
const was = store.clear(key);
|
|
@@ -564,6 +631,43 @@ export const makeAccount = (opts) => {
|
|
|
564
631
|
if (e instanceof OtaMemberError && e.shape)
|
|
565
632
|
log(`[account] the answer to that sign-in (${String(e.code).slice(0, 16)}): ${e.shape}`);
|
|
566
633
|
};
|
|
634
|
+
/**
|
|
635
|
+
* THE ACCOUNT'S OWN SIGN-IN (0.72.0) - on our sign-in page, after an account is made,
|
|
636
|
+
* and again on a membership's or the terms' page: with no providerCode (the 11-16
|
|
637
|
+
* document's platform sign-in); where the backend answers that a providerCode is
|
|
638
|
+
* missing (`asksForProviderCode` - the backend before it wants one) - the same
|
|
639
|
+
* sign-in once more on FALLBACK_SIGN_IN_PROVIDER, and its answer is the one that
|
|
640
|
+
* counts. Any other no (a wrong password, say) is the answer: not asked again
|
|
641
|
+
* (0.72.1, 总线程's review of 0.72.0, P3). A backend that did not answer is not asked
|
|
642
|
+
* again either. With `account.signInProvider` set: that channel alone. The log says
|
|
643
|
+
* which way it went (总线程 11-16: robin signs in, 总线程 reads the log).
|
|
644
|
+
*/
|
|
645
|
+
const platformSignIn = async (who, identity, password, lang) => {
|
|
646
|
+
if (signInProvider)
|
|
647
|
+
return ota.signIn({ group: signInProvider, identity, password, lang });
|
|
648
|
+
try {
|
|
649
|
+
const got = await ota.signIn({ identity, password, lang });
|
|
650
|
+
log(`[account] ${who}: the account signed in with no providerCode (the platform's own)`);
|
|
651
|
+
return got;
|
|
652
|
+
}
|
|
653
|
+
catch (e) {
|
|
654
|
+
if (notThere(e))
|
|
655
|
+
throw e;
|
|
656
|
+
if (!asksForProviderCode(e)) {
|
|
657
|
+
logRefused(`[account] ${who}: a sign-in with no providerCode was refused (${codeOf(e)}) - not for a missing providerCode, so not asked again on ${FALLBACK_SIGN_IN_PROVIDER}`, e);
|
|
658
|
+
throw e;
|
|
659
|
+
}
|
|
660
|
+
logRefused(`[account] ${who}: a sign-in with no providerCode was refused (${codeOf(e)}) - again on ${FALLBACK_SIGN_IN_PROVIDER}`, e);
|
|
661
|
+
}
|
|
662
|
+
const got = await ota.signIn({
|
|
663
|
+
group: FALLBACK_SIGN_IN_PROVIDER,
|
|
664
|
+
identity,
|
|
665
|
+
password,
|
|
666
|
+
lang,
|
|
667
|
+
});
|
|
668
|
+
log(`[account] ${who}: the account signed in on ${FALLBACK_SIGN_IN_PROVIDER} (the fallback)`);
|
|
669
|
+
return got;
|
|
670
|
+
};
|
|
567
671
|
/**
|
|
568
672
|
* The conversation's sign-in, while its session stands. ⚠️ NOTHING TO ASK THE
|
|
569
673
|
* BACKEND ANY MORE (0.62.0): their `/ota/*` has no /member/info and no refresh
|
|
@@ -1312,7 +1416,7 @@ export const makeAccount = (opts) => {
|
|
|
1312
1416
|
let proved = null;
|
|
1313
1417
|
let triedOutcome = 'unknown';
|
|
1314
1418
|
try {
|
|
1315
|
-
proved = await
|
|
1419
|
+
proved = await platformSignIn(tag(r.key), account, password, lang);
|
|
1316
1420
|
triedOutcome = 'ok';
|
|
1317
1421
|
}
|
|
1318
1422
|
catch (e) {
|
|
@@ -1347,12 +1451,12 @@ export const makeAccount = (opts) => {
|
|
|
1347
1451
|
}
|
|
1348
1452
|
// ⚠️ THE SAME ACCOUNT: ITS NEWER SESSION IS KEPT, NOT ENDED (0.62.0). Their
|
|
1349
1453
|
// document keeps one local session for a member's sign-ins - ending this
|
|
1350
|
-
// one could end the account's own.
|
|
1351
|
-
//
|
|
1352
|
-
|
|
1454
|
+
// one could end the account's own. ⚠️ AND THE OLDER IS NOT ENDED EITHER (0.72.0):
|
|
1455
|
+
// the newer token is the conversation's from now on (its memberships ride on it),
|
|
1456
|
+
// the 11-16 backend voids the older itself, and ending it now means every channel
|
|
1457
|
+
// at once (`signOutAll`) - which, if the backend counts channels by the member,
|
|
1458
|
+
// would end the newer's too (questions #77, #83).
|
|
1353
1459
|
still.platform = proved.session;
|
|
1354
|
-
if (!same(older, proved.session))
|
|
1355
|
-
void endSession(older);
|
|
1356
1460
|
const id = web.open(r.key, still.sid);
|
|
1357
1461
|
if (id)
|
|
1358
1462
|
setCookie(c, id);
|
|
@@ -1436,8 +1540,9 @@ export const makeAccount = (opts) => {
|
|
|
1436
1540
|
}
|
|
1437
1541
|
}
|
|
1438
1542
|
let link;
|
|
1543
|
+
let got;
|
|
1439
1544
|
try {
|
|
1440
|
-
|
|
1545
|
+
got = await ota.signIn({
|
|
1441
1546
|
group: m.code,
|
|
1442
1547
|
identity: (up ? values.email : values.identity) ?? '',
|
|
1443
1548
|
password,
|
|
@@ -1471,15 +1576,30 @@ export const makeAccount = (opts) => {
|
|
|
1471
1576
|
.signOut({
|
|
1472
1577
|
group: m.code,
|
|
1473
1578
|
...(link.session ? { session: link.session } : {}),
|
|
1474
|
-
auth:
|
|
1579
|
+
auth: got.session.access,
|
|
1475
1580
|
})
|
|
1476
1581
|
.catch(() => { });
|
|
1477
1582
|
return notOpen(c, code, 'expired', lang, false);
|
|
1478
1583
|
}
|
|
1479
1584
|
if (memberNo)
|
|
1480
1585
|
link.numberMasked = maskNumber(memberNo);
|
|
1481
|
-
//
|
|
1482
|
-
//
|
|
1586
|
+
// ⚠️ THE GROUP'S TOKEN IS THE CONVERSATION'S TOKEN FROM NOW ON (0.72.0, 总线程
|
|
1587
|
+
// 11-16 - the 11-16 document: 「以最后登录的 access token 为准,会覆盖前面的」):
|
|
1588
|
+
// every call after - the account's own channel, every linked group's prices and
|
|
1589
|
+
// bookings, an unlink, the sign-out - carries this one. An older token may be
|
|
1590
|
+
// void: kept per group, linking Atour sent Ascott's booking an old token (401,
|
|
1591
|
+
// and the whole account signed out), and linking a second group lost the first.
|
|
1592
|
+
// Where the backend handed back the same token (the document before: one local
|
|
1593
|
+
// session, renewed to the longest), the account lasts as long as the longer;
|
|
1594
|
+
// a new token lasts as long as its own sign-in said.
|
|
1595
|
+
const renewed = got.session.access === now2.platform.access;
|
|
1596
|
+
now2.platform.access = got.session.access;
|
|
1597
|
+
now2.platform.expires = renewed
|
|
1598
|
+
? Math.max(now2.platform.expires, got.session.expires)
|
|
1599
|
+
: got.session.expires;
|
|
1600
|
+
// A link there already is replaced - its session ended (with the token just
|
|
1601
|
+
// taken, as every unlink) only where it is not the one just signed in (one
|
|
1602
|
+
// session, their document).
|
|
1483
1603
|
const was = now2.links?.get(m.code);
|
|
1484
1604
|
if (was?.session && was.session === link.session)
|
|
1485
1605
|
now2.links?.delete(m.code);
|
|
@@ -1487,11 +1607,6 @@ export const makeAccount = (opts) => {
|
|
|
1487
1607
|
unlink(now2, m.code);
|
|
1488
1608
|
now2.links ??= new Map();
|
|
1489
1609
|
now2.links.set(m.code, link);
|
|
1490
|
-
// ⚠️ ONE LOCAL SESSION, AT ITS LONGEST (their document: several channels'
|
|
1491
|
-
// sign-ins share the account's session, renewed to the longest): where the
|
|
1492
|
-
// group came back with the account's own token, the account lasts as long.
|
|
1493
|
-
if (link.token === now2.platform.access && link.expires > now2.platform.expires)
|
|
1494
|
-
now2.platform.expires = link.expires;
|
|
1495
1610
|
linkRequests.done(r);
|
|
1496
1611
|
log(`[account] ${tag(r.key)} linked a ${m.code} membership${up ? ' it made' : ''}`);
|
|
1497
1612
|
usage({
|
|
@@ -1770,7 +1885,7 @@ export const makeAccount = (opts) => {
|
|
|
1770
1885
|
let proved = null;
|
|
1771
1886
|
let outcome = 'unknown';
|
|
1772
1887
|
try {
|
|
1773
|
-
proved = await
|
|
1888
|
+
proved = await platformSignIn(tag(r.key), account, password, lang);
|
|
1774
1889
|
outcome = 'ok';
|
|
1775
1890
|
}
|
|
1776
1891
|
catch (e) {
|
|
@@ -1800,10 +1915,8 @@ export const makeAccount = (opts) => {
|
|
|
1800
1915
|
log(`[account] a terms link of ${tag(r.key)} opened by another account: refused`);
|
|
1801
1916
|
return termsReauth(c, code, r, lang, 'reauth_other');
|
|
1802
1917
|
}
|
|
1803
|
-
|
|
1918
|
+
// The newer kept, the older left to the backend - as the membership page (0.72.0).
|
|
1804
1919
|
still.platform = proved.session;
|
|
1805
|
-
if (!sameTok(older, proved.session))
|
|
1806
|
-
void endSession(older);
|
|
1807
1920
|
const id = web.open(r.key, still.sid);
|
|
1808
1921
|
if (id)
|
|
1809
1922
|
setCookie(c, id);
|
|
@@ -2081,7 +2194,7 @@ export const makeAccount = (opts) => {
|
|
|
2081
2194
|
// sign-in asks for `identity_field: email`, questions #48).
|
|
2082
2195
|
typed = values.email ?? '';
|
|
2083
2196
|
try {
|
|
2084
|
-
got = await
|
|
2197
|
+
got = await platformSignIn(tag(r.key), typed, password, lang);
|
|
2085
2198
|
}
|
|
2086
2199
|
catch (e) {
|
|
2087
2200
|
requests.reopen(r);
|
|
@@ -2092,7 +2205,7 @@ export const makeAccount = (opts) => {
|
|
|
2092
2205
|
}
|
|
2093
2206
|
}
|
|
2094
2207
|
else {
|
|
2095
|
-
got = await
|
|
2208
|
+
got = await platformSignIn(tag(r.key), typed, password, lang);
|
|
2096
2209
|
outcome = 'ok';
|
|
2097
2210
|
}
|
|
2098
2211
|
}
|
|
@@ -2315,11 +2428,13 @@ export const makeAccount = (opts) => {
|
|
|
2315
2428
|
if (signOut(key))
|
|
2316
2429
|
log(`[account] ${tag(key)} signed out: taken over from another network`);
|
|
2317
2430
|
},
|
|
2431
|
+
// A linked group's prices are asked for with the conversation's one token (0.72.0):
|
|
2432
|
+
// the latest sign-in's, whichever group it was at - a link keeps none of its own.
|
|
2318
2433
|
tokenFor: (key, group) => {
|
|
2319
2434
|
if (!linking)
|
|
2320
2435
|
return undefined;
|
|
2321
2436
|
const s = store.get(key);
|
|
2322
|
-
return s
|
|
2437
|
+
return s && liveLink(s, group) ? s.platform.access : undefined;
|
|
2323
2438
|
},
|
|
2324
2439
|
// The backend said the conversation's sign-in at a group is over (a 4012 to a
|
|
2325
2440
|
// price; to a booking a 401, or 4012 twice): a linked membership goes - and
|
|
@@ -2340,7 +2455,9 @@ export const makeAccount = (opts) => {
|
|
|
2340
2455
|
},
|
|
2341
2456
|
// ⚠️ THE CONVERSATION'S OWN SIGN-IN AT THAT GROUP (see `Account.bookingAuth`).
|
|
2342
2457
|
// `account`: their member_user id as the digits they sent (ota-member.ts
|
|
2343
|
-
// `exactId`) - with none given, who `shownOf` says.
|
|
2458
|
+
// `exactId`) - with none given, who `shownOf` says. ⚠️ THE TOKEN IS THE
|
|
2459
|
+
// CONVERSATION'S ONE, the latest sign-in's (0.72.0); the `Mcp-Session-Id` is still
|
|
2460
|
+
// the group's own sign-in's (whether a newer sign-in replaces it too is questions #77).
|
|
2344
2461
|
bookingAuth: (key, group) => {
|
|
2345
2462
|
const s = store.get(key);
|
|
2346
2463
|
if (!s)
|
|
@@ -2350,12 +2467,19 @@ export const makeAccount = (opts) => {
|
|
|
2350
2467
|
const l = linking ? liveLink(s, code) : undefined;
|
|
2351
2468
|
if (l)
|
|
2352
2469
|
return {
|
|
2353
|
-
token:
|
|
2470
|
+
token: s.platform.access,
|
|
2354
2471
|
...(l.mcpSessionId ? { mcpSessionId: l.mcpSessionId } : {}),
|
|
2355
2472
|
account,
|
|
2356
2473
|
};
|
|
2357
|
-
if (s.platform.provider !== code)
|
|
2474
|
+
if (s.platform.provider !== code) {
|
|
2475
|
+
// ⚠️ SIGNED IN AT NO GROUP (0.72.0, 总线程 11-16): the platform's own sign-in books
|
|
2476
|
+
// nowhere by itself - Ascott is linked like any group first, and the answer gives
|
|
2477
|
+
// the link. Whether its token alone could book there is questions #78 - logged,
|
|
2478
|
+
// so a refusal here can be read against the backend's answer.
|
|
2479
|
+
if (!s.platform.provider && code === FALLBACK_SIGN_IN_PROVIDER)
|
|
2480
|
+
log(`[account] ${tag(key)}: a booking at ${code} asks for a link - the account signed in with no providerCode (questions #78)`);
|
|
2358
2481
|
return undefined;
|
|
2482
|
+
}
|
|
2359
2483
|
return {
|
|
2360
2484
|
token: s.platform.access,
|
|
2361
2485
|
...(s.platform.mcpSessionId ? { mcpSessionId: s.platform.mcpSessionId } : {}),
|