fix: auth bypass, SPA serving, and provider improvements (#97)

* feat(chat): polish syntax highlighting and tool payload rendering (#94)

* [verified] feat(chat): polish syntax highlighting and tool payload rendering

* [verified] fix(chat): tighten large tool payload rendering

* docs: update data volume path in Docker docs

Align documentation with docker-compose.yml change:
hermes-web-ui-data -> hermes-web-ui, /app/dist/data -> /root/.hermes-web-ui

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: bundle server build and restructure service modules

- Add build-server.mjs script for standalone server compilation
- Add logger service with structured output
- Restructure auth, gateway-manager, hermes-cli, hermes services
- Update docker-compose volume mount path
- Update tsconfig and entry point for bundled server

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: separate controllers from routes and centralize route registration

- Extract business logic from route handlers into controllers/
- Add centralized route registry in routes/index.ts with public/auth/protected layers
- Replace global auth whitelist with sequential middleware registration
- Extract shared helpers to services/config-helpers.ts
- Allow custom provider name to be user-editable in ProviderFormModal
- Deduplicate custom providers by poolKey instead of base_url in getAvailable

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: auth bypass via path case, SPA serving, and provider improvements

- Fix auth bypass: path case-insensitive check for /api, /v1, /upload
- Fix SPA returning 401: skip auth for non-API paths (static files)
- Fix profile switch: use local loading state instead of shared store ref
- Auto-append /v1 to base_url when fetching models (frontend + backend)
- Guard .env writing to built-in providers only
- Add builtin field to provider presets, enable base_url input in form
- Print auth token to console on startup (pino only writes to file)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Zhicheng Han <43314240+hanzckernel@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ekko
2026-04-21 12:35:48 +08:00
committed by GitHub
parent 21296a416b
commit 477af66232
65 changed files with 2743 additions and 2621 deletions
+170
View File
@@ -0,0 +1,170 @@
@use 'variables' as *;
// Shared code-block styles used by markdown rendering and tool payload details.
// Keep these global so v-html output in both MarkdownRenderer.vue and MessageItem.vue
// stays styled even though the HTML is not compiled as Vue template content.
.hljs-code-block {
margin: 8px 0;
border-radius: $radius-sm;
overflow: hidden;
background: $code-bg;
border: 1px solid $border-color;
.code-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 6px 12px;
background: rgba(0, 0, 0, 0.03);
border-bottom: 1px solid $border-color;
.code-lang {
font-size: 11px;
color: $text-muted;
text-transform: uppercase;
}
.copy-btn {
font-size: 11px;
color: $text-muted;
background: none;
border: none;
cursor: pointer;
padding: 2px 6px;
border-radius: 3px;
transition: all $transition-fast;
&:hover {
color: $text-primary;
background: rgba(0, 0, 0, 0.05);
}
}
}
code.hljs {
display: block;
padding: 12px;
font-family: $font-code;
font-size: 13px;
line-height: 1.5;
overflow-x: auto;
}
}
// highlight.js theme override — higher-contrast, still calm
.hljs-code-block {
.hljs {
color: #1f2937;
background: none;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-meta .hljs-keyword {
color: #7c3aed;
font-weight: 600;
}
.hljs-string,
.hljs-attr,
.hljs-regexp,
.hljs-template-variable {
color: #0f766e;
}
.hljs-number,
.hljs-literal,
.hljs-symbol,
.hljs-bullet {
color: #b45309;
}
.hljs-comment,
.hljs-quote {
color: #6b7280;
font-style: italic;
}
.hljs-built_in,
.hljs-title.class_,
.hljs-title.function_ {
color: #2563eb;
}
.hljs-type,
.hljs-variable,
.hljs-property,
.hljs-params {
color: #b91c1c;
}
.hljs-tag,
.hljs-name,
.hljs-section,
.hljs-title {
color: #1f2937;
}
.hljs-meta {
color: #6b7280;
}
}
// Dark mode highlight.js — clearer separation without neon
.dark .hljs-code-block {
.hljs {
color: #e5e7eb;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-meta .hljs-keyword {
color: #c084fc;
font-weight: 600;
}
.hljs-string,
.hljs-attr,
.hljs-regexp,
.hljs-template-variable {
color: #5eead4;
}
.hljs-number,
.hljs-literal,
.hljs-symbol,
.hljs-bullet {
color: #fbbf24;
}
.hljs-comment,
.hljs-quote {
color: #94a3b8;
font-style: italic;
}
.hljs-built_in,
.hljs-title.class_,
.hljs-title.function_ {
color: #93c5fd;
}
.hljs-type,
.hljs-variable,
.hljs-property,
.hljs-params {
color: #fca5a5;
}
.hljs-tag,
.hljs-name,
.hljs-section,
.hljs-title {
color: #f3f4f6;
}
.hljs-meta {
color: #94a3b8;
}
}
+1
View File
@@ -1,4 +1,5 @@
@use 'variables' as *;
@use 'code-block';
*,
*::before,