Lines 18-58javascript
18 /^.*was this (helpful|page helpful|article helpful).*$/gim,
19 /^.*©\s*\d{4}.*all rights reserved.*$/gim,
20 /^\s*(home|about|contact|privacy|terms)\s*\|\s*.*$/gim,
21 /^.*subscribe to (our )?newsletter.*$/gim,
22 /^.*follow us on (twitter|facebook|linkedin).*$/gim
24const MAX_BYTES = 5 * 1024;
25function decodeEntities(text) {
27 for (const [ent, ch] of Object.entries(HTML_ENTITIES)) out = out.split(ent).join(ch);
28 out = out.replace(/&#x([0-9a-fA-F]+);/g, (_m, h) => String.fromCodePoint(parseInt(h, 16)));
29 out = out.replace(/&#(\d+);/g, (_m, d) => String.fromCodePoint(parseInt(d, 10)));
32/** Strip HTML entities + boilerplate, normalize blank lines, truncate to ~5KB. */
33function compactMarkdown(content) {
34 let text = decodeEntities(content);
35 for (const re of BOILERPLATE) text = text.replace(re, "");
36 text = text.replace(/\n{3,}/g, "\n\n").trim();
37 const enc = new TextEncoder().encode(text);
38 if (enc.length > MAX_BYTES) {
39 const truncated = new TextDecoder().decode(enc.slice(0, MAX_BYTES));
40 text = `${truncated}\n\n[... truncated, ${text.slice(truncated.length).split("\n").length - 1} lines]`;
LowWeak Crypto
Package source references weak cryptographic algorithms.
dist/mcp-store-CDUVqtJ0.mjsView on unpkg · L38 44/** 8-char MD5 of `${toolName}::${query}`. */
45function queryHash(toolName, query) {
46 return createHash("md5").update(`${toolName}::${query}`).digest("hex").slice(0, 8);
48/** Bag-of-words Jaccard similarity strictly greater than `threshold`. */
49function jaccardSimilar(a, b, threshold = .8) {
50 const ta = new Set(a.toLowerCase().split(/\s+/).filter(Boolean));
51 const tb = new Set(b.toLowerCase().split(/\s+/).filter(Boolean));
52 if (ta.size === 0 || tb.size === 0) return false;
54 for (const t of ta) if (tb.has(t)) inter++;
55 const union = ta.size + tb.size - inter;
56 return inter / union > threshold;