summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-06-09 11:45:32 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-06-09 11:45:32 +0200
commit16e2a93396f244ae39b91e039ba846eebf3d4237 (patch)
tree7c57431adeb4346731eb17f565d801d3e6c35642
parentca8d6d0105ffaa618fab2d83feba2e35c9a607c5 (diff)
downloadUXP-16e2a93396f244ae39b91e039ba846eebf3d4237.tar
UXP-16e2a93396f244ae39b91e039ba846eebf3d4237.tar.gz
UXP-16e2a93396f244ae39b91e039ba846eebf3d4237.tar.lz
UXP-16e2a93396f244ae39b91e039ba846eebf3d4237.tar.xz
UXP-16e2a93396f244ae39b91e039ba846eebf3d4237.zip
Use a pref for supported Sync server API levels
-rw-r--r--application/palemoon/branding/shared/pref/preferences.inc1
-rw-r--r--services/sync/modules/service.js49
-rw-r--r--services/sync/services-sync.js1
3 files changed, 27 insertions, 24 deletions
diff --git a/application/palemoon/branding/shared/pref/preferences.inc b/application/palemoon/branding/shared/pref/preferences.inc
index 51a1852e6..58539aeb2 100644
--- a/application/palemoon/branding/shared/pref/preferences.inc
+++ b/application/palemoon/branding/shared/pref/preferences.inc
@@ -115,6 +115,7 @@ pref("image.mem.decode_bytes_at_a_time", 65536); //larger chunks
// Sync server URL
pref("services.sync.serverURL","https://pmsync.palemoon.org/sync/index.php/");
pref("services.sync.jpake.serverURL","https://keyserver.palemoon.org/");
+pref("services.sync.APILevel", 1); // FSyncMS doesn't support info/configuration
// ============================================================================
diff --git a/services/sync/modules/service.js b/services/sync/modules/service.js
index 5b97fcca3..f8c64b0fa 100644
--- a/services/sync/modules/service.js
+++ b/services/sync/modules/service.js
@@ -1067,33 +1067,34 @@ Sync11Service.prototype = {
// Note: returns false if we failed for a reason other than the server not yet
// supporting the api.
_fetchServerConfiguration() {
-#if 0 // FSyncMS doesn't support this and it will break auth if left enabled!
- // This is similar to _fetchInfo, but with different error handling.
+ if (Svc.Prefs.get("APILevel") >= 2) {
+ // This is similar to _fetchInfo, but with different error handling.
+ // Only supported by later sync implementations.
- let infoURL = this.userBaseURL + "info/configuration";
- this._log.debug("Fetching server configuration", infoURL);
- let configResponse;
- try {
- configResponse = this.resource(infoURL).get();
- } catch (ex) {
- // This is probably a network or similar error.
- this._log.warn("Failed to fetch info/configuration", ex);
- this.errorHandler.checkServerError(ex);
- return false;
- }
+ let infoURL = this.userBaseURL + "info/configuration";
+ this._log.debug("Fetching server configuration", infoURL);
+ let configResponse;
+ try {
+ configResponse = this.resource(infoURL).get();
+ } catch (ex) {
+ // This is probably a network or similar error.
+ this._log.warn("Failed to fetch info/configuration", ex);
+ this.errorHandler.checkServerError(ex);
+ return false;
+ }
- if (configResponse.status == 404) {
- // This server doesn't support the URL yet - that's OK.
- this._log.debug("info/configuration returned 404 - using default upload semantics");
- } else if (configResponse.status != 200) {
- this._log.warn(`info/configuration returned ${configResponse.status} - using default configuration`);
- this.errorHandler.checkServerError(configResponse);
- return false;
- } else {
- this.serverConfiguration = configResponse.obj;
+ if (configResponse.status == 404) {
+ // This server doesn't support the URL yet - that's OK.
+ this._log.debug("info/configuration returned 404 - using default upload semantics");
+ } else if (configResponse.status != 200) {
+ this._log.warn(`info/configuration returned ${configResponse.status} - using default configuration`);
+ this.errorHandler.checkServerError(configResponse);
+ return false;
+ } else {
+ this.serverConfiguration = configResponse.obj;
+ }
+ this._log.trace("info/configuration for this server", this.serverConfiguration);
}
- this._log.trace("info/configuration for this server", this.serverConfiguration);
-#endif
return true;
},
diff --git a/services/sync/services-sync.js b/services/sync/services-sync.js
index f4167c1ce..ebac4412b 100644
--- a/services/sync/services-sync.js
+++ b/services/sync/services-sync.js
@@ -12,6 +12,7 @@ pref("services.sync.syncKeyHelpURL", "https://services.mozilla.com/help/synckey"
pref("services.sync.lastversion", "firstrun");
pref("services.sync.sendVersionInfo", true);
+pref("services.sync.APILevel", 2);
pref("services.sync.scheduler.eolInterval", 604800); // 1 week
pref("services.sync.scheduler.idleInterval", 3600); // 1 hour