From 60427d67e6c4a926158df37b79a9c5ef0f503d04 Mon Sep 17 00:00:00 2001 From: Thomas Berezansky Date: Mon, 10 Oct 2011 12:48:45 -0400 Subject: [PATCH] Add automatic update block to custom.js.example For those that want to enable automatic updates but use the official download for the client. Signed-off-by: Thomas Berezansky --- .../xul/staff_client/server/skin/custom.js.example | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/Open-ILS/xul/staff_client/server/skin/custom.js.example b/Open-ILS/xul/staff_client/server/skin/custom.js.example index b23a31fd7e..74047d30bf 100644 --- a/Open-ILS/xul/staff_client/server/skin/custom.js.example +++ b/Open-ILS/xul/staff_client/server/skin/custom.js.example @@ -66,3 +66,47 @@ function dump_xulG(msg) { } dump(']]]]]]]]]]]]]]]]]]]]]]]]]]]]]\n'); } + + +// This entire block basically dupliates autoupdate.js as a default preference file +// Useful if you did not build your initial 2.1+ client, but are using the official download +try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var appInfo = Components.classes["@mozilla.org/xre/app-info;1"] + .getService(Components.interfaces.nsIXULAppInfo); + // This ensures that if someone is running in extension mode we don't break the host app's updater + // And that we likely have a valid web hostname for later + if (appInfo.ID == "staff-client@open-ils.org" && (window.location.protocol == 'http:' || window.location.protocol == 'https:')) + { + var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces['nsIPrefBranch']); + // Enable Updater + prefs.setBoolPref("app.update.enabled", true); + // Change to "false" to not automatically update + prefs.setBoolPref("app.update.auto", true); + // 0 downloads without prompt always + prefs.setIntPref("app.update.mode", 0); + + // These settings are in seconds + // Interval for checking + prefs.setIntPref("app.update.interval", 86400); + // Time before prompting to download - If auto is off, mainly + prefs.setIntPref("app.update.nagTimer.download", 86400); + // Time before prompting to restart to apply update that has downloaded + prefs.setIntPref("app.update.nagTimer.restart", 1800); + + // How often to check timers (above) - in MILLIseconds + prefs.setIntPref("app.update.timer", 600000); + + // URL for downloading. For Thomas Berezansky's script the update.xml part isn't needed. + // NOTE: Certs that default to invalid, even those overridden with cert_override.txt, won't work with this! + prefs.setCharPref("app.update.url", "https://" + window.location.hostname + "/updates/check/%CHANNEL%/%VERSION%/update.xml"); + + // URL for manual update information + prefs.setCharPref("app.update.url.manual", "http://" + window.location.hostname + "/updates/manualupdate.html"); + + // Default details URL for updates + prefs.setCharPref("app.update.url.details", "http://" + window.location.hostname + "/updates/updatedetails.html"); + } +} catch(E) { + dump('Error updating automatic update settings for ' + location.href + '\n'); +} -- 2.11.0