From 2f360b7dc085e2af0175e74e38fed0a8c587b567 Mon Sep 17 00:00:00 2001 From: Ryan Lieu Date: Mon, 6 May 2024 10:49:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=9A=84=E6=B8=BA=E8=BD=AF=E9=95=9C=E5=83=8F=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E6=8F=92=E4=BB=B6=EF=BC=8C=E5=8E=BB=E9=99=A4?= =?UTF-8?q?Chinajsdelivr=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TeStore/Action.php | 4 +++- TeStore/Plugin.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) 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',