Skip to content

A modern and elegant dashboard for network traffic visualization and analysis.

feat: Implement a showcase mode that restricts backend management and configuration changes.

luoleib408a9e8840d
diff --git a/.env.example b/.env.example
index e8a3fab..c76278c 100644
--- a/.env.example
+++ b/.env.example
@@ -42,6 +42,13 @@ WS_EXTERNAL_PORT=3002
# 运行环境
# NODE_ENV=production
+# -----------------------------------------------------------------------------
+# 演示模式配置
+# -----------------------------------------------------------------------------
+# 设置为 true 启用演示模式(禁止修改后端配置、认证设置和数据操作)
+# 用于将在线站点转换为演示站点供公众访问
+# SHOWCASE_SITE_MODE=false
+
# =============================================================================
# 配置完成后,请使用以下命令启动:
# docker compose up -d
diff --git a/README.en.md b/README.en.md
index 1b68a31..2eef13f 100644
--- a/README.en.md
+++ b/README.en.md
@@ -9,6 +9,10 @@
<span>Real-time monitoring · Traffic auditing · Multi-gateway support</span>
</p>
+<p align="center">
+ <b>English</b> | <a href="./README.md">中文</a>
+</p>
+
<p align="center">
<a href="https://github.com/foru17/neko-master/stargazers"><img src="https://img.shields.io/github/stars/foru17/neko-master?style=flat-square&color=yellow" alt="Stars"></a>
<a href="https://hub.docker.com/r/foru17/neko-master"><img src="https://img.shields.io/docker/pulls/foru17/neko-master?style=flat-square&color=blue&logo=docker" alt="Docker Pulls"></a>
@@ -27,7 +31,7 @@
> proxy subscription, or cross-network connectivity.
> All data is collected from the user's own network environment.
>
-> Please use this software in compliance with applicable laws and regulations.
+> This project is open-sourced under the MIT License. We assume no responsibility for any consequences resulting from the use of this software. Please use it in compliance with applicable laws and regulations.
![Neko Master Overview](./assets/neko-master-overview.png)
![Neko Master Rules](./assets/neko-master-rules.png)
diff --git a/README.md b/README.md
index 33cf5e7..c5bc44f 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,10 @@
<span>实时监控 · 流量审计 · 多网关管理</span>
</p>
+<p align="center">
+ <b>中文 | <a href="./README.en.md">English</a></b>
+</p>
+
<p align="center">
<a href="https://github.com/foru17/neko-master/stargazers"><img src="https://img.shields.io/github/stars/foru17/neko-master?style=flat-square&color=yellow" alt="Stars"></a>
<a href="https://hub.docker.com/r/foru17/neko-master"><img src="https://img.shields.io/docker/pulls/foru17/neko-master?style=flat-square&color=blue&logo=docker" alt="Docker Pulls"></a>
@@ -26,7 +30,7 @@
> 本项目 **不提供任何网络接入服务、代理订阅或跨网络连接功能**。
> 所有数据均来源于用户自有网络环境。
>
-> 请在符合当地法律法规的前提下使用本软件。
+> 本项目遵循 MIT 协议开源,不对因使用本软件产生的任何后果承担责任。请在合规范围内使用。
![Neko Master Overview](./assets/neko-master-overview.png)
![Neko Master Rules](./assets/neko-master-rules.png)
diff --git a/apps/collector/src/app.ts b/apps/collector/src/app.ts
index 36c5fac..2640435 100644
--- a/apps/collector/src/app.ts
+++ b/apps/collector/src/app.ts
@@ -42,9 +42,9 @@ export async function createApp(options: AppOptions) {
});
// Create services
- const backendService = new BackendService(db, realtimeStore);
- const statsService = new StatsService(db, realtimeStore);
const authService = new AuthService(db);
+ const backendService = new BackendService(db, realtimeStore, authService);
+ const statsService = new StatsService(db, realtimeStore);
// Decorate Fastify instance with services
app.decorate('backendService', backendService);
@@ -75,6 +75,10 @@ export async function createApp(options: AppOptions) {
});
app.post('/api/db/cleanup', async (request, reply) => {
+ if (authService.isShowcaseMode()) {
+ return reply.status(403).send({ error: 'Forbidden' });
+ }
+
const body = request.body as { days?: number; backendId?: number };
const days = body?.days;
const backendId = typeof body?.backendId === 'number' ? body.backendId : undefined;
@@ -111,7 +115,11 @@ export async function createApp(options: AppOptions) {
};
});
- app.post('/api/db/vacuum', async () => {
+ app.post('/api/db/vacuum', async (request, reply) => {
+ if (authService.isShowcaseMode()) {
+ return reply.status(403).send({ error: 'Forbidden' });
+ }
+
db.vacuum();
return { message: 'Database vacuumed successfully' };
});
@@ -121,6 +129,10 @@ export async function createApp(options: AppOptions) {
});
app.put('/api/db/retention', async (request, reply) => {
+ if (authService.isShowcaseMode()) {
+ return reply.status(403).send({ error: 'Forbidden' });
+ }
+
const body = request.body as {
connectionLogsDays?: number;
hourlyStatsDays?: number;
diff --git a/apps/collector/src/modules/auth/auth.controller.ts b/apps/collector/src/modules/auth/auth.controller.ts
index e74f5ef..8dafe63 100644
--- a/apps/collector/src/modules/auth/auth.controller.ts
+++ b/apps/collector/src/modules/auth/auth.controller.ts
@@ -50,6 +50,10 @@ export async function authController(app: FastifyInstance) {
* but requires existing token if already enabled)
*/
app.post('/enable', async (request, reply) => {
+ if (authService.isShowcaseMode()) {
+ return reply.status(403).send({ error: 'Forbidden' });
+ }
+
const body = request.body as { token?: string };
const token = body?.token;
@@ -76,6 +80,10 @@ export async function authController(app: FastifyInstance) {
* Disable authentication (requires valid token)
*/
app.post('/disable', async (request, reply) => {
+ if (authService.isShowcaseMode()) {
+ return reply.status(403).send({ error: 'Forbidden' });
+ }
+
const body = request.body as { token?: string };
const token = body?.token;
@@ -108,6 +116,10 @@ export async function authController(app: FastifyInstance) {
* Update token (requires valid existing token)
*/
app.put('/token', async (request, reply) => {
+ if (authService.isShowcaseMode()) {
+ return reply.status(403).send({ error: 'Forbidden' });
+ }
+
const body = request.body as { currentToken?: string; newToken?: string };
const { currentToken, newToken } = body;
diff --git a/apps/collector/src/modules/auth/auth.service.ts b/apps/collector/src/modules/auth/auth.service.ts
index 3d4d8cf..2b40d82 100644
--- a/apps/collector/src/modules/auth/auth.service.ts
+++ b/apps/collector/src/modules/auth/auth.service.ts
@@ -48,9 +48,17 @@ export class AuthService {
enabled: forcedOff ? false : config.enabled,
hasToken: !!config.tokenHash,
forceAccessControlOff: forcedOff,
+ showcaseMode: this.isShowcaseMode(),
};
}
+ /**
+ * Check if showcase mode is enabled via environment variable
+ */
+ isShowcaseMode(): boolean {
+ return process.env.SHOWCASE_SITE_MODE === 'true';
+ }
+
/**
* Verified token if valid
*/
diff --git a/apps/collector/src/modules/auth/auth.types.ts b/apps/collector/src/modules/auth/auth.types.ts
index aeadf80..4e64bba 100644
--- a/apps/collector/src/modules/auth/auth.types.ts
+++ b/apps/collector/src/modules/auth/auth.types.ts
@@ -17,4 +17,5 @@ export interface AuthState {
enabled: boolean;
hasToken: boolean;
forceAccessControlOff?: boolean;
+ showcaseMode?: boolean;
}
diff --git a/apps/collector/src/modules/backend/backend.controller.ts b/apps/collector/src/modules/backend/backend.controller.ts
index cc47003..bd647b8 100644
--- a/apps/collector/src/modules/backend/backend.controller.ts
+++ b/apps/collector/src/modules/backend/backend.controller.ts
@@ -45,6 +45,10 @@ const backendController: FastifyPluginAsync = async (fastify: FastifyInstance):
// Create new backend
fastify.post<{ Body: CreateBackendInput }>('/', async (request, reply) => {
+ if (fastify.authService.isShowcaseMode()) {
+ return reply.status(403).send({ error: 'Forbidden' });
+ }
+
const { name, url, token } = request.body;
if (!name || !url) {
@@ -64,6 +68,10 @@ const backendController: FastifyPluginAsync = async (fastify: FastifyInstance):
// Update backend
fastify.put<{ Params: BackendParams; Body: UpdateBackendInput }>('/:id', async (request, reply) => {
+ if (fastify.authService.isShowcaseMode()) {
+ return reply.status(403).send({ error: 'Forbidden' });
+ }
+
const { id } = request.params;
const backendId = parseInt(id);
@@ -78,6 +86,10 @@ const backendController: FastifyPluginAsync = async (fastify: FastifyInstance):
// Delete backend
fastify.delete<{ Params: BackendParams }>('/:id', async (request, reply) => {
+ if (fastify.authService.isShowcaseMode()) {
+ return reply.status(403).send({ error: 'Forbidden' });
+ }
+
const { id } = request.params;
const backendId = parseInt(id);
@@ -92,6 +104,10 @@ const backendController: FastifyPluginAsync = async (fastify: FastifyInstance):
// Set active backend
fastify.post<{ Params: BackendParams }>('/:id/activate', async (request, reply) => {
+ if (fastify.authService.isShowcaseMode()) {
+ return reply.status(403).send({ error: 'Forbidden' });
+ }
+
const { id } = request.params;
const backendId = parseInt(id);
@@ -106,6 +122,10 @@ const backendController: FastifyPluginAsync = async (fastify: FastifyInstance):
// Set listening state for a backend
fastify.post<{ Params: BackendParams; Body: ListeningBody }>('/:id/listening', async (request, reply) => {
+ if (fastify.authService.isShowcaseMode()) {
+ return reply.status(403).send({ error: 'Forbidden' });
+ }
+
const { id } = request.params;
const { listening } = request.body;
const backendId = parseInt(id);
@@ -121,6 +141,10 @@ const backendController: FastifyPluginAsync = async (fastify: FastifyInstance):
// Test existing backend connection (uses stored token)
fastify.post<{ Params: BackendParams }>('/:id/test', async (request, reply) => {
+ if (fastify.authService.isShowcaseMode()) {
+ return reply.status(403).send({ error: 'Forbidden' });
+ }
+
const { id } = request.params;
const backendId = parseInt(id);
@@ -134,13 +158,21 @@ const backendController: FastifyPluginAsync = async (fastify: FastifyInstance):
});
// Test backend connection
- fastify.post<{ Body: TestConnectionInput }>('/test', async (request) => {
+ fastify.post<{ Body: TestConnectionInput }>('/test', async (request, reply) => {
+ if (fastify.authService.isShowcaseMode()) {
+ return reply.status(403).send({ error: 'Forbidden' });
+ }
+
const result = await service.testConnection(request.body);
return result;
});
// Clear all data for a specific backend
fastify.post<{ Params: BackendParams }>('/:id/clear-data', async (request, reply) => {
+ if (fastify.authService.isShowcaseMode()) {
+ return reply.status(403).send({ error: 'Forbidden' });
+ }
+
const { id } = request.params;
const backendId = parseInt(id);
diff --git a/apps/collector/src/modules/backend/backend.service.ts b/apps/collector/src/modules/backend/backend.service.ts
index 60ea8d8..ff14ac8 100644
--- a/apps/collector/src/modules/backend/backend.service.ts
+++ b/apps/collector/src/modules/backend/backend.service.ts
@@ -14,10 +14,29 @@ import type {
CreateBackendResult,
} from './backend.types.js';
+import type { AuthService } from '../auth/auth.service.js';
+
+/**
+ * Mask URL for showcase mode - hides host, port, credentials
+ * Handles various URL formats including IPv6 addresses
+ */
+function maskUrl(url: string): string {
+ try {
+ const urlObj = new URL(url);
+ // Only keep protocol, mask everything else
+ return `${urlObj.protocol}//******`;
+ } catch {
+ // If URL parsing fails, use regex fallback
+ // This regex handles: protocol://[anything-until-slash-or-end]
+ return url.replace(/:\/\/[^\/]+/, '://******');
+ }
+}
+
export class BackendService {
constructor(
private db: StatsDatabase,
private realtimeStore: RealtimeStore,
+ private authService: AuthService,
) {}
/**
@@ -25,9 +44,12 @@ export class BackendService {
*/
getAllBackends(): BackendResponse[] {
const backends = this.db.getAllBackends();
+ const isShowcase = this.authService.isShowcaseMode();
+
return backends.map(({ token, ...rest }) => ({
...rest,
hasToken: !!token,
+ url: isShowcase ? maskUrl(rest.url) : rest.url,
}));
}
@@ -40,7 +62,13 @@ export class BackendService {
return { error: 'No active backend configured' };
}
const { token, ...rest } = backend;
- return { ...rest, hasToken: !!token };
+ const isShowcase = this.authService.isShowcaseMode();
+
+ return {
+ ...rest,
+ hasToken: !!token,
+ url: isShowcase ? maskUrl(rest.url) : rest.url,
+ };
}
/**
@@ -48,9 +76,12 @@ export class BackendService {
*/
getListeningBackends(): BackendResponse[] {
const backends = this.db.getListeningBackends();
+ const isShowcase = this.authService.isShowcaseMode();
+
return backends.map(({ token, ...rest }) => ({
...rest,
hasToken: !!token,
+ url: isShowcase ? maskUrl(rest.url) : rest.url,
}));
}
@@ -58,7 +89,16 @@ export class BackendService {
* Get a single backend by ID
*/
getBackend(id: number): BackendConfig | undefined {
- return this.db.getBackend(id);
+ const backend = this.db.getBackend(id);
+ if (!backend) return undefined;
+
+ if (this.authService.isShowcaseMode()) {
+ return {
+ ...backend,
+ url: maskUrl(backend.url),
+ };
+ }
+ return backend;
}
/**
diff --git a/apps/web/app/[locale]/dashboard/components/header/index.tsx b/apps/web/app/[locale]/dashboard/components/header/index.tsx
index 1bee880..0b7e164 100644
--- a/apps/web/app/[locale]/dashboard/components/header/index.tsx
+++ b/apps/web/app/[locale]/dashboard/components/header/index.tsx
@@ -14,6 +14,7 @@ import {
MoreVertical,
Info,
LogOut,
+ ShieldAlert,
} from "lucide-react";
import Image from "next/image";
import { Button } from "@/components/ui/button";
@@ -51,6 +52,8 @@ interface Backend {
}
import { useAuth } from "@/lib/auth";
+import { useAuthState } from "@/lib/auth-queries"; // Added
+import { useTranslations } from "next-intl"; // Added
interface HeaderProps {
// Backend data
@@ -117,6 +120,9 @@ export function Header({
dashboardT,
}: HeaderProps) {
const { logout, authState } = useAuth();
+ const { data: authQueryState } = useAuthState(); // Added
+ const isShowcase = authQueryState?.showcaseMode ?? false; // Added
+ const navT = useTranslations("nav"); // Added
return (
<header className="sticky top-0 z-40 border-b border-border/40 bg-background/80 backdrop-blur-md">
@@ -351,6 +357,17 @@ export function Header({
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-56">
+ {/* Showcase Mode Indicator */}
+ {isShowcase && (
+ <>
+ <DropdownMenuLabel className="flex items-center gap-2 text-amber-600 dark:text-amber-400">
+ <ShieldAlert className="w-4 h-4" />
+ {navT("showcaseMode")}
+ </DropdownMenuLabel>
+ <DropdownMenuSeparator />
+ </>
+ )}
+
{/* Auto Refresh Toggle */}
<DropdownMenuLabel className="flex items-center gap-2">
<RefreshCw className="w-4 h-4" />
diff --git a/apps/web/components/features/backend/backend-config-dialog.tsx b/apps/web/components/features/backend/backend-config-dialog.tsx
index 725ab59..1ff64e9 100644
--- a/apps/web/components/features/backend/backend-config-dialog.tsx
+++ b/apps/web/components/features/backend/backend-config-dialog.tsx
@@ -283,7 +283,7 @@ function parseUrl(url: string): { host: string; port: string; ssl: boolean } {
try {
const urlObj = new URL(url);
return {
- host: urlObj.hostname,
+ host: decodeURIComponent(urlObj.hostname),
port: urlObj.port || (urlObj.protocol === "https:" ? "443" : "80"),
ssl: urlObj.protocol === "https:",
};
@@ -355,6 +355,7 @@ export function BackendConfigDialog({
// Auth State from React Query
const { data: authState } = useAuthState();
const authEnabled = authState?.enabled ?? false;
+ const isShowcase = authState?.showcaseMode ?? false;
// Local auth form state
const [authToken, setAuthToken] = useState("");
@@ -1053,6 +1054,7 @@ export function BackendConfigDialog({
handleToggleListening(backend.id, checked)
}
className="data-[state=checked]:bg-green-500"
+ disabled={isShowcase}
/>
<span className="text-xs text-muted-foreground hidden sm:inline">
{t("collect")}
@@ -1108,7 +1110,8 @@ export function BackendConfigDialog({
size="icon"
className="h-8 w-8"
onClick={() => startEdit(backend)}
- title={commonT("edit")}>
+ title={commonT("edit")}
+ disabled={isShowcase}>
<Edit2 className="w-4 h-4" />
</Button>
@@ -1117,7 +1120,8 @@ export function BackendConfigDialog({
size="icon"
className="h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10"
onClick={() => openDeleteDialog(backend.id)}
- title={commonT("delete")}>
+ title={commonT("delete")}
+ disabled={isShowcase}>
<Trash2 className="w-4 h-4" />
</Button>
</div>
@@ -1154,6 +1158,11 @@ export function BackendConfigDialog({
? t("firstTimeTitle")
: t("addNew")}
</h4>
+ {isShowcase ? (
+ <div className="text-sm text-muted-foreground italic">
+ {t("showcaseModeAddDisabled") || "Adding backends is disabled in showcase mode"}
+ </div>
+ ) : (
<div className="space-y-3">
<div className="grid grid-cols-2 gap-3">
<div>
@@ -1251,8 +1260,10 @@ export function BackendConfigDialog({
</Button>
</div>
</div>
+ )}
</div>
) : backends.length > 0 ? (
+ !isShowcase && (
<Button
variant="outline"
className="w-full border-dashed"
@@ -1263,6 +1274,7 @@ export function BackendConfigDialog({
<Plus className="w-4 h-4 mr-2" />
{t("addNew")}
</Button>
+ )
) : null}
</div>
) : activeTab === "preferences" ? (
@@ -1317,7 +1329,7 @@ export function BackendConfigDialog({
handleDisableAuth();
}
}}
- disabled={authLoading}
+ disabled={authLoading || isShowcase}
/>
</div>
@@ -1343,7 +1355,7 @@ export function BackendConfigDialog({
"pl-10 pr-10 transition-all duration-200",
isTokenInvalid && "border-destructive ring-destructive/20 focus-visible:ring-destructive"
)}
- disabled={authLoading}
+ disabled={authLoading || isShowcase}
/>
<button
type="button"
@@ -1387,6 +1399,7 @@ export function BackendConfigDialog({
size="sm"
className="h-8 bg-background/50 hover:bg-background/80 border-green-500/30 text-green-700 dark:text-green-400"
onClick={() => setChangeTokenDialogOpen(true)}
+ disabled={isShowcase}
>
<Key className="w-3.5 h-3.5 mr-1.5" />
{authState?.forceAccessControlOff ? "Reset Password" : t("auth.changeToken")}
@@ -1464,7 +1477,7 @@ export function BackendConfigDialog({
<button
key={preset.key}
onClick={() => applyPreset(preset.key)}
- disabled={updatingRetention}
+ disabled={updatingRetention || isShowcase}
className={cn(
"px-3 py-1.5 text-sm rounded-md border transition-all",
isActive
@@ -1498,7 +1511,7 @@ export function BackendConfigDialog({
const days = parseInt(e.target.value) || 1;
applyCustomDays(Math.min(90, Math.max(1, days)));
}}
- disabled={updatingRetention}
+ disabled={updatingRetention || isShowcase}
className="w-14 h-6 text-sm text-center p-0 border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0"
/>
<span className="text-xs text-muted-foreground">
@@ -1522,28 +1535,28 @@ export function BackendConfigDialog({
variant="outline"
size="sm"
onClick={() => openClearLogsDialog(1)}
- disabled={clearingLogs}>
+ disabled={clearingLogs || isShowcase}>
{t("clear1Day")}
</Button>
<Button
variant="outline"
size="sm"
onClick={() => openClearLogsDialog(7)}
- disabled={clearingLogs}>
+ disabled={clearingLogs || isShowcase}>
{t("clear7Days")}
</Button>
<Button
variant="outline"
size="sm"
onClick={() => openClearLogsDialog(30)}
- disabled={clearingLogs}>
+ disabled={clearingLogs || isShowcase}>
{t("clear30Days")}
</Button>
<Button
variant="destructive"
size="sm"
onClick={() => openClearLogsDialog(0)}
- disabled={clearingLogs}>
+ disabled={clearingLogs || isShowcase}>
{t("clearAll")}
</Button>
</div>
diff --git a/apps/web/components/features/stats/stats-cards.tsx b/apps/web/components/features/stats/stats-cards.tsx
index ccc3292..e86b5f4 100644
--- a/apps/web/components/features/stats/stats-cards.tsx
+++ b/apps/web/components/features/stats/stats-cards.tsx
@@ -143,10 +143,10 @@ export function StatsCards({ data, backendStatus }: StatsCardsProps) {
<>
<PlaceholderStatCard icon={Download} label={t("totalDownload")} color="#3B82F6" />
<PlaceholderStatCard icon={Upload} label={t("totalUpload")} color="#8B5CF6" />
+ <PlaceholderStatCard icon={Server} label={t("total")} color="#EC4899" />
<PlaceholderStatCard icon={Activity} label={t("totalConnections")} color="#10B981" />
<PlaceholderStatCard icon={Globe} label={t("domains")} color="#06B6D4" />
<PlaceholderStatCard icon={Route} label={t("rules")} color="#F59E0B" />
- <PlaceholderStatCard icon={Server} label={t("total")} color="#EC4899" />
</>
) : (
<>
@@ -164,6 +164,13 @@ export function StatsCards({ data, backendStatus }: StatsCardsProps) {
label={t("totalUpload")}
color="#8B5CF6"
/>
+ <AnimatedStatCard
+ value={(data?.totalDownload || 0) + (data?.totalUpload || 0)}
+ formatter={formatBytes}
+ label={t("total")}
+ icon={Server}
+ color="#EC4899"
+ />
<AnimatedStatCard
value={data?.totalConnections || 0}
formatter={(n) => n.toLocaleString()}
@@ -185,13 +192,6 @@ export function StatsCards({ data, backendStatus }: StatsCardsProps) {
icon={Route}
color="#F59E0B"
/>
- <AnimatedStatCard
- value={(data?.totalDownload || 0) + (data?.totalUpload || 0)}
- formatter={formatBytes}
- label={t("total")}
- icon={Server}
- color="#EC4899"
- />
</>
)}
</div>
diff --git a/apps/web/components/layout/navigation.tsx b/apps/web/components/layout/navigation.tsx
index 361a982..76c9e1f 100644
--- a/apps/web/components/layout/navigation.tsx
+++ b/apps/web/components/layout/navigation.tsx
@@ -16,6 +16,7 @@ import {
Smartphone,
RefreshCw,
X,
+ ShieldAlert, // Added
} from "lucide-react";
import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button";
@@ -29,6 +30,7 @@ import {
} from "@/components/ui/tooltip";
import { useVersionCheck } from "@/hooks/use-version-check";
import { usePWAInstall } from "@/hooks/use-pwa-install";
+import { useAuthState } from "@/lib/auth-queries"; // Added
interface NavigationProps {
activeTab: string;
@@ -58,6 +60,10 @@ export function Navigation({
const [settingsOpen, setSettingsOpen] = useState(false);
const [aboutOpen, setAboutOpen] = useState(false);
const t = useTranslations("nav");
+
+ const { data: authState } = useAuthState(); // Added
+ const isShowcase = authState?.showcaseMode ?? false; // Added
+
const headerT = useTranslations("header");
const backendT = useTranslations("backend");
const aboutT = useTranslations("about");
@@ -109,7 +115,7 @@ export function Navigation({
/>
</div>
<div>
- <div className="flex items-center gap-1.5">
+ <div className="flex items-center gap-2">
<h1 className="font-bold text-xl leading-tight whitespace-nowrap">
{headerT("title")}
</h1>
@@ -117,7 +123,10 @@ export function Navigation({
<Tooltip>
<TooltipTrigger asChild>
<span
- className={cn("relative inline-flex shrink-0", statusDotSizeClass)}
+ className={cn(
+ "relative inline-flex shrink-0",
+ statusDotSizeClass,
+ )}
aria-label={statusText}
role="status">
<span
@@ -150,12 +159,24 @@ export function Navigation({
</Tooltip>
</TooltipProvider>
</div>
- <p className="text-xs leading-4 text-muted-foreground/60 min-h-8">
+ <p className="text-xs leading-4 text-muted-foreground/60 min-h-8 mt-0.5">
{headerT("subtitle")}
</p>
</div>
</div>
+ {/* Showcase Mode Indicator */}
+ {isShowcase && (
+ <div className="px-4 pt-4 pb-2">
+ <div className="flex items-center gap-2 px-3 py-2 rounded-xl bg-amber-500/10 border border-amber-500/20 transition-all hover:bg-amber-500/15">
+ <ShieldAlert className="w-4 h-4 text-amber-600 dark:text-amber-400 shrink-0" />
+ <span className="text-xs font-medium text-amber-600 dark:text-amber-400">
+ {t("showcaseMode")}
+ </span>
+ </div>
+ </div>
+ )}
+
{/* Nav Items */}
<nav className="flex-1 p-4 space-y-1">
{NAV_ITEMS.map((item) => {
diff --git a/apps/web/lib/auth-queries.ts b/apps/web/lib/auth-queries.ts
index 5d86bda..f8e28b1 100644
--- a/apps/web/lib/auth-queries.ts
+++ b/apps/web/lib/auth-queries.ts
@@ -9,6 +9,7 @@ export interface AuthState {
enabled: boolean;
hasToken: boolean;
forceAccessControlOff?: boolean;
+ showcaseMode?: boolean;
}
// API functions
diff --git a/apps/web/messages/en.json b/apps/web/messages/en.json
index ac6c54d..1b0270c 100644
--- a/apps/web/messages/en.json
+++ b/apps/web/messages/en.json
@@ -11,7 +11,8 @@
"proxies": "Proxies",
"rules": "Rules",
"network": "Network",
- "settings": "Settings"
+ "settings": "Settings",
+ "showcaseMode": "Showcase Mode"
},
"header": {
"title": "Neko Master",
@@ -71,7 +72,7 @@
"stats": {
"totalDownload": "Total Download",
"totalUpload": "Total Upload",
- "totalConnections": "Total Connections",
+ "totalConnections": "Connections",
"uniqueDomains": "Unique Domains",
"todayDownload": "Today's Download",
"todayUpload": "Today's Upload",
@@ -411,6 +412,9 @@
"retentionUpdated": "Storage settings saved",
"retentionUpdateFailed": "Failed to save settings",
"invalidToken": "Invalid token format",
+ "showcaseModeAddDisabled": "Adding backends is disabled in showcase mode",
+ "showcaseModeSecurityDisabled": "Security settings are locked in showcase mode",
+ "showcaseModeDbDisabled": "Database operations are disabled in showcase mode",
"auth": {
"title": "Access Control",
"description": "Enable access control to protect your dashboard data",
diff --git a/apps/web/messages/zh.json b/apps/web/messages/zh.json
index 9b0f8da..5c8cb70 100644
--- a/apps/web/messages/zh.json
+++ b/apps/web/messages/zh.json
@@ -11,7 +11,8 @@
"proxies": "代理",
"rules": "规则",
"network": "网络",
- "settings": "设置"
+ "settings": "设置",
+ "showcaseMode": "演示模式"
},
"header": {
"title": "Neko Master",
@@ -410,6 +411,9 @@
"retentionUpdated": "存储设置已保存",
"retentionUpdateFailed": "设置保存失败",
"invalidToken": "令牌格式无效",
+ "showcaseModeAddDisabled": "演示模式下禁止添加后端",
+ "showcaseModeSecurityDisabled": "演示模式下禁止修改安全设置",
+ "showcaseModeDbDisabled": "演示模式下禁止数据库操作",
"auth": {
"title": "访问控制",
"description": "启用访问控制以保护您的面板数据安全",
diff --git a/package.json b/package.json
index 69d3850..3ae5d4d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "neko-master",
- "version": "1.2.1",
+ "version": "1.2.2",
"description": "Modern traffic analytics for edge gateways",
"private": true,
"workspaces": [