import { html } from 'hono/html'; interface LoginViewProps { error?: string; } /** * HTML 转义函数,防止 XSS 攻击 */ function escapeHtml(str: string): string { return str .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, '''); } export function LoginView(props: LoginViewProps) { const escapedError = props.error ? escapeHtml(props.error) : ''; return html` 用户登录 - LLM Gateway

用户登录

${escapedError ? html`
${escapedError}
` : ''}
`; }