feat: auth login in getSchemaApi (#5713)

* feat: auth api

* doc
This commit is contained in:
Archer
2025-09-26 13:32:15 +08:00
committed by GitHub
parent 3b3180480f
commit c66c2ad8f9
3 changed files with 7 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ import { loadOpenAPISchemaFromUrl } from '@fastgpt/global/common/string/swagger'
import { NextAPI } from '@/service/middleware/entry';
import { CommonErrEnum } from '@fastgpt/global/common/error/code/common';
import { isInternalAddress } from '@fastgpt/service/common/system/utils';
import { authCert } from '@fastgpt/service/support/permission/auth/common';
async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
const apiURL = req.body.url as string;
@@ -11,6 +12,8 @@ async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
return Promise.reject(CommonErrEnum.missingParams);
}
await authCert({ req, authToken: true });
const isInternal = isInternalAddress(apiURL);
if (isInternal) {