我正在关注http://www.borngeek.com/firefox/automatic-firefox-extension-updates/的教程,以使我的FF扩展可以自动更新给用户,但我坚持最后一部分“托管更新清单”因为我正在使用Tomcat服务而我没有任何想法如何设置.htaccess(.htaccess文件在配置服务器方面与WEB-INF目录类似吗?)
到目前为止我做了什么,
创建密钥对:Public-Key和Private-Key
计算sha256:b3290c69a1 ......
创建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>
使用密钥
签署update.rdf将singed update.rdf和myextension.xpi放在pluginupdate目录下,其中pluginupdate与WEB-INF位于同一级别。
我的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>
当我重新启动FF浏览器时,没有任何反应。 当我使用带有选项-console
的命令行启动FF浏览器时*** LOG addons.xpi: startup *** LOG addons.xpi: checkForChanges *** LOG addons.xpi: No changes found *** LOG addons.xpi: Opening database
那么,我如何托管和配置Tomcat来托管更新清单?感谢
更新
嗨弗拉迪米尔,
在web.xml中的MIME类型中定义之后,还会使用-console选项提供更多信息。
我删除了扩展并重新安装,日志是
*** 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
弗罗姆线
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
我们可以看到Update Manager(?)正在https://services.addons.mozilla.org/en-GB/firefox/api/1.5/search/guid:myextension%40mozilla.myextension向存储库发出请求。 ?有机SRC = Firefox和安培; appOS = Linux和安培; appVersion = 5.0&安培; tMain = 23&安培; tFirstPaint = 1641&安培; tSessionRestored = 1042
此外,在启动后
*** 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
这是否意味着找到了更新。但我没有看到浏览器上的通知告诉我“有一个新版本的myextension,更新?”。
我错过了什么吗?
答案 0 :(得分:3)
.htaccess文件的要点只是确保服务器知道MIME类型。您似乎可以通过更改conf / web.xml文件来为Tomcat执行此操作:
<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打开或使用{{1}在命令行上。)