Skip to content

Commit 14a0350

Browse files
JohnMcLearclaude
andcommitted
feat(api-docs): swap RapiDoc for Scalar (actively maintained)
Per @SamTV12345's review on #7757: RapiDoc has been effectively unmaintained for a while. Scalar (https://github.com/scalar/scalar) is MIT-licensed, actively developed, and ships a self-contained standalone bundle that works the same way for our purposes. Privacy posture is preserved by configuring the embed: - withDefaultFonts: false (no fonts.scalar.com woff2 fetch) - telemetry: false (defensive) - agent.disabled: true (no api.scalar.com/vector/* calls) - mcp.disabled: true (no MCP integration) - showDeveloperTools: 'never' - hideClientButton: true Verified with headless Chromium: page loads /api-docs, mounts Scalar, renders the Etherpad OpenAPI document, and makes zero requests to any host other than localhost. Vendor: - src/static/vendor/scalar/standalone.js (@scalar/api-reference 1.57.2) - src/static/vendor/scalar/VERSION (sha256 pinned) - src/static/vendor/scalar/LICENSE (MIT) Removed: - src/static/vendor/rapidoc/* Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3539dcb commit 14a0350

9 files changed

Lines changed: 2412 additions & 3942 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
### Notable enhancements
88

99
- **Privacy — drop swagger-ui telemetry, document phone-homes, add opt-outs.**
10-
- Dropped `swagger-ui-express` because upstream injects a Scarf analytics pixel that cannot be disabled at install or runtime (see [swagger-api/swagger-ui#10573](https://github.com/swagger-api/swagger-ui/issues/10573)). `/api-docs` now serves a vendored copy of [RapiDoc](https://rapidocweb.com/) (MIT) with `load-fonts="false"` and explicit system-font stacks so no Google Fonts request is made either.
10+
- Dropped `swagger-ui-express` because upstream injects a Scarf analytics pixel that cannot be disabled at install or runtime (see [swagger-api/swagger-ui#10573](https://github.com/swagger-api/swagger-ui/issues/10573)). `/api-docs` now serves a vendored copy of [Scalar](https://github.com/scalar/scalar) (MIT) configured with `withDefaultFonts: false` and `telemetry: false` so no outbound calls are made.
1111
- New `privacy.updateCheck` (default `true`) — set to `false` to disable the hourly `UpdateCheck.ts` request to `${updateServer}/info.json`.
1212
- New `privacy.pluginCatalog` (default `true`) — set to `false` to disable the admin plugins page fetch of `${updateServer}/plugins.json`. CLI install-by-name still works.
1313
- New [`PRIVACY.md`](PRIVACY.md) at repo root documenting both outbound calls, what they send, and how to turn each off.

PRIVACY.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ No analytics, no usage pings, no third-party SDKs at runtime.
4141
`swagger-ui-express` was dropped because the upstream npm package
4242
injects a Scarf analytics pixel that cannot be disabled at install or
4343
runtime (see [swagger-api/swagger-ui#10573](https://github.com/swagger-api/swagger-ui/issues/10573)).
44-
`/api-docs` is now served by a vendored copy of [RapiDoc](https://rapidocweb.com/)
45-
(MIT) with no outbound calls. The shell explicitly opts out of RapiDoc's
46-
default Google-Fonts fetch by setting `load-fonts="false"` and explicit
47-
system-font stacks.
44+
`/api-docs` is now served by a vendored copy of [Scalar](https://github.com/scalar/scalar)
45+
(MIT) with no outbound calls. The shell explicitly opts out of Scalar's
46+
default font fetch (`withDefaultFonts: false`) and analytics
47+
(`telemetry: false`), and pins a system-font stack via CSS.
4848

4949
`@scarf/scarf` is listed under `ignoredBuiltDependencies` in
5050
`pnpm-workspace.yaml`, so its postinstall pixel is suppressed even if a

src/static/api-docs.html

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,29 @@
55
<title>Etherpad API</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1" />
77
<meta name="referrer" content="no-referrer" />
8-
<script type="module" src="/static/vendor/rapidoc/rapidoc-min.js"></script>
98
<style>
109
html, body { margin: 0; padding: 0; height: 100%; }
11-
rapi-doc { height: 100vh; }
12-
/* RapiDoc ships @font-face rules pointing at fonts.gstatic.com.
13-
Override every font-family rule that mentions Open Sans so the
14-
browser never fetches the woff2 from Google. */
15-
rapi-doc::part(label-input), rapi-doc { font-family: system-ui, -apple-system, sans-serif !important; }
10+
/* Scalar ships @font-face rules pointing at fonts.scalar.com.
11+
withDefaultFonts:false disables that import; the rule below
12+
forces a system-font stack so nothing fetches over the wire. */
13+
:root, .scalar-app, body { font-family: system-ui, -apple-system, sans-serif !important; }
1614
</style>
1715
</head>
1816
<body>
19-
<rapi-doc
20-
spec-url="/api-docs.json"
21-
theme="light"
22-
render-style="read"
23-
show-header="false"
24-
allow-server-selection="false"
25-
allow-authentication="true"
26-
regular-font="system-ui, -apple-system, sans-serif"
27-
mono-font="ui-monospace, SFMono-Regular, monospace"
28-
load-fonts="false"
29-
></rapi-doc>
17+
<div id="app"></div>
18+
<script src="/static/vendor/scalar/standalone.js"></script>
19+
<script>
20+
Scalar.createApiReference('#app', {
21+
url: '/api-docs.json',
22+
theme: 'default',
23+
layout: 'modern',
24+
hideClientButton: true,
25+
showDeveloperTools: 'never',
26+
withDefaultFonts: false,
27+
telemetry: false,
28+
agent: { disabled: true },
29+
mcp: { disabled: true }
30+
});
31+
</script>
3032
</body>
3133
</html>

src/static/vendor/rapidoc/LICENSE

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/static/vendor/rapidoc/VERSION

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/static/vendor/rapidoc/rapidoc-min.js

Lines changed: 0 additions & 3895 deletions
This file was deleted.

src/static/vendor/scalar/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023-present Scalar
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

src/static/vendor/scalar/VERSION

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@scalar/api-reference 1.57.2 (standalone bundle) - vendored 2026-05-16
2+
source: https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.57.2/dist/browser/standalone.js
3+
sha256: 538bea0c451ae72ca26242244491a35b3bee4e1ba282f0076f454a68b83788e5

src/static/vendor/scalar/standalone.js

Lines changed: 2364 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)