Skip to content

Instantly share code, notes, and snippets.

@pupboss
Created July 5, 2020 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pupboss/9f735e859fb25f7ae55c98b347738870 to your computer and use it in GitHub Desktop.
Save pupboss/9f735e859fb25f7ae55c98b347738870 to your computer and use it in GitHub Desktop.
Improve rules
/*
* @Author: jetl
* @Date: 2020-07-06 02:51:46
* @Last Modified by: jetl
* @Last Modified time: 2020-07-06 03:05:01
*/
const fs = require("fs")
const content = fs.readFileSync('ShadowrocketAdb.conf').toString()
const rules = content.split('\n')
let newContent = ''
for (var rule of rules) {
if (rule.startsWith('DOMAIN-SUFFIX') && rule.split('.').length > 2) {
rule = rule.replace('DOMAIN-SUFFIX', 'DOMAIN')
}
newContent += `${rule}\n`
}
fs.writeFile('new.conf', newContent, () => {})
// console.log(newContent)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment