Skip to content
This repository was archived by the owner on May 28, 2023. It is now read-only.

Commit c3bc821

Browse files
Start to add the ability to enable ADS
1 parent df029ab commit c3bc821

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ if (numCPUs > 0 && cluster.isPrimary) {
6666
//only block /,/404,/apps,/error,/search,/settings and /index if the key or cookie is not present
6767
if (bare.shouldRoute(req)) {
6868
try {
69-
for (let i in blacklisted)
70-
if (req.headers['x-bare-host']?.includes(blacklisted[i]))
71-
return res.end('Denied');
69+
if (!req.headers.cookie?.includes('allowads')) {
70+
for (let i in blacklisted)
71+
if (req.headers['x-bare-host']?.includes(blacklisted[i]))
72+
return res.end('Denied');
73+
}
7274
bare.routeRequest(req, res);
7375
} catch (error) {
7476
console.error(error);

0 commit comments

Comments
 (0)