最近发现自己搭建的NextCloud+floccus用于收藏夹同步的服务又不好用了,以为是老问题,NextCloud经常在更新后禁用我装的bookmark插件APP,进去启用了发现Firefox还没好用,打开Firefox插件管理器,发现所有插件都被禁用了,网上搜了下,记录一下解决方法。
总结一下:下面方法都只是当时好用,如果你电脑一直开,Firefox会每24小时检查一次,还得重新启用一次,试了好多,放弃了,直接更换为ESR版本了。。。
附ESR版本下载地址:https://www.mozilla.org/zh-CN/firefox/all/desktop-esr/
下面的方法不用看了,我就当作折腾的记录了,这篇blog我都改了5次了。。。
1.0 插件启用方法 首先在地址栏里输入
需要点击“接受风险并继续”
接着输入搜索这个变量
可以看到这个变量默认是false,把它改为true(就是右侧有个双向箭头就是修改参数值了)
接着同时按下Ctrl+Shift+J这三个键调出浏览器控制台,在最下方输入以下代码并回车
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 async function set_addons_as_signed() { Components.utils.import("resource://gre/modules/addons/XPIDatabase.jsm"); Components.utils.import("resource://gre/modules/AddonManager.jsm"); let addons = await XPIDatabase.getAddonList(a => true); for (let addon of addons) { // The add-on might have vanished, we'll catch that on the next startup if (addon._sourceBundle && !addon._sourceBundle.exists()) continue; if( addon.signedState != AddonManager.SIGNEDSTATE_UNKNOWN ) continue; addon.signedState = AddonManager.SIGNEDSTATE_NOT_REQUIRED; AddonManagerPrivate.callAddonListeners("onPropertyChanged",addon.wrapper, ["signedState"]); await XPIDatabase.updateAddonDisabledState(addon); } XPIDatabase.saveChanges(); } set_addons_as_signed();
关掉Firefox并重新打开Firefox,再次看插件就可以看到它们又都被重新启用了。
如果你像我一样不那么频繁升级FireFox的话,还需要修改另一个参数。
方案
实现难度
安全性
更换Developer/Nightly/ESR版本
★☆☆
高
正式版补丁方式
★★★
中
用户Profile层方式
★★★
中
2.1 补丁方式防止插件定期被重新禁用 在浏览器地址栏输入
再搜索这个变量
1 xpinstall.signatures.required
可以看到这个变量默认是true,把它改为false.
创建文件C:\Program Files\Mozilla Firefox\config.js
1 2 3 4 try { Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm", {}) .eval("SIGNED_TYPES.clear()"); } catch(ex) {}
创建文件C:\Program Files\Mozilla Firefox\defaults\pref\config-prefs.js
1 2 pref("general.config.obscure_value", 0); pref("general.config.filename", "config.js");
重新打开Firefox即可。
2.2 用户Profile层方式防止插件定期被重新禁用 启用userChrome.js
在浏览器地址栏输入
再搜索这个变量
1 toolkit.legacyUserProfileCustomizations.stylesheets
可以看到这个变量默认是false,把它改为true.
在浏览器地址栏输入
找到“配置文件夹”,点击“打开文件夹”
创建chrome文件夹(如果不存在的话)
进入chrome文件夹,创建以下三个文件
disable-add-on-signing.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 <?xml version="1.0"?> <bindings xmlns="http://www.mozilla.org/xbl"> <binding id="js" extends="chrome://global/content/toolbarbutton.xml#browser-controls"> <implementation> <constructor><![CDATA[ try { Services.scriptloader.loadSubScript( Components.stack.filename.replace(/file:.+?chrome[/\\].+$/, "") + "chrome/disable-add-on-signing.js", window ); } catch(e) { console.error(e); } ]]></constructor> </implementation> </binding> </bindings>
userChrome.css
1 2 3 4 @namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul); toolbarbutton#alltabs-button { -moz-binding: url("userChrome.xml#js"); }
userChrome.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 <?xml version="1.0"?> <bindings xmlns="http://www.mozilla.org/xbl"> <binding id="js" extends="chrome://global/content/toolbarbutton.xml#browser-controls"> <implementation> <constructor><![CDATA[ try { Services.scriptloader.loadSubScript( Components.stack.filename.replace(/file:.+?chrome[/\\].+$/, "") + "chrome/disable-add-on-signing.js", window ); } catch(e) { console.error(e); } ]]></constructor> </implementation> </binding> </bindings>
最后重启浏览器即可。如果你是分开步骤执行的,有可能你的插件又被重新禁用了,可以继续重新执行1中的js语句即可恢复。