Skip to content

Commit

Permalink
Fixing.
Browse files Browse the repository at this point in the history
  • Loading branch information
boocmp committed Nov 28, 2024
1 parent 65c17e0 commit df30b67
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
32 changes: 23 additions & 9 deletions lib/contentSign.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,24 @@ const getComponentFiles = (dir, patterns) => {
cwd: dir,
posix: true
}
const files = glob.sync(patterns, options)
return files
.map((f) => {
return path.join(dir, f)
})
.filter((f) => {
return !fs.statSync(f).isDirectory()
})
.sort()
let files = []

patterns.forEach((pattern) => {
const pfiles = glob.sync('./' + pattern)
files = files.concat(pfiles)
})
files = [
...new Set(
files
.map((f) => {
return path.join(dir, f)
})
.filter((f) => {
return !fs.statSync(f).isDirectory()
})
)
]
return files.sort()
}

const computeBlockHashes = (filePath) => {
Expand Down Expand Up @@ -125,6 +134,11 @@ const createVerifiedContents = (
throw new Error('Missing private key')
}

privateKey = fs.readFileSync(privateKey, 'utf-8')
if (!privateKey) {
throw new Error('Cannot read private key')
}

inputDir = ensureTrailingSlash(inputDir)

const componentFiles = getComponentFiles(inputDir, patterns)
Expand Down
6 changes: 3 additions & 3 deletions scripts/packageAdBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function stageFiles (version, outputDir) {
util.copyManifestWithVersion(originalManifest, outputDir, version)
}

const generateVerifiedContents = (stagingDir, id, signingKey) => {
const generateVerifiedContents = (stagingDir, signingKey) => {
util.generateVerifiedContents(
stagingDir,
['resources.json', 'list.txt', 'list_catalog.json'],
Expand All @@ -40,7 +40,7 @@ const postNextVersionWork = (componentSubdir, key, publisherProofKey,
fs.unlinkSync(contentHashFile)
}
if (!localRun) {
generateVerifiedContents(stagingDir, componentSubdir, verifiedContentsKey)
generateVerifiedContents(stagingDir, verifiedContentsKey)
const privateKeyFile = path.join(key, `ad-block-updater-${componentSubdir}.pem`)
util.generateCRXFile(binary, crxFile, privateKeyFile, publisherProofKey,
publisherProofKeyAlt, stagingDir)
Expand Down Expand Up @@ -104,7 +104,7 @@ const processComponent = (
})
} else {
postNextVersionWork(componentSubdir, undefined, publisherProofKey,
publisherProofKeyAlt, binary, localRun, '1.0.0', contentHash)
publisherProofKeyAlt, binary, localRun, '1.0.0', contentHash, verifiedContentsKey)
}
}

Expand Down

0 comments on commit df30b67

Please sign in to comment.