UI: fix control chat logo fallback
This commit is contained in:
@@ -78,6 +78,7 @@ import "./components/dashboard-header.ts";
|
||||
import { buildExternalLinkRel, EXTERNAL_LINK_TARGET } from "./external-link.ts";
|
||||
import { icons } from "./icons.ts";
|
||||
import { normalizeBasePath, TAB_GROUPS, subtitleForTab, titleForTab } from "./navigation.ts";
|
||||
import { agentLogoUrl } from "./views/agents-utils.ts";
|
||||
import {
|
||||
resolveAgentConfig,
|
||||
resolveConfiguredCronModelSuggestions,
|
||||
@@ -450,7 +451,7 @@ export function renderApp(state: AppViewState) {
|
||||
? nothing
|
||||
: html`
|
||||
<div class="sidebar-brand">
|
||||
<img class="sidebar-brand__logo" src="${basePath ? `${basePath}/favicon.svg` : "/favicon.svg"}" alt="OpenClaw" />
|
||||
<img class="sidebar-brand__logo" src="${agentLogoUrl(basePath)}" alt="OpenClaw" />
|
||||
<span class="sidebar-brand__title">OpenClaw</span>
|
||||
</div>
|
||||
`
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
agentLogoUrl,
|
||||
resolveConfiguredCronModelSuggestions,
|
||||
resolveEffectiveModelFallbacks,
|
||||
sortLocaleStrings,
|
||||
@@ -98,3 +99,14 @@ describe("sortLocaleStrings", () => {
|
||||
expect(sortLocaleStrings(new Set(["beta", "alpha"]))).toEqual(["alpha", "beta"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("agentLogoUrl", () => {
|
||||
it("keeps base-mounted control UI logo paths absolute to the mount", () => {
|
||||
expect(agentLogoUrl("/ui")).toBe("/ui/favicon.svg");
|
||||
expect(agentLogoUrl("/apps/openclaw/")).toBe("/apps/openclaw/favicon.svg");
|
||||
});
|
||||
|
||||
it("uses a route-relative fallback before basePath bootstrap finishes", () => {
|
||||
expect(agentLogoUrl("")).toBe("favicon.svg");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -215,7 +215,7 @@ export function resolveAgentAvatarUrl(
|
||||
|
||||
export function agentLogoUrl(basePath: string): string {
|
||||
const base = basePath?.trim() ? basePath.replace(/\/$/, "") : "";
|
||||
return base ? `${base}/favicon.svg` : "/favicon.svg";
|
||||
return base ? `${base}/favicon.svg` : "favicon.svg";
|
||||
}
|
||||
|
||||
function isLikelyEmoji(value: string) {
|
||||
|
||||
@@ -4,10 +4,11 @@ import { renderThemeToggle } from "../app-render.helpers.ts";
|
||||
import type { AppViewState } from "../app-view-state.ts";
|
||||
import { icons } from "../icons.ts";
|
||||
import { normalizeBasePath } from "../navigation.ts";
|
||||
import { agentLogoUrl } from "./agents-utils.ts";
|
||||
|
||||
export function renderLoginGate(state: AppViewState) {
|
||||
const basePath = normalizeBasePath(state.basePath ?? "");
|
||||
const faviconSrc = basePath ? `${basePath}/favicon.svg` : "/favicon.svg";
|
||||
const faviconSrc = agentLogoUrl(basePath);
|
||||
|
||||
return html`
|
||||
<div class="login-gate">
|
||||
|
||||
Reference in New Issue
Block a user