mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-28 19:37:32 +09:00
Use a pref for supported Sync server API levels
This commit is contained in:
parent
f9dfa17007
commit
867de19f7e
3 changed files with 27 additions and 24 deletions
|
|
@ -115,6 +115,7 @@ pref("image.mem.decode_bytes_at_a_time", 65536); //larger chunks
|
||||||
// Sync server URL
|
// Sync server URL
|
||||||
pref("services.sync.serverURL","https://pmsync.palemoon.org/sync/index.php/");
|
pref("services.sync.serverURL","https://pmsync.palemoon.org/sync/index.php/");
|
||||||
pref("services.sync.jpake.serverURL","https://keyserver.palemoon.org/");
|
pref("services.sync.jpake.serverURL","https://keyserver.palemoon.org/");
|
||||||
|
pref("services.sync.APILevel", 1); // FSyncMS doesn't support info/configuration
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1067,33 +1067,34 @@ Sync11Service.prototype = {
|
||||||
// Note: returns false if we failed for a reason other than the server not yet
|
// Note: returns false if we failed for a reason other than the server not yet
|
||||||
// supporting the api.
|
// supporting the api.
|
||||||
_fetchServerConfiguration() {
|
_fetchServerConfiguration() {
|
||||||
#if 0 // FSyncMS doesn't support this and it will break auth if left enabled!
|
if (Svc.Prefs.get("APILevel") >= 2) {
|
||||||
// This is similar to _fetchInfo, but with different error handling.
|
// This is similar to _fetchInfo, but with different error handling.
|
||||||
|
// Only supported by later sync implementations.
|
||||||
|
|
||||||
let infoURL = this.userBaseURL + "info/configuration";
|
let infoURL = this.userBaseURL + "info/configuration";
|
||||||
this._log.debug("Fetching server configuration", infoURL);
|
this._log.debug("Fetching server configuration", infoURL);
|
||||||
let configResponse;
|
let configResponse;
|
||||||
try {
|
try {
|
||||||
configResponse = this.resource(infoURL).get();
|
configResponse = this.resource(infoURL).get();
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
// This is probably a network or similar error.
|
// This is probably a network or similar error.
|
||||||
this._log.warn("Failed to fetch info/configuration", ex);
|
this._log.warn("Failed to fetch info/configuration", ex);
|
||||||
this.errorHandler.checkServerError(ex);
|
this.errorHandler.checkServerError(ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configResponse.status == 404) {
|
if (configResponse.status == 404) {
|
||||||
// This server doesn't support the URL yet - that's OK.
|
// This server doesn't support the URL yet - that's OK.
|
||||||
this._log.debug("info/configuration returned 404 - using default upload semantics");
|
this._log.debug("info/configuration returned 404 - using default upload semantics");
|
||||||
} else if (configResponse.status != 200) {
|
} else if (configResponse.status != 200) {
|
||||||
this._log.warn(`info/configuration returned ${configResponse.status} - using default configuration`);
|
this._log.warn(`info/configuration returned ${configResponse.status} - using default configuration`);
|
||||||
this.errorHandler.checkServerError(configResponse);
|
this.errorHandler.checkServerError(configResponse);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.serverConfiguration = configResponse.obj;
|
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;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ pref("services.sync.syncKeyHelpURL", "https://services.mozilla.com/help/synckey"
|
||||||
|
|
||||||
pref("services.sync.lastversion", "firstrun");
|
pref("services.sync.lastversion", "firstrun");
|
||||||
pref("services.sync.sendVersionInfo", true);
|
pref("services.sync.sendVersionInfo", true);
|
||||||
|
pref("services.sync.APILevel", 2);
|
||||||
|
|
||||||
pref("services.sync.scheduler.eolInterval", 604800); // 1 week
|
pref("services.sync.scheduler.eolInterval", 604800); // 1 week
|
||||||
pref("services.sync.scheduler.idleInterval", 3600); // 1 hour
|
pref("services.sync.scheduler.idleInterval", 3600); // 1 hour
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue