Firefox扩展自动更新功能 [英] Firefox extension automatic update feature
问题描述
我正在学习 http://www.borngeek.com / firefox / automatic-firefox-extension-updates / ,使我的FF扩展可以自动更新到用户,但我坚持最后一部分托管更新清单,因为我使用Tomcat服务,我没有想法如何设置.htaccess(.htaccess文件是否与配置服务器方面的WEB-INF目录类似)
到目前为止,我已经做了,
创建密钥对:公钥和私钥
计算sha256:b3290c69a1 ...
创建update.rdf
<?xml version =1.0?>
xmlns =http:// www。 mozilla.org/2004/em-rdf#\">
< r:说明about =urn:mozilla:extension:myextension@mozilla.myextension.org>
<更新>
< r:Seq>
< r:li>
< r:说明>
< version> 1.0.1< / version>
< targetApplication>
< r:说明>
< id> {ec8030f7-c20a-464f-9b0e-13a3a9e97384}< / id>
< minVersion> 3.5< / minVersion>
< maxVersion> 5.0。*< / maxVersion>
< updateLink> http:// localhost:8080 / myextension / pluginupdate / myextension.xpi< / updateLink>
< updateHash>
sha256:b3290c69a1 ...
< / updateHash>
< / r:说明>
< / targetApplication>
< / r:说明>
< / r:li>
< / r:Seq>
< / updates>
< / r:说明>
< / r:RDF>
使用Key签署update.rdf
放置单独的update.rdf和myextension pluginupdate目录下的.xpi,其中pluginupdate与WEB-INF在同一级别。
我的install.rdf
<?xml version =1.0?>
xmlns:em = http://www.mozilla.org/2004/em-rdf#\">
<描述about =urn:mozilla:install-manifest>
< em:id> myextension@mozilla.myextension.org< / em:id>
< em:name>我的测试扩展程序< / em:name>
< em:version> 1.0< / em:version>
< em:description>测试Mozilla Extension。< / em:description>
< em:creator> TEST Group< / em:creator>
<! - 可选项目 - >
< em:contributor>我< / em:contributor>
< em:homepageURL> http:// ????????? /< / em:homepageURL>
< em:updateKey>
MIGfMA0G .....
< / em:updateKey>
< em:updateURL> http:// localhost:8080 / myextension / pluginupdate / update.rdf< / em:updateURL>
<! - Firefox - >
< em:targetApplication>
<说明>
< em:id> {ec8030f7-c20a-464f-9b0e-13a3a9e97384}< / em:id>
< em:minVersion> 3.5< / em:minVersion>
< em:maxVersion> 5.0。*< / em:maxVersion>
< /说明>
< / em:targetApplication>
< /说明>
< / RDF>
当我重启FF浏览器时,没有任何反应。
当我使用带有选项-console的命令行启动FF Browser时b
$ b
*** LOG addons.xpi:startup
*** LOG addons.xpi:checkForChanges
*** LOG addons.xpi:找不到更改
*** LOG addons.xpi:打开数据库
那么,如何托管和配置Tomcat来托管更新清单呢?谢谢
更新
嗨弗拉基米尔,
在web.xml的MIME类型中定义后,还有一些与-console选项一起提供的信息。
并重新安装它,日志是
*** LOG addons.xpi:启动
*** LOG插件。 xpi:checkForChanges
*** LOG addons.xpi:找不到更改
*** addons.xpi:打开数据库
*** LOG addons.repository:请求https://服务.addons.mozilla.org / en-GB / firefox / api / 1.5 / search / guid:myextension%40mozilla.myextension.org?src = firefox&appOS = Linux&appVersion = 5.0&tMain = 23&tFirstPaint = 1641&tSessionRestored = 1042
*** LOG addons.xpi:开始安装文件:///home/me/browserplugindev/firefox/test/myextension.xpi
*** LOG addons.xpi:Addon myextension@mozilla.myextension.org将被安装为一个打包的xpi
*** LOG addons.xpi:安装文件:///home/me/browserplugindev/firefox/test/myextension.xpi co mpleted。
注意:子进程收到`Goodbye',关闭
*** LOG addons.xpi:shutdown
*** LOG addons.xpi:startup
*** LOG addons .xpi:checkForChanges
*** LOG addons.xpi:在app-profile
中找到myextension@mozilla.myextension.org的更新清单LOG addons.xpi:处理myextension @ mozilla的安装。 myextension.org在应用程序配置文件中
*** LOG addons.xpi:打开数据库
*** LOG addons.xpi:在app-profile中安装的新增附件myextension@mozilla.myextension.org
*** LOG addons.xpi:更新已安装加载项的更改数据库
*** LOG addons.xpi:更新加载项状态
*** LOG addons.xpi:写入加载项列表
Frome行
LOG addons.repository:请求https://services.addons.mozilla.org/zh-CN/firefox/api/1.5/search/guid:myextension%40mozilla.myextension.org?src=firefox&appOS=Linux&appVersion=5.0&tMain=23&tFirstPaint = 1641&tSessionRestored = 1042
我们可以看到Update Manager(?)正在通过https://services.addons.mozilla.org/en-GB/firefox/api/1.5/search/guid:myextension%40mozilla.myextension.org?src向存储库发出请求另外,在启动后
*** LOG addons.xpi:在app-profile
中找到myextension@mozilla.myextension.org的更新清单LOG addons.xpi:处理myextension @ mozilla的安装.myextension.org in app-profile
这意味着找到了更新。但是我没有看到浏览器上的通知,告诉我有一个新版本的myextension,更新?。
我错过了什么?
.htaccess文件的要点是确保服务器知道MIME类型。看来你可以通过改变conf / web.xml文件来做到这一点:
< mime-mapping>
< extension> xpi< / extension>
< mime-type> application / x-xpinstall< / mime-type>
< / mime-mapping>
< mime-mapping>
< extension> rdf< / extension>
< mime-type> application / rdf + xml< / mime-type>
< / mime-mapping>
我查看了update.rdf和install.rdf文件,但没有看到任何明显的问题 - 它应该工作。您可能想要转到 about:config
,然后切换 extensions.logging.enabled
首选项,但这样可以确保(Ctrl-Shift-J打开或在命令行中使用 -jsconsole
)。
I am following the tutorial at http://www.borngeek.com/firefox/automatic-firefox-extension-updates/ to make my FF extension can be updated automatically to users, but I stuck at the last part "Hosting an Update Manifest" as I am using Tomcat serve and I have no ideas how to set up the .htaccess (Is the .htaccess file similar with WEB-INF directory in terms of configure server?)
What I have done so far,
Create a key pair: Public-Key and Private-Key
Calculate sha256: b3290c69a1...
Create update.rdf
<?xml version="1.0"?> <r:RDF xmlns:r="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.mozilla.org/2004/em-rdf#"> <r:Description about="urn:mozilla:extension:myextension@mozilla.myextension.org"> <updates> <r:Seq> <r:li> <r:Description> <version>1.0.1</version> <targetApplication> <r:Description> <id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</id> <minVersion>3.5</minVersion> <maxVersion>5.0.*</maxVersion> <updateLink>http://localhost:8080/myextension/pluginupdate/myextension.xpi</updateLink> <updateHash> sha256:b3290c69a1... </updateHash> </r:Description> </targetApplication> </r:Description> </r:li> </r:Seq> </updates> </r:Description> </r:RDF>
Sign update.rdf using Key
Place singed update.rdf and myextension.xpi under pluginupdate directory, where pluginupdate is on the same level with WEB-INF.
My install.rdf
<?xml version="1.0"?> <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <Description about="urn:mozilla:install-manifest"> <em:id>myextension@mozilla.myextension.org</em:id> <em:name>My Test extension</em:name> <em:version>1.0</em:version> <em:description>Test Mozilla Extension.</em:description> <em:creator>TEST Group</em:creator> <!-- optional items --> <em:contributor>Me</em:contributor> <em:homepageURL>http://?????????/</em:homepageURL> <em:updateKey> MIGfMA0G..... </em:updateKey> <em:updateURL>http://localhost:8080/myextension/pluginupdate/update.rdf</em:updateURL> <!-- Firefox --> <em:targetApplication> <Description> <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <em:minVersion>3.5</em:minVersion> <em:maxVersion>5.0.*</em:maxVersion> </Description> </em:targetApplication> </Description> </RDF>
When i restart FF Browser, nothing happens. When I start FF Browser using command line with option -console
*** LOG addons.xpi: startup *** LOG addons.xpi: checkForChanges *** LOG addons.xpi: No changes found *** LOG addons.xpi: Opening database
So, how can I host and configure Tomcat to host the update manifest? Thanks
Update
Hi Wladimir,
After define in the MIME type in the web.xml, there are some more information given with the -console option.
I removed the extension and re-installed it, the logs are
*** LOG addons.xpi: startup *** LOG addons.xpi: checkForChanges *** LOG addons.xpi: No changes found *** LOG addons.xpi: Opening database *** LOG addons.repository: Requesting https://services.addons.mozilla.org/en-GB/firefox/api/1.5/search/guid:myextension%40mozilla.myextension.org?src=firefox&appOS=Linux&appVersion=5.0&tMain=23&tFirstPaint=1641&tSessionRestored=1042 *** LOG addons.xpi: Starting install of file:///home/me/browserplugindev/firefox/test/myextension.xpi *** LOG addons.xpi: Addon myextension@mozilla.myextension.org will be installed as a packed xpi *** LOG addons.xpi: Install of file:///home/me/browserplugindev/firefox/test/myextension.xpi completed. NOTE: child process received `Goodbye', closing down *** LOG addons.xpi: shutdown *** LOG addons.xpi: startup *** LOG addons.xpi: checkForChanges *** LOG addons.xpi: Found updated manifest for myextension@mozilla.myextension.org in app-profile *** LOG addons.xpi: Processing install of myextension@mozilla.myextension.org in app-profile *** LOG addons.xpi: Opening database *** LOG addons.xpi: New add-on myextension@mozilla.myextension.org installed in app-profile *** LOG addons.xpi: Updating database with changes to installed add-ons *** LOG addons.xpi: Updating add-on states *** LOG addons.xpi: Writing add-ons list
Frome line
LOG addons.repository: Requesting https://services.addons.mozilla.org/en-GB/firefox/api/1.5/search/guid:myextension%40mozilla.myextension.org?src=firefox&appOS=Linux&appVersion=5.0&tMain=23&tFirstPaint=1641&tSessionRestored=1042
we can see that Update Manager (?) is making request to repository at https://services.addons.mozilla.org/en-GB/firefox/api/1.5/search/guid:myextension%40mozilla.myextension.org?src=firefox&appOS=Linux&appVersion=5.0&tMain=23&tFirstPaint=1641&tSessionRestored=1042
Also, after the startup
*** LOG addons.xpi: Found updated manifest for myextension@mozilla.myextension.org in app-profile *** LOG addons.xpi: Processing install of myextension@mozilla.myextension.org in app-profile
So does it mean that the update is found. But I did not see the notification on the Browser that tell me something like "there is a new version of myextension, update?".
Did i miss anything?
The point of the .htaccess file is simply ensuring that the server knows the MIME types. It seems that you can do that for Tomcat by changing conf/web.xml file:
<mime-mapping>
<extension>xpi</extension>
<mime-type>application/x-xpinstall</mime-type>
</mime-mapping>
<mime-mapping>
<extension>rdf</extension>
<mime-type>application/rdf+xml</mime-type>
</mime-mapping>
I looked through your update.rdf and install.rdf files and I don't see any obvious issues - it should work. You might want to go to about:config
and switch on extensions.logging.enabled
preference however, this will make sure that additional information is sent to the Error Console (press Ctrl-Shift-J to open or use -jsconsole
on the command line).
这篇关于Firefox扩展自动更新功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!