Verified Commit 9396de9d authored by Aral Balkan's avatar Aral Balkan
Browse files

Generate metadata.json file

Currently only has the md5 hash of the WebKit blocking rules file.
parent d97a9d1f
......@@ -797,15 +797,19 @@ Better is a Safari content blocker for <a href='https://itunes.apple.com/us/app/
#
saveBlockerListJSON: (dataDirectory) =>
blockerListJSONFilePath = path.join dataDirectory, 'blockerList.json'
blockerListJSONHashFilePath = path.join dataDirectory, 'blockerList.json.md5'
metadataFilePath = path.join dataDirectory, 'metadata.json'
# In development, pretty print the JSON to make it easier to debug.
# In production, minify it for better performance.
args = if app.isRunningInDevelopment then [@rules, null, 4] else [@rules]
output = JSON.stringify.apply @, args
hash = checksum(output)
(fs.outputFileAsync blockerListJSONFilePath, JSON.stringify.apply @, args).then =>
fs.outputFileAsync blockerListJSONHashFilePath, hash
metadata = JSON.stringify({
md5: hash,
# timestamp:
})
(fs.outputFileAsync blockerListJSONFilePath, output).then =>
fs.outputFileAsync metadataFilePath, metadata
#
# Saves the rule partials in JSON format.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment