removed token requirement for core update
This commit is contained in:
parent
3b3e3bbb66
commit
380bd753e3
@ -6,26 +6,11 @@ use App\Http\Controllers\Controller;
|
|||||||
use App\Models\Module\Module as Model;
|
use App\Models\Module\Module as Model;
|
||||||
use App\Utilities\Updater;
|
use App\Utilities\Updater;
|
||||||
use App\Utilities\Versions;
|
use App\Utilities\Versions;
|
||||||
use Illuminate\Routing\Route;
|
|
||||||
use Module;
|
use Module;
|
||||||
|
|
||||||
class Updates extends Controller
|
class Updates extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiate a new controller instance.
|
|
||||||
*
|
|
||||||
* @param Route $route
|
|
||||||
*/
|
|
||||||
public function __construct(Route $route)
|
|
||||||
{
|
|
||||||
if (!setting('general.api_token')) {
|
|
||||||
return redirect('modules/token/create')->send();
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::__construct($route);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the form for creating a new resource.
|
* Show the form for creating a new resource.
|
||||||
*
|
*
|
||||||
|
@ -124,7 +124,7 @@ class Updater
|
|||||||
// Get data from cache
|
// Get data from cache
|
||||||
$data = Cache::get('updates');
|
$data = Cache::get('updates');
|
||||||
|
|
||||||
if (!empty($data) || !setting('general.api_token')) {
|
if (!empty($data)) {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class Versions
|
|||||||
// Get data from cache
|
// Get data from cache
|
||||||
$data = Cache::get('versions');
|
$data = Cache::get('versions');
|
||||||
|
|
||||||
if (!empty($data) || !setting('general.api_token')) {
|
if (!empty($data)) {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,6 +74,13 @@ class Versions
|
|||||||
|
|
||||||
$data['core'] = static::getLatestVersion($url);
|
$data['core'] = static::getLatestVersion($url);
|
||||||
|
|
||||||
|
// API token required for modules
|
||||||
|
if (!setting('general.api_token')) {
|
||||||
|
Cache::put('versions', $data, Date::now()->addHour(6));
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
// Then modules
|
// Then modules
|
||||||
foreach ($modules as $module) {
|
foreach ($modules as $module) {
|
||||||
$alias = $module->get('alias');
|
$alias = $module->get('alias');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user