Changeset 0.7.0.13 (#38)

This commit is contained in:
2026-02-21 13:53:36 +00:00
parent a95e246cd7
commit b72bfbb5b4
10 changed files with 42 additions and 20 deletions

View File

@@ -16,8 +16,9 @@ FROM golang:1.22-bookworm AS backend
WORKDIR /app WORKDIR /app
COPY server/go.mod server/go.sum* ./ COPY server/go.mod server/go.sum* ./
COPY server/ . COPY server/ .
COPY VERSION ./
RUN go mod download && go mod tidy && go mod verify RUN go mod download && go mod tidy && go mod verify
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /bin/switchboard . RUN CGO_ENABLED=0 go build -ldflags="-s -w -X main.Version=$(cat VERSION)" -o /bin/switchboard .
# ── Stage 2: Vendor JS libs ───────────────── # ── Stage 2: Vendor JS libs ─────────────────
FROM node:20-alpine AS vendor FROM node:20-alpine AS vendor
@@ -43,6 +44,11 @@ COPY --from=backend /bin/switchboard /usr/local/bin/switchboard
# Frontend static files # Frontend static files
COPY src/ /usr/share/nginx/html/ COPY src/ /usr/share/nginx/html/
COPY VERSION /VERSION
# Inject version into index.html at build time
RUN APP_VERSION=$(cat /VERSION | tr -d '[:space:]') && \
sed -i "s|%%APP_VERSION%%|${APP_VERSION}|g" /usr/share/nginx/html/index.html
# Vendor libs (overwrite any existing copies in src/vendor/) # Vendor libs (overwrite any existing copies in src/vendor/)
COPY --from=vendor /vendor/marked.min.js /usr/share/nginx/html/vendor/marked.min.js COPY --from=vendor /vendor/marked.min.js /usr/share/nginx/html/vendor/marked.min.js

View File

@@ -31,6 +31,7 @@ RUN rm -f /etc/nginx/conf.d/default.conf
COPY src/ /usr/share/nginx/html/ COPY src/ /usr/share/nginx/html/
COPY --from=vendor /vendor/ /usr/share/nginx/html/vendor/ COPY --from=vendor /vendor/ /usr/share/nginx/html/vendor/
COPY VERSION /VERSION
COPY docker-entrypoint-fe.sh /docker-entrypoint-fe.sh COPY docker-entrypoint-fe.sh /docker-entrypoint-fe.sh
RUN chmod +x /docker-entrypoint-fe.sh RUN chmod +x /docker-entrypoint-fe.sh

View File

@@ -13,6 +13,12 @@ set -e
BASE_PATH="${BASE_PATH:-}" BASE_PATH="${BASE_PATH:-}"
# Read version from VERSION file (baked in at build time)
APP_VERSION="dev"
if [ -f /VERSION ]; then
APP_VERSION=$(cat /VERSION | tr -d '[:space:]')
fi
# Compute base href (needs trailing slash for <base> tag) # Compute base href (needs trailing slash for <base> tag)
if [ -z "${BASE_PATH}" ]; then if [ -z "${BASE_PATH}" ]; then
BASE_HREF="/" BASE_HREF="/"
@@ -24,9 +30,10 @@ fi
sed -i \ sed -i \
-e "s|%%BASE_PATH%%|${BASE_PATH}|g" \ -e "s|%%BASE_PATH%%|${BASE_PATH}|g" \
-e "s|%%BASE_HREF%%|${BASE_HREF}|g" \ -e "s|%%BASE_HREF%%|${BASE_HREF}|g" \
-e "s|%%APP_VERSION%%|${APP_VERSION}|g" \
/usr/share/nginx/html/index.html /usr/share/nginx/html/index.html
echo "✅ Frontend configured: BASE_PATH=${BASE_PATH:-/}" echo "✅ Frontend configured: BASE_PATH=${BASE_PATH:-/} VERSION=${APP_VERSION}"
# ── Generate nginx config ─────────────────── # ── Generate nginx config ───────────────────
# If BASE_PATH is set, serve under that prefix with alias. # If BASE_PATH is set, serve under that prefix with alias.

View File

@@ -8,6 +8,8 @@
# Build stage # Build stage
FROM golang:1.22-bookworm AS builder FROM golang:1.22-bookworm AS builder
ARG APP_VERSION=dev
WORKDIR /app WORKDIR /app
# Copy module files and download deps # Copy module files and download deps
@@ -17,7 +19,7 @@ RUN go mod download
# Copy source and tidy (resolves any go.sum gaps) # Copy source and tidy (resolves any go.sum gaps)
COPY . . COPY . .
RUN go mod tidy RUN go mod tidy
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /bin/switchboard . RUN CGO_ENABLED=0 go build -ldflags="-s -w -X main.Version=${APP_VERSION}" -o /bin/switchboard .
# Runtime stage # Runtime stage
FROM debian:bookworm-slim FROM debian:bookworm-slim

View File

@@ -1,7 +1,7 @@
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=JetBrains+Mono:wght@400;500&display=swap'); @import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=JetBrains+Mono:wght@400;500&display=swap');
/* ========================================== /* ==========================================
Chat Switchboard v0.6.1 Chat Switchboard
Clean utility layout · Open WebUI inspired Clean utility layout · Open WebUI inspired
========================================== */ ========================================== */
@@ -67,8 +67,9 @@ a:hover { text-decoration: underline; }
padding: 2px 0; line-height: 1.4; padding: 2px 0; line-height: 1.4;
background: var(--banner-bg); color: var(--banner-fg); background: var(--banner-bg); color: var(--banner-fg);
flex-shrink: 0; z-index: 9999; flex-shrink: 0; z-index: 9999;
min-height: 22px; box-sizing: border-box;
} }
.banner.active { display: block; } .banner.active { display: flex; align-items: center; justify-content: center; }
.banner-top { order: -1; } .banner-top { order: -1; }
.banner-bottom { order: 999; } .banner-bottom { order: 999; }

