Skip to content

Commit

Permalink
Switch to NPM-managed SwaggerUI.
Browse files Browse the repository at this point in the history
  • Loading branch information
BusterNeece committed Nov 28, 2024
1 parent bab5a4f commit 614d919
Show file tree
Hide file tree
Showing 23 changed files with 1,889 additions and 238 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ USER node
WORKDIR /data/builtin

RUN rm -rf ./src ./dist ./public \
&& mkdir -p ./src/content ./src/images ./src/scss \
&& mkdir -p ./src/content/docs ./src/pages ./src/images ./src/scss \
&& cp ../src/content/config.ts ./src/content \
&& cp -R ../src/content/docs/docs ./src/content/docs \
&& cp -R ../src/pages/api ./src/pages/api \
&& cp -R ../src/images/* ./src/images \
&& cp -R ../src/scss/* ./src/scss \
&& rm -f ./src/content/docs/*.* \
&& cp ./index.md ./src/content/docs \
&& mkdir -p ./public \
&& cp -R ../public/api ./public/api \
&& mkdir -p ./public \
&& cp -R ../public/img ./public/img \
&& sed -i -r 's|url: "(.*?)"|url: "/api/openapi.yml"|' ./public/api/swagger-initializer.js \
&& sed -i -r 's|url: "(.*?)"|url: "/api/openapi.yml"|' ./src/pages/api/index.astro \
&& cd .. \
&& npm ci --include=dev \
&& npm run builtin-build \
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ services:
frontend:
build:
context: .
target: development
target: builtin
ports:
- '4321:4321'
user: 1000:1000
Expand Down
1,913 changes: 1,838 additions & 75 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@astrojs/starlight": "^0.29.2",
"astro": "^4.16.16",
"bootstrap": "^5.3",
"sass": "^1.77"
"sass": "^1.77",
"swagger-ui": "^5.18.2"
}
}
Binary file removed public/api/favicon-16x16.png
Binary file not shown.
Binary file removed public/api/favicon-32x32.png
Binary file not shown.
16 changes: 0 additions & 16 deletions public/api/index.css

This file was deleted.

19 changes: 0 additions & 19 deletions public/api/index.html

This file was deleted.

79 changes: 0 additions & 79 deletions public/api/oauth2-redirect.html

This file was deleted.

20 changes: 0 additions & 20 deletions public/api/swagger-initializer.js

This file was deleted.

3 changes: 0 additions & 3 deletions public/api/swagger-ui-bundle.js

This file was deleted.

1 change: 0 additions & 1 deletion public/api/swagger-ui-bundle.js.map

This file was deleted.

3 changes: 0 additions & 3 deletions public/api/swagger-ui-es-bundle-core.js

This file was deleted.

1 change: 0 additions & 1 deletion public/api/swagger-ui-es-bundle-core.js.map

This file was deleted.

3 changes: 0 additions & 3 deletions public/api/swagger-ui-es-bundle.js

This file was deleted.

1 change: 0 additions & 1 deletion public/api/swagger-ui-es-bundle.js.map

This file was deleted.

3 changes: 0 additions & 3 deletions public/api/swagger-ui-standalone-preset.js

This file was deleted.

1 change: 0 additions & 1 deletion public/api/swagger-ui-standalone-preset.js.map

This file was deleted.

3 changes: 0 additions & 3 deletions public/api/swagger-ui.css

This file was deleted.

1 change: 0 additions & 1 deletion public/api/swagger-ui.css.map

This file was deleted.

2 changes: 0 additions & 2 deletions public/api/swagger-ui.js

This file was deleted.

1 change: 0 additions & 1 deletion public/api/swagger-ui.js.map

This file was deleted.

44 changes: 44 additions & 0 deletions src/pages/api/index.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Swagger UI</title>

<style>
html {
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}

*,
*:before,
*:after {
box-sizing: inherit;
}

body {
margin: 0;
background: #fafafa;
}
</style>
</head>

<body>
<div id="swagger-ui"></div>

<script>
import SwaggerUI from "swagger-ui";
import "swagger-ui/dist/swagger-ui.css";
import SwaggerUIStandalonePreset from "swagger-ui/dist/swagger-ui-standalone-preset";

SwaggerUI({
url: "https://raw.githubusercontent.com/AzuraCast/AzuraCast/main/web/static/openapi.yml",
dom_id: "#swagger-ui",
deepLinking: true,
presets: [SwaggerUI.presets.apis, SwaggerUIStandalonePreset],
layout: "StandaloneLayout",
});
</script>
</body>
</html>

0 comments on commit 614d919

Please sign in to comment.