自动更新Chrome扩展程序无效

时间:2012-04-04 21:47:46

标签: google-chrome-extension auto-update

我正在尝试实现Chrome extension的自动更新功能。但由于某种原因,它不起作用。我在GitHub上托管了一个updates.xml文件,我看到它被下载了(下载计数器显示了这个)。但永远不会下载扩展程序的latest version

我的manifest.json看起来像是:

"version": "0.14.0",
"update_url": "https://github.com/downloads/PeeHaa/cv-pls/updates.xml",

我的updates.xml看起来像:

<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
  <app appid='bcbifciedokdgkokbbfippkbecnkpclj'>
    <updatecheck codebase='https://github.com/downloads/PeeHaa/cv-pls/cv-pls.0.14.0.crx' version='0.14.0' />
  </app>
</gupdate>

我已经检查并仔细检查了appid和下载网址,它们都是正确的。

有人知道这里出了什么问题吗?它是否与它在GitHub上托管的事实有关?

2 个答案:

答案 0 :(得分:3)

我之前尝试过这种方法,但也失败了。 update.xml文件已正确下载,但我的应用程序的最新版本无法安装。

我发现它不起作用,因为github没有提供正确的标头。如果您查看hosting documentation,则内容类型标题应为“application / x-chrome-extension”。

我刚刚在php中编写了一个简单的脚本来为我提供文件:

<?php
$file = "";
header("Content-type: application/x-chrome-extension");
header("Content-Disposition: attachment; filename='extension.crx'");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($file));
echo readfile($file);
exit;

答案 1 :(得分:1)

看起来update.xml和crx网址都从https://github.com重定向到https://cloud.github.com。这是我可以看到导致更新失败的唯一原因。尝试更新update.xml代码库URL以包含cloud