From 565e2e6d4d75dc401e00a9b071253c6d69fe3d4b Mon Sep 17 00:00:00 2001 From: Viet Huynh Date: Mon, 18 Sep 2023 02:51:49 +0700 Subject: [PATCH] added checks for old filenames --- .gitignore | 2 ++ cf_list_create.js | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c8446c6..2a8473b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ lerna-debug.log* # CGPS output +input.csv +whitelist.csv blocklist.txt allowlist.txt diff --git a/cf_list_create.js b/cf_list_create.js index 3b495a2..b57afea 100644 --- a/cf_list_create.js +++ b/cf_list_create.js @@ -1,3 +1,4 @@ +import { existsSync } from "fs"; import { resolve } from "path"; import { @@ -18,8 +19,12 @@ import { readFile, } from "./lib/utils.js"; -const allowlistFilename = "allowlist.txt"; -const blocklistFilename = "blocklist.txt"; +const allowlistFilename = existsSync("whitelist.csv") + ? "whitelist.csv" + : "allowlist.txt"; +const blocklistFilename = existsSync("input.csv") + ? "input.csv" + : "blocklist.txt"; const allowlist = new Map(); const blocklist = new Map(); const domains = [];