Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

chore: update spam filter (#6271)

Mark Wiemerb932787b80f8
diff --git a/docs/_data/blocklist.json b/docs/_data/blocklist.json
index 0e74abf6..04eadb85 100644
--- a/docs/_data/blocklist.json
+++ b/docs/_data/blocklist.json
@@ -1,18 +1,36 @@
[
+ "carl-marius",
"cheap-writing-service",
"coin-master-free-spins",
"cyberflix-tv",
"device-tricks1",
"domywriting",
+ "elfontario",
"emailmarketingservices-io",
+ "flybyapis",
"hurtiglaan-nu",
+ "hypeproxies",
"igor-noskov",
+ "instant_famous",
+ "insviewers",
+ "localcitationservice",
+ "medyamagazacomtr",
"mochajs",
"my-true-media",
"open-apk-file",
+ "piloterr",
+ "rebrowser",
+ "redreply",
+ "scrapfly",
+ "storylooker",
+ "superclones",
+ "tikninja",
+ "tikster",
"thetoy",
"trust-my-paper",
+ "twtservices",
"writemypaper4me",
"writerseperhour",
- "yiannakis-ttafounas-ttafounas"
+ "yiannakis-ttafounas-ttafounas",
+ "zenrows"
]
diff --git a/docs/_data/supporters.cjs b/docs/_data/supporters.cjs
index bba18421..f476c098 100755
--- a/docs/_data/supporters.cjs
+++ b/docs/_data/supporters.cjs
@@ -2,14 +2,19 @@
* This script gathers metadata for active supporters of Mocha from OpenCollective's
* API by aggregating order ("donation") information.
*
- * It's intended to be used with 11ty, but can be run directly. Running directly
- * enables debug output.
+ * - Gathers logo/avatar images (they are always pngs)
+ * - Gathers links
+ * - Sorts by tier and total contributions
+ * - Validates images
+ * - Writes images to a temp dir
+ *
+ * We filter out spam based on the code below and these general guidelines:
+ * - Not based on deceiving people
+ *
+ * While we try our best, we cannot guarantee quality in the list of sponsors.
+ * Some non-spam may be blocked, and some spam may be allowed.
+ * Please let us know in the usual places if you feel there is a mistake.
*
- * - gathers logo/avatar images (they are always pngs)
- * - gathers links
- * - sorts by tier and total contributions
- * - validates images
- * - writes images to a temp dir
* @see https://docs.opencollective.com/help/contributing/development/api
*/
@@ -25,7 +30,7 @@ const blocklist = new Set(require("./blocklist.json"));
* be displayed on the website.
*/
const BLOCKED_STRINGS =
- /(?:[ck]a[sz]ino|seo|slot|gambl(?:e|ing)|crypto|follow|buy|cheap|instagram|hacks|tiktok|likes|youtube|subscriber|boost|deposit|mushroom|bingo|broker|promotion|bathroom|landscaping|lawn care|groundskeeping|remediation|esports|links|coupon|review|refer|promocode|rabattkod|jämför|betting|reddit|hire|fortune|equity|download|marketing|comment|rank|scrapcar|lawyer|celeb|concrete|firestick|playground|betking)/i;
+ /(?:[ck]a[sz]ino|seo|slot|gambl(?:e|ing)|crypto|cheap|instagram|hacks|tiktok|likes|subscriber|boost|deposit|mushroom|bingo|broker|promotion|groundskeeping|links|review|refer|promocode|rabattkod|jämför|betting|reddit|hire|fortune|equity|download|marketing|comment|rank|scrapcar|lawyer|celeb|concrete|firestick|playground|betking)/i;
/**
* Add a few Categories exposed by Open Collective to help moderation
@@ -42,7 +47,6 @@ const BLOCKED_CATEGORIES = [
/**
* The OC API endpoint
-
*/
const API_ENDPOINT = "https://api.opencollective.com/graphql/v2";
@@ -164,19 +168,22 @@ const getAllOrders = async (slug = "mochajs") => {
};
const isAllowed = ({ name, slug, website, categories }) => {
- const allowed =
- !blocklist.has(slug) &&
- !BLOCKED_STRINGS.test(name) &&
- !BLOCKED_STRINGS.test(slug) &&
- !BLOCKED_STRINGS.test(website) &&
- !categories.some((category) => BLOCKED_CATEGORIES.includes(category));
+ const blockReasons = [];
+ if (blocklist.has(slug)) blockReasons.push("slug in blocklist");
+ if (BLOCKED_STRINGS.test(name)) blockReasons.push("name blocked");
+ if (BLOCKED_STRINGS.test(slug)) blockReasons.push("slug blocked");
+ if (BLOCKED_STRINGS.test(website)) blockReasons.push("website blocked");
+ if (categories.some((category) => BLOCKED_CATEGORIES.includes(category)))
+ blockReasons.push("category blocked");
+
+ const allowed = blockReasons.length === 0;
if (!allowed) {
- debug("filtering %o", { categories, name, slug, website });
+ debug("blocking %o", { categories, name, slug, website });
+ debug(`reason(s): ${blockReasons}`);
} else {
- // debug('keeping %o', {categories, name, slug, website}, BLOCKED_STRINGS.test(website));
+ debug("allowing %o", { categories, name, slug, website });
}
-
return allowed;
};
diff --git a/docs/src/content/data/sponsors.json b/docs/src/content/data/sponsors.json
deleted file mode 100644
index b7fc5aba..00000000
--- a/docs/src/content/data/sponsors.json
+++ /dev/null
@@ -1,12 +0,0 @@
-[
- {
- "href": "https://localizejs.com",
- "image": "https://images.opencollective.com/localize/bb2cd4d/logo/256.png",
- "title": "Localize"
- },
- {
- "href": "https://route4me.com",
- "image": "https://images.opencollective.com/route4me/71fb6fa/avatar/256.png",
- "title": "Route4Me Route Planner"
- }
-]