style(api-docs): redesign TOC, section icons, endpoint rows, and code blocks with ultra-dark support (#4332)

* style(api-docs): redesign TOC, section icons, endpoint rows, and code blocks with ultra-dark support

* style(api-docs): rename visibleSections to visibleEndpoints, drop dead toc-stuck CSS

- visibleSections counted endpoints, not sections — rename matches
  the displayed "X / Y endpoints" label.
- .toc-nav.toc-stuck was never toggled by any code path.

* docs(api): add missing POST /panel/api/inbounds/:id/resetTraffic entry

This route was added in #4334/#4338 but endpoints.js wasn't updated,
breaking TestAPIRoutesDocumented (91 routes in source, 90 documented).

---------

Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>
This commit is contained in:
Abdalrahman 2026-05-13 16:05:23 +03:00 committed by GitHub
parent f29c8a5e29
commit 102df7a290
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 388 additions and 89 deletions

View file

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, computed, onMounted } from 'vue'; import { ref, computed, onMounted, onBeforeUnmount } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { Modal, message } from 'ant-design-vue'; import { Modal, message } from 'ant-design-vue';
import { import {
@ -11,6 +11,16 @@ import {
SearchOutlined, SearchOutlined,
ExpandOutlined, ExpandOutlined,
CompressOutlined, CompressOutlined,
ApiOutlined,
SafetyCertificateOutlined,
CloudServerOutlined,
ClusterOutlined,
GlobalOutlined,
SaveOutlined,
SettingOutlined,
WifiOutlined,
LinkOutlined,
NodeIndexOutlined,
} from '@ant-design/icons-vue'; } from '@ant-design/icons-vue';
import { theme as themeState, antdThemeConfig } from '@/composables/useTheme.js'; import { theme as themeState, antdThemeConfig } from '@/composables/useTheme.js';
@ -32,6 +42,20 @@ const tokenVisible = ref(false);
const searchQuery = ref(''); const searchQuery = ref('');
const collapsedSections = ref(new Set()); const collapsedSections = ref(new Set());
const activeSection = ref('');
const sectionIcons = {
auth: SafetyCertificateOutlined,
inbounds: NodeIndexOutlined,
server: CloudServerOutlined,
nodes: ClusterOutlined,
customGeo: GlobalOutlined,
backup: SaveOutlined,
settings: SettingOutlined,
xraySettings: WifiOutlined,
subscription: LinkOutlined,
websocket: ApiOutlined,
};
const curlExample = `curl -X GET \\ const curlExample = `curl -X GET \\
-H "Authorization: Bearer YOUR_API_TOKEN" \\ -H "Authorization: Bearer YOUR_API_TOKEN" \\
@ -57,7 +81,7 @@ const endpointCount = computed(() =>
allSections.reduce((sum, s) => sum + s.endpoints.length, 0) allSections.reduce((sum, s) => sum + s.endpoints.length, 0)
); );
const visibleSections = computed(() => const visibleEndpoints = computed(() =>
sections.value.reduce((sum, s) => sum + s.endpoints.length, 0) sections.value.reduce((sum, s) => sum + s.endpoints.length, 0)
); );
@ -121,8 +145,33 @@ function scrollToSection(id) {
if (el) el.scrollIntoView({ behavior: 'smooth', block: 'start' }); if (el) el.scrollIntoView({ behavior: 'smooth', block: 'start' });
} }
let scrollObserver = null;
function onScroll() {
const toc = document.querySelector('.toc-nav');
const tocHeight = toc ? toc.offsetHeight : 56;
let current = '';
for (const s of sections.value) {
const el = document.getElementById(s.id);
if (!el) continue;
const rect = el.getBoundingClientRect();
if (rect.top <= tocHeight + 20) {
current = s.id;
}
}
activeSection.value = current;
}
onMounted(() => { onMounted(() => {
loadApiToken(); loadApiToken();
scrollObserver = onScroll;
window.addEventListener('scroll', scrollObserver, { passive: true });
onScroll();
});
onBeforeUnmount(() => {
if (scrollObserver) {
window.removeEventListener('scroll', scrollObserver);
}
}); });
</script> </script>
@ -150,7 +199,7 @@ onMounted(() => {
<KeyOutlined /> <KeyOutlined />
<span>API Token</span> <span>API Token</span>
</div> </div>
<a-space size="small" wrap> <div class="token-actions">
<a-button size="small" @click="tokenVisible = !tokenVisible"> <a-button size="small" @click="tokenVisible = !tokenVisible">
<template #icon> <template #icon>
<EyeInvisibleOutlined v-if="tokenVisible" /> <EyeInvisibleOutlined v-if="tokenVisible" />
@ -170,7 +219,7 @@ onMounted(() => {
</template> </template>
Regenerate Regenerate
</a-button> </a-button>
</a-space> </div>
</div> </div>
<a-spin :spinning="tokenLoading" size="small"> <a-spin :spinning="tokenLoading" size="small">
<pre <pre
@ -197,7 +246,7 @@ onMounted(() => {
<template #prefix><SearchOutlined /></template> <template #prefix><SearchOutlined /></template>
</a-input-search> </a-input-search>
<span class="match-count" v-if="searchQuery"> <span class="match-count" v-if="searchQuery">
{{ visibleSections }} / {{ endpointCount }} endpoints {{ visibleEndpoints }} / {{ endpointCount }} endpoints
</span> </span>
<a-space size="small"> <a-space size="small">
<a-button size="small" @click="expandAll"> <a-button size="small" @click="expandAll">
@ -213,16 +262,27 @@ onMounted(() => {
<nav class="toc-nav"> <nav class="toc-nav">
<span class="toc-label">On this page:</span> <span class="toc-label">On this page:</span>
<a v-for="s in sections" :key="s.id" class="toc-link" :href="`#${s.id}`" <div class="toc-links">
@click.prevent="scrollToSection(s.id)"> <a
{{ s.title }} ({{ s.endpoints.length }}) v-for="s in sections"
</a> :key="s.id"
class="toc-link"
:class="{ active: activeSection === s.id }"
:href="`#${s.id}`"
@click.prevent="scrollToSection(s.id)"
>
<component :is="sectionIcons[s.id]" class="toc-icon" />
<span class="toc-text">{{ s.title }}</span>
<span class="toc-badge">{{ s.endpoints.length }}</span>
</a>
</div>
</nav> </nav>
<EndpointSection <EndpointSection
v-for="s in sections" v-for="s in sections"
:key="s.id" :key="s.id"
:section="s" :section="s"
:icon="sectionIcons[s.id]"
:collapsed="isCollapsed(s.id)" :collapsed="isCollapsed(s.id)"
@toggle="toggleSection(s.id)" @toggle="toggleSection(s.id)"
/> />
@ -273,20 +333,25 @@ onMounted(() => {
} }
.docs-header { .docs-header {
margin-bottom: 18px; margin-bottom: 20px;
padding: 24px;
background: var(--bg-card);
border: 1px solid rgba(128, 128, 128, 0.12);
border-radius: 10px;
} }
.docs-title { .docs-title {
font-size: 26px; font-size: 28px;
font-weight: 700; font-weight: 800;
margin: 0 0 8px; margin: 0 0 8px;
color: rgba(0, 0, 0, 0.88); color: rgba(0, 0, 0, 0.88);
letter-spacing: -0.3px;
} }
.docs-lead { .docs-lead {
margin: 0; margin: 0;
color: rgba(0, 0, 0, 0.65); color: rgba(0, 0, 0, 0.65);
line-height: 1.6; line-height: 1.65;
font-size: 14px; font-size: 14px;
} }
@ -310,7 +375,8 @@ onMounted(() => {
justify-content: space-between; justify-content: space-between;
gap: 12px; gap: 12px;
flex-wrap: wrap; flex-wrap: wrap;
margin-bottom: 8px; margin-bottom: 10px;
min-height: 32px;
} }
.token-card-title { .token-card-title {
@ -321,6 +387,13 @@ onMounted(() => {
font-size: 14px; font-size: 14px;
} }
.token-actions {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.token-value { .token-value {
background: rgba(128, 128, 128, 0.08); background: rgba(128, 128, 128, 0.08);
border: 1px solid rgba(128, 128, 128, 0.15); border: 1px solid rgba(128, 128, 128, 0.15);
@ -377,32 +450,87 @@ onMounted(() => {
.toc-nav { .toc-nav {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
align-items: center; align-items: flex-start;
gap: 8px 14px; gap: 8px 12px;
padding: 12px 16px; padding: 12px 16px;
background: rgba(128, 128, 128, 0.08); background: var(--bg-card);
border-radius: 6px; border: 1px solid rgba(128, 128, 128, 0.12);
border-radius: 8px;
margin-bottom: 16px; margin-bottom: 16px;
} }
.toc-label { .toc-label {
font-size: 12px; font-size: 11px;
font-weight: 600; font-weight: 600;
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.5px; letter-spacing: 0.6px;
color: rgba(0, 0, 0, 0.5); color: rgba(0, 0, 0, 0.5);
padding-top: 3px;
flex-shrink: 0;
}
.toc-links {
display: flex;
flex-wrap: wrap;
gap: 6px;
} }
.toc-link { .toc-link {
color: #1677ff; display: inline-flex;
align-items: center;
gap: 5px;
padding: 4px 10px;
border-radius: 20px;
font-size: 12.5px;
color: rgba(0, 0, 0, 0.65);
background: rgba(128, 128, 128, 0.06);
border: 1px solid transparent;
text-decoration: none; text-decoration: none;
cursor: pointer; cursor: pointer;
font-size: 13px; transition: all 0.2s;
white-space: nowrap;
} }
.toc-link:hover { .toc-link:hover {
color: #4096ff; background: rgba(22, 119, 255, 0.08);
text-decoration: underline; color: #1677ff;
border-color: rgba(22, 119, 255, 0.2);
}
.toc-link.active {
background: rgba(22, 119, 255, 0.12);
color: #1677ff;
border-color: rgba(22, 119, 255, 0.3);
font-weight: 600;
}
.toc-icon {
font-size: 13px;
opacity: 0.8;
}
.toc-text {
font-size: 12.5px;
}
.toc-badge {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 18px;
height: 18px;
padding: 0 5px;
border-radius: 9px;
font-size: 10.5px;
font-weight: 700;
background: rgba(22, 119, 255, 0.12);
color: #1677ff;
line-height: 1;
}
.toc-link.active .toc-badge {
background: #1677ff;
color: #fff;
} }
</style> </style>
@ -411,16 +539,40 @@ body.dark .docs-title {
color: rgba(255, 255, 255, 0.92); color: rgba(255, 255, 255, 0.92);
} }
html[data-theme='ultra-dark'] .docs-title {
color: rgba(255, 255, 255, 0.95);
}
body.dark .docs-header {
background: #252526;
border-color: rgba(255, 255, 255, 0.08);
}
html[data-theme='ultra-dark'] .docs-header {
background: #0a0a0a;
border-color: rgba(255, 255, 255, 0.06);
}
body.dark .docs-lead, body.dark .docs-lead,
body.dark .token-hint { body.dark .token-hint {
color: rgba(255, 255, 255, 0.7); color: rgba(255, 255, 255, 0.7);
} }
html[data-theme='ultra-dark'] .docs-lead,
html[data-theme='ultra-dark'] .token-hint {
color: rgba(255, 255, 255, 0.75);
}
body.dark .docs-lead code, body.dark .docs-lead code,
body.dark .token-hint code { body.dark .token-hint code {
background: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.1);
} }
html[data-theme='ultra-dark'] .docs-lead code,
html[data-theme='ultra-dark'] .token-hint code {
background: rgba(255, 255, 255, 0.12);
}
body.dark .token-value, body.dark .token-value,
body.dark .code-block { body.dark .code-block {
background: rgba(255, 255, 255, 0.04); background: rgba(255, 255, 255, 0.04);
@ -428,11 +580,58 @@ body.dark .code-block {
color: rgba(255, 255, 255, 0.88); color: rgba(255, 255, 255, 0.88);
} }
html[data-theme='ultra-dark'] .token-value,
html[data-theme='ultra-dark'] .code-block {
background: rgba(255, 255, 255, 0.02);
border-color: rgba(255, 255, 255, 0.08);
}
body.dark .toc-nav { body.dark .toc-nav {
background: rgba(255, 255, 255, 0.04); background: #252526;
border-color: rgba(255, 255, 255, 0.08);
}
html[data-theme='ultra-dark'] .toc-nav {
background: #0a0a0a;
border-color: rgba(255, 255, 255, 0.06);
} }
body.dark .toc-label { body.dark .toc-label {
color: rgba(255, 255, 255, 0.55); color: rgba(255, 255, 255, 0.55);
} }
html[data-theme='ultra-dark'] .toc-label {
color: rgba(255, 255, 255, 0.6);
}
body.dark .toc-link {
color: rgba(255, 255, 255, 0.65);
background: rgba(255, 255, 255, 0.06);
}
html[data-theme='ultra-dark'] .toc-link {
background: rgba(255, 255, 255, 0.04);
}
body.dark .toc-link:hover {
background: rgba(88, 166, 255, 0.12);
color: #58a6ff;
border-color: rgba(88, 166, 255, 0.25);
}
body.dark .toc-link.active {
background: rgba(88, 166, 255, 0.15);
color: #58a6ff;
border-color: rgba(88, 166, 255, 0.35);
}
body.dark .toc-badge {
background: rgba(88, 166, 255, 0.15);
color: #58a6ff;
}
body.dark .toc-link.active .toc-badge {
background: #58a6ff;
color: #0d1117;
}
</style> </style>

View file

@ -50,10 +50,13 @@ async function copyCode() {
<template> <template>
<div class="code-block-wrapper"> <div class="code-block-wrapper">
<button class="copy-btn" :class="{ copied }" @click="copyCode" :title="copied ? 'Copied' : 'Copy'"> <div class="code-toolbar">
<CheckOutlined v-if="copied" /> <span class="lang-badge">{{ lang.toUpperCase() }}</span>
<CopyOutlined v-else /> <button class="copy-btn" :class="{ copied }" @click="copyCode" :title="copied ? 'Copied' : 'Copy'">
</button> <CheckOutlined v-if="copied" />
<CopyOutlined v-else />
</button>
</div>
<pre class="code-block" :class="`lang-${lang}`"><code v-html="highlighted"></code></pre> <pre class="code-block" :class="`lang-${lang}`"><code v-html="highlighted"></code></pre>
</div> </div>
</template> </template>
@ -63,30 +66,40 @@ async function copyCode() {
position: relative; position: relative;
border-radius: 6px; border-radius: 6px;
overflow: hidden; overflow: hidden;
border: 1px solid rgba(128, 128, 128, 0.15);
}
.code-toolbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 4px 8px;
background: rgba(128, 128, 128, 0.06);
border-bottom: 1px solid rgba(128, 128, 128, 0.1);
}
.lang-badge {
font-size: 10px;
font-weight: 700;
letter-spacing: 0.5px;
color: rgba(0, 0, 0, 0.4);
text-transform: uppercase;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
} }
.copy-btn { .copy-btn {
position: absolute;
top: 6px;
right: 6px;
z-index: 1;
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 28px; width: 26px;
height: 28px; height: 26px;
border: 1px solid rgba(128, 128, 128, 0.2); border: 1px solid rgba(128, 128, 128, 0.15);
border-radius: 4px; border-radius: 4px;
background: rgba(255, 255, 255, 0.85); background: rgba(255, 255, 255, 0.7);
color: rgba(0, 0, 0, 0.5); color: rgba(0, 0, 0, 0.45);
cursor: pointer; cursor: pointer;
font-size: 13px; font-size: 12px;
opacity: 0; transition: all 0.15s;
transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.code-block-wrapper:hover .copy-btn {
opacity: 1;
} }
.copy-btn:hover { .copy-btn:hover {
@ -96,27 +109,24 @@ async function copyCode() {
} }
.copy-btn.copied { .copy-btn.copied {
opacity: 1;
background: #52c41a; background: #52c41a;
color: #fff; color: #fff;
border-color: #52c41a; border-color: #52c41a;
} }
.code-block { .code-block {
background: rgba(128, 128, 128, 0.08); background: rgba(128, 128, 128, 0.04);
border: 1px solid rgba(128, 128, 128, 0.15); padding: 10px 12px;
border-radius: 6px;
padding: 12px;
margin: 0; margin: 0;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 12.5px; font-size: 12.5px;
line-height: 1.55; line-height: 1.6;
white-space: pre-wrap; white-space: pre-wrap;
word-break: break-word; word-break: break-word;
overflow-x: auto; overflow-x: auto;
border: none;
border-radius: 0;
} }
</style> </style>
<style> <style>
@ -126,9 +136,21 @@ async function copyCode() {
.json-boolean { color: #cf222e; } .json-boolean { color: #cf222e; }
.json-null { color: #8250df; } .json-null { color: #8250df; }
body.dark .code-block { body.dark .code-block-wrapper {
background: rgba(255, 255, 255, 0.04);
border-color: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.1);
}
body.dark .code-toolbar {
background: rgba(255, 255, 255, 0.03);
border-color: rgba(255, 255, 255, 0.06);
}
body.dark .lang-badge {
color: rgba(255, 255, 255, 0.4);
}
body.dark .code-block {
background: rgba(255, 255, 255, 0.03);
color: rgba(255, 255, 255, 0.88); color: rgba(255, 255, 255, 0.88);
} }
@ -139,13 +161,13 @@ body.dark .json-boolean { color: #ff7b72; }
body.dark .json-null { color: #d2a8ff; } body.dark .json-null { color: #d2a8ff; }
body.dark .copy-btn { body.dark .copy-btn {
background: rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.06);
color: rgba(255, 255, 255, 0.5); color: rgba(255, 255, 255, 0.45);
border-color: rgba(255, 255, 255, 0.15); border-color: rgba(255, 255, 255, 0.12);
} }
body.dark .copy-btn:hover { body.dark .copy-btn:hover {
background: rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.1);
color: #58a6ff; color: #58a6ff;
border-color: #58a6ff; border-color: #58a6ff;
} }

View file

@ -51,11 +51,22 @@ const paramColumns = [
<style scoped> <style scoped>
.endpoint-row { .endpoint-row {
padding: 12px 0; padding: 14px 0;
margin: 0;
transition: background 0.15s;
border-radius: 6px;
padding-left: 8px;
padding-right: 8px;
margin-left: -8px;
margin-right: -8px;
}
.endpoint-row:hover {
background: rgba(128, 128, 128, 0.03);
} }
.endpoint-row + .endpoint-row { .endpoint-row + .endpoint-row {
border-top: 1px solid rgba(128, 128, 128, 0.15); border-top: 1px solid rgba(128, 128, 128, 0.1);
} }
.endpoint-header { .endpoint-header {
@ -66,35 +77,45 @@ const paramColumns = [
} }
.method-tag { .method-tag {
font-weight: 600; font-weight: 700;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 11px;
letter-spacing: 0.5px; letter-spacing: 0.5px;
min-width: 60px; min-width: 56px;
text-align: center; text-align: center;
text-transform: uppercase;
border-radius: 4px;
padding: 2px 8px;
line-height: 1.6;
} }
.endpoint-path { .endpoint-path {
font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 13px; font-size: 13.5px;
word-break: break-all; word-break: break-all;
color: rgba(0, 0, 0, 0.8);
background: rgba(128, 128, 128, 0.06);
padding: 2px 8px;
border-radius: 4px;
} }
.endpoint-summary { .endpoint-summary {
margin: 8px 0 0; margin: 8px 0 0;
color: rgba(0, 0, 0, 0.65); color: rgba(0, 0, 0, 0.6);
line-height: 1.55; line-height: 1.6;
font-size: 13.5px;
} }
.endpoint-block { .endpoint-block {
margin-top: 12px; margin-top: 14px;
} }
.block-label { .block-label {
font-size: 12px; font-size: 11px;
font-weight: 600; font-weight: 600;
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.5px; letter-spacing: 0.6px;
color: rgba(0, 0, 0, 0.5); color: rgba(0, 0, 0, 0.45);
margin-bottom: 6px; margin-bottom: 6px;
} }
@ -118,12 +139,25 @@ const paramColumns = [
</style> </style>
<style> <style>
body.dark .endpoint-row:hover {
background: rgba(255, 255, 255, 0.02);
}
body.dark .endpoint-row + .endpoint-row {
border-top-color: rgba(255, 255, 255, 0.08);
}
body.dark .endpoint-path {
color: rgba(255, 255, 255, 0.82);
background: rgba(255, 255, 255, 0.05);
}
body.dark .endpoint-summary { body.dark .endpoint-summary {
color: rgba(255, 255, 255, 0.7); color: rgba(255, 255, 255, 0.65);
} }
body.dark .block-label { body.dark .block-label {
color: rgba(255, 255, 255, 0.55); color: rgba(255, 255, 255, 0.45);
} }
body.dark .error-label { body.dark .error-label {

View file

@ -9,6 +9,7 @@ import { safeInlineHtml } from './endpoints.js';
const props = defineProps({ const props = defineProps({
section: { type: Object, required: true }, section: { type: Object, required: true },
icon: { type: Object, default: null },
collapsed: { type: Boolean, default: false }, collapsed: { type: Boolean, default: false },
}); });
@ -27,6 +28,7 @@ const endpointLabel = computed(() =>
<div class="section-header-left"> <div class="section-header-left">
<DownOutlined v-if="!collapsed" class="collapse-icon" /> <DownOutlined v-if="!collapsed" class="collapse-icon" />
<RightOutlined v-else class="collapse-icon" /> <RightOutlined v-else class="collapse-icon" />
<component v-if="icon" :is="icon" class="section-icon" />
<h2 class="section-title">{{ section.title }}</h2> <h2 class="section-title">{{ section.title }}</h2>
</div> </div>
<span class="endpoint-count">{{ endpointLabel }}</span> <span class="endpoint-count">{{ endpointLabel }}</span>
@ -58,11 +60,15 @@ const endpointLabel = computed(() =>
<style scoped> <style scoped>
.api-section { .api-section {
background: #fff; background: #fff;
border: 1px solid rgba(128, 128, 128, 0.15); border: 1px solid rgba(128, 128, 128, 0.12);
border-radius: 8px; border-radius: 8px;
padding: 16px 24px; padding: 20px 24px;
margin-bottom: 16px; margin-bottom: 16px;
scroll-margin-top: 16px; transition: box-shadow 0.2s, border-color 0.2s;
}
.api-section:hover {
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
} }
.section-header { .section-header {
@ -73,39 +79,52 @@ const endpointLabel = computed(() =>
user-select: none; user-select: none;
} }
.section-header:hover .collapse-icon { .section-header:hover .collapse-icon,
.section-header:hover .section-icon {
color: #1677ff; color: #1677ff;
} }
.section-header-left { .section-header-left {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 8px; gap: 10px;
} }
.collapse-icon { .collapse-icon {
font-size: 12px; font-size: 12px;
color: rgba(0, 0, 0, 0.4);
transition: color 0.2s;
}
.section-icon {
font-size: 18px;
color: rgba(0, 0, 0, 0.45); color: rgba(0, 0, 0, 0.45);
transition: color 0.2s; transition: color 0.2s;
} }
.section-title { .section-title {
font-size: 20px; font-size: 20px;
font-weight: 600; font-weight: 700;
margin: 0; margin: 0;
color: rgba(0, 0, 0, 0.88); color: rgba(0, 0, 0, 0.88);
} }
.endpoint-count { .endpoint-count {
font-size: 12px; font-size: 11px;
font-weight: 600;
color: rgba(0, 0, 0, 0.45); color: rgba(0, 0, 0, 0.45);
white-space: nowrap; white-space: nowrap;
background: rgba(128, 128, 128, 0.08);
padding: 3px 10px;
border-radius: 12px;
text-transform: uppercase;
letter-spacing: 0.3px;
} }
.section-description { .section-description {
margin: 10px 0 14px; margin: 12px 0 14px;
color: rgba(0, 0, 0, 0.65); color: rgba(0, 0, 0, 0.65);
line-height: 1.55; line-height: 1.6;
} }
.sub-header-block { .sub-header-block {
@ -134,18 +153,30 @@ const endpointLabel = computed(() =>
<style> <style>
body.dark .api-section { body.dark .api-section {
background: #252526; background: #252526;
border-color: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.08);
}
body.dark .api-section:hover {
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
} }
html[data-theme='ultra-dark'] .api-section { html[data-theme='ultra-dark'] .api-section {
background: #0a0a0a; background: #0a0a0a;
border-color: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.06);
}
html[data-theme='ultra-dark'] .api-section:hover {
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
} }
body.dark .section-title { body.dark .section-title {
color: rgba(255, 255, 255, 0.92); color: rgba(255, 255, 255, 0.92);
} }
body.dark .section-icon {
color: rgba(255, 255, 255, 0.5);
}
body.dark .section-description { body.dark .section-description {
color: rgba(255, 255, 255, 0.7); color: rgba(255, 255, 255, 0.7);
} }
@ -153,4 +184,9 @@ body.dark .section-description {
body.dark .block-label { body.dark .block-label {
color: rgba(255, 255, 255, 0.55); color: rgba(255, 255, 255, 0.55);
} }
body.dark .endpoint-count {
color: rgba(255, 255, 255, 0.55);
background: rgba(255, 255, 255, 0.06);
}
</style> </style>

View file

@ -69,7 +69,7 @@ export const sections = [
{ {
id: 'inbounds', id: 'inbounds',
title: 'Inbounds API', title: 'Inbounds',
description: description:
'Manage inbound configurations and their clients. All endpoints live under /panel/api/inbounds and require a logged-in session or Bearer token. Link-generating endpoints honour forwarded headers only when the request comes from a configured trusted proxy.', 'Manage inbound configurations and their clients. All endpoints live under /panel/api/inbounds and require a logged-in session or Bearer token. Link-generating endpoints honour forwarded headers only when the request comes from a configured trusted proxy.',
endpoints: [ endpoints: [
@ -193,6 +193,14 @@ export const sections = [
body: body:
'{\n "id": 1,\n "settings": "{\\"clients\\":[{\\"id\\":\\"uuid-here\\",\\"email\\":\\"user1\\",\\"limitIp\\":2,\\"totalGB\\":10737418240,\\"expiryTime\\":1735689600000,\\"enable\\":true}]}"\n}', '{\n "id": 1,\n "settings": "{\\"clients\\":[{\\"id\\":\\"uuid-here\\",\\"email\\":\\"user1\\",\\"limitIp\\":2,\\"totalGB\\":10737418240,\\"expiryTime\\":1735689600000,\\"enable\\":true}]}"\n}',
}, },
{
method: 'POST',
path: '/panel/api/inbounds/:id/resetTraffic',
summary: 'Zero out upload + download counters for a single inbound. Does not touch per-client counters.',
params: [
{ name: 'id', in: 'path', type: 'number', desc: 'Inbound ID.' },
],
},
{ {
method: 'POST', method: 'POST',
path: '/panel/api/inbounds/:id/resetClientTraffic/:email', path: '/panel/api/inbounds/:id/resetClientTraffic/:email',
@ -289,7 +297,7 @@ export const sections = [
{ {
id: 'server', id: 'server',
title: 'Server API', title: 'Server',
description: description:
'System status, log retrieval, certificate generators, Xray binary management, and backup/restore. All under /panel/api/server.', 'System status, log retrieval, certificate generators, Xray binary management, and backup/restore. All under /panel/api/server.',
endpoints: [ endpoints: [
@ -488,7 +496,7 @@ export const sections = [
{ {
id: 'nodes', id: 'nodes',
title: 'Nodes API', title: 'Nodes',
description: description:
'Manage remote 3x-ui panels acting as nodes for a central panel. All endpoints under /panel/api/nodes.', 'Manage remote 3x-ui panels acting as nodes for a central panel. All endpoints under /panel/api/nodes.',
endpoints: [ endpoints: [
@ -569,7 +577,7 @@ export const sections = [
{ {
id: 'customGeo', id: 'customGeo',
title: 'Custom Geo API', title: 'Custom Geo',
description: description:
'Manage user-supplied GeoIP / GeoSite source files. All endpoints under /panel/api/custom-geo.', 'Manage user-supplied GeoIP / GeoSite source files. All endpoints under /panel/api/custom-geo.',
endpoints: [ endpoints: [
@ -637,7 +645,7 @@ export const sections = [
{ {
id: 'settings', id: 'settings',
title: 'Settings API', title: 'Settings',
description: description:
'Panel configuration, user credentials, and API token management. All endpoints live under /panel/setting and require a logged-in session or Bearer token.', 'Panel configuration, user credentials, and API token management. All endpoints live under /panel/setting and require a logged-in session or Bearer token.',
endpoints: [ endpoints: [
@ -697,7 +705,7 @@ export const sections = [
{ {
id: 'xraySettings', id: 'xraySettings',
title: 'Xray Settings API', title: 'Xray Settings',
description: description:
'Xray configuration template, outbound management, Warp/Nord integration, and config testing. All endpoints under /panel/xray.', 'Xray configuration template, outbound management, Warp/Nord integration, and config testing. All endpoints under /panel/xray.',
endpoints: [ endpoints: [