Skip to content

Commit

Permalink
use mirrored lists to assemble adblock components
Browse files Browse the repository at this point in the history
  • Loading branch information
antonok-edm committed Nov 22, 2024
1 parent 39dc2f1 commit f71ae0f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/generateAdBlockRustDataFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import Sentry from '../lib/sentry.js'
import util from '../lib/util.js'
import path from 'path'
import fs from 'fs'
import crypto from 'node:crypto'

/**
* Obtains the output path to store a file given the specied name and subdir
Expand Down Expand Up @@ -89,7 +90,9 @@ const generateDataFilesForCatalogEntry = (entry) => {
const promises = []
lists.forEach((l) => {
console.log(`${entry.langs} ${l.url}...`)
promises.push(util.fetchTextFromURL(l.url)
const sourceUrlHash = crypto.createHash('md5').update(l.url).digest("hex")
const mirroredListUrl = 'https://raw.githubusercontent.com/brave-experiments/adblock-lists-mirror/refs/heads/lists/lists/' + sourceUrlHash + '.txt'
promises.push(util.fetchTextFromURL(mirroredListUrl)
.then(data => ({ title: l.title || entry.title, format: l.format, data }))
.then(async listBuffer => {
const compat = removeIncompatibleRules(preprocess(listBuffer))
Expand Down

0 comments on commit f71ae0f

Please sign in to comment.