3232use OCP \AppFramework \Http \Attribute \NoAdminRequired ;
3333use OCP \AppFramework \Http \Attribute \NoCSRFRequired ;
3434use OCP \AppFramework \Http \DataResponse ;
35- use OCP \Http \Client \IClientService ;
3635use OCP \IRequest ;
37- use Psr \Log \LoggerInterface ;
3836
3937class StatusApiController extends ApiController {
4038 /** @var IAppManager */
@@ -44,15 +42,6 @@ class StatusApiController extends ApiController {
4442 private $ licensemanager ;
4543 private $ appVersionClient ;
4644 private $ licenseservice ;
47- private $ httpClient ;
48- private $ logger ;
49-
50- private const RELEASES_BASE_URL = 'https://releasesapp.com/api/entries/latest/ ' ;
51- private const RELEASE_WORKSPACES = [
52- 'outlook-cross-platform ' => 'dc9b6f11-139c-46ad-83a7-efca461ef0d0 ' ,
53- 'ms-teams ' => '6880e895-ba93-4433-9729-371ea9dc0ac1 ' ,
54- 'outlook-windows ' => '13f7862f-8df4-4106-a818-4d5a82f6fe50 ' ,
55- ];
5645
5746 public function __construct (
5847 $ appName ,
@@ -62,17 +51,13 @@ public function __construct(
6251 LicenseManager $ licensemanager ,
6352 AppVersionHttpClient $ appVersionClient ,
6453 LicenseService $ licenseservice ,
65- IClientService $ clientService ,
66- LoggerInterface $ logger ,
6754 ) {
6855 parent ::__construct ($ appName , $ request );
6956 $ this ->appManager = $ appManager ;
7057 $ this ->userId = $ userId ;
7158 $ this ->appVersionClient = $ appVersionClient ;
7259 $ this ->licensemanager = $ licensemanager ;
7360 $ this ->licenseservice = $ licenseservice ;
74- $ this ->httpClient = $ clientService ->newClient ();
75- $ this ->logger = $ logger ;
7661 }
7762 /**
7863 * Get the status of the user's license
@@ -147,27 +132,4 @@ public function index(): DataResponse {
147132 // Returns license status
148133 return new DataResponse ($ statusobj );
149134 }
150-
151- /**
152- * Fetches the latest release entry for all products from releasesapp.com
153- *
154- * @return DataResponse
155- */
156- #[NoAdminRequired]
157- #[NoCSRFRequired]
158- public function releases (): DataResponse {
159- $ results = [];
160- foreach (self ::RELEASE_WORKSPACES as $ slug => $ uuid ) {
161- try {
162- $ response = $ this ->httpClient ->get (self ::RELEASES_BASE_URL . $ uuid );
163- $ data = json_decode ($ response ->getBody (), true );
164- if ($ data ) {
165- $ results [$ slug ] = $ data ;
166- }
167- } catch (\Exception $ e ) {
168- $ this ->logger ->warning ('Failed to fetch release for ' . $ slug . ': ' . $ e ->getMessage ());
169- }
170- }
171- return new DataResponse ($ results );
172- }
173135}
0 commit comments