From 0dbf3c6292aff9dbc04fdddcf1928c0a3c73dabc Mon Sep 17 00:00:00 2001 From: Chaoran Chen Date: Wed, 4 Dec 2024 08:11:33 +0100 Subject: [PATCH 1/3] feat(website): show API URLs on API documentation page --- .../src/pages/api-documentation/index.astro | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/website/src/pages/api-documentation/index.astro b/website/src/pages/api-documentation/index.astro index fdce4687aa..3690d70d02 100644 --- a/website/src/pages/api-documentation/index.astro +++ b/website/src/pages/api-documentation/index.astro @@ -5,6 +5,7 @@ import BaseLayout from '../../layouts/BaseLayout.astro'; import { routes } from '../../routes/routes.ts'; const clientConfig = getRuntimeConfig().public; +const keycloakUrl = getRuntimeConfig().serverSide.keycloakUrl; const websiteConfig = getWebsiteConfig(); @@ -24,7 +25,7 @@ const BUTTON_CLASS =

API Documentation

-
+

There is a

-
+

Backend Server

-
+

LAPIS Query Engines

{ @@ -78,6 +83,29 @@ const BUTTON_CLASS = )) }
+
+ Host of LAPIS Query Engines: +
    + { + Object.entries(clientConfig.lapisUrls).map(([organism, url]) => ( +
  • + {organismToDisplayName[organism]}: {url} +
  • + )) + } +
+
+
+ +
+

Keycloak Server

+
+ We use the open source software Keycloak for authentication. +
+
+ Host of Keycloak Server: + {keycloakUrl} +
From d4d11214d84ff3a3183040f3378d78b453935688 Mon Sep 17 00:00:00 2001 From: Chaoran Chen Date: Wed, 4 Dec 2024 10:07:28 +0100 Subject: [PATCH 2/3] fix keycloak url --- website/src/pages/api-documentation/index.astro | 3 ++- website/src/utils/getAuthUrl.ts | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/website/src/pages/api-documentation/index.astro b/website/src/pages/api-documentation/index.astro index 3690d70d02..baf67b4922 100644 --- a/website/src/pages/api-documentation/index.astro +++ b/website/src/pages/api-documentation/index.astro @@ -3,9 +3,10 @@ import { authenticationApiDocsUrl } from './authenticationApiDocsUrl'; import { getRuntimeConfig, getWebsiteConfig } from '../../config'; import BaseLayout from '../../layouts/BaseLayout.astro'; import { routes } from '../../routes/routes.ts'; +import { getAuthBaseUrl } from '../../utils/getAuthUrl'; const clientConfig = getRuntimeConfig().public; -const keycloakUrl = getRuntimeConfig().serverSide.keycloakUrl; +const keycloakUrl = getAuthBaseUrl(); const websiteConfig = getWebsiteConfig(); diff --git a/website/src/utils/getAuthUrl.ts b/website/src/utils/getAuthUrl.ts index 24b30389c9..91a0b39ed8 100644 --- a/website/src/utils/getAuthUrl.ts +++ b/website/src/utils/getAuthUrl.ts @@ -20,3 +20,12 @@ export const getAuthUrl = async (redirectUrl: string) => { }); /* eslint-enable @typescript-eslint/naming-convention */ }; + +export const getAuthBaseUrl = async () => { + const authUrl = await getAuthUrl('/'); + const index = authUrl.indexOf('/realms'); + if (index === -1) { + return null; + } + return authUrl.substring(0, index); +}; From b36ba4b24f9fb3f745e36dadaae51b5b0a3bea84 Mon Sep 17 00:00:00 2001 From: Chaoran Chen Date: Wed, 4 Dec 2024 10:10:29 +0100 Subject: [PATCH 3/3] rename "host" to simply "URL" --- website/src/pages/api-documentation/index.astro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/src/pages/api-documentation/index.astro b/website/src/pages/api-documentation/index.astro index baf67b4922..b52f2ee0a4 100644 --- a/website/src/pages/api-documentation/index.astro +++ b/website/src/pages/api-documentation/index.astro @@ -68,7 +68,7 @@ const BUTTON_CLASS = View Backend API Documentation
- Host of Backend Server: + URL of Backend Server: {clientConfig.backendUrl}
@@ -85,7 +85,7 @@ const BUTTON_CLASS = }
- Host of LAPIS Query Engines: + URLs of LAPIS Query Engines:
    { Object.entries(clientConfig.lapisUrls).map(([organism, url]) => ( @@ -104,7 +104,7 @@ const BUTTON_CLASS = We use the open source software Keycloak for authentication.
- Host of Keycloak Server: + URL of Keycloak Server: {keycloakUrl}