OLD | NEW |
1 # coding: utf-8 | 1 # coding: utf-8 |
2 | 2 |
3 # This file is part of the Adblock Plus web scripts, | 3 # This file is part of the Adblock Plus web scripts, |
4 # Copyright (C) 2006-2015 Eyeo GmbH | 4 # Copyright (C) 2006-2015 Eyeo GmbH |
5 # | 5 # |
6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
9 # | 9 # |
10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 if not highestVersion or compareVersions(version, highestVersion) > 0: | 325 if not highestVersion or compareVersions(version, highestVersion) > 0: |
326 highestURL = urlparse.urljoin(repo.downloadsURL, filename) | 326 highestURL = urlparse.urljoin(repo.downloadsURL, filename) |
327 highestVersion = version | 327 highestVersion = version |
328 | 328 |
329 return (highestURL, highestVersion) | 329 return (highestURL, highestVersion) |
330 | 330 |
331 def _getDownloadLink(repo): | 331 def _getDownloadLink(repo): |
332 """ | 332 """ |
333 gets the download link to the most current version of an extension | 333 gets the download link to the most current version of an extension |
334 """ | 334 """ |
335 # you can't easily install extensions from third-party sources on Chrome | |
336 # and Opera. So always get the link for the version on the Web Store. | |
337 if repo.galleryID: | 335 if repo.galleryID: |
338 if repo.type == "chrome": | 336 if repo.type == "chrome": |
339 return _getGoogleDownloadLink(repo.galleryID) | 337 return _getGoogleDownloadLink(repo.galleryID) |
340 if repo.type == "opera": | 338 elif repo.type == "opera": |
341 return _getOperaDownloadLink(repo.galleryID) | 339 return _getOperaDownloadLink(repo.galleryID) |
| 340 elif repo.type == "gecko": |
| 341 return _getMozillaDownloadLink(repo.galleryID) |
342 | 342 |
343 (localURL, localVersion) = _getLocalLink(repo) | 343 return _getLocalLink(repo) |
344 | |
345 # get a link to Firefox Add-Ons, if the latest version has been published ther
e | |
346 if repo.type == 'gecko' and repo.galleryID: | |
347 (galleryURL, galleryVersion) = _getMozillaDownloadLink(repo.galleryID) | |
348 if not localVersion or (galleryVersion and | |
349 compareVersions(galleryVersion, localVersion) >= 0): | |
350 return (galleryURL, galleryVersion) | |
351 | |
352 return (localURL, localVersion) | |
353 | 344 |
354 def _getQRCode(text): | 345 def _getQRCode(text): |
355 try: | 346 try: |
356 import qrcode | 347 import qrcode |
357 import base64 | 348 import base64 |
358 import Image # required by qrcode but not formally a dependency | 349 import Image # required by qrcode but not formally a dependency |
359 except: | 350 except: |
360 return None | 351 return None |
361 | 352 |
362 data = StringIO() | 353 data = StringIO() |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 if not extensions: | 416 if not extensions: |
426 return | 417 return |
427 | 418 |
428 updates = {} | 419 updates = {} |
429 for extension in extensions: | 420 for extension in extensions: |
430 updates[extension['basename']] = { | 421 updates[extension['basename']] = { |
431 "url": extension['updateURL'], | 422 "url": extension['updateURL'], |
432 "version": extension['version'] | 423 "version": extension['version'] |
433 } | 424 } |
434 writeLibabpUpdateManifest(path, updates) | 425 writeLibabpUpdateManifest(path, updates) |
OLD | NEW |