diff --git a/app/Actions/Diagnostics/Info.php b/app/Actions/Diagnostics/Info.php index 6db0e442f2d..eedd5d684a8 100644 --- a/app/Actions/Diagnostics/Info.php +++ b/app/Actions/Diagnostics/Info.php @@ -3,6 +3,7 @@ namespace App\Actions\Diagnostics; use App\Actions\Diagnostics\Pipes\Infos\CountForeignKeyInfo; +use App\Actions\Diagnostics\Pipes\Infos\DockerVersionInfo; use App\Actions\Diagnostics\Pipes\Infos\ExtensionsInfo; use App\Actions\Diagnostics\Pipes\Infos\InstallTypeInfo; use App\Actions\Diagnostics\Pipes\Infos\SystemInfo; @@ -18,6 +19,7 @@ class Info */ private $pipes = [ VersionInfo::class, + DockerVersionInfo::class, InstallTypeInfo::class, SystemInfo::class, ExtensionsInfo::class, diff --git a/app/Actions/Diagnostics/Pipes/Infos/DockerVersionInfo.php b/app/Actions/Diagnostics/Pipes/Infos/DockerVersionInfo.php new file mode 100644 index 00000000000..9b29cb2994b --- /dev/null +++ b/app/Actions/Diagnostics/Pipes/Infos/DockerVersionInfo.php @@ -0,0 +1,70 @@ +isDocker()) { + if ($this->isLinuxServer()) { + $docker = 'linuxserver.io'; + } + if ($this->isLycheeOrg()) { + $docker = 'lycheeorg'; + } + + $docker = 'custom'; + } + + $data[] = Diagnostics::line('Docker:', $docker); + + return $next($data); + } + + /** + * Check if we are running in Docker. + * + * @return bool + */ + public function isDocker(): bool + { + return is_file('/.dockerenv'); + } + + /** + * Check if we are running in Docker. + * + * @return bool + */ + private function isLinuxServer(): bool + { + return is_file('/build_version'); + } + + /** + * Check if we are running in Docker. + * + * @return bool + */ + private function isLycheeOrg(): bool + { + return is_file(base_path('/docker_target')); + } +} diff --git a/app/Http/Controllers/Admin/UpdateController.php b/app/Http/Controllers/Admin/UpdateController.php index b0ac235e56e..80594f044eb 100644 --- a/app/Http/Controllers/Admin/UpdateController.php +++ b/app/Http/Controllers/Admin/UpdateController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Admin; use App\Actions\Diagnostics\Pipes\Checks\UpdatableCheck; +use App\Actions\Diagnostics\Pipes\Infos\DockerVersionInfo; use App\Actions\Diagnostics\Pipes\Infos\VersionInfo; use App\Actions\InstallUpdate\ApplyUpdate; use App\Contracts\Exceptions\LycheeException; @@ -32,12 +33,13 @@ public function __construct(ApplyUpdate $applyUpdate) /** * Retrieve Update data from the server. * - * @param UpdateRequest $request - * @param VersionInfo $versionInfo + * @param UpdateRequest $request + * @param VersionInfo $versionInfo + * @param DockerVersionInfo $dockerVersionInfo * * @return UpdateInfo */ - public function get(UpdateRequest $request, VersionInfo $versionInfo): UpdateInfo + public function get(UpdateRequest $request, VersionInfo $versionInfo, DockerVersionInfo $dockerVersionInfo): UpdateInfo { /** @var VersionChannelType $channelName */ $channelName = $versionInfo->getChannelName(); @@ -57,7 +59,7 @@ public function get(UpdateRequest $request, VersionInfo $versionInfo): UpdateInf } } - return new UpdateInfo($info, $extra, $channelName); + return new UpdateInfo($info, $extra, $channelName, $dockerVersionInfo->isDocker()); } /** @@ -65,9 +67,9 @@ public function get(UpdateRequest $request, VersionInfo $versionInfo): UpdateInf * * @return UpdateCheckInfo */ - public function check(UpdateRequest $request, GitHubVersion $gitHubFunctions, VersionInfo $versionInfo): UpdateCheckInfo + public function check(UpdateRequest $request, GitHubVersion $gitHubFunctions, VersionInfo $versionInfo, DockerVersionInfo $dockerVersionInfo): UpdateCheckInfo { - return new UpdateCheckInfo($gitHubFunctions->getBehindTest(), !$gitHubFunctions->isUpToDate() || !$versionInfo->fileVersion->isUpToDate()); + return new UpdateCheckInfo($gitHubFunctions->getBehindTest(), !$dockerVersionInfo->isDocker() && (!$gitHubFunctions->isUpToDate() || !$versionInfo->fileVersion->isUpToDate())); } /** diff --git a/app/Http/Resources/Diagnostics/UpdateInfo.php b/app/Http/Resources/Diagnostics/UpdateInfo.php index c906cc5a1a1..04410b194f1 100644 --- a/app/Http/Resources/Diagnostics/UpdateInfo.php +++ b/app/Http/Resources/Diagnostics/UpdateInfo.php @@ -13,6 +13,7 @@ public function __construct( public string $info, public string $extra, public VersionChannelType $channelName, + public bool $isDocker, ) { } } diff --git a/app/Metadata/Versions/GitHubVersion.php b/app/Metadata/Versions/GitHubVersion.php index c6f0dcc9fd4..9e1b2a23205 100644 --- a/app/Metadata/Versions/GitHubVersion.php +++ b/app/Metadata/Versions/GitHubVersion.php @@ -226,7 +226,8 @@ private function hydrateLocalHead(): void private function hydrateRemote(bool $useCache): void { // We do not fetch when local branch is not master. - if ($this->remote === null || !$this->isMasterBranch()) { + // We do not fetch when the localHead is not set. + if ($this->remote === null || $this->localHead === null || !$this->isMasterBranch()) { return; } diff --git a/resources/js/components/maintenance/MaintenanceUpdate.vue b/resources/js/components/maintenance/MaintenanceUpdate.vue index c680c614ba8..5af23f20e16 100644 --- a/resources/js/components/maintenance/MaintenanceUpdate.vue +++ b/resources/js/components/maintenance/MaintenanceUpdate.vue @@ -1,6 +1,6 @@