一尘不染

Firefox扩展程序自动更新功能

tomcat

我正在按照http://www.borngeek.com/firefox/automatic-firefox-extension-
updates/上的教程进行操作,以使FF扩展名可以自动更新给用户,但是我停留在最后一部分“托管更新清单”
”,因为我正在使用Tomcat服务,并且我不知道如何设置.htaccess(就配置服务器而言,.htaccess文件是否与WEB-INF目录相似?)

我到目前为止所做的

创建密钥对:Public-Key and 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:说明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:Description>
        </ targetApplication>
    </ r:Description>
    </ r:li>
    </ r:Seq>
    </ updates>
</ r:Description>

</ r:RDF>

使用密钥签名update.rdf

将单独的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:启动
*** LOG addons.xpi:checkForChanges
*** LOG addons.xpi:未找到更改
*** LOG addons.xpi:打开数据库

因此,如何托管和配置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

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

我们可以在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: 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,更新吗?”。

我有想念吗?


阅读 256

收藏
2020-06-16

共1个答案

一尘不染

.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打开或-jsconsole在命令行上使用)。

2020-06-16