fix(producers): 补全 clash 目标的小写别名

生产者注册表里其它目标都同时提供大小写别名(surge/Surge、uri/URI、
json/JSON、stash/Stash、egern/Egern…),只有 Clash 缺少小写的 clash。

结果是通过 `?target=clash` 或 `?platform=clash` 请求订阅时,
后端抛出 `Target platform: clash is not supported!` 并返回 500,
而 `?target=Clash` 正常。UA 映射本身返回的也是 'Clash',所以只有
显式指定小写 target 的客户端会踩到。

补上 `clash: Clash_Producer()`,与其它目标保持一致。
This commit is contained in:
FaintGhost committed 2026-10-29 17:04:38 +01:00
1 parent c1018115a7
commit ffc0a213c1
2 files changed
+36

No files matched your search

@@ -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(),
@@ -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]),
);
}
});
});