2012-04-04 52 views
3

我正在嘗試執行我的Chrome extension的自動更新功能。但由於某種原因,它不起作用。我有一個updates.xml文件託管在GitHub上,我發現它被下載(下載計數器顯示這個)。但擴展的latest version從不下載。自動更新Chrome擴展程序不起作用

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上託管的事實有什麼關係?

+0

有自動更新在過去的工作,同樣的設置? – abraham 2012-04-04 22:02:45

+0

@abraham nopez。從未工作過。 – PeeHaa 2012-04-04 22:04:30

+0

相關:[如何託管Chrome擴展?](http://stackoverflow.com/q/10737123/367456) – hakre 2012-06-13 08:56:22

回答

1

它看起來像update.xml和crx URL從https://github.com重定向到https://cloud.github.com。這是我看到會導致更新失敗的唯一原因。嘗試更新update.xml代碼庫URL以包含cloud

+0

將嘗試。我會及時通知你的。 – PeeHaa 2012-04-04 22:05:50

+0

仍然[不起作用](https://github.com/PeeHaa/cv-pls/downloads)。我看到我的最新updates.xml被多次下載,但是我沒有看到這個擴展本身的任何下載:( – PeeHaa 2012-04-05 12:48:46

+0

)我打算在這個週末做一些測試,因爲它看起來應該可以工作。已經使用Gist for update.xml之前,它工作得很好。如果我沒有發佈更新,請在週日對我進行Ping。 – abraham 2012-04-05 18:33:59

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; 
+0

我剛跑過'curl -v --head http://cloud.github.com/downloads/PeeHaa/cv-pls/cv-pls.0.14.0.crx'並在響應中存在頭部「Content-Type:application/x-chrome-extension」。 – abraham 2012-04-16 21:09:09