@rocket.chat/houston 2.1.8 → 2.1.9

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.
@@ -477,11 +477,14 @@ async function reuse(name, wait, req, emit, { streamOutput, resolved = null, pre
477
477
  // while the name served nothing at all: the route was removed by the teardown and never
478
478
  // rewritten.
479
479
  await (0, ready_1.restoreRoute)(meta, emit);
480
+ // The summary AFTER `ready`, which asks Rocket.Chat things the notes say: the GUI's Bring up
481
+ // printed "sign-in is refused" just under "Rocket.Chat has a license", from before it asked.
482
+ const waited = wait ? await (0, ready_1.waitAndFinalize)(meta, emit) : null;
480
483
  const result = await inspect.summary(meta);
481
484
  result.reused = true;
482
485
  result.waited = wait;
483
- if (wait)
484
- Object.assign(result, await (0, ready_1.waitAndFinalize)(meta, emit));
486
+ if (waited !== null)
487
+ Object.assign(result, waited);
485
488
  // NOT when the caller seeds. `seedHere` means the CLI runs it after this returns, so
486
489
  // seeding here as well would seed the workspace twice -- the manifest only ever adds, so
487
490
  // the readback would report rooms holding more than planned.
@@ -1019,7 +1022,7 @@ async function buildDocument(plan) {
1019
1022
  envOverrides: plan.envOverrides,
1020
1023
  });
1021
1024
  plan.spec.adminPassword = plan.adminPassword;
1022
- const premium = request.premiumAuthWarning([plan.pre.name], resolved.rcVersion, plan.spec.licensed, plan.token);
1025
+ const premium = request.premiumAuthWarning(plan.pre, resolved.rcVersion, plan.spec.licensed, plan.token);
1023
1026
  if (premium !== '')
1024
1027
  (0, events_1.warn)(plan.emit, premium, { phase: 'create' });
1025
1028
  const voice = request.voiceLicenceWarning([plan.pre.name], plan.spec.licensed, plan.token);
@@ -1076,6 +1079,14 @@ function buildRecord(plan) {
1076
1079
  if (spec.rootUrl && spec.rootUrl !== plan.root) {
1077
1080
  plan.meta.extra.advertised_url = spec.rootUrl;
1078
1081
  }
1082
+ // A rebuild that keeps the data and moves the address: the database keeps the old Site_Url,
1083
+ // which `ready` moves once (`followTheMove`).
1084
+ const was = plan.previousMeta;
1085
+ if (was !== null &&
1086
+ !plan.req.fresh &&
1087
+ record.externalUrl(was) !== record.externalUrl(plan.meta)) {
1088
+ plan.meta.extra.site_url_moved_from = record.externalUrl(was);
1089
+ }
1079
1090
  if (pre.postReady.length > 0)
1080
1091
  plan.meta.extra.post_ready = pre.postReady;
1081
1092
  if (pre.notes.length > 0)
@@ -1093,6 +1104,9 @@ function buildRecord(plan) {
1093
1104
  plan.meta.extra.env = plan.envOverrides;
1094
1105
  if (spec.licensed)
1095
1106
  plan.meta.extra.licensed = true;
1107
+ // A token, never its text: the notes stop asking for a licence a registration may bring.
1108
+ if (plan.token)
1109
+ plan.meta.extra.registered = true;
1096
1110
  if (plan.req.actor) {
1097
1111
  // Who owns this. Shown by `list` and the GUI card.
1098
1112
  plan.meta.extra.created_by = plan.req.actor;
@@ -1267,11 +1281,13 @@ async function startTheWorkspace(plan, { recordWritten = false } = {}) {
1267
1281
  /** The summary the caller gets back, plus waiting and seeding when asked. */
1268
1282
  async function finish(plan) {
1269
1283
  const meta = plan.meta;
1284
+ // After `ready`, for the reason `reuse` records.
1285
+ const waited = plan.wait ? await (0, ready_1.waitAndFinalize)(meta, plan.emit) : null;
1270
1286
  const result = await inspect.summary(meta);
1271
1287
  result.reused = false;
1272
1288
  result.waited = plan.wait;
1273
- if (plan.wait)
1274
- Object.assign(result, await (0, ready_1.waitAndFinalize)(meta, plan.emit));
1289
+ if (waited !== null)
1290
+ Object.assign(result, waited);
1275
1291
  // NOT when the caller seeds, for the reason `reuse` records.
1276
1292
  if (plan.req.seed && !plan.req.seedHere) {
1277
1293
  result.seed = await seeding.runSeedInline(meta, plan.req.seedProfile, plan.req.stats, plan.emit, { scenarios: plan.req.seedScenarios, historyDays: plan.req.seedHistoryDays });
@@ -424,9 +424,9 @@ function settleAddressing(job) {
424
424
  job.root = `http://${request.callHost(job.bindHost)}:${String(job.hostPort)}`;
425
425
  job.microservices = job.req.deployment === topology.MICROSERVICES;
426
426
  // Allocation, deployment and notes share the same resolved scenario.
427
- requestedPreset(job);
427
+ const built = requestedPreset(job);
428
428
  const names = (0, composite_1.namesOf)(job.req.preset || 'default');
429
- const premium = request.premiumAuthWarning(names, job.resolved?.rcVersion ?? '', job.licensed, job.regToken);
429
+ const premium = request.premiumAuthWarning(built, job.resolved?.rcVersion ?? '', job.licensed, job.regToken);
430
430
  if (premium !== '')
431
431
  (0, events_1.warn)(job.emit, premium, { phase: 'plan' });
432
432
  const voice = request.voiceLicenceWarning(names, job.licensed, job.regToken);
@@ -522,6 +522,12 @@ async function planKubeTls(job) {
522
522
  job.ktls = await tlsplan.kubernetesTlsPlan(job.req, job.tlsspec, job.plan, {
523
523
  emit: job.emit,
524
524
  });
525
+ // Said, not dropped: with a name the chart writes ROOT_URL from it, and a second entry
526
+ // would be a server-side-apply conflict (`validateRootAddress`).
527
+ if (job.req.rootUrl) {
528
+ (0, events_1.warn)(job.emit, `--root-url ${job.req.rootUrl} is not applied: on Kubernetes with HTTPS, Rocket.Chat's ` +
529
+ `ROOT_URL is https://${job.ktls.host}, which the chart sets from the name.`, { phase: 'tls' });
530
+ }
525
531
  // A preset's own UIs at paths of that name; `installChart` routes them with an Ingress.
526
532
  if (job.presetForNotes !== null) {
527
533
  job.presetForNotes = (0, public_1.withPublicUrl)(job.presetForNotes, `https://${job.ktls.host}`, topology.KUBERNETES);
@@ -690,7 +696,9 @@ async function createTheWorkspace(job) {
690
696
  // PASSED AT LAST. `createWorkspace` has taken `rootUrl` since it was written and this
691
697
  // call never supplied it, so `valuesFor` never set anything and the chart emitted no
692
698
  // ROOT_URL -- Rocket.Chat ran on its own default while every human reached it here.
693
- rootUrl: job.root,
699
+ // `--root-url` is what Rocket.Chat advertises, as on Compose; houston's own calls keep
700
+ // the forward (`job.root`). It was dropped here, so Site_Url stayed on loopback.
701
+ rootUrl: job.req.rootUrl || job.root,
694
702
  // With a name, the chart's own Ingress template builds the Ingress -- houston
695
703
  // hand-writes none.
696
704
  tlsHost: job.ktls?.host ?? '',
@@ -732,6 +740,11 @@ async function buildRecord(job) {
732
740
  adminPassword: job.adminPassword,
733
741
  createdAt: bornAt(job.previousMeta),
734
742
  });
743
+ // What Rocket.Chat advertises, under the key Compose records it: `externalUrl`, the notes and
744
+ // a re-up (`carryRecordedAxes`) read it. Not with a TLS name, which the chart writes itself.
745
+ if (job.ktls === null && job.req.rootUrl && job.req.rootUrl !== job.root) {
746
+ job.meta.extra.advertised_url = job.req.rootUrl;
747
+ }
735
748
  // The preset's own record fields -- `mailpit_url`, which `admin.login` reads to fetch an
736
749
  // email-2FA code, so without it every login to an email workspace here failed at 2FA.
737
750
  // BEFORE the runtime's stamps, so a preset cannot overwrite them.
@@ -783,6 +796,11 @@ async function buildRecord(job) {
783
796
  emit: job.emit,
784
797
  });
785
798
  }
799
+ // A re-up that moves the address keeps the database's Site_Url, which `ready` moves once.
800
+ const was = job.previousMeta;
801
+ if (was !== null && (0, record_1.externalUrl)(was) !== (0, record_1.externalUrl)(job.meta)) {
802
+ job.meta.extra.site_url_moved_from = (0, record_1.externalUrl)(was);
803
+ }
786
804
  }
787
805
  /** What was ASKED for, so the workspace can be rebuilt exactly as it was. */
788
806
  function recordTheRequest(job) {
@@ -806,6 +824,9 @@ function recordTheRequest(job) {
806
824
  meta.extra.env = job.envOverrides;
807
825
  if (job.licensed)
808
826
  meta.extra.licensed = true;
827
+ // A token, never its text: the notes stop asking for a licence a registration may bring.
828
+ if (job.regToken)
829
+ meta.extra.registered = true;
809
830
  // A preset's self-configuration actions, recorded exactly as the Compose path records
810
831
  // them. Without this the OIDC preset would create no OAuth provider and the SAML preset
811
832
  // no provider settings -- both recorded and neither applied.
@@ -275,7 +275,8 @@ function buildAndLicense(meta) {
275
275
  const extra = bag(meta.extra);
276
276
  return {
277
277
  ci_build: (0, versions_1.isBuildTag)(tag) ? tag : '',
278
- licensed: extra.licensed === true,
278
+ // Or one added later in Rocket.Chat itself, which `ready` found there.
279
+ licensed: extra.licensed === true || extra.license_status === 'valid',
279
280
  license_refused: extra.license_status === 'refused',
280
281
  };
281
282
  }
@@ -48,6 +48,11 @@ exports.kubernetesNoteGroups = kubernetesNoteGroups;
48
48
  exports.composeNoteGroups = composeNoteGroups;
49
49
  exports.inboxUrl = inboxUrl;
50
50
  exports.webhooksGroup = webhooksGroup;
51
+ exports.premiumSignIn = premiumSignIn;
52
+ exports.oauthNeedsHttps = oauthNeedsHttps;
53
+ exports.loginPresetOf = loginPresetOf;
54
+ exports.signInGate = signInGate;
55
+ exports.signInGroup = signInGroup;
51
56
  exports.noteGroupsOf = noteGroupsOf;
52
57
  /**
53
58
  * The prose a workspace carries: what it is, how to reach it, what to do next.
@@ -67,6 +72,8 @@ const monitoring_1 = require("../../lib/monitoring");
67
72
  const format_1 = require("../../lib/format");
68
73
  const presets = __importStar(require("../../lib/presets/index"));
69
74
  const public_1 = require("../../lib/presets/public");
75
+ const versions_1 = require("../../lib/versions");
76
+ const version_spec_1 = require("../../lib/version-spec");
70
77
  const certmanager_1 = require("../kube/certmanager");
71
78
  const forward_1 = require("../kube/forward");
72
79
  const names_1 = require("../kube/names");
@@ -714,13 +721,142 @@ function webhooksGroup(meta) {
714
721
  }
715
722
  return [noteGroup('Webhooks', { rows, body, commands })];
716
723
  }
724
+ /** A release 9.0 or later; a build tag (develop, pr-N) is not knowable here, so no. */
725
+ function from900(rcVersion) {
726
+ return (0, versions_1.isValidVersion)(rcVersion) && ((0, version_spec_1.parseVersion)(rcVersion).release[0] ?? 0) >= 9;
727
+ }
728
+ /** Whether the preset signs in through a Custom OAuth provider: oidc, and ldap's idp=oidc. */
729
+ const signsInByOauth = (pre) => pre.postReady.some((action) => action.action === 'create_oauth_provider');
730
+ /**
731
+ * The sign-ins a login preset gets refused on Rocket.Chat 9 without a licence, or null. 9.0.0
732
+ * registers `LDAP_Enable`, SAML's enable setting and every Custom OAuth one with a licence
733
+ * module (PRs #41643, #42477), and `settings.addCustomOAuth` refuses without
734
+ * `oauth-enterprise`. Read off what the preset sets up, not its name: ldap's idp=saml and
735
+ * idp=oidc sign in through SAML and Custom OAuth too. The create's warning and the workspace's
736
+ * notes both say it from here. `has` is the modules Rocket.Chat said its license turns on.
737
+ */
738
+ function premiumSignIn(pre, rcVersion, has = []) {
739
+ if (!from900(rcVersion))
740
+ return null;
741
+ // EACH MEMBER of a composed name. Compose passed the preset it built, `email+ldap` or
742
+ // `ldap+multi-instance`, which matched nothing -- so Docker never warned for a combination
743
+ // while Kubernetes, passing the members, did.
744
+ const names = (0, composite_1.namesOf)(pre.name);
745
+ const all = [];
746
+ if (names.includes('ldap'))
747
+ all.push(['LDAP', 'ldap-enterprise']);
748
+ if (pre.postReady.some((action) => action.action === 'saml_idp_cert'))
749
+ all.push(['SAML', 'saml-enterprise']);
750
+ if (signsInByOauth(pre))
751
+ all.push(['Custom OAuth', 'oauth-enterprise']);
752
+ const gated = all.filter(([, mod]) => !has.includes(mod));
753
+ if (gated.length === 0)
754
+ return null;
755
+ return {
756
+ kinds: gated.map(([kind]) => kind).join(' and '),
757
+ modules: gated.map(([, mod]) => mod).join(' and '),
758
+ through: names.filter((name) => ['ldap', 'saml', 'oidc'].includes(name)).join(' and '),
759
+ };
760
+ }
761
+ /**
762
+ * Whether Rocket.Chat needs HTTPS for this workspace's sign-in. 9.0 moved Custom OAuth to
763
+ * Passport, whose session cookie is `secure` in a production build
764
+ * (`server/configuration/configurePassport.ts`): over plain http it is never set, and the
765
+ * callback returns to the login page with no error logged. Measured on 9.0.0 with a licence:
766
+ * the same workspace signed in over HTTPS and not over http; 8.9.1 signed in over both.
767
+ */
768
+ function oauthNeedsHttps(pre, rcVersion) {
769
+ return from900(rcVersion) && signsInByOauth(pre);
770
+ }
771
+ /** A workspace's preset as `premiumSignIn` reads it: its name and the post-ready it was built with. */
772
+ function loginPresetOf(meta) {
773
+ const recorded = bag(meta.extra).post_ready;
774
+ return {
775
+ name: meta.preset,
776
+ postReady: Array.isArray(recorded) ? recorded : [],
777
+ };
778
+ }
779
+ /**
780
+ * The sign-in Rocket.Chat 9 refuses this workspace for lack of a license, as the record knows
781
+ * it; `asked` is whether that comes from Rocket.Chat's own answer rather than the create's flags.
782
+ */
783
+ function signInGate(meta) {
784
+ const extra = bag(meta.extra);
785
+ const pre = loginPresetOf(meta);
786
+ // What Rocket.Chat said its license turns on, when `ready` last asked, beats what the create
787
+ // was given: a license added later in Administration lifts the gate, and a registration token
788
+ // that brought no license does not.
789
+ const asked = Array.isArray(extra.license_modules)
790
+ ? extra.license_modules.filter((m) => typeof m === 'string')
791
+ : null;
792
+ const gate = asked !== null
793
+ ? premiumSignIn(pre, meta.rcVersion, asked)
794
+ : extra.licensed === true || extra.registered === true
795
+ ? null
796
+ : premiumSignIn(pre, meta.rcVersion);
797
+ return gate === null ? null : { ...gate, asked: asked !== null };
798
+ }
799
+ /**
800
+ * What Rocket.Chat 9 asks of this workspace's sign-in: a licence, and HTTPS for Custom OAuth.
801
+ * The create warns once in a log that scrolls away; this says it again on every `info` and in
802
+ * the GUI's panel, from the record. Worded for both front-ends, as the voice preset's notes are.
803
+ */
804
+ function signInGroup(meta) {
805
+ const pre = loginPresetOf(meta);
806
+ const body = [];
807
+ const gate = signInGate(meta);
808
+ if (gate !== null) {
809
+ body.push(`Rocket.Chat 9.0 and later refuse ${gate.kinds} sign-in without a Premium plan (a ` +
810
+ `license carrying ${gate.modules}), and ` +
811
+ (gate.asked
812
+ ? 'Rocket.Chat had no such license when houston last asked it'
813
+ : "this workspace's record shows neither a license nor a registration token") +
814
+ `: sign-in through the ${gate.through} preset is refused.`, 'To test it with one, add the license in Rocket.Chat under Administration → Subscription ' +
815
+ "(it applies at once, without a restart), then run the preset's setup again: " +
816
+ `\`houston ready --name ${meta.name}\` (in the GUI: take it down, then bring it up). ` +
817
+ 'That also asks Rocket.Chat again, and this note goes once the license is there.');
818
+ }
819
+ if (oauthNeedsHttps(pre, meta.rcVersion)) {
820
+ const https = (0, record_1.externalUrl)(meta).startsWith('https:');
821
+ const [major, minor] = (0, version_spec_1.parseVersion)(meta.rcVersion).release;
822
+ if (major === 9 && minor === 0 && !(https && !meta.publicUrl)) {
823
+ // houston's HTTPS hands Rocket.Chat an absolute token path, which 9.0.x joins onto the
824
+ // provider URL (`customOAuth.ts` at 9.0.0); a proxy of the user's own leaves it relative.
825
+ body.push("Rocket.Chat 9.0 cannot finish this OAuth sign-in through houston: over plain http the 'Keycloak " +
826
+ "(OIDC)' sign-in returns to the login page, and over houston's HTTPS (`--https`, " +
827
+ '`--domain`) the callback answers 500, because 9.0 joins the full token address ' +
828
+ 'houston gives it onto the provider URL (fixed in 9.1.0, RocketChat/Rocket.Chat#43062). ' +
829
+ 'To test this sign-in, use 8.9, or 9.1.0 or later, or a TLS proxy of your own ' +
830
+ '(`--root-url https://<name>`).');
831
+ // First: a license alone does not make it work here, so the license advice comes after.
832
+ body.unshift(body.pop());
833
+ }
834
+ else if (!https) {
835
+ const rebuild = `\`houston up --name ${meta.name} --version ${meta.rcVersion} --force\``;
836
+ body.push('Rocket.Chat 9.0 and later sign in through OAuth only over HTTPS, and this workspace is ' +
837
+ "plain http: the 'Keycloak (OIDC)' sign-in returns to the login page. Rebuild it with " +
838
+ `HTTPS, keeping its data: ${rebuild} with \`--https\` (a browser on the machine ` +
839
+ 'running houston) or `--domain <name>` (in the GUI: create it again under this name, ' +
840
+ 'with an HTTPS choice and "Rebuild it from these settings, keeping its data").');
841
+ }
842
+ else if (meta.publicUrl && (0, format_1.toText)(bag(meta.extra).tls) === tls_1.MODE_LOCAL) {
843
+ body.push('Rocket.Chat 9.0 and later sign in through OAuth only over HTTPS. This workspace is ' +
844
+ `served at ${meta.publicUrl} on houston's local certificate, which opens only in a ` +
845
+ 'browser on the machine running houston, once `houston trust-ca` has run there. To ' +
846
+ 'sign in from another computer, create it with a public name instead (`--domain`; in ' +
847
+ "the GUI, HTTPS: Let's Encrypt).");
848
+ }
849
+ }
850
+ return body.length > 0 ? [noteGroup('Signing in on Rocket.Chat 9', { body })] : [];
851
+ }
717
852
  /** Every group this workspace has, scenario first. The one entry point. */
718
853
  async function noteGroupsOf(meta) {
719
854
  const scenario = scenarioGroup(meta);
855
+ const signIn = signInGroup(meta);
720
856
  if (topology.ofMeta(meta) === topology.KUBERNETES) {
721
857
  // Not corrected here: a Kubernetes workspace is reached through a port-forward the
722
858
  // reader runs themselves, so `localhost` is genuinely their localhost.
723
- return [...scenario, ...(await kubernetesNoteGroups(meta))];
859
+ return [...scenario, ...signIn, ...(await kubernetesNoteGroups(meta))];
724
860
  }
725
- return [...scenario, ...composeNoteGroups(meta), ...localUrlNote(meta, scenario)];
861
+ return [...scenario, ...signIn, ...composeNoteGroups(meta), ...localUrlNote(meta, scenario)];
726
862
  }
@@ -83,6 +83,7 @@ const postready = __importStar(require("../postready"));
83
83
  const topology = __importStar(require("../topology"));
84
84
  const tls_1 = require("../tls");
85
85
  const admin_1 = require("./admin");
86
+ const notes_1 = require("./notes");
86
87
  const inspect = __importStar(require("./inspect"));
87
88
  const seeding = __importStar(require("./seeding"));
88
89
  const journal_1 = require("../journal");
@@ -647,19 +648,35 @@ async function waitServingKubernetes(meta, emit, timeout) {
647
648
  * Site_Url is anything else is installed and refused ("Url validation failed"), and the
648
649
  * panel said "Licensed" all the same. Asked a few times, because Rocket.Chat may still be
649
650
  * applying it when it first serves; no answer records nothing rather than a guess.
651
+ *
652
+ * Also asked, once, where Rocket.Chat 9 refuses this workspace's sign-in without a license
653
+ * houston did not give: one added later in Administration → Subscription lifts it, and the
654
+ * notes said "refused" for as long as the workspace lived. The modules it turns on are
655
+ * recorded too, which is what the notes read.
650
656
  */
651
657
  async function checkLicense(meta, auth, emit, pause = exec_1.sleep) {
652
- if (auth === null || bag(meta.extra).licensed !== true)
658
+ if (auth === null)
659
+ return;
660
+ const given = bag(meta.extra).licensed === true;
661
+ const pre = (0, notes_1.loginPresetOf)(meta);
662
+ if (!given && (0, notes_1.premiumSignIn)(pre, meta.rcVersion) === null)
653
663
  return;
654
- let valid = null;
655
- for (let tries = 0; tries < 4 && valid !== true; tries += 1) {
664
+ let answer = null;
665
+ for (let tries = 0; tries < (given ? 4 : 1) && answer?.valid !== true; tries += 1) {
656
666
  if (tries > 0)
657
667
  await pause(5000);
658
- valid = await (0, rcapi_1.licenseValid)(meta.rootUrl, auth);
668
+ answer = await (0, rcapi_1.licenseInfo)(meta.rootUrl, auth);
659
669
  }
660
- if (valid === null)
670
+ if (answer === null)
661
671
  return;
662
- if (valid) {
672
+ const { valid, modules } = answer;
673
+ if (!given) {
674
+ const lifted = (0, notes_1.premiumSignIn)(pre, meta.rcVersion);
675
+ if (valid && lifted !== null && (0, notes_1.premiumSignIn)(pre, meta.rcVersion, modules ?? []) === null)
676
+ (0, events_1.info)(emit, `Rocket.Chat has a license carrying ${lifted.modules}: sign-in through the ` +
677
+ `${lifted.through} preset is no longer refused`, { phase: 'post_ready' });
678
+ }
679
+ else if (valid) {
663
680
  (0, events_1.info)(emit, 'Rocket.Chat accepted the license', { phase: 'post_ready' });
664
681
  }
665
682
  else {
@@ -670,13 +687,58 @@ async function checkLicense(meta, auth, emit, pause = exec_1.sleep) {
670
687
  'license refused even once the address is right (measured on 8.8.1): put it right, ' +
671
688
  `then \`houston restart --name ${meta.name}\` and \`houston ready --name ${meta.name}\`.`, { phase: 'post_ready' });
672
689
  }
673
- const status = valid ? 'valid' : 'refused';
674
- if (bag(meta.extra).license_status === status)
690
+ // One houston did not give and Rocket.Chat does not hold is no status at all: never "refused".
691
+ const status = valid ? 'valid' : given ? 'refused' : undefined;
692
+ const extra = bag(meta.extra);
693
+ if (extra.license_status === status &&
694
+ JSON.stringify(extra.license_modules) === JSON.stringify(modules ?? undefined))
695
+ return;
696
+ const put = (into) => {
697
+ if (status === undefined)
698
+ delete into.license_status;
699
+ else
700
+ into.license_status = status;
701
+ if (modules === null)
702
+ delete into.license_modules;
703
+ else
704
+ into.license_modules = modules;
705
+ };
706
+ await (0, record_1.updateMeta)(meta.name, (current) => {
707
+ put(current.extra);
708
+ });
709
+ put(meta.extra);
710
+ }
711
+ /**
712
+ * Site_Url onto the address a rebuild moved this workspace to, once. Rocket.Chat keeps the stored
713
+ * setting whatever ROOT_URL says and gives it to the browser as the address to connect to: an
714
+ * http oidc workspace upgraded to 9.0.0 and rebuilt onto https sat on its loading spinner. Moved
715
+ * only while it still names the old address, so one set by hand stays; `restore` does the same
716
+ * for a bundle's (`backup.retargetSiteUrl`). Unanswered, the marker stays for the next `ready`.
717
+ */
718
+ async function followTheMove(meta, auth, emit) {
719
+ const from = (0, format_1.toText)(bag(meta.extra).site_url_moved_from);
720
+ if (from === '' || auth === null)
721
+ return;
722
+ const want = (0, record_1.externalUrl)(meta);
723
+ const site = await (0, rcapi_1.getSetting)(meta.rootUrl, auth, (0, record_1.adminPass)(meta), 'Site_Url');
724
+ if (site === null)
675
725
  return;
726
+ const trim = (url) => url.replace(/\/+$/u, '');
727
+ if (typeof site === 'string' && trim(site) === trim(from) && trim(from) !== trim(want)) {
728
+ if (!(await (0, rcapi_1.setSetting)(meta.rootUrl, auth, (0, record_1.adminPass)(meta), 'Site_Url', want))) {
729
+ (0, events_1.warn)(emit, `Site_Url still reads ${from}, the address before this rebuild, and the browser follows ` +
730
+ `it: set it to ${want} (Administration, Settings, General, Site URL), or run ` +
731
+ `\`houston ready --name ${meta.name}\` again.`, { phase: 'post_ready' });
732
+ return;
733
+ }
734
+ (0, events_1.info)(emit, `Site_Url moved from ${from} to ${want}, where this workspace is now served`, {
735
+ phase: 'post_ready',
736
+ });
737
+ }
676
738
  await (0, record_1.updateMeta)(meta.name, (current) => {
677
- current.extra.license_status = status;
739
+ delete current.extra.site_url_moved_from;
678
740
  });
679
- meta.extra.license_status = status;
741
+ delete meta.extra.site_url_moved_from;
680
742
  }
681
743
  /**
682
744
  * Wait for the workspace to serve, then finish it off.
@@ -691,8 +753,11 @@ async function waitAndFinalize(meta, emit = events_1.nullEmit, timeout = 300.0,
691
753
  const served = await waitServing(meta, emit, timeout);
692
754
  const elapsed = Math.floor((Date.now() - started) / 1000);
693
755
  const auth = await finalize(meta, emit);
694
- await postready.runPostReady(meta, auth, emit);
756
+ // Before the preset's setup, which builds its callbacks and checks from Site_Url.
757
+ await followTheMove(meta, auth, emit);
758
+ // Before it too: the license Rocket.Chat holds now, not at the last `ready`, decides the advice.
695
759
  await checkLicense(meta, auth, emit);
760
+ await postready.runPostReady(meta, auth, emit, { licenseGate: (0, notes_1.signInGate)(meta) });
696
761
  // AND THE SEED THE INTERRUPTED CREATE ASKED FOR. The note says the workspace "may be
697
762
  // running without its preset configuration or seed data" and names this command as the
698
763
  // thing that completes it -- and this used to run post_ready, seed nothing, print
@@ -74,10 +74,10 @@ const common_1 = require("../../lib/presets/common");
74
74
  const presets = __importStar(require("../../lib/presets/index"));
75
75
  const composite_1 = require("../../lib/presets/composite");
76
76
  const versions_1 = require("../../lib/versions");
77
- const version_spec_1 = require("../../lib/version-spec");
78
77
  const topology = __importStar(require("../topology"));
79
78
  const context_2 = require("../kube/context");
80
79
  const rcapi_1 = require("../rcapi");
80
+ const notes_1 = require("./notes");
81
81
  const types_1 = require("./types");
82
82
  /** Truthiness, as a function -- `unknown` may not appear in a conditional. */
83
83
  function isTruthy(value) {
@@ -155,34 +155,19 @@ function voiceLicenceWarning(presetNames, licensed, regToken) {
155
155
  'has neither --license nor --reg-token: it boots, but Rocket.Chat shows no call button ' +
156
156
  'until one is applied in Administration → Subscription.');
157
157
  }
158
- /** Presets whose login Rocket.Chat has announced will need a Premium plan from 9.0.0. */
159
- const PREMIUM_AUTH_PRESETS = {
160
- ldap: 'LDAP',
161
- saml: 'SAML',
162
- oidc: 'Custom OAuth',
163
- };
164
158
  /**
165
- * Warn when a workspace's login preset may be refused on Rocket.Chat 9 for want of a licence,
166
- * or ''. Rocket.Chat 8.8 logs that LDAP and SAML login will need a Premium plan from 9.0.0,
167
- * and 8.9 says the same of Custom OAuth. The gates were open drafts on 2026-10-08 (PRs #41643
168
- * and #42477), so this says "may", and it is a warning, not a refusal.
159
+ * Warn when a workspace's login preset will be refused on Rocket.Chat 9 for want of a licence,
160
+ * or ''. A warning, not a refusal: the workspace still boots, and a licence can be added later.
161
+ * Worded for both front-ends: the GUI's job shows it too.
169
162
  */
170
- function premiumAuthWarning(presetNames, rcVersion, licensed, regToken) {
171
- if (licensed || regToken !== '' || !(0, versions_1.isValidVersion)(rcVersion))
163
+ function premiumAuthWarning(pre, rcVersion, licensed, regToken) {
164
+ const gate = licensed || regToken !== '' ? null : (0, notes_1.premiumSignIn)(pre, rcVersion);
165
+ if (gate === null)
172
166
  return '';
173
- if (((0, version_spec_1.parseVersion)(rcVersion).release[0] ?? 0) < 9)
174
- return '';
175
- // EACH MEMBER of a composed name. Compose passed the preset it built, `email+ldap` or
176
- // `ldap+multi-instance`, which matched nothing -- so Docker never warned for a combination
177
- // while Kubernetes, passing the members, did.
178
- const names = presetNames.flatMap((name) => (0, composite_1.namesOf)(name));
179
- const kinds = names.map((name) => PREMIUM_AUTH_PRESETS[name]).filter((kind) => kind);
180
- if (kinds.length === 0)
181
- return '';
182
- return (`Rocket.Chat 9.0 is set to require a Premium plan for ${kinds.join(' and ')} login, and ` +
183
- `this workspace has neither --license nor --reg-token: logins through the ` +
184
- `${names.filter((name) => name in PREMIUM_AUTH_PRESETS).join(' and ')} preset may be ` +
185
- 'refused. Add --license <file> or --reg-token <token> to test with one.');
167
+ return (`Rocket.Chat 9.0 and later refuse ${gate.kinds} login without a Premium plan (a license ` +
168
+ `carrying ${gate.modules}), and this workspace has neither a license nor a registration ` +
169
+ `token: logins through the ${gate.through} preset will be refused. Give it one when ` +
170
+ "creating (--license or --reg-token; in the GUI, Add a license), or add one later as the workspace's notes say.");
186
171
  }
187
172
  /**
188
173
  * Warn when a SAML login and the email preset are combined, or ''. With email two-factor on, Rocket.Chat asks a