View File

@@ -5,11 +5,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, interactive-widget=resizes-content"> <meta name="viewport" content="width=device-width, initial-scale=1.0, interactive-widget=resizes-content">
<base href="%%BASE_HREF%%"> <base href="%%BASE_HREF%%">
<script>window.__BASE__ = '%%BASE_PATH%%';</script> <script>window.__BASE__ = '%%BASE_PATH%%';</script>
<script>window.__VERSION__ = '%%APP_VERSION%%'; if (window.__VERSION__.includes('%%')) window.__VERSION__ = 'dev';</script>
<title>Chat Switchboard</title> <title>Chat Switchboard</title>
<link rel="icon" type="image/svg+xml" href="favicon.svg"> <link rel="icon" type="image/svg+xml" href="favicon.svg">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32.png"> <link rel="icon" type="image/png" sizes="32x32" href="favicon-32.png">
<link rel="apple-touch-icon" sizes="192x192" href="favicon-192.png"> <link rel="apple-touch-icon" sizes="192x192" href="favicon-192.png">
<link rel="stylesheet" href="css/styles.css?v=0.7.0.12"> <link rel="stylesheet" href="css/styles.css?v=%%APP_VERSION%%">
</head> </head>
<body> <body>
@@ -161,7 +162,7 @@
<div class="hero-pill"><span class="pill-icon">✈️</span> Air-gap ready</div> <div class="hero-pill"><span class="pill-icon">✈️</span> Air-gap ready</div>
<div class="hero-pill"><span class="pill-icon">🧠</span> Thinking blocks</div> <div class="hero-pill"><span class="pill-icon">🧠</span> Thinking blocks</div>
</div> </div>
<div class="hero-version">v0.6.2</div> <div class="hero-version">v%%APP_VERSION%%</div>
</div> </div>
</div> </div>
<div class="splash-auth"> <div class="splash-auth">
@@ -240,13 +241,13 @@
<h3>Display</h3> <h3>Display</h3>
<div class="form-group"> <div class="form-group">
<label>UI Scale <span class="form-hint" id="scaleValue">100%</span></label> <label>UI Scale <span class="form-hint" id="scaleValue">100%</span></label>
<input type="range" id="settingsScale" min="80" max="130" step="5" value="100" class="range-input"> <input type="range" id="settingsScale" min="80" max="150" step="5" value="100" class="range-input">
<div class="range-labels"><span>80%</span><span>100%</span><span>130%</span></div> <div class="range-labels"><span>80%</span><span>150%</span></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Message Font Size <span class="form-hint" id="msgFontValue">14px</span></label> <label>Message Font Size <span class="form-hint" id="msgFontValue">14px</span></label>
<input type="range" id="settingsMsgFont" min="12" max="20" step="1" value="14" class="range-input"> <input type="range" id="settingsMsgFont" min="12" max="20" step="1" value="14" class="range-input">
<div class="range-labels"><span>12px</span><span>14px</span><span>20px</span></div> <div class="range-labels"><span>12px</span><span>20px</span></div>
</div> </div>
</section> </section>
</div> </div>
@@ -440,10 +441,10 @@
<script src="vendor/marked.min.js" onerror="this.onerror=null;this.src='https://cdnjs.cloudflare.com/ajax/libs/marked/16.3.0/lib/marked.umd.min.js'"></script> <script src="vendor/marked.min.js" onerror="this.onerror=null;this.src='https://cdnjs.cloudflare.com/ajax/libs/marked/16.3.0/lib/marked.umd.min.js'"></script>
<script src="vendor/purify.min.js" onerror="this.onerror=null;this.src='https://cdnjs.cloudflare.com/ajax/libs/dompurify/3.2.4/purify.min.js'"></script> <script src="vendor/purify.min.js" onerror="this.onerror=null;this.src='https://cdnjs.cloudflare.com/ajax/libs/dompurify/3.2.4/purify.min.js'"></script>
<script src="js/debug.js?v=0.7.0.12"></script> <script src="js/debug.js?v=%%APP_VERSION%%"></script>
<script src="js/events.js?v=0.7.0.12"></script> <script src="js/events.js?v=%%APP_VERSION%%"></script>
<script src="js/api.js?v=0.7.0.12"></script> <script src="js/api.js?v=%%APP_VERSION%%"></script>
<script src="js/ui.js?v=0.7.0.12"></script> <script src="js/ui.js?v=%%APP_VERSION%%"></script>
<script src="js/app.js?v=0.7.0.12"></script> <script src="js/app.js?v=%%APP_VERSION%%"></script>
</body> </body>
</html> </html>

