diff --git a/TeStore/Action.php b/TeStore/Action.php index 79e10d8b..9bd74011 100644 --- a/TeStore/Action.php +++ b/TeStore/Action.php @@ -229,11 +229,13 @@ public function install() $zip = $cdn ? $cdn : $zip; $proxy = $proxy ? $proxy : 'cdn.jsdelivr.net/gh'; $zip = str_replace(array('github.com', 'raw.githubusercontent.com'), $proxy, $zip); - $zip = $proxy == 'cdn.jsdelivr.net/gh' ? str_replace(array('blob/', 'raw/', 'master/'), '', $zip) : str_replace(array('blob/', 'raw/'), '', $zip); + $zip = substr($proxy, -3) === "/gh" ? str_replace(array('blob/', 'raw/', 'master/'), '', $zip) : str_replace(array('blob/', 'raw/'), '', $zip); } + //下载至临时目录 $zipFile = $this->useCurl ? $this->curlGet($zip) : @file_get_contents($zip, 0, stream_context_create(array('http' => array('timeout' => 20)))); //设20秒超时 + if (!$zipFile) { $result['error'] = _t('下载压缩包出错'); } else { diff --git a/TeStore/Plugin.php b/TeStore/Plugin.php index 552e3ba8..11d5bdaf 100644 --- a/TeStore/Plugin.php +++ b/TeStore/Plugin.php @@ -91,7 +91,7 @@ public static function config(Typecho_Widget_Helper_Form $form) $form->addInput($cache); $proxy = new Typecho_Widget_Helper_Form_Element_Radio('proxy', - array(''=>_t('否'),'cdn.jsdelivr.net/gh'=>_t('jsDelivr镜像'),'jsd.onmicrosoft.cn/gh'=>_t('渺软镜像'),'jsd.cdn.zzko.cn/gh'=>_t('Chinajsdelivr')),'',_t('使用代理加速'),_t('GitHub连接不畅时可选')); + array(''=>_t('否'),'cdn.jsdelivr.net/gh'=>_t('jsDelivr镜像'),'jsd.onmicrosoft.cn/gh'=>_t('渺软镜像')),'',_t('使用代理加速'),_t('GitHub连接不畅时可选')); $form->addInput($proxy); $curl = new Typecho_Widget_Helper_Form_Element_Checkbox('curl',