Merge branch 'dev' of gitlab.corp.qunar.com:mfe/yapi into dev-1.3.0

This commit is contained in:
gaoxiaolin.gao 2018-05-10 18:05:08 +08:00
commit e12d45d146
10 changed files with 63 additions and 12 deletions

View File

@ -2,6 +2,7 @@
* 增强跨域请求安全性,只允许 YApi 网站进行跨域请求
* 优化文档
* 修复 schema 描述信息展示 bug
* 增加禁止普通用户注册功能
### v1.3.14

View File

@ -4,4 +4,5 @@
* [服务器管理](index.md#服务器管理)
* [升级](index.md#升级)
* [配置邮箱](index.md#配置邮箱)
* [配置LDAP登录](index.md#配置LDAP登录)
* [配置LDAP登录](index.md#配置LDAP登录)
* [禁止注册](index.md#禁止注册)

View File

@ -133,3 +133,15 @@ node server/app.js //启动服务器后,请访问 127.0.0.1:{config.json配置
重启服务器后,可以在登录页看到如下画面,说明 ladp 配置成功
<img src="./ldap.png" />
## 禁止注册
在 config.json 添加 `closeRegister:true` 配置项,就可以禁止用户注册 yapi 平台,修改完成后,请重启 yapi 服务器。
```json
{
"port": "*****",
"closeRegister":true
}
```

View File

@ -284,6 +284,9 @@ class userController extends baseController {
* @example ./api/user/login.json
*/
async reg(ctx) { //注册
if(yapi.WEBCONFIG.closeRegister){
return ctx.body = yapi.commons.resReturn(null, 400, '禁止注册');
}
let userInst = yapi.getInst(userModel);
let params = ctx.request.body; //获取请求的参数,检查是否存在用户名和密码

View File

@ -1,4 +1,4 @@
<html lang="zh-CN"><head><meta charSet="UTF-8"/><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/><meta name="apple-mobile-web-app-capable" content="yes"/><meta name="apple-mobile-web-app-status-bar-style" content="black"/><link rel="apple-touch-icon" sizes="180x180" href="../ydoc/images/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="../ydoc/images/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="../ydoc/images/favicon-16x16.png"/><link rel="manifest" href="../ydoc/images/manifest.json"/><link rel="mask-icon" href="../ydoc/images/safari-pinned-tab.svg&quot;" color="#5bbad5"/><meta name="theme-color" content="#ffffff"/><meta http-equiv="Cache-Control" content="no-transform"/><meta http-equiv="Cache-Control" content="no-siteapp"/><title>内网部署</title><link rel="stylesheet" href="../ydoc/styles/style.css"/><meta name="author" content="ymfe"/><meta name="keywords" content="api管理,接口管理,接口文档,api文档"/><meta name="description" content="YApi 是高效、易用、功能强大的 api 管理平台,旨在为开发、产品、测试人员提供更优雅的接口管理服务。可以帮助开发者轻松创建、发布、维护 APIYApi 还为用户提供了优秀的交互体验,开发人员只需利用平台提供的接口数据写入工具以及简单的点击操作就可以实现接口的管理"/><meta id="releativePath" content=".."/><link rel="stylesheet" href="../ydoc/ydoc-plugin-search/search.css"/><link rel="stylesheet" href="../ydoc/ydoc-plugin-search/search.css"/><link rel="stylesheet" href="../ydoc/ydoc-plugin-img-view/imgView.css"/><link rel="stylesheet" href="../web.css"/></head><body><div class="g-doc"><div class="m-aside"><div class="m-summary" id="js-menu"><div class="m-summary-content" id="js-menu-content"><div class="m-summary-block"><ul class="m-summary-list"><li class="item"><a href="index.html#%e5%ae%89%e8%a3%85" class="href">安装</a></li><li class="item"><a href="index.html#%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%ae%a1%e7%90%86" class="href">服务器管理</a></li><li class="item"><a href="index.html#%e5%8d%87%e7%ba%a7" class="href">升级</a></li><li class="item"><a href="index.html#%e9%85%8d%e7%bd%ae%e9%82%ae%e7%ae%b1" class="href">配置邮箱</a></li><li class="item"><a href="index.html#%e9%85%8d%e7%bd%aeldap%e7%99%bb%e5%bd%95" class="href">配置LDAP登录</a></li></ul></div></div></div><div class="m-summary-switch" id="js-summary-switch"><svg viewBox="0 0 926.23699 573.74994" version="1.1" x="0px" y="0px" width="15" height="15" class="bottom"><g transform="translate(904.92214,-879.1482)"><path d="m -673.67664,1221.6502 -231.2455,-231.24803 55.6165,-55.627 c 30.5891,-30.59485 56.1806,-55.627 56.8701,-55.627 0.6894,0 79.8637,78.60862 175.9427,174.68583 l 174.6892,174.6858 174.6892,-174.6858 c 96.079,-96.07721 175.253196,-174.68583 175.942696,-174.68583 0.6895,0 26.281,25.03215 56.8701,55.627 l 55.6165,55.627 -231.245496,231.24803 c -127.185,127.1864-231.5279,231.248 -231.873,231.248 -0.3451,0 -104.688,-104.0616 -231.873,-231.248 z" fill="#fff"></path></g></svg><svg viewBox="0 0 926.23699 573.74994" version="1.1" x="0px" y="0px" width="15" height="15" class="top"><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="aaa" fill="#fff" fill-rule="nonzero"><path d="M231.2455,342.502 L0,111.25397 L55.6165,55.62697 C86.2056,25.03212 111.7971,-2.99999998e-05 112.4866,-2.99999998e-05 C113.176,-2.99999998e-05 192.3503,78.60859 288.4293,174.6858 L463.1185,349.3716 L637.8077,174.6858 C733.8867,78.60859 813.060896,-2.99999997e-05 813.750396,-2.99999997e-05 C814.439896,-2.99999997e-05 840.031396,25.03212 870.620496,55.62697 L926.236996,111.25397 L694.9915,342.502 C567.8065,469.6884 463.4636,573.75 463.1185,573.75 C462.7734,573.75 358.4305,469.6884 231.2455,342.502 Z" id="Shape" transform="translate(463.118498, 286.874985) scale(1, -1) translate(-463.118498, -286.874985) "></path></g></g></svg></div></div><div class="m-main" id="js-panel"><header class="m-header" id="js-header"><div class="m-header-title js-logo"><a href="../index.html" target="_self"><img class="logo" width="36" src="../documents/images/logo_header@2x.png"/><h6 class="name">YApi</h6></a></div><div><div class="m-search">
<html lang="zh-CN"><head><meta charSet="UTF-8"/><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/><meta name="apple-mobile-web-app-capable" content="yes"/><meta name="apple-mobile-web-app-status-bar-style" content="black"/><link rel="apple-touch-icon" sizes="180x180" href="../ydoc/images/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="../ydoc/images/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="../ydoc/images/favicon-16x16.png"/><link rel="manifest" href="../ydoc/images/manifest.json"/><link rel="mask-icon" href="../ydoc/images/safari-pinned-tab.svg&quot;" color="#5bbad5"/><meta name="theme-color" content="#ffffff"/><meta http-equiv="Cache-Control" content="no-transform"/><meta http-equiv="Cache-Control" content="no-siteapp"/><title>内网部署</title><link rel="stylesheet" href="../ydoc/styles/style.css"/><meta name="author" content="ymfe"/><meta name="keywords" content="api管理,接口管理,接口文档,api文档"/><meta name="description" content="YApi 是高效、易用、功能强大的 api 管理平台,旨在为开发、产品、测试人员提供更优雅的接口管理服务。可以帮助开发者轻松创建、发布、维护 APIYApi 还为用户提供了优秀的交互体验,开发人员只需利用平台提供的接口数据写入工具以及简单的点击操作就可以实现接口的管理"/><meta id="releativePath" content=".."/><link rel="stylesheet" href="../ydoc/ydoc-plugin-search/search.css"/><link rel="stylesheet" href="../ydoc/ydoc-plugin-search/search.css"/><link rel="stylesheet" href="../ydoc/ydoc-plugin-img-view/imgView.css"/><link rel="stylesheet" href="../web.css"/></head><body><div class="g-doc"><div class="m-aside"><div class="m-summary" id="js-menu"><div class="m-summary-content" id="js-menu-content"><div class="m-summary-block"><ul class="m-summary-list"><li class="item"><a href="index.html#%e5%ae%89%e8%a3%85" class="href">安装</a></li><li class="item"><a href="index.html#%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%ae%a1%e7%90%86" class="href">服务器管理</a></li><li class="item"><a href="index.html#%e5%8d%87%e7%ba%a7" class="href">升级</a></li><li class="item"><a href="index.html#%e9%85%8d%e7%bd%ae%e9%82%ae%e7%ae%b1" class="href">配置邮箱</a></li><li class="item"><a href="index.html#%e9%85%8d%e7%bd%aeldap%e7%99%bb%e5%bd%95" class="href">配置LDAP登录</a></li><li class="item"><a href="index.html#%e7%a6%81%e6%ad%a2%e6%b3%a8%e5%86%8c" class="href">禁止注册</a></li></ul></div></div></div><div class="m-summary-switch" id="js-summary-switch"><svg viewBox="0 0 926.23699 573.74994" version="1.1" x="0px" y="0px" width="15" height="15" class="bottom"><g transform="translate(904.92214,-879.1482)"><path d="m -673.67664,1221.6502 -231.2455,-231.24803 55.6165,-55.627 c 30.5891,-30.59485 56.1806,-55.627 56.8701,-55.627 0.6894,0 79.8637,78.60862 175.9427,174.68583 l 174.6892,174.6858 174.6892,-174.6858 c 96.079,-96.07721 175.253196,-174.68583 175.942696,-174.68583 0.6895,0 26.281,25.03215 56.8701,55.627 l 55.6165,55.627 -231.245496,231.24803 c -127.185,127.1864-231.5279,231.248 -231.873,231.248 -0.3451,0 -104.688,-104.0616 -231.873,-231.248 z" fill="#fff"></path></g></svg><svg viewBox="0 0 926.23699 573.74994" version="1.1" x="0px" y="0px" width="15" height="15" class="top"><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="aaa" fill="#fff" fill-rule="nonzero"><path d="M231.2455,342.502 L0,111.25397 L55.6165,55.62697 C86.2056,25.03212 111.7971,-2.99999998e-05 112.4866,-2.99999998e-05 C113.176,-2.99999998e-05 192.3503,78.60859 288.4293,174.6858 L463.1185,349.3716 L637.8077,174.6858 C733.8867,78.60859 813.060896,-2.99999997e-05 813.750396,-2.99999997e-05 C814.439896,-2.99999997e-05 840.031396,25.03212 870.620496,55.62697 L926.236996,111.25397 L694.9915,342.502 C567.8065,469.6884 463.4636,573.75 463.1185,573.75 C462.7734,573.75 358.4305,469.6884 231.2455,342.502 Z" id="Shape" transform="translate(463.118498, 286.874985) scale(1, -1) translate(-463.118498, -286.874985) "></path></g></g></svg></div></div><div class="m-main" id="js-panel"><header class="m-header" id="js-header"><div class="m-header-title js-logo"><a href="../index.html" target="_self"><img class="logo" width="36" src="../documents/images/logo_header@2x.png"/><h6 class="name">YApi</h6></a></div><div><div class="m-search">
<div class="icon">&#xf0fd;</div>
<input type="text" class="input js-input" placeholder="搜索" />
<div class="m-search-result js-search-result"></div>
@ -123,6 +123,14 @@ yapi update -v v1.1.0 //升级到指定版本
</ul>
<p>重启服务器后,可以在登录页看到如下画面,说明 ladp 配置成功</p>
<img src="./ldap.png">
<h2 id="禁止注册">禁止注册</h2>
<p>在 config.json 添加 <code>closeRegister:true</code> 配置项,就可以禁止用户注册 yapi 平台,修改完成后,请重启 yapi 服务器。</p>
<pre><code class="language-json"><span class="token punctuation">{</span>
<span class="token property">"port"</span><span class="token operator">:</span> <span class="token string">"*****"</span><span class="token punctuation">,</span>
<span class="token property">"closeRegister"</span><span class="token operator">:</span><span class="token boolean">true</span>
<span class="token punctuation">}</span>
</code></pre>
</div></div></div></div><div><div class="m-mask js-mask">
<div class="container">
<img src="" alt="" class="img js-mask-img" />

View File

@ -7,7 +7,13 @@
<div class="icon">&#xf0fd;</div>
<input type="text" class="input js-input" placeholder="搜索" />
<div class="m-search-result js-search-result"></div>
</div></div><nav class="m-header-nav js-nav"><ul class="m-header-items"><li class="item active"><a class="href" href="index.html">教程</a></li><li class="item "><a class="href" href="../devops/index.html">内网部署</a></li></ul></nav><div id="js-nav-btn" class="m-header-btn ui-font-ydoc"></div></header><div class="m-content" id="js-content"><div id="markdown-body" class="m-content-container markdown-body"><h3 id="v1.3.14">v1.3.14</h3>
</div></div><nav class="m-header-nav js-nav"><ul class="m-header-items"><li class="item active"><a class="href" href="index.html">教程</a></li><li class="item "><a class="href" href="../devops/index.html">内网部署</a></li></ul></nav><div id="js-nav-btn" class="m-header-btn ui-font-ydoc"></div></header><div class="m-content" id="js-content"><div id="markdown-body" class="m-content-container markdown-body"><h3 id="v1.3.15">v1.3.15</h3>
<ul>
<li>增强跨域请求安全性,只允许 YApi 网站进行跨域请求</li>
<li>优化文档</li>
<li>修复 schema 描述信息展示 bug</li>
</ul>
<h3 id="v1.3.14">v1.3.14</h3>
<ul>
<li>修复接口编辑白屏问题</li>
</ul>

View File

@ -77,17 +77,17 @@ Mock.Random 方法,详细使用方法请查看 <a href="https://github.com/nuy
<h3 id="自定义-mock-脚本-示例1,-根据请求参数重写-mockjson">示例1, 根据请求参数重写 mockJson</h3>
<pre><code>if(params.type == 1){
mockJson.errcode = 400;
mockJson.errmsg = &#x27;error;
mockJson.errmsg = &#x27;error&#x27;;
}
if(header.token == &#x27;t&#x27;){
mockJson.errcode = 300;
mockJson.errmsg = &#x27;error;
mockJson.errmsg = &#x27;error&#x27;;
}
if(cookie.type == &#x27;a&#x27;){
mockJson.errcode = 500;
mockJson.errmsg = &#x27;error;
mockJson.errmsg = &#x27;error&#x27;;
}
</code></pre>

View File

@ -79,7 +79,7 @@
}
}
</code></pre>
<p>假设我们需要在 url 增加一个 token 参数,可以写如下自定义脚本:</p>
<p>假设我们需要在一组接口的 url 增加一个公共的 token 参数,可以写如下自定义脚本:</p>
<pre><code>context.query.token = context.utils.md5(context.pathname + &#x27;salt&#x27;);
</code></pre>

View File

@ -7,7 +7,7 @@
<div class="icon">&#xf0fd;</div>
<input type="text" class="input js-input" placeholder="搜索" />
<div class="m-search-result js-search-result"></div>
</div></div><nav class="m-header-nav js-nav"><ul class="m-header-items"><li class="item "><a class="href" href="documents/index.html">教程</a></li><li class="item "><a class="href" href="devops/index.html">内网部署</a></li></ul></nav><div id="js-nav-btn" class="m-header-btn ui-font-ydoc"></div></header><div class="m-content" id="js-content"><div><div class="g-home"><section class="m-section home"><div class="m-section-container"><div class="m-section-title"><h4 class="name">YApi</h4><p class="desc">旨在为开发、产品、测试人员提供更优雅的接口管理服务。可以帮助开发者轻松创建、发布、维护 API</p><div class="m-section-btngroup"><a href="./documents/index.html"><div class="btn ">开始</div></a><a href="https://github.com/ymfe/yapi"><div class="btn btn-ghost">Github &gt;</div></a></div><p class="caption">当前版本: v1.3.14</p></div><div class="m-section-banner"><img src="./ydoc/images/dogbg@1x.png" alt="bg" srcSet="./ydoc/images/dogbg@2x.png 2x"/></div></div></section><section class="m-section feature"><div class="m-section-container"><div class="m-section-box"><div class="item"><h6 class="title">权限管理</h6><p class="desc">YApi 成熟的团队管理扁平化项目权限配置满足各类企业的需求</p></div><div class="item"><h6 class="title">可视化接口管理</h6><p class="desc">基于 websocket 的多人协作接口编辑功能和类 postman 测试工具,让多人协作成倍提升开发效率</p></div><div class="item"><h6 class="title">Mock Server</h6><p class="desc">易用的 Mock Server再也不用担心 mock 数据的生成了</p></div><div class="item"><h6 class="title">自动化测试</h6><p class="desc">完善的接口自动化测试,保证数据的正确性</p></div><div class="item"><h6 class="title">数据导入</h6><p class="desc">支持导入 swagger, postman, har 数据格式,方便迁移旧项目</p></div><div class="item"><h6 class="title">插件机制</h6><p class="desc">强大的插件机制,满足各类业务需求</p></div></div></div></section></div><footer class="m-footer"><div class="m-footer-container"><div class="m-footer-links"><div class="group"><p class="title">团队网址</p><ul><li><a class="href" href="https://ymfe.org/">YMFE</a></li><li><a class="href" href="https://blog.ymfe.org/">YMFE Blog</a></li></ul></div><div class="group"><p class="title">Git仓库</p><ul><li><a class="href" href="https://github.com/YMFE/yapi">Github</a></li><li><a class="href" href="https://github.com/YMFE/yapi/issues">Github Issue</a></li></ul></div></div><div class="m-footer-title"><p class="copyright">© 2018 <a class="href" href="https://ymfe.org/">YMFE Team</a></p><p>Build by <a class="href" href="https://ydoc.ymfe.org/">ydoc</a></p></div></div></footer></div></div></div></div><div><div class="m-mask js-mask">
</div></div><nav class="m-header-nav js-nav"><ul class="m-header-items"><li class="item "><a class="href" href="documents/index.html">教程</a></li><li class="item "><a class="href" href="devops/index.html">内网部署</a></li></ul></nav><div id="js-nav-btn" class="m-header-btn ui-font-ydoc"></div></header><div class="m-content" id="js-content"><div><div class="g-home"><section class="m-section home"><div class="m-section-container"><div class="m-section-title"><h4 class="name">YApi</h4><p class="desc">旨在为开发、产品、测试人员提供更优雅的接口管理服务。可以帮助开发者轻松创建、发布、维护 API</p><div class="m-section-btngroup"><a href="./documents/index.html"><div class="btn ">开始</div></a><a href="https://github.com/ymfe/yapi"><div class="btn btn-ghost">Github &gt;</div></a></div><p class="caption">当前版本: v1.3.15</p></div><div class="m-section-banner"><img src="./ydoc/images/dogbg@1x.png" alt="bg" srcSet="./ydoc/images/dogbg@2x.png 2x"/></div></div></section><section class="m-section feature"><div class="m-section-container"><div class="m-section-box"><div class="item"><h6 class="title">权限管理</h6><p class="desc">YApi 成熟的团队管理扁平化项目权限配置满足各类企业的需求</p></div><div class="item"><h6 class="title">可视化接口管理</h6><p class="desc">基于 websocket 的多人协作接口编辑功能和类 postman 测试工具,让多人协作成倍提升开发效率</p></div><div class="item"><h6 class="title">Mock Server</h6><p class="desc">易用的 Mock Server再也不用担心 mock 数据的生成了</p></div><div class="item"><h6 class="title">自动化测试</h6><p class="desc">完善的接口自动化测试,保证数据的正确性</p></div><div class="item"><h6 class="title">数据导入</h6><p class="desc">支持导入 swagger, postman, har 数据格式,方便迁移旧项目</p></div><div class="item"><h6 class="title">插件机制</h6><p class="desc">强大的插件机制,满足各类业务需求</p></div></div></div></section></div><footer class="m-footer"><div class="m-footer-container"><div class="m-footer-links"><div class="group"><p class="title">团队网址</p><ul><li><a class="href" href="https://ymfe.org/">YMFE</a></li><li><a class="href" href="https://blog.ymfe.org/">YMFE Blog</a></li></ul></div><div class="group"><p class="title">Git仓库</p><ul><li><a class="href" href="https://github.com/YMFE/yapi">Github</a></li><li><a class="href" href="https://github.com/YMFE/yapi/issues">Github Issue</a></li></ul></div></div><div class="m-footer-title"><p class="copyright">© 2018 <a class="href" href="https://ymfe.org/">YMFE Team</a></p><p>Build by <a class="href" href="https://ydoc.ymfe.org/">ydoc</a></p></div></div></footer></div></div></div></div><div><div class="m-mask js-mask">
<div class="container">
<img src="" alt="" class="img js-mask-img" />
</div>

View File

@ -220,7 +220,7 @@ window.ydoc_plugin_search_json = {
{
"title": "请求参数示例",
"url": "/documents/project.html#请求配置-请求参数示例",
"content": "请求参数示例以 jquery ajax 为例,假设当前的请求参数是{ url: '/api/user?id=1',\n method: 'POST',\n headers: {\n xxx: 'xxx'\n },\n data: {\n type: 1\n }\n}\n那么公共变量 context 包含以下属性context = { pathname: '/api/user',\n query: {\n id: 1\n },\n requestHeader: {\n xxx: 'xxx'\n },\n method: 'POST',\n requestBody: {\n type:1\n }\n}\n假设我们需要在 url 增加一个 token 参数可以写如下自定义脚本context.query.token = context.utils.md5(context.pathname + 'salt');\n"
"content": "请求参数示例以 jquery ajax 为例,假设当前的请求参数是{ url: '/api/user?id=1',\n method: 'POST',\n headers: {\n xxx: 'xxx'\n },\n data: {\n type: 1\n }\n}\n那么公共变量 context 包含以下属性context = { pathname: '/api/user',\n query: {\n id: 1\n },\n requestHeader: {\n xxx: 'xxx'\n },\n method: 'POST',\n requestBody: {\n type:1\n }\n}\n假设我们需要在一组接口的 url 增加一个公共的 token 参数可以写如下自定义脚本context.query.token = context.utils.md5(context.pathname + 'salt');\n"
},
{
"title": "返回数据示例",
@ -297,7 +297,7 @@ window.ydoc_plugin_search_json = {
{
"title": "请求参数示例",
"url": "/documents/project.html#请求配置-请求参数示例",
"content": "请求参数示例以 jquery ajax 为例,假设当前的请求参数是{ url: '/api/user?id=1',\n method: 'POST',\n headers: {\n xxx: 'xxx'\n },\n data: {\n type: 1\n }\n}\n那么公共变量 context 包含以下属性context = { pathname: '/api/user',\n query: {\n id: 1\n },\n requestHeader: {\n xxx: 'xxx'\n },\n method: 'POST',\n requestBody: {\n type:1\n }\n}\n假设我们需要在 url 增加一个 token 参数可以写如下自定义脚本context.query.token = context.utils.md5(context.pathname + 'salt');\n"
"content": "请求参数示例以 jquery ajax 为例,假设当前的请求参数是{ url: '/api/user?id=1',\n method: 'POST',\n headers: {\n xxx: 'xxx'\n },\n data: {\n type: 1\n }\n}\n那么公共变量 context 包含以下属性context = { pathname: '/api/user',\n query: {\n id: 1\n },\n requestHeader: {\n xxx: 'xxx'\n },\n method: 'POST',\n requestBody: {\n type:1\n }\n}\n假设我们需要在一组接口的 url 增加一个公共的 token 参数可以写如下自定义脚本context.query.token = context.utils.md5(context.pathname + 'salt');\n"
},
{
"title": "返回数据示例",
@ -532,7 +532,7 @@ window.ydoc_plugin_search_json = {
{
"title": "示例1, 根据请求参数重写 mockJson",
"url": "/documents/adv_mock.html#自定义-mock-脚本-示例1,-根据请求参数重写-mockjson",
"content": "示例1, 根据请求参数重写 mockJsonif(params.type == 1){ mockJson.errcode = 400;\n mockJson.errmsg = 'error;\n}\n\nif(header.token == 't'){\n mockJson.errcode = 300;\n mockJson.errmsg = 'error;\n}\n\nif(cookie.type == 'a'){\n mockJson.errcode = 500;\n mockJson.errmsg = 'error;\n}\n\n"
"content": "示例1, 根据请求参数重写 mockJsonif(params.type == 1){ mockJson.errcode = 400;\n mockJson.errmsg = 'error';\n}\n\nif(header.token == 't'){\n mockJson.errcode = 300;\n mockJson.errmsg = 'error';\n}\n\nif(cookie.type == 'a'){\n mockJson.errcode = 500;\n mockJson.errmsg = 'error';\n}\n\n"
},
{
"title": "示例2, 生成高度自定义数据内容",
@ -584,7 +584,7 @@ window.ydoc_plugin_search_json = {
{
"title": "示例1, 根据请求参数重写 mockJson",
"url": "/documents/adv_mock.html#自定义-mock-脚本-示例1,-根据请求参数重写-mockjson",
"content": "示例1, 根据请求参数重写 mockJsonif(params.type == 1){ mockJson.errcode = 400;\n mockJson.errmsg = 'error;\n}\n\nif(header.token == 't'){\n mockJson.errcode = 300;\n mockJson.errmsg = 'error;\n}\n\nif(cookie.type == 'a'){\n mockJson.errcode = 500;\n mockJson.errmsg = 'error;\n}\n\n"
"content": "示例1, 根据请求参数重写 mockJsonif(params.type == 1){ mockJson.errcode = 400;\n mockJson.errmsg = 'error';\n}\n\nif(header.token == 't'){\n mockJson.errcode = 300;\n mockJson.errmsg = 'error';\n}\n\nif(cookie.type == 'a'){\n mockJson.errcode = 500;\n mockJson.errmsg = 'error';\n}\n\n"
},
{
"title": "示例2, 生成高度自定义数据内容",
@ -1159,6 +1159,11 @@ window.ydoc_plugin_search_json = {
"content": "",
"url": "/documents/CHANGELOG.html",
"children": [
{
"title": "v1.3.15",
"url": "/documents/CHANGELOG.html#v1.3.15",
"content": "v1.3.15增强跨域请求安全性,只允许 YApi 网站进行跨域请求\n优化文档\n修复 schema 描述信息展示 bug\n"
},
{
"title": "v1.3.14",
"url": "/documents/CHANGELOG.html#v1.3.14",
@ -1296,6 +1301,11 @@ window.ydoc_plugin_search_json = {
"content": "",
"url": "/documents/CHANGELOG.html",
"children": [
{
"title": "v1.3.15",
"url": "/documents/CHANGELOG.html#v1.3.15",
"content": "v1.3.15增强跨域请求安全性,只允许 YApi 网站进行跨域请求\n优化文档\n修复 schema 描述信息展示 bug\n"
},
{
"title": "v1.3.14",
"url": "/documents/CHANGELOG.html#v1.3.14",
@ -1474,6 +1484,11 @@ window.ydoc_plugin_search_json = {
"title": "配置LDAP登录",
"url": "/devops/index.html#配置ldap登录",
"content": "配置LDAP登录打开项目目录 config.json 文件,添加如下字段:{ \"port\": \"*****\",\n \"adminAccount\": \"********\",\n \"db\": {...},\n \"mail\": {...},\n \"ldapLogin\": {\n \"enable\": true,\n \"server\": \"ldap://l-ldapt1.ops.dev.cn0.qunar.com\",\n \"baseDn\": \"CN=Admin,CN=Users,DC=test,DC=com\",\n \"bindPassword\": \"password123\",\n \"searchDn\": \"OU=UserContainer,DC=test,DC=com\",\n \"searchStandard\": \"mail\"\n }\n}\n\n这里面的配置项含义如下enable 表示是否配置 LDAP 登录true(支持 LDAP登录 )/false(不支持LDAP登录);\nserver LDAP 服务器地址,前面需要加上 ldap:// 前缀,也可以是 ldaps:// 表示是通过 SSL 连接;\nbaseDn LDAP 服务器的登录用户名,必须是从根结点到用户节点的全路径;\nbindPassword 登录该 LDAP 服务器的密码;\nsearchDn 查询用户数据的路径,类似数据库中的一张表的地址,注意这里也必须是全路径;\nsearchStandard 查询条件,这里是 mail 表示查询用户信息是通过邮箱信息来查询的。注意该字段信息与LDAP数据库存储数据的字段相对应如果如果存储用户邮箱信息的字段是 email, 这里就需要修改成 email.\n重启服务器后可以在登录页看到如下画面说明 ladp 配置成功"
},
{
"title": "禁止注册",
"url": "/devops/index.html#禁止注册",
"content": "禁止注册在 config.json 添加 closeRegister:true 配置项,就可以禁止用户注册 yapi 平台,修改完成后,请重启 yapi 服务器。{ \"port\": \"*****\",\n \"closeRegister\":true\n}\n\n"
}
]
},
@ -1521,6 +1536,11 @@ window.ydoc_plugin_search_json = {
"title": "配置LDAP登录",
"url": "/devops/index.html#配置ldap登录",
"content": "配置LDAP登录打开项目目录 config.json 文件,添加如下字段:{ \"port\": \"*****\",\n \"adminAccount\": \"********\",\n \"db\": {...},\n \"mail\": {...},\n \"ldapLogin\": {\n \"enable\": true,\n \"server\": \"ldap://l-ldapt1.ops.dev.cn0.qunar.com\",\n \"baseDn\": \"CN=Admin,CN=Users,DC=test,DC=com\",\n \"bindPassword\": \"password123\",\n \"searchDn\": \"OU=UserContainer,DC=test,DC=com\",\n \"searchStandard\": \"mail\"\n }\n}\n\n这里面的配置项含义如下enable 表示是否配置 LDAP 登录true(支持 LDAP登录 )/false(不支持LDAP登录);\nserver LDAP 服务器地址,前面需要加上 ldap:// 前缀,也可以是 ldaps:// 表示是通过 SSL 连接;\nbaseDn LDAP 服务器的登录用户名,必须是从根结点到用户节点的全路径;\nbindPassword 登录该 LDAP 服务器的密码;\nsearchDn 查询用户数据的路径,类似数据库中的一张表的地址,注意这里也必须是全路径;\nsearchStandard 查询条件,这里是 mail 表示查询用户信息是通过邮箱信息来查询的。注意该字段信息与LDAP数据库存储数据的字段相对应如果如果存储用户邮箱信息的字段是 email, 这里就需要修改成 email.\n重启服务器后可以在登录页看到如下画面说明 ladp 配置成功"
},
{
"title": "禁止注册",
"url": "/devops/index.html#禁止注册",
"content": "禁止注册在 config.json 添加 closeRegister:true 配置项,就可以禁止用户注册 yapi 平台,修改完成后,请重启 yapi 服务器。{ \"port\": \"*****\",\n \"closeRegister\":true\n}\n\n"
}
]
}