added index to API list

This commit is contained in:
Pablo Revilla
2025-09-17 07:44:48 -07:00
parent 4201c5476b
commit d5272c1aec
2 changed files with 191 additions and 0 deletions

View File

@@ -0,0 +1,100 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>API Documentation - Config</title>
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist/swagger-ui.css" />
<style>
body { margin: 0; background: #ffffff; color: #000; }
#swagger-ui { background: #ffffff; color: #000; }
.swagger-ui { background-color: #ffffff !important; color: #000 !important; }
.swagger-ui .topbar,
.swagger-ui .info,
.swagger-ui .opblock-summary-description,
.swagger-ui .parameters-col_description,
.swagger-ui .response-col_description { color: #000 !important; }
.swagger-ui .opblock { background-color: #f9f9f9 !important; border-color: #ddd !important; }
.swagger-ui .opblock-summary { background-color: #eaeaea !important; color: #000 !important; }
.swagger-ui .opblock-section-header { color: #000 !important; }
.swagger-ui .parameters,
.swagger-ui .response { background-color: #fafafa !important; color: #000 !important; }
.swagger-ui table { color: #000 !important; }
.swagger-ui a { color: #1a0dab !important; }
.swagger-ui input,
.swagger-ui select,
.swagger-ui textarea { background-color: #fff !important; color: #000 !important; border: 1px solid #ccc !important; }
</style>
</head>
<body>
<div id="swagger-ui"></div>
<script src="https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js"></script>
<script>
const spec = {
openapi: "3.0.0",
info: {
title: "Site Config API",
version: "1.0.0",
description: "API for retrieving the site configuration. This endpoint does not take any parameters."
},
paths: {
"/api/config": {
get: {
summary: "Get site configuration",
description: "Returns the current site configuration object.",
responses: {
"200": {
description: "Successful response",
content: {
"application/json": {
schema: {
type: "object",
properties: {
site_config: {
type: "object",
additionalProperties: true,
example: {
site_name: "MeshView",
firehose_interval: 1000,
starting: "/nodes",
theme: "dark"
}
}
}
}
}
}
},
"500": {
description: "Server error",
content: {
"application/json": {
schema: {
type: "object",
properties: {
error: { type: "string", example: "Internal server error" }
}
}
}
}
}
}
}
}
}
};
window.onload = () => {
SwaggerUIBundle({
spec,
dom_id: '#swagger-ui',
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIBundle.SwaggerUIStandalonePreset
],
layout: "BaseLayout"
});
};
</script>
</body>
</html>

91
meshview/static/api.html Normal file
View File

@@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>API Index</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #1e1e1e;
color: #eaeaea;
margin: 0;
padding: 0;
}
header {
background: #2a2a2a;
padding: 20px;
text-align: center;
font-size: 1.6em;
font-weight: bold;
}
.container {
max-width: 800px;
margin: 30px auto;
padding: 20px;
}
ul {
list-style: none;
padding: 0;
}
li {
background: #272b2f;
border: 1px solid #474b4e;
padding: 15px 20px;
margin-bottom: 15px;
border-radius: 10px;
transition: background 0.2s;
}
li:hover {
background: #33383d;
}
a {
color: #4cafef;
text-decoration: none;
font-weight: bold;
font-size: 1.1em;
}
p {
margin: 8px 0 0 0;
font-size: 0.9em;
color: #bbbbbb;
}
</style>
</head>
<body>
<header>
API Index
</header>
<div class="container">
<ul>
<li>
<a href="/api-chat">Chat API</a>
<p> View chat messages.</p>
</li>
<li>
<a href="/api-nodes">Node API</a>
<p>Retrieve node information.</p>
</li>
<li>
<a href="/api-packets">Packet API</a>
<p>Access raw packet data.</p>
</li>
<li>
<a href="/api-stats">Statistics API </a>
<p>View system and traffic statistics.</p>
</li>
<li>
<a href="/api-edges">Edges API</a>
<p>Get edges details.</p>
</li>
<li>
<a href="/api-config">Configuration API</a>
<p>Get and update configuration details.</p>
</li>
</ul>
</div>
</body>
</html>