Skip to content

Commit 115da0b

Browse files
Removes the TopBar form (#103)
This removes the TopBar form, which removes any problems around it. Our doc page is only for our current API. Note, this doesn't need any custom build to accomplish, just a (non-intuitive) change to swagger-initializer.js. As this change is against the gh-pages branch, I can't also update build-bin/README.md on master. I'll do that in a separate PR once it is verified to fix the issue. Later, we can make GH automation to regenerate the dist by unzipping the swagger dist overwriting everything except our IDL and swagger-initializer.js. Signed-off-by: Adrian Cole <[email protected]>
1 parent 75b3c49 commit 115da0b

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

swagger-initializer.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
window.onload = function() {
1+
window.onload = function () {
22
//<editor-fold desc="Changeable Configuration Block">
33

4-
// the following lines will be replaced by docker/configurator, when it runs in a docker-container
4+
// Changes from defaults include the url and skipping the first standalone
5+
// preset, as that loads the TopBar. We don't need to load arbitrary API
6+
// definitions and forms increase the XSS attack surface.
57
window.ui = SwaggerUIBundle({
68
url: "https://zipkin.io/zipkin-api/zipkin2-api.yaml",
79
dom_id: '#swagger-ui',
810
deepLinking: true,
911
presets: [
10-
SwaggerUIBundle.presets.apis,
11-
SwaggerUIStandalonePreset
12-
],
13-
plugins: [
14-
SwaggerUIBundle.plugins.DownloadUrl
12+
SwaggerUIBundle.presets.apis,
13+
14+
// Retain defaults, except index zero, which is the TopBar.
15+
// https://github.com/swagger-api/swagger-ui/blob/v5.11.8/src/standalone/presets/standalone/index.js#L10
16+
SwaggerUIStandalonePreset.slice(1)
1517
],
18+
plugins: [SwaggerUIBundle.plugins.DownloadUrl],
1619
layout: "StandaloneLayout"
1720
});
1821

0 commit comments

Comments
 (0)