enh: allow custom openapi json url

This commit is contained in:
Timothy Jaeryang Baek
2025-05-27 00:20:47 +04:00
parent a38e44e870
commit 2c7ccc69fe
3 changed files with 20 additions and 8 deletions

View File

@@ -346,11 +346,15 @@ export const getToolServersData = async (i18n, servers: object[]) => {
.map(async (server) => {
const data = await getToolServerData(
(server?.auth_type ?? 'bearer') === 'bearer' ? server?.key : localStorage.token,
server?.url + '/' + (server?.path ?? 'openapi.json')
(server?.path ?? '').includes('://')
? server?.path
: `${server?.url}${(server?.path ?? '').startsWith('/') ? '' : '/'}${server?.path}`
).catch((err) => {
toast.error(
i18n.t(`Failed to connect to {{URL}} OpenAPI tool server`, {
URL: server?.url + '/' + (server?.path ?? 'openapi.json')
URL: (server?.path ?? '').includes('://')
? server?.path
: `${server?.url}${(server?.path ?? '').startsWith('/') ? '' : '/'}${server?.path}`
})
);
return null;