index.html 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <!-- HTML for static distribution bundle build -->
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <title>Swagger UI</title>
  7. <link rel="stylesheet" type="text/css" href="./swagger-ui.css"/>
  8. <link rel="stylesheet" type="text/css" href="index.css"/>
  9. <link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32"/>
  10. <link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16"/>
  11. </head>
  12. <body>
  13. <div id="swagger-ui"></div>
  14. <script src="./swagger-ui-bundle.js" charset="UTF-8"></script>
  15. <script src="./swagger-ui-standalone-preset.js" charset="UTF-8"></script>
  16. <script src="./swagger-initializer.js" charset="UTF-8"></script>
  17. <script>
  18. window.onload = function () {
  19. const servicesUrl = new URL("/q/services", window.location.href);
  20. fetch(servicesUrl.toString())
  21. .then(response => response.json())
  22. .then(data => {
  23. const urls = data.services.filter((x) => [
  24. "grpc.health.v1.Health",
  25. "kratos.api.Metadata",
  26. "grpc.reflection.v1alpha.ServerReflection",
  27. ].indexOf(x) === -1).map((x) => {
  28. const url = new URL("/q/service/" + x, window.location.href);
  29. return {url: url.toString(), name: x}
  30. });
  31. // Begin Swagger UI call region
  32. const ui = SwaggerUIBundle({
  33. urls: urls,
  34. dom_id: '#swagger-ui',
  35. deepLinking: true,
  36. presets: [
  37. SwaggerUIBundle.presets.apis,
  38. SwaggerUIStandalonePreset,
  39. ],
  40. plugins: [
  41. SwaggerUIBundle.plugins.Topbar,
  42. SwaggerUIBundle.plugins.DownloadUrl,
  43. ],
  44. layout: "StandaloneLayout"
  45. });
  46. // End Swagger UI call region
  47. window.ui = ui;
  48. });
  49. };
  50. </script>
  51. </body>
  52. </html>