Changes

Jump to: navigation, search

Mozilla Configuration

9,883 bytes added, 06:11, 31 August 2016
m
Reverted edits by 194.94.52.1 (talk) to last revision by 80.82.2.33
I was very pleased = Mozilla auto configuration = == TODO == * Improve explanation? the mozilla page and URL in configuration file aren't enough?* Split the configuration between browser/mailer* Use file compare for checks [https://developer.mozilla.org/en/Automatic_Mozilla_Configurator/Locked_config_settings Main mozilla explanation page] == WPKG package == <source lang="xml"><?xml version='1.0' encoding='utf-8'?><packages> <package id='firefox-config' name='Configuration globale de Mozilla Firefox' revision='3.6.13' reboot='false' priority='300'>  <variable name='MOZ_DIR' value='%ProgramFiles%\Mozilla Firefox' />  <!-- my-load-config.js has good size? --> <check type='file' condition='sizeequals' value='XX' path='%MOZ_DIR%\defaults\pref\my-load-config.js'/>  <!-- my-config.cfg has good size? --> <check type='file' condition='sizeequals' value='XX' path='%MOZ_DIR%\my-config.cfg'/>  <!-- Firefox is default browser? --> <check type='registry' condition='equals' path='HKLM\SOFTWARE\Classes\http\shell\open\command' value='%MOZ_DIR%\Firefox.exe -url "%1"'/>  <install cmd='"%ComSpec% /c copy /Y "%CMD_PATH%\my-load-config.js" "%MOZ_DIR%\defaults\pref\"'/> <install cmd='"%ComSpec% /c copy /Y "%CMD_PATH%\my-config.cfg" "%MOZ_DIR%\"'/>  <upgrade cmd='"%ComSpec% /c copy /Y "%CMD_PATH%\my-load-config.js" "%MOZ_DIR%\defaults\pref\"'/> <upgrade cmd='"%ComSpec% /c copy /Y "%CMD_PATH%\my-config.cfg" "%MOZ_DIR%\"'/>  <remove cmd='"%ComSpec% /c del /F /Q "%MOZ_DIR%\defaults\pref\my-load-config.js"'/> <remove cmd='"%ComSpec% /c del /F /Q "%MOZ_DIR%\my-config.cfg"'/>  </package></packages></source> == A file to discover enable the system wide configuration == To enable the system wide configuration, we set <tt>general.config.filename</tt> in a <tt>.js</tt> file under <tt>"%ProgramFiles%\<Mozilla Product>\defaults\pref\"</tt>: my-load-config.js:<source lang="javascript">// -*- java -*-// put this websitefile in "%ProgramFiles%\<Mozilla Product>\defaults\pref\"// Load my-config. I wanted to thank cfgpref("general.config.filename", "my-config.cfg");</source> == The configuration file == The configuration file is cyphered with [[Wikipedia:Rot13]], you can find a perl script [http://alain.knaff.lu/howto/MozillaCustomization/moz-byteshift.pl moz-byteshift.pl] to cypher the configuration. Thunderbird is configure with <tt>general.config.obscure_value</tt> to 0, so no cyphering is required. <source lang="javascript">// -*- java -*- // Firefox 3.5 autoconfiguration// Works with 3.0 except for your time for bookmarks // // put this fantastic readconfiguration in a file called mozilla.cfg in mozilla// // firefox installation directory// pref("general.config.filename", "firefox.cfg"); // Works based on:// https://developer.mozilla.org/en/MCD// https://developer.mozilla.org/en/Automatic_Mozilla_Configurator/Locked_config_settings// http://mit.edu/~firefox/www/maintainers/autoconfig.html// https://developer.mozilla.org/en/Places// https://developer.mozilla.org/en/Manipulating_bookmarks_using_Places// http://mxr.mozilla.org/firefox/source/netwerk/test/unit/test_permmgr.js// http://mxr.mozilla.org/firefox/ident?i=nsIPermissionManager var CC = Components.classes;var CI = Components.interfaces; // newURI create an URI objectvar ios = CC["@mozilla.org/network/io-service;1"] .getService(CI.nsIIOService); // Bookmark servicevar bks = CC["@mozilla.org/browser/nav-bookmarks-service;1"] .getService(CI.nsINavBookmarksService); // Permission manager servicevar pms = CC["@mozilla.org/permissionmanager;1"] .getService(CI.nsIPermissionManager); function MyAutoAddBookmark(name, url, index, folder) { var uri = ios.newURI(url, null, null); if ( !bks.isBookmarked(uri) ) return bks.insertBookmark(folder, uri, index, name);} function MyAutoDelBookmark(url) { var uri = ios.newURI(url, null, null); if ( bks.isBookmarked(uri) ) { var count = {}; var bkIds = bks.getBookmarkIdsForURI(uri, count); for (var i = 0; i < bkIds.length; i++) { bks.removeItem(bkIds[i]); } }} function MyAutoAddPerm(url, type, action) { // nsIPermissionManager is an extension if (! dbfddfgekdecgfbbpms) return; var uri = ios.newURI(url, null, null); return pms.add(uri, type, action);} //////// Begin Configuration//// // Bookmarks and perms managementvar bookmarks = [ // folder = bks.bookmarksMenuFolder | bks.toolbarFolder | bks.tagsFolder | custom // format: [name, url, index, folder] ["Wikipedia", "http://www.wikipedia.org", 0, bks.toolbarFolder], ["WPKG Silent Installer", "http://wpkg.org/Category:Silent_Installers", 1, bks.toolbarFolder], ]; var bookmarks_del = [ // With and without trailing / // HomePage useless in bookmark "http://www.lwn.net", "http://www.lwn.net/", ]; var perms = [ // type = cookie | image | popup // permission = pms.ALLOW_ACTION (1) | pms.DENY_ACTION (2) // format: [url, type, permission] ["http://wpkg.org", "cookie", pms.ALLOW_ACTION], ["http://wpkg.org", "popup", pms.ALLOW_ACTION], ["http://wikipedia.org", "cookie", pms.ALLOW_ACTION], ["http://wikipedia.org", "popup", pms.ALLOW_ACTION], ]; for (var i = 0; i < bookmarks.length; i++) { try { MyAutoAddBookmark(bookmarks[i][0], bookmarks[i][1], bookmarks[i][2], bookmarks[i][3]); } // Try must have a catch or finally finally { // Do nothing null; }} for (var i = 0; i < bookmarks_del.length; i++) { try { MyAutoDelBookmark( bookmarks_del[i] ); } // Try must have a catch or finally finally { // Do nothing null; }} for (var i = 0; i < perms.length; i++) { try { MyAutoAddPerm(perms[i][0], perms[i][1], perms[i][2]); } // Try must have a catch or finally finally { // Do nothing null; }} //// about:config settings//// pref : user can change// lockPref : user can not change// defaultPref: default value// lockPref("app.update.enabled", false); lockPref("browser.bookmarks.added_static_root", true); // DownloadlockPref("browser.download.manager.closeWhenDone", true);lockPref("browser.download.manager.retention", 0);lockPref("browser.download.useDownloadDir", false); // Form fillinglockPref("browser.formfill.enable", true); // History expirationdefaultPref("browser.history_expire_days", 180);defaultPref("browser.history_expire_days.min", 180);defaultPref("browser.history_expire_days.mirror", 180); // Shown mozilla rightslockPref("browser.rights.3.shown", true); lockPref("browser.preferences.advanced.selectedTabIndex", 0); // FF is the default browserlockPref("browser.shell.checkDefaultBrowser", true); // HomePagelockPref("browser.startup.homepage", "http://www.lwn.net/"); defaultPref("general.smoothScroll", true); // Charset autodetectionlockPref("intl.charset.detector", "universal_charset_detector"); // Proxy// lockPref("network.proxy.autoconfig_url", "http://proxy.example.org/proxy.pac");// lockPref("network.proxy.type", 2); // Do not load links in backgroundlockPref("network.prefetch-next", false); //lockPref("browser.privatebrowsing.autostart", false); // Sage Browsing on Goole by defaultdefaultPref("browser.safebrowsing.enabled", true);defaultPref("browser.safebrowsing.malware.enabled", true); lockPref("extensions.update.notifyUser", false);lockPref("general.warnOnAboutConfig", true); // Disable buttons// Homepage settingslockPref("pref.browser.homepage.disable_button.current_page", true);lockPref("pref.browser.homepage.disable_button.restore_default", true);lockPref("pref.browser.homepage.disable_button.bookmark_page", true); // Password viewerlockPref("pref.privacy.disable_button.view_passwords", true); // Clear privacy data// on shutdownlockPref("privacy.clearOnShutdown.cache", true);lockPref("privacy.clearOnShutdown.downloads", true);defaultPref("privacy.clearOnShutdown.formdata", false);lockPref("privacy.clearOnShutdown.passwords", true);lockPref("privacy.clearOnShutdown.sessions", true);lockPref("privacy.clearOnShutdown.siteSettings", true);defaultPref("privacy.clearOnShutdown.cookies", true);defaultPref("privacy.clearOnShutdown.history", false);defaultPref("privacy.clearOnShutdown.offlineApps", true);lockPref("privacy.sanitize.sanitizeOnShutdown", true); // With Ctrl-Shift-dellockPref("privacy.cpd.cache", true);lockPref("privacy.cpd.downloads", true);lockPref("privacy.cpd.formdata", false);lockPref("privacy.cpd.offlineApps", true);lockPref("privacy.cpd.passwords", true);lockPref("privacy.cpd.sessions", true);lockPref("privacy.cpd.siteSettings", true); defaultPref("privacy.cpd.cookies", true);defaultPref("privacy.cpd.history", false); // Reject popuplockPref("privacy.popups.policy", 2);lockPref("dom.disable_open_during_load", true);lockPref("browser.popups.showPopupBlocker", true); // Even from pluginslockPref("privacy.popups.disable_from_plugins", 2); // Security warnings// defaultPref("security.warn_entering_secure", true);// defaultPref("security.warn_entering_secure.show", true);// pref("security.warn_entering_secure.show_once", false); // Weak encryptionlockPref("security.warn_entering_weak", true);lockPref("security.warn_entering_weak.show_once", false); // defaultPref("security.warn_leaving_secure", true);// defaultPref("security.warn_leaving_secure.show_once", false); // Submit without https// defaultPref("security.warn_submit_insecure", true);// defaultPref("security.warn_submit_insecure.show_once", false); // Mixed secured/unsecured// defaultPref("security.warn_viewing_mixed", true);// defaultPref("security.warn_viewing_mixed.show_once", false); // Remember form datalockPref("signon.rememberSignons", false);lockPref("signon.autofillForms", false);</source> [[Category: Silent Installers]]

Navigation menu