-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.js
68 lines (58 loc) · 1.76 KB
/
configure.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const readline = require("readline");
const fs = require("fs");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let urls = [];
rl.question("Do you need to whitelist addtional domains (besides root)? y/n: ", (whitelist) => {
if (whitelist === "y") {
askForURL(whitelist);
} else {
rl.close()
}
});
function askForURL(whitelist) {
rl.question(
'Enter a domain to whitelist (or "done" to finish): ',
(urlInput) => {
if (urlInput.toLowerCase() !== "done") {
urls.push(urlInput.trim());
askForURL(whitelist); // Recursively ask for the next URL
} else {
rl.close()
}
}
);
}
// function askForStyleEditing(allowDomain, urls) {
// rl.question(
// "Enable style editing via query params? y/n: ",
// (styleEditing) => {
// modifyScript(allowDomain, urls, styleEditing);
// rl.close();
// }
// );
// }
function modifyScript(allowDomain, urls, styleEditing) {
// Load the original script
// let scriptContent = fs.readFileSync("script.js", "utf8");
// Modify script based on the configurations
// if (allowDomain === "y") {
// Add party mode enabling code if required
// (Given the provided script, no changes seem necessary for this option)
// }
if (urls.length > 0) {
// Replace the placeholder whitelist with the provided URLs, comma separated
scriptContent = scriptContent.replace(
'["ENTERYOURURLHERE.COM"]',
JSON.stringify(urls)
);
}
// if (styleEditing === "y") {
// Add style editing enabling code if required
// (Again, based on the provided script, no specific changes seem necessary for this option)
// }
// Save the modified script
fs.writeFileSync("script.js", scriptContent);
}