66 lines
1.7 KiB
JavaScript
66 lines
1.7 KiB
JavaScript
/**
|
|
* LiangXin 专用节点清理脚本
|
|
* 负责去掉高速、BGP、CMCU 等 LiangXin 线路描述,保留地区、序号和倍率。
|
|
*/
|
|
// noinspection JSUnusedGlobalSymbols
|
|
const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-4';
|
|
|
|
async function loadRenameUtils() {
|
|
if (typeof globalThis !== 'undefined' && globalThis.SubStoreRenameUtils) {
|
|
return globalThis.SubStoreRenameUtils;
|
|
}
|
|
|
|
const cache = typeof scriptResourceCache !== 'undefined' ? scriptResourceCache : null;
|
|
let script = cache && cache.get(COMMON_SCRIPT_URL);
|
|
if (!script) {
|
|
const response = await $substore.http.get({ url: COMMON_SCRIPT_URL });
|
|
script = response && (response.body || response.data || response);
|
|
if (cache) cache.set(COMMON_SCRIPT_URL, script);
|
|
}
|
|
|
|
new Function(String(script))();
|
|
return globalThis.SubStoreRenameUtils;
|
|
}
|
|
|
|
async function operator(proxies) {
|
|
const utils = await loadRenameUtils();
|
|
const lineDescriptorKeywords = [
|
|
'CMCU',
|
|
'CUCM',
|
|
'CMCT',
|
|
'CTCM',
|
|
'CUCT',
|
|
'CTCU',
|
|
'BGP',
|
|
'CMI',
|
|
'CUG',
|
|
'CN2',
|
|
'IEPL',
|
|
'IPLC',
|
|
'9929',
|
|
'4837',
|
|
'CM',
|
|
'CU',
|
|
'CT',
|
|
'高速',
|
|
'极速',
|
|
'专线',
|
|
'中转',
|
|
'直连',
|
|
'隧道',
|
|
'三网',
|
|
'移动',
|
|
'联通',
|
|
'电信'
|
|
];
|
|
|
|
return proxies.map(proxy => {
|
|
if (typeof proxy.name !== 'string') {
|
|
return proxy;
|
|
}
|
|
|
|
proxy.name = utils.stripLineDescriptors(proxy.name, lineDescriptorKeywords);
|
|
return proxy;
|
|
});
|
|
}
|