更新 'clash.js'

This commit is contained in:
vpt 2023-01-10 16:43:45 +08:00
parent cd26176513
commit 2c47de6599

View File

@ -13,16 +13,16 @@ module.exports.parse = async(raw, utils, meta) => {
// 配置预先规则 // 配置预先规则
async function configPrependRules(utils, obj) { async function configPrependRules(utils, obj) {
const { axios,console } = utils const { axios } = utils
const proxyGroupName = getProxyGroupName(obj) const proxyGroupName = getProxyGroupName(obj)
const directGroupName = getDirectGroupName(obj) const directGroupName = getDirectGroupName(obj)
try { try {
const directResponse = await axios.get('https://git.yevpt.com/vpt/public-data/raw/branch/master/direct') const noCacheDate = '?nocachekey=' + Date.now()
const directResponse = await axios.get('https://git.yevpt.com/vpt/public-data/raw/branch/master/direct' + noCacheDate)
const directs = directResponse.data const directs = directResponse.data
const prependDirectRules = directs.split(`\n`).map(item => `DOMAIN-SUFFIX,${item},${directGroupName}`) const prependDirectRules = directs.split(`\n`).map(item => `DOMAIN-SUFFIX,${item},${directGroupName}`)
const proxyResponse = await axios.get('https://git.yevpt.com/vpt/public-data/raw/branch/master/proxy') const proxyResponse = await axios.get('https://git.yevpt.com/vpt/public-data/raw/branch/master/proxy' + noCacheDate)
const proxys = proxyResponse.data const proxys = proxyResponse.data
console.log('proxys',proxys.split(`\n`).slice(-5))
const prependProxyRules = proxys.split(`\n`).map(item => `DOMAIN-SUFFIX,${item},${proxyGroupName}`) const prependProxyRules = proxys.split(`\n`).map(item => `DOMAIN-SUFFIX,${item},${proxyGroupName}`)
const prependRules = [...prependDirectRules, ...prependProxyRules] const prependRules = [...prependDirectRules, ...prependProxyRules]
obj.rules = [...prependRules, ...obj.rules] obj.rules = [...prependRules, ...obj.rules]