@rocket.chat/houston 0.27.0-next.2 → 2.1.8
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 +1 -1
- package/README.md +108 -15
- package/bin/houston +62 -0
- package/data/docs/ARCHITECTURE.md +387 -0
- package/data/docs/automation.md +107 -0
- package/data/docs/e2ee.md +76 -0
- package/data/docs/eks.md +258 -0
- package/data/docs/gui.md +282 -0
- package/data/docs/guide.md +669 -0
- package/data/docs/kubernetes.md +138 -0
- package/data/docs/troubleshooting.md +193 -0
- package/data/docs/upgrading.md +84 -0
- package/data/docs/voice.md +253 -0
- package/data/iam/engineer-policy.json +11 -0
- package/data/iam/engineer-rbac.yaml +42 -0
- package/data/iam/operator-policy.json +211 -0
- package/data/loadtest/badbot.js +22 -0
- package/data/loadtest/common.js +168 -0
- package/data/loadtest/custom.js +20 -0
- package/data/loadtest/journey.js +58 -0
- package/data/loadtest/login.js +18 -0
- package/data/loadtest/messages.js +13 -0
- package/data/loadtest/mixed.js +39 -0
- package/data/loadtest/read.js +12 -0
- package/data/loadtest/webhook.js +20 -0
- package/data/monitoring/houston-logs.json +98 -0
- package/data/monitoring/k6-loadtest.json +610 -0
- package/data/monitoring/mongodb-exporter.json +3007 -0
- package/data/monitoring/node-exporter-full.json +16114 -0
- package/data/monitoring/rocketchat-metrics.json +6471 -0
- package/data/presets/airgapped.yaml +16 -0
- package/data/presets/default.yaml +9 -0
- package/data/seed/avatar-0.png +0 -0
- package/data/seed/avatar-1.png +0 -0
- package/data/seed/avatar-2.png +0 -0
- package/data/seed/avatar-3.png +0 -0
- package/data/seed/avatar-4.png +0 -0
- package/data/seed/avatar-5.png +0 -0
- package/data/seed/avatar-6.png +0 -0
- package/data/seed/avatar-7.png +0 -0
- package/data/seed/seed-metrics.csv +3 -0
- package/data/seed/seed-preview.png +0 -0
- package/data/seed/seed-report.pdf +32 -0
- package/data/seed/seed-runbook.txt +3 -0
- package/data/skill/SKILL.md +399 -0
- package/data/versions.yaml +55 -0
- package/data/voice/freeswitch/drachtio.xml +52 -0
- package/data/voice/freeswitch/public.xml +87 -0
- package/data/webui/app.css +2003 -0
- package/data/webui/index.html +678 -0
- package/data/webui/js/api.js +561 -0
- package/data/webui/js/boot.js +44 -0
- package/data/webui/js/clusters-tail.js +1377 -0
- package/data/webui/js/clusters.js +896 -0
- package/data/webui/js/create.js +276 -0
- package/data/webui/js/detail.js +507 -0
- package/data/webui/js/jobs.js +636 -0
- package/data/webui/js/logs.js +634 -0
- package/data/webui/js/main.js +14 -0
- package/data/webui/js/options.js +408 -0
- package/data/webui/js/people.js +438 -0
- package/data/webui/js/perf.js +303 -0
- package/data/webui/js/render.js +438 -0
- package/data/webui/js/shared.js +3 -0
- package/data/webui/js/state.js +583 -0
- package/data/webui/js/theme.js +123 -0
- package/data/webui/js/util.js +584 -0
- package/dist/cli/app.js +593 -0
- package/dist/cli/capabilities.js +76 -0
- package/dist/cli/cell-widths.js +495 -0
- package/dist/cli/entry.js +10 -0
- package/dist/cli/error-panel.js +492 -0
- package/dist/cli/handlers/actor.js +84 -0
- package/dist/cli/handlers/https.js +614 -0
- package/dist/cli/handlers/prompt.js +299 -0
- package/dist/cli/handlers/users.js +226 -0
- package/dist/cli/handlers.js +3678 -0
- package/dist/cli/help.js +183 -0
- package/dist/cli/index.js +15 -0
- package/dist/cli/perf.js +810 -0
- package/dist/cli/render.js +254 -0
- package/dist/cli/serve.js +858 -0
- package/dist/cli/spec-data.js +2593 -0
- package/dist/cli/spec-types.js +8 -0
- package/dist/cli/usage-error.js +520 -0
- package/dist/cli/wire.js +70 -0
- package/dist/core/audit.js +346 -0
- package/dist/core/backup-compat.js +85 -0
- package/dist/core/backup.js +1639 -0
- package/dist/core/cluster.js +1398 -0
- package/dist/core/configimport.js +344 -0
- package/dist/core/data.js +267 -0
- package/dist/core/database-of.js +82 -0
- package/dist/core/diagnose.js +159 -0
- package/dist/core/doctor.js +1518 -0
- package/dist/core/edge/acme.js +338 -0
- package/dist/core/edge/engine.js +500 -0
- package/dist/core/edge/networks.js +174 -0
- package/dist/core/edge/paths.js +107 -0
- package/dist/core/edge/routes.js +251 -0
- package/dist/core/edge/routeyml.js +195 -0
- package/dist/core/edge/runtime.js +493 -0
- package/dist/core/edge/spec.js +305 -0
- package/dist/core/edge/types.js +202 -0
- package/dist/core/eks-docs.js +135 -0
- package/dist/core/eks.js +2240 -0
- package/dist/core/envvars.js +562 -0
- package/dist/core/eventlog.js +541 -0
- package/dist/core/firstrun.js +153 -0
- package/dist/core/journal.js +691 -0
- package/dist/core/kube/ask.js +231 -0
- package/dist/core/kube/capabilities.js +269 -0
- package/dist/core/kube/certmanager.js +452 -0
- package/dist/core/kube/chart.js +413 -0
- package/dist/core/kube/cluster.js +196 -0
- package/dist/core/kube/context.js +545 -0
- package/dist/core/kube/endpoints.js +448 -0
- package/dist/core/kube/exec.js +195 -0
- package/dist/core/kube/forward.js +732 -0
- package/dist/core/kube/grafana-ingress.js +110 -0
- package/dist/core/kube/ingress.js +218 -0
- package/dist/core/kube/manifests.js +361 -0
- package/dist/core/kube/monitoring.js +768 -0
- package/dist/core/kube/names.js +237 -0
- package/dist/core/kube/namespace.js +678 -0
- package/dist/core/kube/operator.js +941 -0
- package/dist/core/kube/probe.js +202 -0
- package/dist/core/kube/reachability.js +163 -0
- package/dist/core/kube/release.js +439 -0
- package/dist/core/kube/replicaset.js +180 -0
- package/dist/core/kube/scale.js +398 -0
- package/dist/core/kube/status.js +633 -0
- package/dist/core/kube/tools.js +238 -0
- package/dist/core/kube/transfer.js +173 -0
- package/dist/core/kube/workspace.js +423 -0
- package/dist/core/lifecycle/admin.js +64 -0
- package/dist/core/lifecycle/create-docker.js +1533 -0
- package/dist/core/lifecycle/create-k8s.js +939 -0
- package/dist/core/lifecycle/destroy.js +339 -0
- package/dist/core/lifecycle/inspect.js +635 -0
- package/dist/core/lifecycle/naming.js +298 -0
- package/dist/core/lifecycle/notes.js +726 -0
- package/dist/core/lifecycle/ownership.js +313 -0
- package/dist/core/lifecycle/payload.js +401 -0
- package/dist/core/lifecycle/ports.js +388 -0
- package/dist/core/lifecycle/preconditions.js +367 -0
- package/dist/core/lifecycle/pruning.js +551 -0
- package/dist/core/lifecycle/ready.js +753 -0
- package/dist/core/lifecycle/request.js +525 -0
- package/dist/core/lifecycle/seeding.js +281 -0
- package/dist/core/lifecycle/sizing.js +392 -0
- package/dist/core/lifecycle/state.js +286 -0
- package/dist/core/lifecycle/tlsplan.js +704 -0
- package/dist/core/lifecycle/types.js +232 -0
- package/dist/core/loadtest.js +995 -0
- package/dist/core/migrate.js +612 -0
- package/dist/core/monitor.js +494 -0
- package/dist/core/postready.js +969 -0
- package/dist/core/promote.js +804 -0
- package/dist/core/rcapi.js +1285 -0
- package/dist/core/recovery.js +75 -0
- package/dist/core/runner/engine.js +394 -0
- package/dist/core/runner/host.js +298 -0
- package/dist/core/runner/locks.js +129 -0
- package/dist/core/runner/paths.js +173 -0
- package/dist/core/runner/ports.js +172 -0
- package/dist/core/runner/queries.js +612 -0
- package/dist/core/runner/record.js +563 -0
- package/dist/core/scaleseed.js +271 -0
- package/dist/core/seed-db.js +208 -0
- package/dist/core/sessions.js +472 -0
- package/dist/core/skill.js +326 -0
- package/dist/core/sso-identities.js +172 -0
- package/dist/core/sso.js +703 -0
- package/dist/core/tls-local.js +311 -0
- package/dist/core/tls.js +878 -0
- package/dist/core/topology.js +482 -0
- package/dist/core/upgrade.js +868 -0
- package/dist/core/users.js +739 -0
- package/dist/lib/audit.js +100 -0
- package/dist/lib/close-matches.js +238 -0
- package/dist/lib/compose.js +672 -0
- package/dist/lib/config.js +1398 -0
- package/dist/lib/context.js +18 -0
- package/dist/lib/errors.js +305 -0
- package/dist/lib/events.js +208 -0
- package/dist/lib/float-text.js +126 -0
- package/dist/lib/format.js +1320 -0
- package/dist/lib/home.js +325 -0
- package/dist/lib/journal.js +122 -0
- package/dist/lib/json-text.js +733 -0
- package/dist/lib/jsonout.js +382 -0
- package/dist/lib/lock.js +516 -0
- package/dist/lib/login-name.js +202 -0
- package/dist/lib/map-limit.js +29 -0
- package/dist/lib/mkdir-parents.js +90 -0
- package/dist/lib/mongo-kernel.js +67 -0
- package/dist/lib/monitoring.js +492 -0
- package/dist/lib/platform-name.js +59 -0
- package/dist/lib/presets/common.js +390 -0
- package/dist/lib/presets/composite.js +326 -0
- package/dist/lib/presets/e2ee.js +143 -0
- package/dist/lib/presets/email.js +172 -0
- package/dist/lib/presets/guides.js +27 -0
- package/dist/lib/presets/index.js +490 -0
- package/dist/lib/presets/keycloak.js +369 -0
- package/dist/lib/presets/ldap.js +1285 -0
- package/dist/lib/presets/livechat.js +220 -0
- package/dist/lib/presets/multi-instance.js +124 -0
- package/dist/lib/presets/oidc.js +161 -0
- package/dist/lib/presets/public.js +496 -0
- package/dist/lib/presets/registry.js +64 -0
- package/dist/lib/presets/s3-minio.js +300 -0
- package/dist/lib/presets/saml.js +149 -0
- package/dist/lib/presets/scenario.js +51 -0
- package/dist/lib/presets/types.js +86 -0
- package/dist/lib/presets/voice-pbx.js +320 -0
- package/dist/lib/presets/voice.js +345 -0
- package/dist/lib/presets/webhooks.js +182 -0
- package/dist/lib/redact.js +106 -0
- package/dist/lib/seed-options.js +68 -0
- package/dist/lib/seed-profiles.js +59 -0
- package/dist/lib/targz.js +1383 -0
- package/dist/lib/teammode.js +25 -0
- package/dist/lib/tempdir.js +162 -0
- package/dist/lib/unicode-tables.js +2335 -0
- package/dist/lib/version-spec.js +357 -0
- package/dist/lib/versions.js +463 -0
- package/dist/lib/yaml-dump.js +1361 -0
- package/dist/perf/baseline.js +168 -0
- package/dist/perf/constrain.js +296 -0
- package/dist/perf/k6.js +235 -0
- package/dist/perf/mongoprof.js +171 -0
- package/dist/perf/rcmetrics.js +178 -0
- package/dist/perf/report.js +386 -0
- package/dist/perf/resources.js +224 -0
- package/dist/perf/slo.js +111 -0
- package/dist/perf/timeline.js +187 -0
- package/dist/perf/timings.js +85 -0
- package/dist/perf/verdict.js +201 -0
- package/dist/seams/aws-cli.js +126 -0
- package/dist/seams/docker-cli.js +280 -0
- package/dist/seams/exec.js +861 -0
- package/dist/seams/fs/lock.js +528 -0
- package/dist/seams/kubectl.js +83 -0
- package/dist/seams/rc-http.js +921 -0
- package/dist/seed/apply.js +190 -0
- package/dist/seed/assets.js +76 -0
- package/dist/seed/check.js +391 -0
- package/dist/seed/client.js +172 -0
- package/dist/seed/executor.js +726 -0
- package/dist/seed/history.js +281 -0
- package/dist/seed/kinds.js +91 -0
- package/dist/seed/plan.js +432 -0
- package/dist/seed/receipt.js +339 -0
- package/dist/seed/repairs.js +75 -0
- package/dist/seed/verification.js +363 -0
- package/dist/seed/wording.js +248 -0
- package/dist/web/app.js +326 -0
- package/dist/web/jobs.js +510 -0
- package/dist/web/route-deps.js +211 -0
- package/dist/web/route-table.js +213 -0
- package/dist/web/routes/backup.js +244 -0
- package/dist/web/routes/clusters.js +303 -0
- package/dist/web/routes/data.js +187 -0
- package/dist/web/routes/edge.js +82 -0
- package/dist/web/routes/index.js +63 -0
- package/dist/web/routes/jobs.js +95 -0
- package/dist/web/routes/logs.js +297 -0
- package/dist/web/routes/meta.js +191 -0
- package/dist/web/routes/people.js +151 -0
- package/dist/web/routes/perf.js +95 -0
- package/dist/web/routes/repros.js +550 -0
- package/dist/web/routes/session.js +361 -0
- package/dist/web/routes/spa.js +198 -0
- package/dist/web/security.js +475 -0
- package/dist/web/signin.js +246 -0
- package/package.json +67 -32
- package/.eslintrc +0 -94
- package/.swcrc +0 -18
- package/dist/bin.js +0 -3
- package/dist/cli.js +0 -184
- package/dist/commands/createBranch.js +0 -192
- package/src/bin.js +0 -4
- package/src/cli.ts +0 -25
- package/src/commands/createBranch.ts +0 -25
- package/src-old/logs.js +0 -323
- package/src-old/md.js +0 -191
- package/src-old/release-table.js +0 -60
- package/src-old/set-version.js +0 -614
- package/src-old/utils.js +0 -15
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { ctx } from "./shared.js";
|
|
2
|
+
|
|
3
|
+
// The create dialog's options, step 2: presets ticked from a list, each with its own
|
|
4
|
+
// settings; the license; what the version is; and the Rocket.Chat 9.0 notice. One state
|
|
5
|
+
// and one render, so the list, the panels and the notice never disagree.
|
|
6
|
+
|
|
7
|
+
// `ctx.el` sets every attribute it is given, so `checked: false` would tick a box: this
|
|
8
|
+
// one leaves out false and null, and flattens its children.
|
|
9
|
+
function node(tag, attrs = {}, ...kids) {
|
|
10
|
+
const n = document.createElement(tag);
|
|
11
|
+
for (const [k, v] of Object.entries(attrs)) {
|
|
12
|
+
if (v === false || v == null) continue;
|
|
13
|
+
if (k.startsWith("on")) n.addEventListener(k.slice(2), v);
|
|
14
|
+
else if (k === "class") n.className = v;
|
|
15
|
+
else n.setAttribute(k, v === true ? "" : v);
|
|
16
|
+
}
|
|
17
|
+
n.append(...kids.flat().filter((x) => x != null && x !== false));
|
|
18
|
+
return n;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const BUILD = /^(develop|pr-([1-9][0-9]{0,6}))(-(?:fips|cov))?(-gha-run-[0-9]{1,15})?$/u;
|
|
22
|
+
const RELEASE = /^(\d+)\.(\d+)\.(\d+)$/u;
|
|
23
|
+
const CANDIDATE = /^(\d+)\.(\d+)\.(\d+)-rc\.(\d+)$/u;
|
|
24
|
+
// What only a combination needs saying, in the dialog's words (the CLI prints its own).
|
|
25
|
+
const TWO_STORES = "Two separate user stores: directory users are user1…N, Keycloak users are sso-user1…N.";
|
|
26
|
+
const PAIR_NOTES = [
|
|
27
|
+
[["email", "ldap"], "Email two-factor is on, and directory users' emails are verified, so a directory sign-in asks for a code: read it in Mailpit."],
|
|
28
|
+
[["ldap", "saml"], TWO_STORES],
|
|
29
|
+
[["ldap", "oidc"], TWO_STORES],
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
let S = fresh();
|
|
33
|
+
function fresh() {
|
|
34
|
+
// `params` holds only what was CHANGED: an untouched control shows its default and sends
|
|
35
|
+
// nothing, so the request says exactly what the person chose.
|
|
36
|
+
return { presets: new Set(), params: {}, license: "", licFile: "", licOpen: false, version: null };
|
|
37
|
+
}
|
|
38
|
+
const P = (p) => (S.params[p] ||= {});
|
|
39
|
+
const ticked = (n) => S.presets.has(n);
|
|
40
|
+
const catalogue = () => (ctx.PRESETS || []).filter((p) => p.name !== "default");
|
|
41
|
+
const presetOf = (name) => (ctx.PRESETS || []).find((p) => p.name === name) || { params_help: {} };
|
|
42
|
+
const runtime = () => (ctx.$("#runtime-value") && ctx.$("#runtime-value").value) || "docker";
|
|
43
|
+
const firstSentence = (d) => (/^.*?[.!?](?=\s|$)/u.exec(d || "") || [d || ""])[0];
|
|
44
|
+
// "(default houston-uploads)" -> "houston-uploads"; nothing when the default is a phrase.
|
|
45
|
+
function defaultOf(help) {
|
|
46
|
+
const m = /\(default ([^;,)]+)/u.exec(help || "");
|
|
47
|
+
const v = m ? m[1].trim().replace(/^'(.*)'$/u, "$1") : "";
|
|
48
|
+
return /\s/u.test(v) ? "" : v;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function whyOff(name) {
|
|
52
|
+
const p = presetOf(name);
|
|
53
|
+
if (runtime() === "kubernetes" && p.kubernetes === false) return "Not on Kubernetes";
|
|
54
|
+
const rival = { saml: "oidc", oidc: "saml" }[name];
|
|
55
|
+
if (rival && ticked(rival)) return "One sign-in provider per workspace";
|
|
56
|
+
return "";
|
|
57
|
+
}
|
|
58
|
+
// voice's SIP options: each needs the one before it, and all of them Docker. A hidden one is
|
|
59
|
+
// not sent either, or a value typed before switching place would have the create refused.
|
|
60
|
+
const voiceOn = (key) => P("voice")[key] === "on";
|
|
61
|
+
function voiceShown(key) {
|
|
62
|
+
if (key === "ice_servers") return true;
|
|
63
|
+
if (runtime() === "kubernetes") return false;
|
|
64
|
+
if (key === "sip_integration") return true;
|
|
65
|
+
return key === "freeswitch_dialplans" ? voiceOn("sip_integration") && voiceOn("pbx") : voiceOn("sip_integration");
|
|
66
|
+
}
|
|
67
|
+
// ldap's own single sign-on follows a ticked saml or oidc preset: one Keycloak per workspace.
|
|
68
|
+
const keycloakPreset = () => ticked("saml") || ticked("oidc");
|
|
69
|
+
const ldapIdp = () => (ticked("saml") ? "saml" : ticked("oidc") ? "oidc" : P("ldap").idp || "none");
|
|
70
|
+
function signInKinds() {
|
|
71
|
+
const k = [];
|
|
72
|
+
if (ticked("ldap")) k.push("LDAP");
|
|
73
|
+
if (ticked("saml") || (ticked("ldap") && ldapIdp() === "saml")) k.push("SAML");
|
|
74
|
+
if (ticked("oidc") || (ticked("ldap") && ldapIdp() === "oidc")) k.push("OIDC");
|
|
75
|
+
return k;
|
|
76
|
+
}
|
|
77
|
+
const andJoin = (a) => (a.length < 2 ? a.join("") : `${a.slice(0, -1).join(", ")} and ${a[a.length - 1]}`);
|
|
78
|
+
const presetText = () => [...S.presets].sort().join(" + ");
|
|
79
|
+
const may = () => ctx.MAY_SET_PRIVILEGED === true;
|
|
80
|
+
|
|
81
|
+
// ---- the version ----------------------------------------------------------------
|
|
82
|
+
function kindOf(v) {
|
|
83
|
+
const b = BUILD.exec(v);
|
|
84
|
+
if (b) return { kind: "ci", pr: b[2] || "" };
|
|
85
|
+
const r = RELEASE.exec(v) || CANDIDATE.exec(v);
|
|
86
|
+
if (r) return { kind: r.length > 4 ? "rc" : "release", major: +r[1] };
|
|
87
|
+
return { kind: v ? "other" : "empty" };
|
|
88
|
+
}
|
|
89
|
+
// The release the 9.0 notice goes by: the version itself, or a CI build's base, once the
|
|
90
|
+
// server has read it from the build's package.json.
|
|
91
|
+
function baseMajor() {
|
|
92
|
+
const s = S.version;
|
|
93
|
+
if (!s) return null;
|
|
94
|
+
if (s.kind === "release" || s.kind === "rc") return s.major;
|
|
95
|
+
if (s.kind === "ci" && s.answer && s.answer.rc_version) return parseInt(s.answer.rc_version, 10);
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
const baseRelease = (rcVersion) => String(rcVersion || "").replace(/\.dev\d+$/u, "");
|
|
99
|
+
|
|
100
|
+
let versionTimer = null;
|
|
101
|
+
function onVersion(value) {
|
|
102
|
+
const v = value.trim();
|
|
103
|
+
S.version = { v, ...kindOf(v), answer: null, error: "" };
|
|
104
|
+
clearTimeout(versionTimer);
|
|
105
|
+
renderVersion();
|
|
106
|
+
renderPresets();
|
|
107
|
+
if (S.version.kind === "empty") return;
|
|
108
|
+
// Asked 400 ms after typing stops: which MongoDB, a CI build's base release, and whether
|
|
109
|
+
// this engine can run that MongoDB, before committing to a multi-GB pull.
|
|
110
|
+
versionTimer = setTimeout(async () => {
|
|
111
|
+
const asked = v;
|
|
112
|
+
try {
|
|
113
|
+
const r = await ctx.api(`/api/versions/${encodeURIComponent(v)}`);
|
|
114
|
+
if (S.version && S.version.v === asked) S.version.answer = r;
|
|
115
|
+
} catch (err) {
|
|
116
|
+
if (S.version && S.version.v === asked) S.version.error = err.message;
|
|
117
|
+
}
|
|
118
|
+
renderVersion();
|
|
119
|
+
renderPresets();
|
|
120
|
+
}, 400);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function renderVersion() {
|
|
124
|
+
const out = ctx.$("#version-hint");
|
|
125
|
+
const s = S.version;
|
|
126
|
+
ctx.$("#version-pill").hidden = !s || s.kind !== "ci";
|
|
127
|
+
out.replaceChildren();
|
|
128
|
+
out.className = "hint";
|
|
129
|
+
if (!s || s.kind === "empty") return;
|
|
130
|
+
if (s.error) { out.textContent = s.error; out.className = "hint bad"; return; }
|
|
131
|
+
const a = s.answer;
|
|
132
|
+
const mongo = a ? ` · MongoDB ${a.mongo_tag}` : "";
|
|
133
|
+
if (s.kind === "release" || s.kind === "rc") {
|
|
134
|
+
out.append(`${s.kind === "rc" ? "Release candidate" : "Release"} ${s.v}${mongo}`);
|
|
135
|
+
} else if (s.kind === "ci") {
|
|
136
|
+
out.append("Built by Rocket.Chat's CI ");
|
|
137
|
+
if (s.pr) {
|
|
138
|
+
out.append("for ", node("a", { href: `https://github.com/RocketChat/Rocket.Chat/pull/${s.pr}`,
|
|
139
|
+
target: "_blank", rel: "noreferrer" }, `pull request #${s.pr}`));
|
|
140
|
+
} else out.append("as the latest develop build");
|
|
141
|
+
out.append(node("br"), "Pulled fresh on every create: ",
|
|
142
|
+
node("code", {}, `ghcr.io/rocketchat/rocket.chat:${s.v}`), node("br"));
|
|
143
|
+
if (a) {
|
|
144
|
+
out.append(`Based on ${baseRelease(a.rc_version)} (from ${s.pr ? "the pull request's" : "develop's"} `
|
|
145
|
+
+ `package.json), so MongoDB ${a.mongo_tag}`);
|
|
146
|
+
} else out.append(node("span", { class: "looking" }, "Looking up its base release…"));
|
|
147
|
+
// The server refuses a CI build from whoever it refuses the image field from, and the
|
|
148
|
+
// image field on this same step says so; this said nothing until Create was refused.
|
|
149
|
+
if (!may()) {
|
|
150
|
+
out.append(node("br"), "Limited to admins on this server (", node("code", {}, "gui.create_policy admin"), ").");
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
out.append("Not a release or a CI build");
|
|
154
|
+
}
|
|
155
|
+
// The engine-kernel conflict the server found, said where the version is typed.
|
|
156
|
+
if (a && a.warning) { out.append(node("br"), a.warning); out.className = "hint bad"; }
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// ---- the license ------------------------------------------------------------------
|
|
160
|
+
function renderLicense() {
|
|
161
|
+
const has = S.license !== "";
|
|
162
|
+
ctx.$("#lic-pill").hidden = !has;
|
|
163
|
+
ctx.$("#lic-add").hidden = has || S.licOpen;
|
|
164
|
+
ctx.$("#lic-add").disabled = !may();
|
|
165
|
+
ctx.$("#lic-cancel").hidden = !S.licOpen;
|
|
166
|
+
ctx.$("#lic-b").hidden = !S.licOpen;
|
|
167
|
+
ctx.$("#lic-sum").hidden = !has || S.licOpen;
|
|
168
|
+
ctx.$("#lic-policy").hidden = may();
|
|
169
|
+
// Masked: its length and last four characters, never the text.
|
|
170
|
+
ctx.$("#lic-sum-t").replaceChildren(`License added${S.licFile ? ` from ${S.licFile}` : ""} · `
|
|
171
|
+
+ `${S.license.length.toLocaleString("en-US")} characters · `, node("code", {}, "…" + S.license.slice(-4)));
|
|
172
|
+
}
|
|
173
|
+
function openLicense() {
|
|
174
|
+
if (!may()) return;
|
|
175
|
+
S.licOpen = true;
|
|
176
|
+
renderLicense();
|
|
177
|
+
ctx.$("#lic").scrollIntoView({ block: "center" });
|
|
178
|
+
ctx.$("#lic-text").focus();
|
|
179
|
+
}
|
|
180
|
+
// The box closes as soon as a license is in it: pasted, or read from a file.
|
|
181
|
+
function commitLicense(text, file = "") {
|
|
182
|
+
const t = String(text || "").trim();
|
|
183
|
+
if (!t) return;
|
|
184
|
+
Object.assign(S, { license: t, licFile: file, licOpen: false });
|
|
185
|
+
ctx.$("#lic-text").value = "";
|
|
186
|
+
ctx.$("#lic-file").value = "";
|
|
187
|
+
renderLicense();
|
|
188
|
+
renderPresets();
|
|
189
|
+
}
|
|
190
|
+
function openToken() {
|
|
191
|
+
const adv = ctx.$("#create-dialog details.adv");
|
|
192
|
+
if (adv) adv.open = true;
|
|
193
|
+
const t = ctx.$("#create-form").reg_token;
|
|
194
|
+
if (t) { t.scrollIntoView({ block: "center" }); t.focus(); }
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// ---- the presets ------------------------------------------------------------------
|
|
198
|
+
function renderPresets() {
|
|
199
|
+
// A preset this place cannot take does not stay ticked from the last place.
|
|
200
|
+
for (const name of [...S.presets]) if (whyOff(name) === "Not on Kubernetes") S.presets.delete(name);
|
|
201
|
+
ctx.$("#plist").replaceChildren(...catalogue().map(({ name, description }) => {
|
|
202
|
+
const why = whyOff(name);
|
|
203
|
+
return node("label", { class: "prow" + (why ? " off" : "") },
|
|
204
|
+
node("input", { type: "checkbox", name: "preset", value: name, checked: ticked(name), disabled: !!why }),
|
|
205
|
+
node("span", { class: "prow-t" }, node("span", { class: "prow-n" }, name),
|
|
206
|
+
node("span", { class: "prow-d", title: description }, firstSentence(description))),
|
|
207
|
+
why ? node("span", { class: "prow-why" }, why) : null);
|
|
208
|
+
}));
|
|
209
|
+
ctx.$("#pnone").hidden = S.presets.size > 0;
|
|
210
|
+
const combo = ctx.$("#pcombo");
|
|
211
|
+
combo.hidden = S.presets.size < 2;
|
|
212
|
+
combo.replaceChildren("Combined: ", node("b", {}, presetText()),
|
|
213
|
+
...[...new Set(PAIR_NOTES.filter(([pair]) => pair.every(ticked)).map(([, note]) => note))]
|
|
214
|
+
.map((note) => node("p", {}, note)));
|
|
215
|
+
// A 9.x release (or a CI build based on one), a sign-in preset, and nothing licensing it.
|
|
216
|
+
const major = baseMajor(), kinds = signInKinds();
|
|
217
|
+
const token = ctx.$("#create-form").reg_token;
|
|
218
|
+
const v9 = ctx.$("#v9");
|
|
219
|
+
v9.hidden = !(major >= 9 && kinds.length && !S.license && !(token && token.value.trim()));
|
|
220
|
+
v9.replaceChildren(
|
|
221
|
+
`Rocket.Chat 9.0 is set to require a Premium plan for ${andJoin(kinds)} sign-in. `
|
|
222
|
+
+ "Without a license or a registration token, those sign-ins may be refused. ",
|
|
223
|
+
node("button", { type: "button", class: "linkbtn", onclick: openLicense, disabled: !may() }, "Add a license"), " or a ",
|
|
224
|
+
node("button", { type: "button", class: "linkbtn", onclick: openToken }, "registration token"), ".");
|
|
225
|
+
ctx.$("#ppanels").replaceChildren(...[...S.presets].sort().map(paramPanel).filter(Boolean));
|
|
226
|
+
if (ctx.$("#create-foot-hint") && ctx.$("#create-step-2") && !ctx.$("#create-step-2").hidden) {
|
|
227
|
+
ctx.$("#create-foot-hint").textContent = ctx.createSummaryLine();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// One settings row: the label on the left, the control and its hint on the right.
|
|
232
|
+
const row = (label, ...v) => [node("div", { class: "k" }, label), node("div", { class: "v" }, ...v)];
|
|
233
|
+
const num = (p, key, dflt) => node("input", { class: "num", type: "number", min: "1",
|
|
234
|
+
value: P(p)[key] ?? dflt, "data-p": p, "data-k": key });
|
|
235
|
+
const txt = (p, key, placeholder) => node("input", { class: "txt", value: P(p)[key] ?? "", placeholder,
|
|
236
|
+
"data-p": p, "data-k": key });
|
|
237
|
+
// A checkbox stores the param's own words: on/off, houston/none, true/false.
|
|
238
|
+
const check = (p, key, [yes, no], dflt, text, opt) => node("label", { class: "ck" },
|
|
239
|
+
node("input", { type: "checkbox", checked: (P(p)[key] ?? dflt) === yes, "data-p": p, "data-k": key,
|
|
240
|
+
"data-yes": yes, "data-no": no }),
|
|
241
|
+
node("span", {}, text, opt ? node("span", { class: "opt" }, " " + opt) : null));
|
|
242
|
+
function seg(p, key, options, { value = P(p)[key] ?? options[0][0], disabled = false } = {}) {
|
|
243
|
+
return node("div", { class: "seg" + (disabled ? " off" : ""), role: "group" },
|
|
244
|
+
...options.map(([v, label]) => node("button", { type: "button", "aria-pressed": String(v === value),
|
|
245
|
+
disabled, "data-p": p, "data-k": key, "data-v": v }, label)));
|
|
246
|
+
}
|
|
247
|
+
const hint = (text) => node("p", { class: "hint" }, text);
|
|
248
|
+
// Every key without a designed control: a text field for `--set key=value`, labelled by
|
|
249
|
+
// the key, with the catalogue's help under it -- what this dialog has always offered.
|
|
250
|
+
const plain = (p, key, help) => row(node("code", {}, key), txt(p, key, defaultOf(help)), hint(help));
|
|
251
|
+
|
|
252
|
+
const DESIGNED = {
|
|
253
|
+
// Rocket.Chat's own setting names, as Workspace > Settings > End-to-end encryption shows them.
|
|
254
|
+
e2ee: {
|
|
255
|
+
policy: () => row("Policy", seg("e2ee", "policy", [["optional", "Optional"], ["default", "On by default"], ["enforced", "Enforced"]]),
|
|
256
|
+
hint({ default: "New DMs and private rooms start encrypted; people may turn it off.",
|
|
257
|
+
enforced: "New private rooms must be encrypted. Needs Rocket.Chat 8.8.0 or later." }[P("e2ee").policy]
|
|
258
|
+
?? "People choose encryption for each DM or private room.")),
|
|
259
|
+
users: () => row("Test users", check("e2ee", "users", ["on", "off"], "on",
|
|
260
|
+
"e2e-alice, e2e-bob and e2e-carol", "(password = username)")),
|
|
261
|
+
files: () => row("Files", check("e2ee", "files", ["on", "off"], "on", "Encrypt files")),
|
|
262
|
+
allow_unencrypted: () => row("Plaintext", check("e2ee", "allow_unencrypted", ["on", "off"], "off",
|
|
263
|
+
"Unencrypted messages in encrypted rooms")),
|
|
264
|
+
},
|
|
265
|
+
ldap: {
|
|
266
|
+
users: () => row("Users", num("ldap", "users", "5")),
|
|
267
|
+
domain: () => row("Domain", txt("ldap", "domain", "example.com")),
|
|
268
|
+
directory: () => row("Directory", seg("ldap", "directory", [["openldap", "OpenLDAP"], ["ad", "Active Directory"]]),
|
|
269
|
+
hint(P("ldap").directory === "ad" ? "Samba answering as Active Directory: sAMAccountName, objectGUID, nested groups"
|
|
270
|
+
: "OpenLDAP, with phpLDAPadmin to browse it")),
|
|
271
|
+
groups: () => row("Groups", check("ldap", "groups", ["on", "off"], "off",
|
|
272
|
+
"Lab groups: rocket-chat, rocket-admin, employee; only rocket-chat may sign in")),
|
|
273
|
+
bind: () => row("Bind", seg("ldap", "bind", [["admin", "Admin"], ["service", "Read-only service account"]]),
|
|
274
|
+
P("ldap").bind === "service" && P("ldap").directory !== "ad"
|
|
275
|
+
? hint("Limited to 500 entries per search, as many real directories are.") : null),
|
|
276
|
+
tls: () => row("Encryption", seg("ldap", "tls", [["none", "None"], ["ldaps", "LDAPS"], ["starttls", "StartTLS"]]),
|
|
277
|
+
(P("ldap").tls ?? "none") === "none" ? null
|
|
278
|
+
: check("ldap", "trust", ["houston", "none"], "houston", "Trust houston's certificate authority",
|
|
279
|
+
"(untick to see an untrusted certificate)")),
|
|
280
|
+
trust: () => [],
|
|
281
|
+
idp: () => row("Single sign-on", seg("ldap", "idp", [["none", "None"], ["saml", "SAML"], ["oidc", "OIDC"]],
|
|
282
|
+
{ value: ldapIdp(), disabled: keycloakPreset() }),
|
|
283
|
+
keycloakPreset() ? hint("Uses the same Keycloak as the saml/oidc preset") : null,
|
|
284
|
+
ldapIdp() === "none" || keycloakPreset() ? null
|
|
285
|
+
: check("ldap", "mfa", ["on", "off"], "off", "Ask for a one-time code (TOTP) at sign-in")),
|
|
286
|
+
mfa: () => [],
|
|
287
|
+
// Only for ldap's own Keycloak: with a saml/oidc preset ticked, that panel's idp_host decides.
|
|
288
|
+
idp_host: (help) => ((P("ldap").idp ?? "none") === "none" || keycloakPreset() ? [] : plain("ldap", "idp_host", help)),
|
|
289
|
+
},
|
|
290
|
+
saml: { users: () => row("Users", num("saml", "users", "5")) },
|
|
291
|
+
oidc: { users: () => row("Users", num("oidc", "users", "5")) },
|
|
292
|
+
email: { verification: () => row("Verification", check("email", "verification", ["true", "false"], "false",
|
|
293
|
+
"Require email verification on new accounts")) },
|
|
294
|
+
s3_minio: { presigned: () => row("Presigned URLs", check("s3_minio", "presigned", ["true", "false"], "false",
|
|
295
|
+
"Serve downloads from presigned MinIO URLs, not through Rocket.Chat (your browser must "
|
|
296
|
+
+ "reach MinIO directly; breaks over HTTPS)")) },
|
|
297
|
+
// Each option is labelled as Rocket.Chat's settings and compose files name it, and its --set
|
|
298
|
+
// key is the same words, so a lab built here is repeated on the command line word for word.
|
|
299
|
+
// Each SIP option opens once the one it needs is on; on Kubernetes none is offered.
|
|
300
|
+
voice: {
|
|
301
|
+
sip_integration: () => (runtime() === "kubernetes"
|
|
302
|
+
? row("SIP integration", hint("SIP integration and the PBX run on Docker only. Calls between users work here."))
|
|
303
|
+
: row("SIP integration", check("voice", "sip_integration", ["on", "off"], "off", "Drachtio (signaling gateway) and FreeSWITCH (SIP provider)",
|
|
304
|
+
"(dial numbers, take calls from a PBX)"),
|
|
305
|
+
voiceOn("sip_integration") ? hint("voice-alice and voice-bob get Voice call extensions 1001 and 1002. Dial 123 to hear yourself.") : null)),
|
|
306
|
+
voip_domain: () => (voiceShown("voip_domain") ? row("VoIP domain", txt("voice", "voip_domain", "freeswitch (a browser on this server only)"),
|
|
307
|
+
hint("VOIP_DOMAIN in rocketchat-compose: the address browsers and phones send RTP audio to. For a browser on another computer: this server's LAN or public IP, or a name that points straight at it.")) : []),
|
|
308
|
+
rtp_ports: () => (voiceShown("rtp_ports") ? row("RTP ports", txt("voice", "rtp_ports", "20000-20046"),
|
|
309
|
+
hint("UDP, start-end, at most 200 (VOIP_RTP_START_PORT to VOIP_RTP_END_PORT). A second SIP workspace on this server needs its own range.")) : []),
|
|
310
|
+
pbx: () => (voiceShown("pbx") ? row("PBX", check("voice", "pbx", ["on", "off"], "off",
|
|
311
|
+
"A lab PBX (Asterisk)", "(desk phones, ring groups, an outside caller)"),
|
|
312
|
+
voiceOn("pbx") ? hint("Connected to FreeSWITCH's external profile the way compose.freeswitch.external.yml connects external calls.") : null) : []),
|
|
313
|
+
freeswitch_dialplans: () => (voiceShown("freeswitch_dialplans") ? row("FreeSWITCH dialplans",
|
|
314
|
+
seg("voice", "freeswitch_dialplans", [["stock", "stock"], ["edit", "edit"]]),
|
|
315
|
+
hint(P("voice").freeswitch_dialplans === "edit"
|
|
316
|
+
? "edit: public.xml and drachtio.xml as editable copies in the workspace folder, kept across rebuilds and backups."
|
|
317
|
+
: "stock: as FreeSWITCH writes them. edit: editable copies in the workspace folder.")) : []),
|
|
318
|
+
ice_servers: () => row("ICE servers", txt("voice", "ice_servers", "Rocket.Chat's own"),
|
|
319
|
+
hint("Rocket.Chat's ICE servers setting (WebRTC settings): stun:, turn: or turns:host:port, comma-separated; user:password@ is allowed and shown masked. Empty keeps Rocket.Chat's own (Google STUN).")),
|
|
320
|
+
},
|
|
321
|
+
};
|
|
322
|
+
const ORDER = { ldap: ["users", "domain", "directory", "groups", "bind", "tls", "trust", "idp", "mfa", "idp_host"],
|
|
323
|
+
e2ee: ["policy", "users", "files", "allow_unencrypted"],
|
|
324
|
+
voice: ["sip_integration", "voip_domain", "rtp_ports", "pbx", "freeswitch_dialplans", "ice_servers"] };
|
|
325
|
+
|
|
326
|
+
function paramPanel(name) {
|
|
327
|
+
const help = presetOf(name).params_help || {}, keys = Object.keys(help);
|
|
328
|
+
if (!keys.length) return null;
|
|
329
|
+
const first = (ORDER[name] || []).filter((k) => keys.includes(k));
|
|
330
|
+
const designed = DESIGNED[name] || {};
|
|
331
|
+
const rows = [...first, ...keys.filter((k) => !first.includes(k))]
|
|
332
|
+
.map((k) => (designed[k] ? designed[k](help[k]) : plain(name, k, help[k])));
|
|
333
|
+
return node("section", { class: "ppanel" }, node("div", { class: "ppanel-h" }, name),
|
|
334
|
+
node("div", { class: "prm" }, ...rows.flat()));
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// ---- what the create sends ------------------------------------------------------------
|
|
338
|
+
// One preset: `preset` and its params as `--set` keys, as this dialog has always sent.
|
|
339
|
+
// Several: `presets` and each one's params under its own name. ldap's own single sign-on is
|
|
340
|
+
// left out when a saml/oidc preset already brings the Keycloak.
|
|
341
|
+
function optionsRequest() {
|
|
342
|
+
const names = [...S.presets].sort();
|
|
343
|
+
const paramsOf = (p) => {
|
|
344
|
+
const out = {};
|
|
345
|
+
for (const [k, v] of Object.entries(S.params[p] || {})) {
|
|
346
|
+
if (String(v).trim() === "") continue;
|
|
347
|
+
if (p === "ldap" && keycloakPreset() && ["idp", "mfa", "idp_host"].includes(k)) continue;
|
|
348
|
+
if (p === "voice" && !voiceShown(k)) continue;
|
|
349
|
+
out[k] = String(v).trim();
|
|
350
|
+
}
|
|
351
|
+
return out;
|
|
352
|
+
};
|
|
353
|
+
const req = names.length > 1
|
|
354
|
+
? { presets: names, params: Object.fromEntries(names.map((p) => [p, paramsOf(p)])) }
|
|
355
|
+
: { preset: names[0] || "default", params: names[0] ? paramsOf(names[0]) : {} };
|
|
356
|
+
if (S.license) req.license = S.license;
|
|
357
|
+
return req;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function initOptions(preset) {
|
|
361
|
+
S = fresh();
|
|
362
|
+
if (preset && preset !== "default" && catalogue().some((p) => p.name === preset)) S.presets.add(preset);
|
|
363
|
+
ctx.$("#lic-text").value = "";
|
|
364
|
+
ctx.$("#lic-file").value = "";
|
|
365
|
+
onVersion(ctx.$("#create-form").version.value);
|
|
366
|
+
renderOptions();
|
|
367
|
+
}
|
|
368
|
+
function renderOptions() { renderVersion(); renderLicense(); renderPresets(); }
|
|
369
|
+
|
|
370
|
+
// ---- events -----------------------------------------------------------------------
|
|
371
|
+
const form = ctx.$("#create-form");
|
|
372
|
+
form.addEventListener("change", (e) => {
|
|
373
|
+
const t = e.target;
|
|
374
|
+
if (t.name === "preset" && t.closest("#plist")) {
|
|
375
|
+
if (t.checked) S.presets.add(t.value); else S.presets.delete(t.value);
|
|
376
|
+
renderPresets();
|
|
377
|
+
} else if (t.dataset.p && t.type === "checkbox") {
|
|
378
|
+
P(t.dataset.p)[t.dataset.k] = t.checked ? t.dataset.yes : t.dataset.no;
|
|
379
|
+
renderPresets();
|
|
380
|
+
} else if (t.id === "lic-file" && t.files[0]) {
|
|
381
|
+
const file = t.files[0];
|
|
382
|
+
file.text().then((text) => commitLicense(text, file.name));
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
form.addEventListener("input", (e) => {
|
|
386
|
+
const t = e.target;
|
|
387
|
+
if (t.name === "version") onVersion(t.value);
|
|
388
|
+
else if (t.name === "reg_token") renderPresets();
|
|
389
|
+
else if (t.dataset.p && t.type !== "checkbox") P(t.dataset.p)[t.dataset.k] = t.value;
|
|
390
|
+
});
|
|
391
|
+
form.addEventListener("click", (e) => {
|
|
392
|
+
const b = e.target.closest("button");
|
|
393
|
+
if (!b) return;
|
|
394
|
+
if (b.dataset.v && b.dataset.p && !b.disabled) { P(b.dataset.p)[b.dataset.k] = b.dataset.v; renderPresets(); }
|
|
395
|
+
else if (b.id === "lic-add" || b.id === "lic-replace") openLicense();
|
|
396
|
+
else if (b.id === "lic-cancel") { S.licOpen = false; ctx.$("#lic-text").value = ""; renderLicense(); }
|
|
397
|
+
else if (b.id === "lic-remove") { Object.assign(S, { license: "", licFile: "" }); renderLicense(); renderPresets(); }
|
|
398
|
+
});
|
|
399
|
+
ctx.$("#lic-text").addEventListener("paste", () => setTimeout(() => commitLicense(ctx.$("#lic-text").value), 0));
|
|
400
|
+
ctx.$("#lic-text").addEventListener("blur", () => commitLicense(ctx.$("#lic-text").value));
|
|
401
|
+
|
|
402
|
+
Object.defineProperties(ctx, {
|
|
403
|
+
"initOptions": { enumerable: true, get: () => initOptions },
|
|
404
|
+
"renderOptions": { enumerable: true, get: () => renderOptions },
|
|
405
|
+
"optionsRequest": { enumerable: true, get: () => optionsRequest },
|
|
406
|
+
"optionsPresetText": { enumerable: true, get: () => presetText },
|
|
407
|
+
});
|
|
408
|
+
export { initOptions, renderOptions, optionsRequest, presetText as optionsPresetText };
|