diff --git a/projects/app/src/pages/api/marketplace/[...path].ts b/projects/app/src/pages/api/marketplace/[...path].ts index 2f30a262b0..7b0699f2b9 100644 --- a/projects/app/src/pages/api/marketplace/[...path].ts +++ b/projects/app/src/pages/api/marketplace/[...path].ts @@ -1,9 +1,11 @@ import type { NextApiRequest, NextApiResponse } from 'next'; import { jsonRes } from '@fastgpt/service/common/response'; import { Readable } from 'stream'; +import { authSystemAdmin } from '@fastgpt/service/support/permission/user/auth'; export default async function handler(req: NextApiRequest, res: NextApiResponse) { try { + await authSystemAdmin({ req }); const { path = [], ...query } = req.query as any; const queryStr = new URLSearchParams(query).toString(); diff --git a/projects/app/src/pages/api/plugin/[...pluginRequestPath].ts b/projects/app/src/pages/api/plugin/[...pluginRequestPath].ts deleted file mode 100644 index 5e83339862..0000000000 --- a/projects/app/src/pages/api/plugin/[...pluginRequestPath].ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { ApiRequestProps, ApiResponseType } from '@fastgpt/service/type/next'; -import { PLUGIN_BASE_URL, PLUGIN_TOKEN } from '@fastgpt/service/thirdProvider/fastgptPlugin'; - -export type PluginQuery = { - pluginRequestPath: string[]; -}; -export type PluginBody = {}; -export type PluginResponse = {}; - -async function handler(req: ApiRequestProps, res: ApiResponseType) { - const { pluginRequestPath } = req.query; - const urlObj = new URL(pluginRequestPath.join('/'), PLUGIN_BASE_URL); - Object.entries(req.query).forEach(([key, value]) => { - if (key !== 'pluginRequestPath') { - urlObj.searchParams.set(key, String(value)); - } - }); - const body = - req.method?.toUpperCase() === 'POST' || req.method === 'PUT' - ? JSON.stringify(req.body) - : undefined; - const pluginRes = await fetch(urlObj.toString(), { - method: req.method, - body, - headers: { - authtoken: PLUGIN_TOKEN, - 'Content-Type': 'application/json' - } - }); - res.status(pluginRes.status); - res.json(await pluginRes.json()); -} - -export default handler;