diff --git a/bootstrap.php b/bootstrap.php index 4cefe0f9..6fb46d62 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -18,7 +18,6 @@ \Movary\HttpController\Web\CreateUserController::class => DI\factory([Factory::class, 'createCreateUserController']), \Movary\HttpController\Web\JobController::class => DI\factory([Factory::class, 'createJobController']), \Movary\HttpController\Web\LandingPageController::class => DI\factory([Factory::class, 'createLandingPageController']), - \Movary\HttpController\Web\SettingsController::class => DI\factory([Factory::class, 'createSettingsController']), \Movary\HttpController\Web\Middleware\ServerHasRegistrationEnabled::class => DI\factory([Factory::class, 'createMiddlewareServerHasRegistrationEnabled']), \Movary\ValueObject\Http\Request::class => DI\factory([Factory::class, 'createCurrentHttpRequest']), \Movary\Command\CreatePublicStorageLink::class => DI\factory([Factory::class, 'createCreatePublicStorageLink']), diff --git a/docs/openapi.json b/docs/openapi.json index a7c368ed..87fff390 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -4,11 +4,7 @@ "title": "Movary", "version": "" }, - "servers": [ - { - "url": "\/api" - } - ], + "servers": [], "paths": { "\/users\/{username}\/history": { "get": { diff --git a/src/Api/Jellyfin/JellyfinClient.php b/src/Api/Jellyfin/JellyfinClient.php index 91ac28fa..73b12637 100644 --- a/src/Api/Jellyfin/JellyfinClient.php +++ b/src/Api/Jellyfin/JellyfinClient.php @@ -110,7 +110,7 @@ private function convertException(\Exception $e, Url $url) : \Exception private function generateHeaders(?JellyfinAccessToken $jellyfinAccessToken = null) : array { $appName = $this->serverSettings->getJellyfinAppName(); - $appVersion = $this->serverSettings->getApplicationVersion() ?? 'dev'; + $appVersion = $this->serverSettings->getApplicationVersion(); $deviceId = $this->serverSettings->requireJellyfinDeviceId(); $authorizationString = 'MediaBrowser Client ="' . $appName . '", Device ="' . php_uname('s') . '", Version="' . $appVersion . '", DeviceId="' . $deviceId . '"'; diff --git a/src/Factory.php b/src/Factory.php index c3d3c48c..acad5e47 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -266,30 +266,6 @@ public static function createOpenApiController(ContainerInterface $container) : ); } - public static function createSettingsController(ContainerInterface $container, Config $config) : SettingsController - { - return new SettingsController( - $container->get(Twig\Environment::class), - $container->get(Authentication::class), - $container->get(TwoFactorAuthenticationApi::class), - $container->get(UserApi::class), - $container->get(MovieApi::class), - $container->get(GithubApi::class), - $container->get(PlexApi::class), - $container->get(SessionWrapper::class), - $container->get(LetterboxdExporter::class), - $container->get(TraktApi::class), - $container->get(JellyfinApi::class), - $container->get(ServerSettings::class), - $container->get(WebhookUrlBuilder::class), - $container->get(JobQueueApi::class), - $container->get(DashboardFactory::class), - $container->get(EmailService::class), - $container->get(Tmdb\Cache\TmdbIsoCountryCache::class), - self::getApplicationVersion($config), - ); - } - public static function createTmdbApiClient(ContainerInterface $container) : Tmdb\TmdbClient { return new Tmdb\TmdbClient( diff --git a/src/HttpController/Api/OpenApiController.php b/src/HttpController/Api/OpenApiController.php index 97ec692f..e1c5700d 100644 --- a/src/HttpController/Api/OpenApiController.php +++ b/src/HttpController/Api/OpenApiController.php @@ -22,6 +22,7 @@ public function getSchema() : Response $openapiData['info']['version'] = $this->serverSettings->getApplicationVersion(); + $openapiData['servers'][0]['url'] = '/api'; $applicationUrl = $this->serverSettings->getApplicationUrl(); if ($applicationUrl !== null) { $openapiData['servers'][0]['url'] = trim($applicationUrl, '/') . '/api'; diff --git a/src/HttpController/Web/SettingsController.php b/src/HttpController/Web/SettingsController.php index 5dd2afbc..16d29e89 100644 --- a/src/HttpController/Web/SettingsController.php +++ b/src/HttpController/Web/SettingsController.php @@ -51,7 +51,6 @@ public function __construct( private readonly DashboardFactory $dashboardFactory, private readonly EmailService $emailService, private readonly TmdbIsoCountryCache $countryCache, - private readonly string $currentApplicationVersion, ) { } @@ -152,7 +151,7 @@ public function renderAppPage() : Response return Response::create( StatusCode::createOk(), $this->twig->render('page/settings-app.html.twig', [ - 'currentApplicationVersion' => $this->currentApplicationVersion, + 'currentApplicationVersion' => $this->serverSettings->getApplicationVersion(), 'latestRelease' => $this->githubApi->fetchLatestMovaryRelease(), 'timeZone' => date_default_timezone_get(), ]), diff --git a/src/Service/ServerSettings.php b/src/Service/ServerSettings.php index cae57316..b5222628 100644 --- a/src/Service/ServerSettings.php +++ b/src/Service/ServerSettings.php @@ -51,9 +51,9 @@ public function getApplicationUrl() : ?string return $this->getByKey(self::APPLICATION_URL); } - public function getApplicationVersion() : ?string + public function getApplicationVersion() : string { - return $this->getByKey(self::APPLICATION_VERSION); + return $this->getByKey(self::APPLICATION_VERSION) ?? 'unknown'; } public function getFromAddress() : ?string