Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/routes/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { PageServerLoad } from './$types';
import { ENTITY_SPACE_ID } from '$lib/constants/entities';
import {
API_EXPLORER_URL,
API_MANAGER_URL,
Expand All @@ -8,13 +9,23 @@ import {
getAppDirectory
} from '$lib/obp/appDirectory';

/** API Explorer opened on this deployment's dynamic endpoints, scoped to the bank
* that owns them (OBP_ENTITY_SPACE_ID). System level entities have no bank, so no bank_id. */
function apiExplorerLink(baseUrl: string, bankId: string | null): string {
const url = new URL(baseUrl);
url.searchParams.set('content', 'dynamic');
if (bankId) url.searchParams.set('bank_id', bankId);
return url.toString();
}

/** The OBP tools linked below the fold, located through OBP's app directory. A tool
* OBP has no URL for is null, and its card is left out. */
export const load: PageServerLoad = async ({ fetch }) => {
const directory = await getAppDirectory(fetch);
const portalUrl = directory[PORTAL_URL];
const apiExplorerUrl = directory[API_EXPLORER_URL];
return {
apiExplorerUrl: directory[API_EXPLORER_URL] ?? null,
apiExplorerUrl: apiExplorerUrl ? apiExplorerLink(apiExplorerUrl, ENTITY_SPACE_ID) : null,
apiManagerUrl: directory[API_MANAGER_URL] ?? null,
mcpUrl: directory[MCP_URL] ?? null,
portalUrl: portalUrl ?? null,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
{
href: data.portalUrl,
icon: Globe,
title: 'Portal',
title: 'Register',
description: 'Register, get API keys and read the guides.'
},
{
Expand Down
Loading