mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-07-17 22:35:19 +00:00
The Docker image already injects CONTAINERIZED=true; consume it via config('invoiceshelf.containerized'), expose it on /app/version, block the update endpoints + console command, and show a 'docker compose pull' panel instead of the updater. Adds missing i18n keys.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
34 lines
850 B
PHP
34 lines
850 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Setting;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\File;
|
|
|
|
class AppVersionController extends Controller
|
|
{
|
|
/**
|
|
* Handle the incoming request.
|
|
*
|
|
* @return JsonResponse
|
|
*/
|
|
public function __invoke(Request $request)
|
|
{
|
|
$version = preg_replace('~[\r\n]+~', '', File::get(base_path('version.md')));
|
|
|
|
$channel = Setting::getSetting('updater_channel');
|
|
if (is_null($channel)) {
|
|
$channel = 'stable';
|
|
Setting::setSetting('updater_channel', 'stable'); // default.
|
|
}
|
|
|
|
return response()->json([
|
|
'version' => $version,
|
|
'channel' => $channel,
|
|
'containerized' => (bool) config('invoiceshelf.containerized'),
|
|
]);
|
|
}
|
|
}
|