Index: lib/synchronizer.js |
=================================================================== |
--- a/lib/synchronizer.js |
+++ b/lib/synchronizer.js |
@@ -25,17 +25,16 @@ |
MILLIS_IN_SECOND, MILLIS_IN_MINUTE, |
MILLIS_IN_HOUR, MILLIS_IN_DAY} = require("./downloader"); |
const {Filter} = require("./filterClasses"); |
const {FilterStorage} = require("./filterStorage"); |
const {FilterNotifier} = require("./filterNotifier"); |
const {Prefs} = require("prefs"); |
const {Subscription, |
DownloadableSubscription} = require("./subscriptionClasses"); |
-const {Utils} = require("utils"); |
const INITIAL_DELAY = 1 * MILLIS_IN_MINUTE; |
const CHECK_INTERVAL = 1 * MILLIS_IN_HOUR; |
const DEFAULT_EXPIRATION_INTERVAL = 5 * MILLIS_IN_DAY; |
/** |
* The object providing actual downloading functionality. |
* @type {Downloader} |
@@ -149,19 +148,16 @@ |
redirectCallback) |
{ |
let lines = responseText.split(/[\r\n]+/); |
let headerMatch = /\[Adblock(?:\s*Plus\s*([\d.]+)?)?\]/i.exec(lines[0]); |
if (!headerMatch) |
return errorCallback("synchronize_invalid_data"); |
let minVersion = headerMatch[1]; |
- // Don't remove parameter comments immediately but add them to a list first, |
- // they need to be considered in the checksum calculation. |
- let remove = []; |
let params = { |
redirect: null, |
homepage: null, |
title: null, |
version: null, |
expires: null |
}; |
for (let i = 0; i < lines.length; i++) |
@@ -169,24 +165,17 @@ |
let match = /^\s*!\s*(\w+)\s*:\s*(.*)/.exec(lines[i]); |
if (match) |
{ |
let keyword = match[1].toLowerCase(); |
let value = match[2]; |
if (keyword in params) |
{ |
params[keyword] = value; |
- remove.push(i); |
- } |
- else if (keyword == "checksum") |
- { |
lines.splice(i--, 1); |
- let checksum = Utils.generateChecksum(lines); |
- if (checksum && checksum != value.replace(/=+$/, "")) |
- return errorCallback("synchronize_checksum_mismatch"); |
} |
} |
} |
if (params.redirect) |
return redirectCallback(params.redirect); |
// Handle redirects |
@@ -213,20 +202,16 @@ |
// The download actually succeeded |
subscription.lastSuccess = subscription.lastDownload = Math.round( |
Date.now() / MILLIS_IN_SECOND |
); |
subscription.downloadStatus = "synchronize_ok"; |
subscription.downloadCount = downloadable.downloadCount; |
subscription.errors = 0; |
- // Remove lines containing parameters |
- for (let i = remove.length - 1; i >= 0; i--) |
- lines.splice(remove[i], 1); |
- |
// Process parameters |
if (params.homepage) |
{ |
let url; |
try |
{ |
url = new URL(params.homepage); |
} |