other: add uid to describe API

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/672/head
Varun Patil 2023-05-17 22:41:53 -07:00
parent ddfc586465
commit 554e91d447
1 changed files with 9 additions and 2 deletions

View File

@ -111,13 +111,20 @@ class OtherController extends GenericApiController
$appManager = \OC::$server->get(\OCP\App\IAppManager::class);
$urlGenerator = \OC::$server->get(\OCP\IURLGenerator::class);
$res = new JSONResponse([
$info = [
'version' => $appManager->getAppInfo('memories')['version'],
'baseUrl' => $urlGenerator->linkToRouteAbsolute('memories.Page.main'),
'loginFlowUrl' => $urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.init'),
]);
];
try {
$info['uid'] = Util::getUID();
} catch (\Exception $e) {
$info['uid'] = null;
}
// This is public information
$res = new JSONResponse($info);
$res->addHeader('Access-Control-Allow-Origin', '*');
return $res;