removed token requirement for core update
This commit is contained in:
		| @@ -6,26 +6,11 @@ use App\Http\Controllers\Controller; | ||||
| use App\Models\Module\Module as Model; | ||||
| use App\Utilities\Updater; | ||||
| use App\Utilities\Versions; | ||||
| use Illuminate\Routing\Route; | ||||
| use Module; | ||||
|  | ||||
| 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. | ||||
|      * | ||||
|   | ||||
| @@ -124,7 +124,7 @@ class Updater | ||||
|         // Get data from cache | ||||
|         $data = Cache::get('updates'); | ||||
|  | ||||
|         if (!empty($data) || !setting('general.api_token')) { | ||||
|         if (!empty($data)) { | ||||
|             return $data; | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -60,7 +60,7 @@ class Versions | ||||
|         // Get data from cache | ||||
|         $data = Cache::get('versions'); | ||||
|  | ||||
|         if (!empty($data) || !setting('general.api_token')) { | ||||
|         if (!empty($data)) { | ||||
|             return $data; | ||||
|         } | ||||
|  | ||||
| @@ -74,6 +74,13 @@ class Versions | ||||
|  | ||||
|         $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 | ||||
|         foreach ($modules as $module) { | ||||
|             $alias = $module->get('alias'); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user