aicodeswitch 5.2.3 → 5.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -373,7 +373,7 @@ class ProxyServer {
373
373
  if (apiPath === '/v1/models') {
374
374
  // 鉴权
375
375
  const apiKeyValue = this.extractApiKey(req);
376
- if (apiKeyValue === null || apiKeyValue === void 0 ? void 0 : apiKeyValue.startsWith('sk_')) {
376
+ if ((apiKeyValue === null || apiKeyValue === void 0 ? void 0 : apiKeyValue.startsWith('sk_')) && (0, auth_1.isAuthEnabled)()) {
377
377
  // AccessKey 鉴权
378
378
  if (!this.accessKeyModule) {
379
379
  res.status(401).json({ error: { type: 'authentication_error', code: 'INVALID_API_KEY', message: 'AccessKey 功能未启用' } });
@@ -399,7 +399,7 @@ class ProxyServer {
399
399
  // 检查是否为 AccessKey 请求
400
400
  const apiKeyValue = this.extractApiKey(req);
401
401
  let accessKeyCtx = null;
402
- if ((apiKeyValue === null || apiKeyValue === void 0 ? void 0 : apiKeyValue.startsWith('sk_')) && this.accessKeyModule) {
402
+ if ((apiKeyValue === null || apiKeyValue === void 0 ? void 0 : apiKeyValue.startsWith('sk_')) && this.accessKeyModule && (0, auth_1.isAuthEnabled)()) {
403
403
  const result = this.accessKeyModule.keyResolver.resolve(apiKeyValue);
404
404
  if (!result || 'error' in result) {
405
405
  const err = result ? result.error : { type: 'authentication_error', code: 'INVALID_API_KEY', message: '无效的 API Key', httpStatus: 401 };
@@ -484,7 +484,7 @@ class ProxyServer {
484
484
  }
485
485
  // AUTH 鉴权检查
486
486
  const apiKeyValue = this.extractApiKey(req);
487
- if ((apiKeyValue === null || apiKeyValue === void 0 ? void 0 : apiKeyValue.startsWith('sk_')) && this.accessKeyModule) {
487
+ if ((apiKeyValue === null || apiKeyValue === void 0 ? void 0 : apiKeyValue.startsWith('sk_')) && this.accessKeyModule && (0, auth_1.isAuthEnabled)()) {
488
488
  const result = this.accessKeyModule.keyResolver.resolve(apiKeyValue);
489
489
  if (!result || 'error' in result) {
490
490
  const err = result ? result.error : { type: 'authentication_error', code: 'INVALID_API_KEY', message: '无效的 API Key', httpStatus: 401 };
@@ -803,7 +803,7 @@ class ProxyServer {
803
803
  try {
804
804
  // 检查 API Key 验证(支持 AccessKey 和全局 apiKey)
805
805
  const apiKeyValue = this.extractApiKey(req);
806
- if ((apiKeyValue === null || apiKeyValue === void 0 ? void 0 : apiKeyValue.startsWith('sk_')) && this.accessKeyModule) {
806
+ if ((apiKeyValue === null || apiKeyValue === void 0 ? void 0 : apiKeyValue.startsWith('sk_')) && this.accessKeyModule && (0, auth_1.isAuthEnabled)()) {
807
807
  // AccessKey 鉴权
808
808
  const result = this.accessKeyModule.keyResolver.resolve(apiKeyValue);
809
809
  if (!result || 'error' in result) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aicodeswitch",
3
- "version": "5.2.3",
3
+ "version": "5.2.4",
4
4
  "description": "A tool to help you manage AI programming tools to access large language models locally. It allows your Claude Code, Codex and other tools to no longer be limited to official models.",
5
5
  "author": "tangshuang",
6
6
  "license": "GPL-3.0",