1212use OCA \AppAPI \AppInfo \Application ;
1313use OCA \AppAPI \Attribute \AppAPIAuth ;
1414use OCA \AppAPI \Service \AppAPIService ;
15-
1615use OCA \AppAPI \Service \ExAppService ;
16+
1717use OCP \AppFramework \Http ;
1818use OCP \AppFramework \Http \Attribute \NoAdminRequired ;
1919use OCP \AppFramework \Http \Attribute \NoCSRFRequired ;
2222use OCP \AppFramework \OCS \OCSBadRequestException ;
2323use OCP \AppFramework \OCSController ;
2424use OCP \IRequest ;
25+ use OCP \IURLGenerator ;
2526use Psr \Log \InvalidArgumentException ;
2627use Psr \Log \LoggerInterface ;
2728
@@ -33,6 +34,7 @@ public function __construct(
3334 private readonly LoggerInterface $ logger ,
3435 private readonly AppAPIService $ service ,
3536 private readonly ExAppService $ exAppService ,
37+ private readonly IURLGenerator $ urlGenerator ,
3638 ) {
3739 parent ::__construct (Application::APP_ID , $ request );
3840
@@ -89,7 +91,6 @@ public function setAppInitProgress(int $progress, string $error = ''): DataRespo
8991 return new DataResponse ();
9092 }
9193
92-
9394 /**
9495 * Retrieves the enabled status of an ExApp (0 for disabled, 1 for enabled).
9596 * Note: This endpoint is accessible even if the ExApp itself is disabled.
@@ -106,4 +107,13 @@ public function getEnabledState(): DataResponse {
106107 }
107108 return new DataResponse ($ exApp ->getEnabled ());
108109 }
110+
111+ #[AppAPIAuth]
112+ #[PublicPage]
113+ #[NoCSRFRequired]
114+ public function getNextcloudAbsoluteUrl (string $ url ): DataResponse {
115+ return new DataResponse ([
116+ 'absolute_url ' => $ this ->urlGenerator ->getAbsoluteURL ($ url ),
117+ ], Http::STATUS_OK );
118+ }
109119}
0 commit comments