Created
July 5, 2020 19:10
-
-
Save pupboss/9f735e859fb25f7ae55c98b347738870 to your computer and use it in GitHub Desktop.
Improve rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* @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