|
|
@@ -2,8 +2,24 @@
|
|
|
<html lang="en"><head><meta charset="utf-8"><title>smartbotic-vectorapi API</title>
|
|
|
<meta name="viewport" content="width=device-width,initial-scale=1"></head>
|
|
|
<body style="margin:0">
|
|
|
- <rapi-doc spec-url="/openapi.json" theme="dark" bg-color="#0b0f17" text-color="#e5e7eb"
|
|
|
+ <rapi-doc theme="dark" bg-color="#0b0f17" text-color="#e5e7eb"
|
|
|
render-style="read" show-header="false" allow-try="true"
|
|
|
regular-font="system-ui, sans-serif"></rapi-doc>
|
|
|
- <script type="module" src="/docs/rapidoc-min.js"></script>
|
|
|
+ <script>
|
|
|
+ // This page is served from <mount>/docs, with or without a trailing slash,
|
|
|
+ // and a subpath reverse proxy (e.g. nginx `location /rag/`) strips the prefix
|
|
|
+ // before the server sees it. So derive the mount prefix here rather than
|
|
|
+ // hardcoding absolute URLs, which 404 whenever the app is not at the root.
|
|
|
+ // '/docs' -> '' '/rag/docs' -> '/rag'
|
|
|
+ // '/docs/' -> '' '/rag/docs/' -> '/rag'
|
|
|
+ var BASE = location.pathname.replace(/\/docs\/?$/, '');
|
|
|
+ var doc = document.querySelector('rapi-doc');
|
|
|
+ doc.setAttribute('spec-url', BASE + '/openapi.json');
|
|
|
+ // The spec declares no `servers`, so point "Try it" at this same mount.
|
|
|
+ doc.setAttribute('server-url', location.origin + BASE);
|
|
|
+ var s = document.createElement('script');
|
|
|
+ s.type = 'module';
|
|
|
+ s.src = BASE + '/docs/rapidoc-min.js';
|
|
|
+ document.body.appendChild(s);
|
|
|
+ </script>
|
|
|
</body></html>
|