mirror of
https://github.com/YMFE/yapi.git
synced 2024-11-27 04:40:08 +08:00
feat: 支持 /api/open 前缀的开放api
This commit is contained in:
parent
140e9f1eb7
commit
50f9a58e56
@ -56,7 +56,8 @@ class baseController {
|
||||
let params = Object.assign({}, ctx.query, ctx.request.body);
|
||||
let token = params.token;
|
||||
|
||||
if (token && openApiRouter.indexOf(ctx.path) > -1) {
|
||||
// 如果前缀是 /api/open,执行 parse token 逻辑
|
||||
if (token && (openApiRouter.indexOf(ctx.path) > -1 || ctx.path.indexOf('/api/open/') === 0 )) {
|
||||
let tokens = parseToken(token)
|
||||
|
||||
const oldTokenUid = '999999'
|
||||
|
@ -588,7 +588,9 @@ function addPluginRouter(config) {
|
||||
throw new Error('Plugin Route config Error');
|
||||
}
|
||||
let method = config.method || 'GET';
|
||||
let routerPath = '/plugin/' + config.path;
|
||||
// let routerPath = '/plugin/' + config.path;
|
||||
// 支持 /api/open/plugin 前缀的 openApi
|
||||
let routerPath = (config.prefix || '') + '/plugin/' + config.path;
|
||||
if (pluginsRouterPath.indexOf(routerPath) > -1) {
|
||||
throw new Error('Plugin Route path conflict, please try rename the path');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user