Explorar el Código

enh: openapi tool server custom path

Timothy Jaeryang Baek hace 4 meses
padre
commit
77fa11098a
Se han modificado 2 ficheros con 7 adiciones y 4 borrados
  1. 6 3
      src/lib/apis/index.ts
  2. 1 1
      src/lib/components/AddServerModal.svelte

+ 6 - 3
src/lib/apis/index.ts

@@ -262,7 +262,7 @@ export const stopTask = async (token: string, id: string) => {
 export const getToolServerData = async (token: string, url: string) => {
 	let error = null;
 
-	const res = await fetch(`${url}/openapi.json`, {
+	const res = await fetch(`${url}`, {
 		method: 'GET',
 		headers: {
 			Accept: 'application/json',
@@ -304,10 +304,13 @@ export const getToolServersData = async (i18n, servers: object[]) => {
 			servers
 				.filter((server) => server?.config?.enable)
 				.map(async (server) => {
-					const data = await getToolServerData(server?.key, server?.url).catch((err) => {
+					const data = await getToolServerData(
+						server?.key,
+						server?.url + (server?.path ?? '/openapi.json')
+					).catch((err) => {
 						toast.error(
 							i18n.t(`Failed to connect to {{URL}} OpenAPI tool server`, {
-								URL: server?.url
+								URL: server?.url + (server?.path ?? '/openapi.json')
 							})
 						);
 						return null;

+ 1 - 1
src/lib/components/AddServerModal.svelte

@@ -56,8 +56,8 @@
 		show = false;
 
 		url = '';
-		key = '';
 		path = '/openapi.json';
+		key = '';
 		auth_type = 'bearer';
 
 		enable = true;