refactor updater

This commit is contained in:
jayvirsinh_gohil
2019-11-13 20:14:46 +05:30
parent 3efc3357c1
commit fa1ddae78c
2 changed files with 5 additions and 4 deletions

View File

@ -4,20 +4,21 @@ namespace Laraspace\Space;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use Laraspace\Setting;
trait SiteApi
{
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]);
$headers['headers'] = array(
'Accept' => 'application/json',
'Referer' => url('/'),
'crater' => getFullVersion()
'crater' => Setting::getSetting('version')
);
$data['http_errors'] = false;

View File

@ -17,9 +17,9 @@ class Updater
$data = 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
if ($response instanceof RequestException) {