OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 * Generates the real download URL for an object by appending various | 200 * Generates the real download URL for an object by appending various |
201 * parameters. | 201 * parameters. |
202 * @param {Downloadable} downloadable | 202 * @param {Downloadable} downloadable |
203 * @return {string} | 203 * @return {string} |
204 */ | 204 */ |
205 getDownloadUrl(downloadable) | 205 getDownloadUrl(downloadable) |
206 { | 206 { |
207 const {addonName, addonVersion, application, applicationVersion, | 207 const {addonName, addonVersion, application, applicationVersion, |
208 platform, platformVersion} = require("info"); | 208 platform, platformVersion} = require("info"); |
209 let url = downloadable.redirectURL || downloadable.url; | 209 let url = downloadable.redirectURL || downloadable.url; |
210 if (url.indexOf("?") >= 0) | 210 if (url.includes("?")) |
211 url += "&"; | 211 url += "&"; |
212 else | 212 else |
213 url += "?"; | 213 url += "?"; |
214 // We limit the download count to 4+ to keep the request anonymized | 214 // We limit the download count to 4+ to keep the request anonymized |
215 let {downloadCount} = downloadable; | 215 let {downloadCount} = downloadable; |
216 if (downloadCount > 4) | 216 if (downloadCount > 4) |
217 downloadCount = "4+"; | 217 downloadCount = "4+"; |
218 url += "addonName=" + encodeURIComponent(addonName) + | 218 url += "addonName=" + encodeURIComponent(addonName) + |
219 "&addonVersion=" + encodeURIComponent(addonVersion) + | 219 "&addonVersion=" + encodeURIComponent(addonVersion) + |
220 "&application=" + encodeURIComponent(application) + | 220 "&application=" + encodeURIComponent(application) + |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 * @type {number} | 413 * @type {number} |
414 */ | 414 */ |
415 hardExpiration: 0, | 415 hardExpiration: 0, |
416 | 416 |
417 /** | 417 /** |
418 * Number indicating how often the object was downloaded. | 418 * Number indicating how often the object was downloaded. |
419 * @type {number} | 419 * @type {number} |
420 */ | 420 */ |
421 downloadCount: 0 | 421 downloadCount: 0 |
422 }; | 422 }; |
OLD | NEW |