Skip to content

Commit

Permalink
fix: 修复新增的渺软镜像无法安装插件,去除Chinajsdelivr镜像
Browse files Browse the repository at this point in the history
  • Loading branch information
benzBrake committed May 6, 2024
1 parent 61a74dd commit 2f360b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion TeStore/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion TeStore/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 2f360b7

Please sign in to comment.