Add new plugins registry (fix #31)

This commit is contained in:
Pig Fang 2019-04-01 16:12:11 +08:00
parent a5d0b3f137
commit 58437a1b97
4 changed files with 7 additions and 3344 deletions

View File

@ -18,13 +18,6 @@ class MarketController extends Controller
*/
protected $guzzle;
/**
* Default request options for Guzzle HTTP client.
*
* @var array
*/
protected $guzzleConfig;
/**
* Cache for plugins registry.
*
@ -35,10 +28,6 @@ class MarketController extends Controller
public function __construct(\GuzzleHttp\Client $guzzle)
{
$this->guzzle = $guzzle;
$this->guzzleConfig = [
'headers' => ['User-Agent' => config('secure.user_agent')],
'verify' => config('secure.certificates'),
];
}
public function marketData()
@ -101,9 +90,7 @@ class MarketController extends Controller
// Download
try {
$this->guzzle->request('GET', $url, array_merge($this->guzzleConfig, [
'sink' => $tmp_path,
]));
$this->guzzle->request('GET', $url, ['sink' => $tmp_path]);
} catch (Exception $e) {
report($e);
@ -145,7 +132,7 @@ class MarketController extends Controller
if (app()->environment('testing') || ! $this->registryCache) {
try {
$pluginsJson = $this->guzzle->request(
'GET', config('plugins.registry'), $this->guzzleConfig
'GET', config('plugins.registry')
)->getBody();
} catch (Exception $e) {
throw new Exception(trans('admin.plugins.market.connection-error', [

View File

@ -31,5 +31,9 @@ return [
| Specify where to get plugins' metadata for plugin market.
|
*/
'registry' => env('PLUGINS_REGISTRY', 'https://work.prinzeugen.net/blessing-skin-server/plugins.json'),
'registry' => env(
'PLUGINS_REGISTRY',
'https://dev.azure.com/blessing-skin/0dc12c60-882a-46a2-90c6-9450490193a2/_apis/'.
'git/repositories/d5283b63-dfb0-497e-ad17-2860a547596f/Items?path=%2Fregistry.json'
),
];

View File

@ -11,18 +11,4 @@ return [
*/
'cipher' => env('PWD_METHOD', 'SALTED2MD5'),
'salt' => env('SALT', ''),
/*
|--------------------------------------------------------------------------
| SSL Certificates
|--------------------------------------------------------------------------
|
| Describes the SSL certificate verification behavior of all Guzzle requests.
| By default, we use the CA bundle provided by Mozilla.
|
| See: http://docs.guzzlephp.org/en/stable/request-options.html#verify
|
*/
'certificates' => env('SSL_CERT', storage_path('patches/ca-bundle.crt')),
'user_agent' => env('USER_AGENT', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36'),
];

File diff suppressed because it is too large Load Diff