feat: simplify journal connection via WebSocket upgrade
Refactor the journal server to run over WebSockets on the existing HTTP server instead of a separate MQTT TCP port. This removes the need for a separate port configuration and simplifies the connection flow by auto-connecting to the current host. - Remove `--mqtt-port` CLI option - Attach Aedes broker to the HTTP server via WebSocket upgrade - Update UI to remove manual broker URL and player name inputs - Add "Content Source" access from the sidebar - Update JournalPanel to auto-connect to the local server
This commit is contained in:
@@ -8,6 +8,7 @@ export interface SidebarProps {
|
||||
onClose: () => void;
|
||||
fileTree?: FileNode[];
|
||||
pathHeadings?: Record<string, TocNode[]>;
|
||||
onDataSourceOpen?: () => void;
|
||||
}
|
||||
|
||||
interface SidebarContentProps {
|
||||
@@ -16,6 +17,7 @@ interface SidebarContentProps {
|
||||
currentPath: string;
|
||||
onClose: () => void;
|
||||
isDesktop?: boolean;
|
||||
onDataSourceOpen?: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,15 +39,24 @@ const SidebarContent: Component<SidebarContentProps> = (props) => {
|
||||
<div class="p-4 border-b border-b-gray-200">
|
||||
<div class="flex items-center justify-between">
|
||||
<h2 class="text-lg font-bold text-gray-900">目录</h2>
|
||||
<Show when={!props.isDesktop}>
|
||||
<div class="flex items-center gap-1">
|
||||
<button
|
||||
onClick={props.onClose}
|
||||
class="text-gray-500 hover:text-gray-700"
|
||||
title="关闭"
|
||||
onClick={props.onDataSourceOpen}
|
||||
class="text-gray-400 hover:text-gray-600 p-1 rounded hover:bg-gray-100"
|
||||
title="Content Source"
|
||||
>
|
||||
✕
|
||||
📂
|
||||
</button>
|
||||
</Show>
|
||||
<Show when={!props.isDesktop}>
|
||||
<button
|
||||
onClick={props.onClose}
|
||||
class="text-gray-500 hover:text-gray-700"
|
||||
title="关闭"
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
</Show>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -121,6 +132,7 @@ export const MobileSidebar: Component<SidebarProps> = (props) => {
|
||||
pathHeadings={pathHeadings()}
|
||||
currentPath={location.pathname}
|
||||
onClose={props.onClose}
|
||||
onDataSourceOpen={props.onDataSourceOpen}
|
||||
/>
|
||||
</aside>
|
||||
</>
|
||||
@@ -133,6 +145,7 @@ export const MobileSidebar: Component<SidebarProps> = (props) => {
|
||||
export const DesktopSidebar: Component<{
|
||||
fileTree?: FileNode[];
|
||||
pathHeadings?: Record<string, TocNode[]>;
|
||||
onDataSourceOpen?: () => void;
|
||||
}> = (props) => {
|
||||
const location = useLocation();
|
||||
const [selfFileTree, setSelfFileTree] = createSignal<FileNode[]>([]);
|
||||
@@ -158,6 +171,7 @@ export const DesktopSidebar: Component<{
|
||||
currentPath={location.pathname}
|
||||
onClose={() => {}}
|
||||
isDesktop
|
||||
onDataSourceOpen={props.onDataSourceOpen}
|
||||
/>
|
||||
</aside>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user