mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-15 09:14:08 +00:00
Backup, Update, Modules, and global Settings controllers (mail config, PDF config, disk management, global settings) are application-wide features not scoped to a company. Move them from Admin/ to SuperAdmin/ to match the v3.0 UI structure where these live under Administration. Company-scoped settings controllers remain in Admin/Settings/.
36 lines
974 B
PHP
36 lines
974 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\V1\SuperAdmin\Update;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\Update\Updater;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\File;
|
|
|
|
class CheckVersionController extends Controller
|
|
{
|
|
/**
|
|
* Handle the incoming request.
|
|
*
|
|
* @return JsonResponse
|
|
*/
|
|
public function __invoke(Request $request)
|
|
{
|
|
if ((! $request->user()) || (! $request->user()->isOwner())) {
|
|
return response()->json([
|
|
'success' => false,
|
|
'message' => 'You are not allowed to update this app.',
|
|
], 401);
|
|
}
|
|
|
|
set_time_limit(600); // 10 minutes
|
|
|
|
$channel = $request->get('channel', 'stable');
|
|
$version = preg_replace('~[\r\n]+~', '', File::get(base_path('version.md')));
|
|
$response = Updater::checkForUpdate($version, $channel);
|
|
|
|
return response()->json($response);
|
|
}
|
|
}
|