Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Commit c9ec2db

Browse files
committed
⏪️ 取消切换Staging环境的配置
1 parent 2fafcad commit c9ec2db

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

config.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@
44
"CLUSTER_SECRET"=> "",
55
"cache_dir"=> "./cache",//缓存文件夹
66
"MaxConcurrent"=> 10,//下载使用的线程
7-
"Staging"=> false,//切换Staging环境
87
"Debug"=> false,//Debug开关
98
];

inc/cluster.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ public function getFileList() {
8787
if (!file_exists($DOWNLOAD_DIR."/filecache")) {
8888
mkdir($DOWNLOAD_DIR."/filecache",0777,true);
8989
}
90-
$client = new Client(OPENBMCLAPI,443,true);
90+
$client = new Client(OPENBMCLAPIURL,443,true);
9191
$client->set(['timeout' => -1]);
9292
$client->setHeaders([
93-
'Host' => OPENBMCLAPI,
93+
'Host' => OPENBMCLAPIURL,
9494
'User-Agent' => 'openbmclapi-cluster/'.$this->version,
9595
'Accept' => '*',
9696
'Authorization' => "Bearer {$this->token}"
@@ -144,7 +144,7 @@ private function downloader(Swoole\Coroutine\Http\Client $client, $file,$bar) {
144144
'User-Agent' => USERAGENT,
145145
'Accept' => '*/*',
146146
]);
147-
$downloadr = $client->download($location_url['path'].'?'.($location_url['query']??''),$DOWNLOAD_DIR.'/'.substr($file->hash, 0, 2).'/'.$file->hash);
147+
$downloader = $client->download($location_url['path'].'?'.($location_url['query']??''),$DOWNLOAD_DIR.'/'.substr($file->hash, 0, 2).'/'.$file->hash);
148148
if (in_array($client->statusCode, [301, 302])) {
149149
while(in_array($client->statusCode, [301, 302])){
150150
$location_url = parse_url($client->getHeaders()['location']);
@@ -161,9 +161,9 @@ private function downloader(Swoole\Coroutine\Http\Client $client, $file,$bar) {
161161
'User-Agent' => USERAGENT,
162162
'Accept' => '*/*',
163163
]);
164-
$downloadr = $client->download($location_url['path'].'?'.($location_url['query']??''),$DOWNLOAD_DIR.'/'.substr($file->hash, 0, 2).'/'.$file->hash);
164+
$downloader = $client->download($location_url['path'].'?'.($location_url['query']??''),$DOWNLOAD_DIR.'/'.substr($file->hash, 0, 2).'/'.$file->hash);
165165
}
166-
if (!$downloadr) {
166+
if (!$downloader) {
167167
echo PHP_EOL;
168168
mlog("{$file->path} Download Failed: {$client->errMsg} From Node: {$location_url['host']}:{$location_url['port']}",2);
169169
$bar->progress();
@@ -176,7 +176,7 @@ private function downloader(Swoole\Coroutine\Http\Client $client, $file,$bar) {
176176
}
177177
}
178178
else{
179-
if (!$downloadr) {
179+
if (!$downloader) {
180180
echo PHP_EOL;
181181
mlog("{$file->path} Download Failed: {$client->errMsg} From Node: {$location_url['host']}:{$location_url['port']}",2);
182182
$bar->progress();

inc/token.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function __construct($clusterId,$clusterSecret,$version){
1111
}
1212
public function gettoken() {
1313
//获取challenge
14-
$client = new Client(OPENBMCLAPI,443,true);
14+
$client = new Client(OPENBMCLAPIURL,443,true);
1515
$client->setHeaders([
1616
'User-Agent' => 'openbmclapi-cluster/'.$this->version,
1717
'Content-Type' => 'application/json; charset=utf-8',
@@ -22,7 +22,7 @@ public function gettoken() {
2222
$challenge = json_decode($client->body, true);
2323
$signature = hash_hmac('sha256', $challenge['challenge'], $this->clusterSecret);
2424
//获取token和ttl
25-
$client = new Client(OPENBMCLAPI,443,true);
25+
$client = new Client(OPENBMCLAPIURL,443,true);
2626
$client->post(
2727
'/openbmclapi-agent/token',
2828
array(

main.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@
44
use function Swoole\Timer;
55
declare(ticks=1)
66
require './config.php';
7+
const PHPOBAVERSION = '0.0.1-dev';
78
const VERSION = '1.10.3';
89
global $DOWNLOAD_DIR;
910
$DOWNLOAD_DIR = $config['cache_dir'];
10-
const USERAGENT = 'openbmclapi-cluster/' . VERSION . ' ' . 'PHP-OpenBmclApi/0.0.1-dev';
11-
if ($config['Staging'] == true){
12-
define('OPENBMCLAPI', 'openbmclapi.staging.bangbang93.com');
13-
}
14-
else{
15-
define('OPENBMCLAPI', 'openbmclapi.bangbang93.com');
16-
}
11+
const USERAGENT = 'openbmclapi-cluster/' . VERSION . ' ' . 'PHP-OpenBmclApi/'.PHPOBAVERSION;
12+
const OPENBMCLAPIURL = 'openbmclapi.bangbang93.com';
1713
global $tokendata;
1814
$list = glob('./inc/*.php');
1915
foreach ($list as $file) {

0 commit comments

Comments
 (0)