View File

@@ -1,5 +1,5 @@
// ========================================== // ==========================================
// Chat Switchboard API Client (v0.7.0) // Chat Switchboard API Client
// ========================================== // ==========================================
// Backend-only mode. Handles auth tokens and // Backend-only mode. Handles auth tokens and
// all HTTP calls. No offline fallback. // all HTTP calls. No offline fallback.

View File

@@ -1,5 +1,5 @@
// ========================================== // ==========================================
// Chat Switchboard Application (v0.6.1) // Chat Switchboard Application
// ========================================== // ==========================================
const App = { const App = {

View File

@@ -1,5 +1,5 @@
// ========================================== // ==========================================
// Chat Switchboard EventBus (v0.5.3) // Chat Switchboard EventBus
// ========================================== // ==========================================
// Labeled event bus with WebSocket bridge. // Labeled event bus with WebSocket bridge.
// Components subscribe by label (supports * wildcard). // Components subscribe by label (supports * wildcard).

View File

@@ -1,5 +1,5 @@
// ========================================== // ==========================================
// Chat Switchboard UI (v0.6.1) // Chat Switchboard UI
// ========================================== // ==========================================
const UI = { const UI = {
@@ -466,7 +466,11 @@ const UI = {
}, },
applyAppearance(scale, msgFont) { applyAppearance(scale, msgFont) {
document.documentElement.style.zoom = scale / 100; const z = scale === 100 ? '' : scale / 100;
// Zoom content areas + modals (but NOT .app or banners)
document.querySelectorAll('.sidebar, .chat-area, .modal-overlay').forEach(el => el.style.zoom = z);
const splash = document.getElementById('splashGate');
if (splash) splash.style.zoom = z;
document.documentElement.style.setProperty('--msg-font', msgFont + 'px'); document.documentElement.style.setProperty('--msg-font', msgFont + 'px');
localStorage.setItem('cs-appearance', JSON.stringify({ scale, msgFont })); localStorage.setItem('cs-appearance', JSON.stringify({ scale, msgFont }));
}, },