diff --git a/api/main.py b/api/main.py index 27c9690f6..d871860bf 100644 --- a/api/main.py +++ b/api/main.py @@ -714,6 +714,21 @@ async def stats(user: User = Depends(get_current_superuser)): return await pubsub.subscription_stats() +@app.get('/viewer') +async def viewer(): + """Serve simple HTML page to view the API /static/viewer.html + Set various no-cache tag we might update it often""" + with open('api/viewer.html', 'r', encoding='utf-8') as file: + # set header to text/html and no-cache stuff + hdr = { + 'Content-Type': 'text/html', + 'Cache-Control': 'no-cache, no-store, must-revalidate', + 'Pragma': 'no-cache', + 'Expires': '0' + } + return PlainTextResponse(file.read(), headers=hdr) + + versioned_app = VersionedFastAPI( app, version_format='{major}', diff --git a/api/viewer.html b/api/viewer.html new file mode 100644 index 000000000..851247d03 --- /dev/null +++ b/api/viewer.html @@ -0,0 +1,415 @@ + + + + KernelCIv2 API Viewer + + + + + + + +
+
+
+ + \ No newline at end of file