move swagger-ui-theme/ out of hive-c0re/
hive-c0re doesn't touch these files anymore (nginx hosts them directly, see the previous commit) — hive-c0re/swagger-ui-theme/ was a leftover from the original SWAGGER_UI_OVERWRITE_FOLDER build-hook design, which this PR moved away from. New location matches the existing top-level-directory-for-nix-packaged-assets convention (branding/, claude-plugins/). Pure rename, no content change: nix/packages/swagger-ui-theme.nix's three file references updated, everything else picks it up from the same content hash (nix build .#swagger-ui-theme resolves to the exact same store path as before the move).
This commit is contained in:
parent
1bc9c18504
commit
3ef166738c
4 changed files with 20 additions and 26 deletions
|
|
@ -4,35 +4,29 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
# hyperhive's Catppuccin Mocha re-theme of Swagger UI: overlays our 3
|
# hyperhive's Catppuccin Mocha re-theme of Swagger UI: overlays our 3
|
||||||
# hand-authored override files (`hive-c0re/swagger-ui-theme/`) onto
|
# hand-authored override files (`swagger-ui-theme/`, top-level — not
|
||||||
|
# under `hive-c0re/`, which has no relationship to these files) onto
|
||||||
# the plain vendored dist (./swagger-ui-dist.nix). This is the FULL
|
# the plain vendored dist (./swagger-ui-dist.nix). This is the FULL
|
||||||
# tree hive-gateway's nginx serves at `/api/docs/` — hive-c0re hosts
|
# tree hive-gateway's nginx serves at `/api/docs/` — hive-c0re hosts
|
||||||
# none of it, only the dynamic `/api/openapi.json` (see
|
# none of it, only the dynamic `/api/openapi.json` (see
|
||||||
# nix/host-modules/hive-gateway/vhosts.nix).
|
# nix/host-modules/hive-gateway/vhosts.nix).
|
||||||
#
|
#
|
||||||
# Output layout: every file from `swagger-ui-dist`, with 3 replaced:
|
# Output layout: every file from `swagger-ui-dist`, with 3 replaced:
|
||||||
# index.html — adds <link>s for colors.css (live stylix
|
# index.html adds colors.css (live stylix theme) +
|
||||||
# theme, same origin) + hyperhive-theme.css
|
# hyperhive-theme.css <link>s
|
||||||
# hyperhive-theme.css — new; the re-theme itself, consumes
|
# hyperhive-theme.css new; the re-theme, consumes --baseNN vars
|
||||||
# --baseNN vars from colors.css
|
# swagger-initializer.js hardcodes `url: "/api/openapi.json"` —
|
||||||
# swagger-initializer.js — hardcodes `url: "/api/openapi.json"`. The
|
# `utoipa-swagger-ui`'s `serve()` normally
|
||||||
# plain vendored copy points at the
|
# rewrites this per-request from a
|
||||||
# swagger.io petstore demo; normally
|
# `{{config}}` placeholder its OWN build.rs
|
||||||
# `utoipa-swagger-ui`'s `serve()` rewrites
|
# injects (`replace_default_url_with_config`
|
||||||
# this file per-request from a `{{config}}`
|
# + `format_config`); hive-c0re doesn't serve
|
||||||
# placeholder it injects at its OWN build
|
# this file at all anymore, so that rewrite
|
||||||
# time (see that crate's `build.rs`'s
|
# is baked in statically here instead —
|
||||||
# `replace_default_url_with_config` +
|
# hand-verified byte-for-byte against what
|
||||||
# `format_config`). hive-c0re no longer
|
# `format_config` would produce, by applying
|
||||||
# serves this file at all, so that rewrite
|
# the same transform to the real vendored
|
||||||
# has to happen here instead — this copy is
|
# file rather than typing it from scratch.
|
||||||
# hand-verified to byte-match what
|
|
||||||
# `format_config` would produce for
|
|
||||||
# hive-c0re's actual config (single unnamed
|
|
||||||
# url, otherwise all `Config` defaults): the
|
|
||||||
# same transform applied to the real
|
|
||||||
# vendored file, not hand-typed from
|
|
||||||
# scratch.
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
pname = "hyperhive-swagger-ui-theme";
|
pname = "hyperhive-swagger-ui-theme";
|
||||||
version = "0.1.0";
|
version = "0.1.0";
|
||||||
|
|
@ -45,9 +39,9 @@ stdenv.mkDerivation {
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
cp -r ${swagger-ui-dist}/. $out/
|
cp -r ${swagger-ui-dist}/. $out/
|
||||||
chmod -R u+w $out
|
chmod -R u+w $out
|
||||||
install -m644 ${../../hive-c0re/swagger-ui-theme/index.html} $out/index.html
|
install -m644 ${../../swagger-ui-theme/index.html} $out/index.html
|
||||||
install -m644 ${../../hive-c0re/swagger-ui-theme/hyperhive-theme.css} $out/hyperhive-theme.css
|
install -m644 ${../../swagger-ui-theme/hyperhive-theme.css} $out/hyperhive-theme.css
|
||||||
install -m644 ${../../hive-c0re/swagger-ui-theme/swagger-initializer.js} $out/swagger-initializer.js
|
install -m644 ${../../swagger-ui-theme/swagger-initializer.js} $out/swagger-initializer.js
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
||||||
161
swagger-ui-theme/hyperhive-theme.css
Normal file
161
swagger-ui-theme/hyperhive-theme.css
Normal file
|
|
@ -0,0 +1,161 @@
|
||||||
|
/* Partial hyperhive reskin for the vendored Swagger UI at /api/docs.
|
||||||
|
Recolors chrome (background, topbar, borders, links, inputs) to
|
||||||
|
match the dashboard. Swagger's own semantic HTTP-method badge colours
|
||||||
|
and execute/cancel button colours are left alone — those carry
|
||||||
|
meaning independent of hyperhive branding.
|
||||||
|
|
||||||
|
Loaded after swagger-ui.css (see index.html) so these rules win the
|
||||||
|
cascade without `!important`, except where noted below.
|
||||||
|
|
||||||
|
`--baseNN` values come from `/static/colors.css` (linked in
|
||||||
|
index.html, same origin as the dashboard) — this follows the
|
||||||
|
operator's live stylix theme, not a hardcoded copy. See
|
||||||
|
frontend/packages/shared/src/colors.css for the base16 contract. */
|
||||||
|
|
||||||
|
/* Page chrome */
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
background: var(--base00);
|
||||||
|
}
|
||||||
|
.swagger-ui {
|
||||||
|
color: var(--base05);
|
||||||
|
font-family: "JetBrains Mono", "Fira Code", "Cascadia Code",
|
||||||
|
"Source Code Pro", monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Topbar */
|
||||||
|
.swagger-ui .topbar {
|
||||||
|
background: var(--base01);
|
||||||
|
border-bottom: 1px solid var(--base02);
|
||||||
|
}
|
||||||
|
.swagger-ui .topbar .download-url-wrapper input[type="text"] {
|
||||||
|
border-color: var(--base02);
|
||||||
|
background: var(--base00);
|
||||||
|
color: var(--base05);
|
||||||
|
}
|
||||||
|
.swagger-ui .topbar .download-url-wrapper .download-url-button {
|
||||||
|
background: var(--base0E);
|
||||||
|
color: var(--base01);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Info block + links */
|
||||||
|
.swagger-ui .info .title,
|
||||||
|
.swagger-ui .info li,
|
||||||
|
.swagger-ui .info p,
|
||||||
|
.swagger-ui .info table {
|
||||||
|
color: var(--base05);
|
||||||
|
}
|
||||||
|
.swagger-ui a.nostyle,
|
||||||
|
.swagger-ui a.nostyle:visited,
|
||||||
|
.swagger-ui .info a {
|
||||||
|
color: var(--base0D);
|
||||||
|
}
|
||||||
|
.swagger-ui .opblock-tag {
|
||||||
|
color: var(--base05);
|
||||||
|
border-bottom-color: var(--base02);
|
||||||
|
}
|
||||||
|
.swagger-ui .opblock-tag:hover {
|
||||||
|
background: color-mix(in srgb, var(--base0E) 8%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scheme/server selector bar. */
|
||||||
|
.swagger-ui .scheme-container {
|
||||||
|
background: var(--base01);
|
||||||
|
box-shadow: none;
|
||||||
|
border-bottom: 1px solid var(--base02);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Endpoint rows — method-colour left border stays; only the card body
|
||||||
|
is recoloured. */
|
||||||
|
.swagger-ui .opblock {
|
||||||
|
background: var(--base01);
|
||||||
|
border-color: var(--base02);
|
||||||
|
}
|
||||||
|
.swagger-ui .opblock .opblock-summary-description,
|
||||||
|
.swagger-ui .opblock .opblock-summary-path,
|
||||||
|
.swagger-ui .opblock .opblock-summary-path__deprecated {
|
||||||
|
color: var(--base05);
|
||||||
|
}
|
||||||
|
.swagger-ui .opblock .opblock-section-header {
|
||||||
|
background: var(--base00);
|
||||||
|
}
|
||||||
|
.swagger-ui .opblock-description-wrapper p,
|
||||||
|
.swagger-ui .opblock-external-docs-wrapper p,
|
||||||
|
.swagger-ui .opblock-title_normal p,
|
||||||
|
.swagger-ui .parameter__name,
|
||||||
|
.swagger-ui .parameter__type,
|
||||||
|
.swagger-ui .parameter__deprecated,
|
||||||
|
.swagger-ui .parameter__in,
|
||||||
|
.swagger-ui table.model tr.property-row td {
|
||||||
|
color: var(--base05);
|
||||||
|
}
|
||||||
|
.swagger-ui .tab li,
|
||||||
|
.swagger-ui .opblock .opblock-section-header h4,
|
||||||
|
.swagger-ui .opblock .opblock-section-header label {
|
||||||
|
color: var(--base05);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Response / model tables. */
|
||||||
|
.swagger-ui table thead tr td,
|
||||||
|
.swagger-ui table thead tr th {
|
||||||
|
color: var(--base05);
|
||||||
|
border-bottom-color: var(--base02);
|
||||||
|
}
|
||||||
|
.swagger-ui .responses-inner h4,
|
||||||
|
.swagger-ui .responses-inner h5 {
|
||||||
|
color: var(--base05);
|
||||||
|
}
|
||||||
|
.swagger-ui .response-col_status {
|
||||||
|
color: var(--base05);
|
||||||
|
}
|
||||||
|
.swagger-ui .model-box,
|
||||||
|
.swagger-ui section.models {
|
||||||
|
background: var(--base01);
|
||||||
|
}
|
||||||
|
.swagger-ui section.models {
|
||||||
|
border-color: var(--base02);
|
||||||
|
}
|
||||||
|
.swagger-ui section.models h4 {
|
||||||
|
color: var(--base05);
|
||||||
|
}
|
||||||
|
.swagger-ui .model {
|
||||||
|
color: var(--base05);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Form controls */
|
||||||
|
.swagger-ui select,
|
||||||
|
.swagger-ui input[type="text"],
|
||||||
|
.swagger-ui input[type="password"],
|
||||||
|
.swagger-ui input[type="search"],
|
||||||
|
.swagger-ui input[type="email"],
|
||||||
|
.swagger-ui input[type="file"],
|
||||||
|
.swagger-ui textarea {
|
||||||
|
background: var(--base00);
|
||||||
|
color: var(--base05);
|
||||||
|
border-color: var(--base02);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Generic buttons (Try it out / Reset / Authorize etc) — execute/cancel
|
||||||
|
keep Swagger's own colours. */
|
||||||
|
.swagger-ui .btn {
|
||||||
|
color: var(--base05);
|
||||||
|
border-color: var(--base02);
|
||||||
|
background: var(--base00);
|
||||||
|
}
|
||||||
|
.swagger-ui .btn.authorize {
|
||||||
|
color: var(--base0E);
|
||||||
|
border-color: var(--base0E);
|
||||||
|
}
|
||||||
|
.swagger-ui .btn.authorize svg {
|
||||||
|
fill: var(--base0E);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* `!important`: highlight.js re-asserts this per-token inline, so a
|
||||||
|
plain override loses. Scoped to the code-sample block background
|
||||||
|
only — token colours stay as highlight.js's theme provides. */
|
||||||
|
.swagger-ui .highlight-code {
|
||||||
|
background: var(--base00) !important;
|
||||||
|
}
|
||||||
|
.swagger-ui .microlight {
|
||||||
|
color: var(--base05);
|
||||||
|
}
|
||||||
30
swagger-ui-theme/index.html
Normal file
30
swagger-ui-theme/index.html
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
<!-- Served by the gateway's nginx — one of 3 files (see also
|
||||||
|
hyperhive-theme.css, swagger-initializer.js) that
|
||||||
|
nix/packages/swagger-ui-theme.nix overlays onto the plain vendored
|
||||||
|
dist (swagger-ui-dist.nix), and the whole result is what
|
||||||
|
vhosts.nix's `swaggerUiLocations` serves at /api/docs/, wholesale,
|
||||||
|
with NO hive-c0re fallback for any file in the tree. Byte-identical
|
||||||
|
to the vendored Swagger UI's dist/index.html except two added
|
||||||
|
<link>s: `colors.css` (same origin as the dashboard — so this
|
||||||
|
resolves the operator's live stylix theme, not a frozen copy) and
|
||||||
|
hyperhive-theme.css, which consumes its `--baseNN` vars. -->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Swagger UI</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="index.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="/static/colors.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="hyperhive-theme.css" />
|
||||||
|
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
|
||||||
|
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="swagger-ui"></div>
|
||||||
|
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
|
||||||
|
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
|
||||||
|
<script src="./swagger-initializer.js" charset="UTF-8"> </script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
21
swagger-ui-theme/swagger-initializer.js
Normal file
21
swagger-ui-theme/swagger-initializer.js
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
window.onload = function() {
|
||||||
|
//<editor-fold desc="Changeable Configuration Block">
|
||||||
|
|
||||||
|
// the following lines will be replaced by docker/configurator, when it runs in a docker-container
|
||||||
|
window.ui = SwaggerUIBundle({
|
||||||
|
"dom_id": "#swagger-ui",
|
||||||
|
"url": "/api/openapi.json",
|
||||||
|
"deepLinking": true,
|
||||||
|
"layout": "StandaloneLayout",
|
||||||
|
presets: [
|
||||||
|
SwaggerUIBundle.presets.apis,
|
||||||
|
SwaggerUIStandalonePreset
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
SwaggerUIBundle.plugins.DownloadUrl
|
||||||
|
],
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
//</editor-fold>
|
||||||
|
};
|
||||||
Loading…
Reference in a new issue