]> git.ipfire.org Git - thirdparty/blocklistproject/lists.git/commitdiff
Fixing issue in dnsmasq generation script where “/“ would exist on header lines
authorCharlie Fish <fishcharlie@me.com>
Fri, 11 Jun 2021 23:54:05 +0000 (17:54 -0600)
committerCharlie Fish <fishcharlie@me.com>
Fri, 11 Jun 2021 23:54:05 +0000 (17:54 -0600)
scripts/generate-dnsmasq.js

index f76bf89676f0dabe38cf7d8344e4661fd4601078..2c08431902b107aca2d385772d2475ab3b49d5b2 100644 (file)
@@ -6,9 +6,9 @@ const path = require("path");
        await Promise.all(files.map(async (file) => { // For each file
                const fileContents = await fs.readFile(path.join(__dirname, "..", file), "utf8"); // Get file contents as a string
                const noIPFileContents = fileContents
+               .replaceAll(/0\.0\.0\.0 (.*?)( .*)?$/gmu, "0.0.0.0 $1/$2") // I need this line to add "/" at the end of each URL
                .replaceAll(/^0\.0\.0\.0 /gmu, "server=/") // Replace all occurances of "0.0.0.0 " at the beginning of the line with "server=/"
                .replaceAll(/^# 0\.0\.0\.0 /gmu, "# server=/") // Replace all occurances of "# 0.0.0.0 " at the beginning of the line with "# server=/"
-               .replaceAll(/^(.*)$/gmu, "$1/") // I need this line to add "/" at the end of each URL
                .replace(/^# Title: (.*?)$/gmu, "# Title: $1 (NL)"); // Add (NL) to end of title
                await fs.writeFile(path.join(__dirname, "..", "dnsmasq-version", file.replace(".txt", "-dnsmasq.txt")), noIPFileContents, "utf8"); // Write new file to `alt-version` directory
        }));