fix(安全): 修复HTML导出中的XSS漏洞并清理调试日志
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
refactor(日志): 替换console.log为tracing日志系统 style(代码): 移除未使用的代码和依赖项 feat(测试): 添加端到端测试文档和CI工作流 docs(变更日志): 更新CHANGELOG.md记录0.1.0版本变更 perf(构建): 更新依赖版本并优化CI流程
This commit is contained in:
@@ -73,6 +73,9 @@ import {
|
||||
|
||||
import type { GatewayConfigSnapshot, GatewayModelChoice } from './gateway-config';
|
||||
import { installApiMethods } from './gateway-api';
|
||||
import { createLogger } from './logger';
|
||||
|
||||
const log = createLogger('GatewayClient');
|
||||
|
||||
// === Security ===
|
||||
|
||||
@@ -718,7 +721,7 @@ export class GatewayClient {
|
||||
public async restPost<T>(path: string, body?: unknown): Promise<T> {
|
||||
const baseUrl = this.getRestBaseUrl();
|
||||
const url = `${baseUrl}${path}`;
|
||||
console.log(`[GatewayClient] POST ${url}`, body);
|
||||
log.debug(`POST ${url}`, body);
|
||||
|
||||
const response = await fetch(url, {
|
||||
method: 'POST',
|
||||
@@ -728,7 +731,7 @@ export class GatewayClient {
|
||||
|
||||
if (!response.ok) {
|
||||
const errorBody = await response.text().catch(() => '');
|
||||
console.error(`[GatewayClient] POST ${url} failed: ${response.status} ${response.statusText}`, errorBody);
|
||||
log.error(`POST ${url} failed: ${response.status} ${response.statusText}`, errorBody);
|
||||
const error = new Error(`REST API error: ${response.status} ${response.statusText}${errorBody ? ` - ${errorBody}` : ''}`);
|
||||
(error as any).status = response.status;
|
||||
(error as any).body = errorBody;
|
||||
@@ -736,7 +739,7 @@ export class GatewayClient {
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
console.log(`[GatewayClient] POST ${url} response:`, result);
|
||||
log.debug(`POST ${url} response:`, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -876,7 +879,7 @@ export class GatewayClient {
|
||||
maxProtocol: 3,
|
||||
client: {
|
||||
id: clientId,
|
||||
version: '0.2.0',
|
||||
version: '0.1.0',
|
||||
platform: this.detectPlatform(),
|
||||
mode: clientMode,
|
||||
},
|
||||
@@ -885,7 +888,7 @@ export class GatewayClient {
|
||||
|
||||
auth: this.token ? { token: this.token } : {},
|
||||
locale: 'zh-CN',
|
||||
userAgent: 'zclaw-tauri/0.2.0',
|
||||
userAgent: 'zclaw-tauri/0.1.0',
|
||||
device: {
|
||||
id: deviceKeys.deviceId,
|
||||
publicKey: deviceKeys.publicKeyBase64,
|
||||
|
||||
Reference in New Issue
Block a user