This commit is contained in:
Your Name committed 2026-06-19 18:58:07 -04:00
1 parent ce6fa69b09
commit 716bb98b50
4 files changed
+11 -8

No files matched your search

+1 -1
View File
@@ -191,7 +191,7 @@ export const MENU_TOOL_DEFINITIONS = [
} }
] as const; ] as const;
export const MENU_TOOL_NAMES = new Set(MENU_TOOL_DEFINITIONS.map((tool) => tool.name)); export const MENU_TOOL_NAMES = new Set<string>(MENU_TOOL_DEFINITIONS.map((tool) => tool.name));
export async function handleMenuTool(api: AxiosInstance, name: string, params: any) { export async function handleMenuTool(api: AxiosInstance, name: string, params: any) {
if (!MENU_TOOL_NAMES.has(name)) return null; if (!MENU_TOOL_NAMES.has(name)) return null;
+3 -2
View File
@@ -142,16 +142,17 @@ function validateMenuNodeData(nodeData: any, parentId?: string | null) {
function validateMenuTranslations(translations: any) { function validateMenuTranslations(translations: any) {
const issues: string[] = []; const issues: string[] = [];
const warnings: string[] = [];
if (!isPlainObject(translations)) { if (!isPlainObject(translations)) {
issues.push("translations must be a plain object"); issues.push("translations must be a plain object");
return { issues }; return { issues, warnings };
} }
for (const [key, value] of Object.entries(translations)) { for (const [key, value] of Object.entries(translations)) {
if (typeof value !== "string") { if (typeof value !== "string") {
issues.push(`translation for "${key}" must be a string`); issues.push(`translation for "${key}" must be a string`);
} }
} }
return { issues }; return { issues, warnings };
} }
function validateMenuItems(items: any) { function validateMenuItems(items: any) {
+1 -1
View File
@@ -253,7 +253,7 @@ export const SECTION_TOOL_DEFINITIONS = [
} }
] as const; ] as const;
export const SECTION_TOOL_NAMES = new Set(SECTION_TOOL_DEFINITIONS.map((tool) => tool.name)); export const SECTION_TOOL_NAMES = new Set<string>(SECTION_TOOL_DEFINITIONS.map((tool) => tool.name));
export async function handleSectionTool(api: AxiosInstance, name: string, params: any) { export async function handleSectionTool(api: AxiosInstance, name: string, params: any) {
if (!SECTION_TOOL_NAMES.has(name)) return null; if (!SECTION_TOOL_NAMES.has(name)) return null;
+6 -4
View File
@@ -68,16 +68,18 @@ function resolveApiBase() {
if (envValue) { if (envValue) {
const isDev = Boolean(viteEnv?.DEV) const isDev = Boolean(viteEnv?.DEV)
const isLocalhostUrl = /^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?\/api\/?$/.test(envValue) const isLocalhostUrl = /^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?\/api\/?$/.test(envValue)
const win = (globalThis as any).window
if (isDev && typeof window !== 'undefined' && isLocalhostUrl) { if (isDev && typeof win !== 'undefined' && isLocalhostUrl) {
return `${window.location.protocol}//${window.location.hostname}:${DEFAULT_DEV_API_PORT}/api` return `${win.location.protocol}//${win.location.hostname}:${DEFAULT_DEV_API_PORT}/api`
} }
return envValue return envValue
} }
if (typeof window !== 'undefined') { const win = (globalThis as any).window
return `${window.location.protocol}//${window.location.hostname}:${DEFAULT_DEV_API_PORT}/api` if (typeof win !== 'undefined') {
return `${win.location.protocol}//${win.location.hostname}:${DEFAULT_DEV_API_PORT}/api`
} }
return 'http://localhost:3000/api' return 'http://localhost:3000/api'