Browse Source
implement black theme implement swagger API docs Nostr-Signature: c15ce3d2f1ae613492802533a7e71b96df919a2ff52d501630c6ee64abf6a718 573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc ba72d348528a2846c5e44474af821e79fcdb377caa0d905ae7e7fc9115b77ea92f65325a8f0000f83467983068f643ecf3beaca784666d361a8883160ae3a936main
17 changed files with 1522 additions and 213 deletions
@ -1 +1 @@
@@ -1 +1 @@
|
||||
Subproject commit be480332ebd06991a3a88e22aa2d175596e20337 |
||||
Subproject commit daafc006e76eb25bf64b5a65901729faaea2d2eb |
||||
@ -1 +1,2 @@
@@ -1 +1,2 @@
|
||||
{"kind":1640,"pubkey":"573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc","created_at":1771497264,"tags":[["author","Silberengel","silberengel7@protonmail.com"],["message","update docs"]],"content":"Signed commit: update docs","id":"5a14564a2b82b3b4ee4e21d28e7b362cc82e3c27eac38691c85f46480b100cf1","sig":"d1369aff4db39f61aba5f0954c0c8ba92df4aec96f1fab7cc5af51d1b0667734f35dec99363290de2c248b7074369f592b238b1b66987e09f267062073167131"} |
||||
{"kind":1640,"pubkey":"573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc","created_at":1771497680,"tags":[["author","Silberengel","silberengel7@protonmail.com"],["message","validate signatures"]],"content":"Signed commit: validate signatures","id":"47edd2e8cbea27854a429202ddfb3fde3531a355276c619258bc90c4d6ce54cc","sig":"a941abf1d2c8e7dae4d5b4d6424c2e5394b05c98898d88b7acc1501cd6d8d3d13aea8be8d797dcb0701f752a32bf72a3b02f3c814707e10ed18d6d24f11d8ae0"} |
||||
|
||||
@ -0,0 +1,130 @@
@@ -0,0 +1,130 @@
|
||||
<script lang="ts"> |
||||
import { onMount } from 'svelte'; |
||||
|
||||
onMount(() => { |
||||
// Load Swagger UI from local static files |
||||
const link = document.createElement('link'); |
||||
link.rel = 'stylesheet'; |
||||
link.type = 'text/css'; |
||||
link.href = '/swagger-ui/swagger-ui.css'; |
||||
document.head.appendChild(link); |
||||
|
||||
let bundleScript: HTMLScriptElement | null = null; |
||||
|
||||
// Load standalone preset first |
||||
const presetScript = document.createElement('script'); |
||||
presetScript.src = '/swagger-ui/swagger-ui-standalone-preset.js'; |
||||
presetScript.onload = () => { |
||||
// Then load the bundle |
||||
bundleScript = document.createElement('script'); |
||||
bundleScript.src = '/swagger-ui/swagger-ui-bundle.js'; |
||||
bundleScript.onload = () => { |
||||
// @ts-ignore - SwaggerUIBundle is loaded from static files |
||||
const ui = window.SwaggerUIBundle({ |
||||
url: '/api/openapi.json', |
||||
dom_id: '#swagger-ui', |
||||
presets: [ |
||||
// @ts-ignore |
||||
window.SwaggerUIBundle.presets.apis, |
||||
// @ts-ignore |
||||
window.SwaggerUIBundle.presets.standalone |
||||
], |
||||
layout: 'StandaloneLayout', |
||||
deepLinking: true, |
||||
displayRequestDuration: true, |
||||
tryItOutEnabled: true, |
||||
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'], |
||||
validatorUrl: null, |
||||
docExpansion: 'list', |
||||
filter: true, |
||||
showExtensions: true, |
||||
showCommonExtensions: true |
||||
}); |
||||
}; |
||||
document.head.appendChild(bundleScript); |
||||
}; |
||||
document.head.appendChild(presetScript); |
||||
|
||||
return () => { |
||||
// Cleanup |
||||
if (link.parentNode) document.head.removeChild(link); |
||||
if (presetScript.parentNode) document.head.removeChild(presetScript); |
||||
if (bundleScript?.parentNode) document.head.removeChild(bundleScript); |
||||
}; |
||||
}); |
||||
</script> |
||||
|
||||
<div class="api-docs-container"> |
||||
<div class="api-docs-header"> |
||||
<h1>GitRepublic API Documentation</h1> |
||||
<p>Interactive API documentation with Swagger UI. All endpoints use NIP-98 HTTP authentication.</p> |
||||
<p class="note"> |
||||
<strong>Note:</strong> To authenticate, you need to provide a NIP-98 Authorization header. |
||||
The format is: <code>Authorization: Nostr <base64-encoded-event-json></code> |
||||
</p> |
||||
</div> |
||||
<div id="swagger-ui"></div> |
||||
</div> |
||||
|
||||
<style> |
||||
.api-docs-container { |
||||
max-width: 1400px; |
||||
margin: 0 auto; |
||||
padding: 2rem; |
||||
} |
||||
|
||||
.api-docs-header { |
||||
margin-bottom: 2rem; |
||||
padding-bottom: 1rem; |
||||
border-bottom: 1px solid var(--border-color); |
||||
} |
||||
|
||||
.api-docs-header h1 { |
||||
margin: 0 0 0.5rem 0; |
||||
color: var(--text-primary); |
||||
} |
||||
|
||||
.api-docs-header p { |
||||
margin: 0.5rem 0; |
||||
color: var(--text-secondary); |
||||
} |
||||
|
||||
.api-docs-header .note { |
||||
margin-top: 1rem; |
||||
padding: 1rem; |
||||
background: var(--bg-secondary); |
||||
border-left: 3px solid var(--accent); |
||||
border-radius: 0.25rem; |
||||
} |
||||
|
||||
.api-docs-header code { |
||||
background: var(--bg-tertiary); |
||||
padding: 0.2rem 0.4rem; |
||||
border-radius: 0.25rem; |
||||
font-family: 'IBM Plex Mono', monospace; |
||||
font-size: 0.875rem; |
||||
} |
||||
|
||||
#swagger-ui { |
||||
margin-top: 2rem; |
||||
} |
||||
|
||||
/* Override Swagger UI styles to match our theme */ |
||||
:global(.swagger-ui) { |
||||
font-family: 'IBM Plex Serif', serif; |
||||
} |
||||
|
||||
:global(.swagger-ui .topbar) { |
||||
display: none; |
||||
} |
||||
|
||||
:global(.swagger-ui .info .title) { |
||||
color: var(--text-primary); |
||||
} |
||||
|
||||
:global(.swagger-ui .scheme-container) { |
||||
background: var(--bg-secondary); |
||||
padding: 1rem; |
||||
border-radius: 0.375rem; |
||||
} |
||||
</style> |
||||
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
import { json } from '@sveltejs/kit'; |
||||
import type { RequestHandler } from './$types'; |
||||
import openApiSpec from './openapi.json'; |
||||
|
||||
export const GET: RequestHandler = async () => { |
||||
return json(openApiSpec, { |
||||
headers: { |
||||
'Content-Type': 'application/json', |
||||
'Cache-Control': 'public, max-age=3600' |
||||
} |
||||
}); |
||||
}; |
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue