mirror of
https://github.com/ether/etherpad-lite.git
synced 2026-07-18 17:13:58 +00:00
* feat(admin): explain env-var substitution in /settings, surface auth errors (#7819) Three small, env-var-only UX improvements driven by issue #7819, where a Docker operator saved an ep_oauth block in the admin /settings raw view and reported it "disappeared" — but the underlying confusion was that settings.json on disk is a *template*, not the effective config. None of these changes is visible to installs that don't use ${VAR} placeholders. * Banner above the editor explaining the template/env-substitution model, only rendered when the loaded file contains a ${VAR} placeholder. Tells the operator that the file is not env-substituted in place and that the Effective tab shows the live values. * Effective tab in the mode toggle, read-only, also gated on ${VAR}. The backend was already emitting redacted runtime settings as `resolved` alongside every `load`; the SPA now exposes them so an operator can verify what Etherpad is actually using. * admin_auth_error event from the /settings socket handler. The handler previously silently returned when the connecting session wasn't admin, which made misrouted Traefik+SSO auth look like "save did nothing" with no error path in the UI. Emit a dedicated event before dropping the socket so the SPA can show a clear toast. Tests: - src/tests/backend/specs/admin/adminSettingsAuthError.ts — new spec for the auth_error/disconnect contract. - src/tests/frontend-new/admin-spec/adminsettings.spec.ts — new Playwright test asserting the banner + Effective tab only appear after a ${VAR} is added to settings.json, and that the Effective view is read-only + shows [REDACTED] for secrets. No behaviour change for installs without ${VAR} placeholders — banner, Effective tab, and auth-error contract are all the same as before. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(admin): drop fragile pre-condition + add reconnect-loop guard (#7819) CI's admin-UI workflow seeds settings.json by copying settings.json.template verbatim, which contains ~30 \${VAR} placeholders. The new Playwright test asserted "banner not present before adding placeholder" — true on a fresh dev machine, false in CI. Drop that assertion: the negative path is covered by the SettingsPage ENV_VAR_PATTERN regex itself; what matters at the UI level is the positive path (banner + Effective tab render correctly when placeholders are present), which this test still exercises. Also: the server's admin_auth_error path calls socket.disconnect(), which the SPA's existing disconnect handler interprets as "io server disconnect" and immediately reconnects — creating a reject/reconnect loop. Track an authErrored flag and suppress the reconnect once an auth_error has been received. Reset on successful connect, so a legitimate re-auth path still works. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
347 lines
7 KiB
CSS
347 lines
7 KiB
CSS
/* Raw textarea (kept dark to signal "this is code") */
|
|
textarea.settings {
|
|
font-family: "Fira Code", "Cascadia Code", "Source Code Pro", monospace;
|
|
font-size: 14px;
|
|
white-space: pre;
|
|
overflow-wrap: normal;
|
|
overflow-x: auto;
|
|
width: 100%;
|
|
height: 500px;
|
|
padding: 15px;
|
|
background-color: #1e1e1e;
|
|
color: #d4d4d4;
|
|
line-height: 1.5;
|
|
border: 1px solid #333;
|
|
resize: vertical;
|
|
}
|
|
textarea.settings:focus {
|
|
outline: 2px solid #007acc;
|
|
outline-offset: -1px;
|
|
}
|
|
|
|
.settings-button-bar {
|
|
display: flex;
|
|
flex-shrink: 0;
|
|
gap: 10px;
|
|
margin-top: 15px;
|
|
}
|
|
|
|
.settings-links {
|
|
display: flex;
|
|
gap: 20px;
|
|
margin-top: 20px;
|
|
padding-top: 20px;
|
|
border-top: 1px solid #ddd;
|
|
}
|
|
|
|
/* --- env-var banner --- */
|
|
/* Shown only when settings.json contains ${VAR} placeholders. The
|
|
typical reader is a Docker/K8s operator who has just been surprised
|
|
by env-var substitution semantics, so the copy must explain rather
|
|
than warn — visual weight matches a note, not an error. */
|
|
.settings-envvar-banner {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
gap: 12px;
|
|
padding: 12px 16px;
|
|
margin-bottom: 16px;
|
|
background: #f5f7ff;
|
|
border: 1px solid #c7d2fe;
|
|
border-radius: 6px;
|
|
color: #1e293b;
|
|
}
|
|
.settings-envvar-banner svg {
|
|
flex-shrink: 0;
|
|
color: #4f46e5;
|
|
margin-top: 2px;
|
|
}
|
|
.settings-envvar-banner strong {
|
|
display: block;
|
|
margin-bottom: 4px;
|
|
}
|
|
.settings-envvar-banner p {
|
|
margin: 0;
|
|
font-size: 13px;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
/* --- mode toggle --- */
|
|
.settings-mode-toggle {
|
|
display: inline-flex;
|
|
flex-shrink: 0;
|
|
border: 1px solid #ccc;
|
|
border-radius: 6px;
|
|
overflow: hidden;
|
|
margin-bottom: 16px;
|
|
background: #fff;
|
|
}
|
|
.settings-mode-toggle button {
|
|
padding: 6px 14px;
|
|
border: 0;
|
|
background: transparent;
|
|
color: #555;
|
|
font: inherit;
|
|
cursor: pointer;
|
|
}
|
|
.settings-mode-toggle button.active {
|
|
background: var(--etherpad-color, #0f775b);
|
|
color: #fff;
|
|
}
|
|
|
|
/* --- form (light, two-column) --- */
|
|
.settings-form {
|
|
font-family: inherit;
|
|
font-size: 14px;
|
|
color: #333;
|
|
}
|
|
|
|
.settings-section {
|
|
background: #fff;
|
|
border: 1px solid #ddd;
|
|
border-radius: 6px;
|
|
margin-bottom: 18px;
|
|
overflow: hidden;
|
|
}
|
|
.settings-section-header {
|
|
padding: 14px 18px;
|
|
border-bottom: 1px solid #eee;
|
|
background: #fafafa;
|
|
}
|
|
.settings-section-header h2 {
|
|
margin: 0;
|
|
font-size: 15px;
|
|
font-weight: 600;
|
|
color: #222;
|
|
letter-spacing: 0.01em;
|
|
text-transform: uppercase;
|
|
}
|
|
.settings-section-header p {
|
|
margin: 4px 0 0;
|
|
font-size: 13px;
|
|
color: #666;
|
|
white-space: pre-wrap;
|
|
}
|
|
.settings-section-body {
|
|
padding: 4px 0;
|
|
}
|
|
|
|
/* Two-column row: label | control, with help below spanning column 2.
|
|
* Single-column on narrow widths. */
|
|
.settings-row {
|
|
display: grid;
|
|
grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
|
|
gap: 6px 18px;
|
|
padding: 10px 18px;
|
|
align-items: center;
|
|
border-top: 1px solid #f4f4f4;
|
|
}
|
|
.settings-row:first-child {
|
|
border-top: 0;
|
|
}
|
|
.settings-row-label {
|
|
font-weight: 600;
|
|
color: #333;
|
|
word-break: break-word;
|
|
}
|
|
.settings-row-control {
|
|
min-width: 0;
|
|
}
|
|
.settings-row-help {
|
|
grid-column: 2;
|
|
margin: 2px 0 0;
|
|
font-size: 12.5px;
|
|
color: #666;
|
|
white-space: pre-wrap;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
@media (max-width: 600px) {
|
|
.settings-row {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
.settings-row-help {
|
|
grid-column: 1;
|
|
}
|
|
}
|
|
|
|
/* --- nested subsections (objects/arrays inside a section) --- */
|
|
.settings-subsection {
|
|
grid-column: 1 / -1;
|
|
margin: 8px 18px;
|
|
border-left: 3px solid #e2e2e2;
|
|
padding-left: 14px;
|
|
}
|
|
.settings-subsection-header {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 2px;
|
|
padding: 8px 0;
|
|
}
|
|
.settings-subsection-title {
|
|
font-weight: 600;
|
|
color: #444;
|
|
font-size: 13.5px;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.01em;
|
|
}
|
|
.settings-subsection-help {
|
|
color: #777;
|
|
font-size: 12.5px;
|
|
white-space: pre-wrap;
|
|
}
|
|
.settings-subsection-body .settings-row {
|
|
padding-left: 0;
|
|
padding-right: 0;
|
|
}
|
|
|
|
/* --- leaf widgets (light) --- */
|
|
.settings-widget-string,
|
|
.settings-widget-number {
|
|
width: 100%;
|
|
background: #fff;
|
|
color: #222;
|
|
border: 1px solid #ccc;
|
|
border-radius: 4px;
|
|
padding: 6px 10px;
|
|
font-family: inherit;
|
|
font-size: inherit;
|
|
}
|
|
.settings-widget-string:focus,
|
|
.settings-widget-number:focus {
|
|
outline: none;
|
|
border-color: var(--etherpad-color, #0f775b);
|
|
box-shadow: 0 0 0 3px rgba(15, 119, 91, 0.15);
|
|
}
|
|
.settings-widget-number.invalid {
|
|
border-color: #ce5050;
|
|
}
|
|
.settings-widget-null {
|
|
display: inline-block;
|
|
padding: 2px 8px;
|
|
border-radius: 10px;
|
|
background: #f0f0f0;
|
|
color: #888;
|
|
font-style: italic;
|
|
font-size: 12.5px;
|
|
}
|
|
.settings-widget-env {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
background: #f4f8ff;
|
|
color: #335;
|
|
border: 1px dashed #88a;
|
|
border-radius: 12px;
|
|
padding: 2px 10px;
|
|
font-size: 13px;
|
|
}
|
|
.settings-widget-env-icon {
|
|
font-style: normal;
|
|
color: #557;
|
|
}
|
|
.settings-widget-env-name {
|
|
font-family: "Fira Code", monospace;
|
|
font-weight: 600;
|
|
}
|
|
.settings-widget-env-default-label {
|
|
color: #557;
|
|
font-size: 12px;
|
|
text-transform: lowercase;
|
|
}
|
|
.settings-widget-env-default-input {
|
|
background: white;
|
|
border: 1px solid #ccd;
|
|
border-radius: 6px;
|
|
padding: 1px 6px;
|
|
font-family: "Fira Code", monospace;
|
|
font-size: 13px;
|
|
color: #804;
|
|
min-width: 80px;
|
|
max-width: 240px;
|
|
width: auto;
|
|
}
|
|
.settings-widget-env-default-input:focus {
|
|
outline: 2px solid var(--accent, #2b8a3e);
|
|
outline-offset: 1px;
|
|
}
|
|
.settings-widget-env-runtime {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
margin-left: 4px;
|
|
padding: 1px 8px;
|
|
border-radius: 10px;
|
|
background: #e6f4ea;
|
|
color: #1e5631;
|
|
font-family: "Fira Code", monospace;
|
|
font-size: 12px;
|
|
}
|
|
.settings-widget-env-runtime-redacted {
|
|
background: #ececec;
|
|
color: #555;
|
|
}
|
|
.settings-widget-env-runtime-arrow {
|
|
opacity: 0.6;
|
|
}
|
|
.settings-widget-env-runtime-label {
|
|
font-style: italic;
|
|
opacity: 0.7;
|
|
}
|
|
.settings-widget-env-runtime-value {
|
|
font-weight: 600;
|
|
}
|
|
|
|
/* Radix switch (boolean) */
|
|
.settings-widget-boolean {
|
|
appearance: none;
|
|
width: 36px;
|
|
height: 20px;
|
|
border-radius: 999px;
|
|
background: #ccc;
|
|
border: 0;
|
|
position: relative;
|
|
cursor: pointer;
|
|
transition: background 120ms ease;
|
|
padding: 0;
|
|
}
|
|
.settings-widget-boolean[data-state="checked"] {
|
|
background: var(--etherpad-color, #0f775b);
|
|
}
|
|
.settings-widget-boolean-thumb {
|
|
display: block;
|
|
width: 16px;
|
|
height: 16px;
|
|
background: #fff;
|
|
border-radius: 50%;
|
|
transform: translateX(2px);
|
|
transition: transform 120ms ease;
|
|
box-shadow: 0 1px 2px rgba(0,0,0,0.2);
|
|
}
|
|
.settings-widget-boolean[data-state="checked"] .settings-widget-boolean-thumb {
|
|
transform: translateX(18px);
|
|
}
|
|
|
|
/* --- parse error --- */
|
|
.settings-parse-error {
|
|
border: 1px solid #d99;
|
|
background: #fff5f5;
|
|
color: #842;
|
|
padding: 14px 18px;
|
|
border-radius: 6px;
|
|
}
|
|
.settings-parse-error-detail {
|
|
margin: 8px 0;
|
|
white-space: pre-wrap;
|
|
font-family: "Fira Code", monospace;
|
|
font-size: 12.5px;
|
|
}
|
|
.settings-parse-error button {
|
|
margin-top: 4px;
|
|
background: var(--etherpad-color, #0f775b);
|
|
color: #fff;
|
|
border: 0;
|
|
padding: 6px 14px;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font: inherit;
|
|
}
|