🌐 chore: translate non-English comments to English in desktop controllers (#11978)

This commit is contained in:
LobeHub Bot
2026-01-31 00:49:38 +08:00
committed by GitHub
parent 7496511917
commit 67c4bafd3f
3 changed files with 18 additions and 18 deletions

View File

@@ -59,14 +59,14 @@ interface McpInstallParams {
*/
export default class McpInstallController extends ControllerModule {
/**
* 处理 MCP 插件安装请求
* @param parsedData 解析后的协议数据
* @returns 是否处理成功
* Handle MCP plugin installation request
* @param parsedData Parsed protocol data
* @returns Whether processing succeeded
*/
@protocolHandler('install')
public async handleInstallRequest(parsedData: McpInstallParams): Promise<boolean> {
try {
// 从参数中提取必需字段
// Extract required fields from parameters
const { id, schema: schemaParam, marketId } = parsedData;
if (!id) {
@@ -76,11 +76,11 @@ export default class McpInstallController extends ControllerModule {
return false;
}
// 映射协议来源
// Map protocol source
const isOfficialMarket = marketId === 'lobehub';
// 对于官方市场schema 是可选的对于第三方市场schema 是必需的
// For official marketplace, schema is optional; for third-party marketplace, schema is required
if (!isOfficialMarket && !schemaParam) {
logger.warn(`🔧 [McpInstall] Schema is required for third-party marketplace:`, {
marketId,
@@ -90,7 +90,7 @@ export default class McpInstallController extends ControllerModule {
let mcpSchema: McpSchema | undefined;
// 如果提供了 schema 参数,则解析和验证
// If schema parameter is provided, parse and validate
if (schemaParam) {
try {
mcpSchema = JSON.parse(schemaParam);
@@ -104,7 +104,7 @@ export default class McpInstallController extends ControllerModule {
return false;
}
// 验证 identifier 与 id 参数匹配
// Verify identifier matches id parameter
if (mcpSchema.identifier !== id) {
logger.error(`🔧 [McpInstall] Schema identifier does not match URL id parameter:`, {
schemaId: mcpSchema.identifier,
@@ -122,7 +122,7 @@ export default class McpInstallController extends ControllerModule {
pluginVersion: mcpSchema?.version || 'Unknown',
});
// 广播安装请求到前端
// Broadcast installation request to frontend
const installRequest = {
marketId,
pluginId: id,
@@ -136,7 +136,7 @@ export default class McpInstallController extends ControllerModule {
pluginName: installRequest.schema?.name || 'Unknown',
});
// 通过应用实例广播到前端
// Broadcast to frontend via app instance
if (this.app?.browserManager) {
this.app.browserManager.broadcastToWindow('app', 'mcpInstallRequest', installRequest);
logger.debug(`🔧 [McpInstall] Install request broadcasted successfully`);

View File

@@ -88,7 +88,7 @@ export default class NetworkProxyCtr extends ControllerModule {
}
/**
* 测试代理连接
* Test proxy connection
*/
@IpcMethod()
async testProxyConnection(url: string): Promise<{ message?: string; success: boolean }> {
@@ -108,7 +108,7 @@ export default class NetworkProxyCtr extends ControllerModule {
}
/**
* 测试指定代理配置
* Test specified proxy configuration
*/
@IpcMethod()
async testProxyConfig({
@@ -131,17 +131,17 @@ export default class NetworkProxyCtr extends ControllerModule {
}
/**
* 应用初始代理设置
* Apply initial proxy settings
*/
async beforeAppReady(): Promise<void> {
try {
// 获取存储的代理设置
// Get stored proxy settings
const networkProxy = this.app.storeManager.get(
'networkProxy',
defaultProxySettings,
) as NetworkProxySettings;
// 验证配置
// Validate configuration
const validation = ProxyConfigValidator.validate(networkProxy);
if (!validation.isValid) {
logger.warn('Invalid stored proxy configuration, using defaults:', validation.errors);
@@ -158,7 +158,7 @@ export default class NetworkProxyCtr extends ControllerModule {
});
} catch (error) {
logger.error('Failed to apply initial proxy settings:', error);
// 出错时使用默认设置
// Use default settings on error
try {
await ProxyDispatcherManager.applyProxySettings(defaultProxySettings);
logger.info('Fallback to default proxy settings');

View File

@@ -162,7 +162,7 @@ export default class RemoteServerSyncCtr extends ControllerModule {
});
});
// 5. 监听请求本身的错误(如 DNS 解析失败)
// 5. Listen for request errors (e.g., DNS resolution failure)
clientReq.on('error', (error) => {
logger.error(`${logPrefix} Error forwarding request:`, error);
if (sender.isDestroyed()) return;
@@ -196,7 +196,7 @@ export default class RemoteServerSyncCtr extends ControllerModule {
delete requestHeaders['connection']; // Often causes issues
// delete requestHeaders['content-length']; // Let node handle it based on body
// 读取代理配置
// Read proxy configuration
const proxyConfig = this.app.storeManager.get('networkProxy', defaultProxySettings);
let agent;