diff --git a/backend/src/core/proxy-utils/producers/index.js b/backend/src/core/proxy-utils/producers/index.js index 2915a775..8b256914 100644 --- a/backend/src/core/proxy-utils/producers/index.js +++ b/backend/src/core/proxy-utils/producers/index.js @@ -28,6 +28,7 @@ export default { SurgeMac: SurgeMac_Producer(), Loon: Loon_Producer(), Clash: Clash_Producer(), + clash: Clash_Producer(), meta: ClashMeta_Producer(), clashmeta: ClashMeta_Producer(), 'clash.meta': ClashMeta_Producer(), diff --git a/backend/src/test/proxy-producers/target-alias.spec.js b/backend/src/test/proxy-producers/target-alias.spec.js new file mode 100644 index 00000000..38e930cd --- /dev/null +++ b/backend/src/test/proxy-producers/target-alias.spec.js @@ -0,0 +1,35 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { ProxyUtils } from '@/core/proxy-utils'; +import { produceExternal } from './helpers'; + +const PROXY = { + type: 'ss', + name: 'SS Node', + server: '1.2.3.4', + port: 443, + cipher: 'aes-128-gcm', + password: 'secret', +}; + +describe('Proxy target aliases', function () { + it('produces the same output for lowercase and capitalized target names', function () { + const cases = [ + ['clash', 'Clash'], + ['meta', 'ClashMeta'], + ['mihomo', 'ClashMeta'], + ['uri', 'URI'], + ['v2ray', 'V2Ray'], + ['json', 'JSON'], + ['stash', 'Stash'], + ['egern', 'Egern'], + ['sing-box', 'sing-box'], + ]; + for (const [lower, canonical] of cases) { + expect(produceExternal(lower, [PROXY]), lower).to.equal( + produceExternal(canonical, [PROXY]), + ); + } + }); +});