mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 04:01:10 -04:00
refactor updater
This commit is contained in:
@ -4,20 +4,21 @@ namespace Laraspace\Space;
|
|||||||
|
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use GuzzleHttp\Exception\RequestException;
|
use GuzzleHttp\Exception\RequestException;
|
||||||
|
use Laraspace\Setting;
|
||||||
|
|
||||||
trait SiteApi
|
trait SiteApi
|
||||||
{
|
{
|
||||||
|
|
||||||
protected static function getRemote($url, $data = array())
|
protected static function getRemote($url, $data = array())
|
||||||
{
|
{
|
||||||
$base = 'https://codeload.github.com/';
|
$base = 'http://download-test.test/';
|
||||||
|
|
||||||
$client = new Client(['verify' => false, 'base_uri' => $base]);
|
$client = new Client(['verify' => false, 'base_uri' => $base]);
|
||||||
|
|
||||||
$headers['headers'] = array(
|
$headers['headers'] = array(
|
||||||
'Accept' => 'application/json',
|
'Accept' => 'application/json',
|
||||||
'Referer' => url('/'),
|
'Referer' => url('/'),
|
||||||
'crater' => getFullVersion()
|
'crater' => Setting::getSetting('version')
|
||||||
);
|
);
|
||||||
|
|
||||||
$data['http_errors'] = false;
|
$data['http_errors'] = false;
|
||||||
|
|||||||
@ -17,9 +17,9 @@ class Updater
|
|||||||
$data = null;
|
$data = null;
|
||||||
$path = null;
|
$path = null;
|
||||||
|
|
||||||
$url = 'laraspace/laraspace/zip/master';
|
$url = '/api/download';
|
||||||
|
|
||||||
$response = static::getRemote($url, ['timeout' => 50, 'track_redirects' => true]);
|
$response = static::getRemote($url, ['timeout' => 100, 'track_redirects' => true]);
|
||||||
|
|
||||||
// Exception
|
// Exception
|
||||||
if ($response instanceof RequestException) {
|
if ($response instanceof RequestException) {
|
||||||
|
|||||||
Reference in New Issue
Block a user