@@ -755,11 +755,11 @@ <h1 id="anyproxy">AnyProxy</h1>
755
755
< ul >
756
756
< li > 基于Node.js,开放二次开发能力,允许自定义请求处理逻辑</ li >
757
757
< li > 支持Https的解析</ li >
758
- < li > < p > 提供GUI界面,用以观察请求
759
- 相比3.x版本,AnyProxy 4.0的主要变化: </ p >
760
- </ li >
761
- < li > < p > 规则文件(Rule)全面支持Promise和Generator </ p >
762
- </ li >
758
+ < li > 提供GUI界面,用以观察请求</ li >
759
+ </ ul >
760
+ < p > 相比3.x版本,AnyProxy 4.0的主要变化: </ p >
761
+ < ul >
762
+ < li > 规则文件(Rule)全面支持Promise和Generator < /li >
763
763
< li > 简化了规则文件内的接口</ li >
764
764
< li > Web版界面重构</ li >
765
765
</ ul >
@@ -768,7 +768,7 @@ <h1 id="快速开始">快速开始</h1>
768
768
< h2 id ="作为全局模块 "> 作为全局模块</ h2 >
769
769
< h3 id ="安装 "> 安装</ h3 >
770
770
< p > 对于Debian或者Ubuntu系统,在安装AnyProxy之前,可能还需要安装 < code > nodejs-legacy</ code > </ p >
771
- < pre > < code class ="lang-bash "> sudo apg -get install nodejs-legacy
771
+ < pre > < code class ="lang-bash "> sudo apt -get install nodejs-legacy
772
772
</ code > </ pre >
773
773
< p > 然后,安装AnyProxy</ p >
774
774
< pre > < code class ="lang-bash "> npm install -g anyproxy
@@ -974,19 +974,11 @@ <h3 id="开发示例">开发示例</h3>
974
974
< li > < p > Step 1,编写规则</ p >
975
975
< pre > < code class ="lang-js "> < span class ="hljs-comment "> // file: sample.js</ span >
976
976
< span class ="hljs-built_in "> module</ span > .exports = {
977
- summary: < span class ="hljs-string "> 'a rule to modify response'</ span > ,
977
+ summary: < span class ="hljs-string "> 'a rule to hack response'</ span > ,
978
978
*beforeSendResponse(requestDetail, responseDetail) {
979
979
< span class ="hljs-keyword "> if</ span > (requestDetail.url === < span class ="hljs-string "> 'http://httpbin.org/user-agent'</ span > ) {
980
980
< span class ="hljs-keyword "> const</ span > newResponse = responseDetail.response;
981
- newResponse.body += < span class ="hljs-string "> '<br/><span style="color:blue">-- AnyProxy Hacked! --</span>'</ span > ;
982
-
983
- newResponse.body += < span class ="hljs-string "> `<script>
984
- setTimeout(
985
- function (){
986
- window.alert("Sorry, You Are Hacked...")
987
- }, 300);
988
- </script>`</ span > ;
989
- newResponse.header[< span class ="hljs-string "> 'Content-Type'</ span > ] = < span class ="hljs-string "> 'text/html'</ span > ;
981
+ newResponse.body += < span class ="hljs-string "> '- AnyProxy Hacked!'</ span > ;
990
982
991
983
< span class ="hljs-keyword "> return</ span > < span class ="hljs-keyword "> new</ span > < span class ="hljs-built_in "> Promise</ span > ((resolve, reject) => {
992
984
setTimeout(() => { < span class ="hljs-comment "> // delay</ span >
@@ -1632,7 +1624,7 @@ <h1 class="search-results-title">No results matching "<span class='search-query'
1632
1624
< script >
1633
1625
var gitbook = gitbook || [ ] ;
1634
1626
gitbook . push ( function ( ) {
1635
- gitbook . page . hasChanged ( { "page" :{ "title" :"简介" , "level" :"1.1" , "depth" :1 , "next" :{ "title" :"快速开始" , "level" :"1.2" , "depth" :1 , "anchor" :"#快速开始" , "path" :"README.md" , "ref" :"README.md#快速开始" , "articles" :[ { "title" :"安装" , "level" :"1.2.1" , "depth" :2 , "anchor" :"#安装" , "path" :"README.md" , "ref" :"README.md#安装" , "articles" :[ ] } , { "title" :"启动" , "level" :"1.2.2" , "depth" :2 , "anchor" :"#启动" , "path" :"README.md" , "ref" :"README.md#启动" , "articles" :[ ] } , { "title" :"其他命令" , "level" :"1.2.3" , "depth" :2 , "anchor" :"#其他命令" , "path" :"README.md" , "ref" :"README.md#其他命令" , "articles" :[ ] } , { "title" :"作为npm模块启动" , "level" :"1.2.4" , "depth" :2 , "anchor" :"#作为npm模块使用" , "path" :"README.md" , "ref" :"README.md#作为npm模块使用" , "articles" :[ ] } ] } , "dir" :"ltr" } , "config" :{ "plugins" :[ ] , "styles" :{ "website" :"styles/website.css" , "pdf" :"styles/pdf.css" , "epub" :"styles/epub.css" , "mobi" :"styles/mobi.css" , "ebook" :"styles/ebook.css" , "print" :"styles/print.css" } , "pluginsConfig" :{ "livereload" :{ } , "highlight" :{ } , "search" :{ } , "lunr" :{ "maxIndexSize" :1000000 , "ignoreSpecialCharacters" :false } , "sharing" :{ "facebook" :true , "twitter" :true , "google" :false , "weibo" :false , "instapaper" :false , "vk" :false , "all" :[ "facebook" , "google" , "twitter" , "weibo" , "instapaper" ] } , "fontsettings" :{ "theme" :"white" , "family" :"sans" , "size" :2 } , "theme-default" :{ "styles" :{ "website" :"styles/website.css" , "pdf" :"styles/pdf.css" , "epub" :"styles/epub.css" , "mobi" :"styles/mobi.css" , "ebook" :"styles/ebook.css" , "print" :"styles/print.css" } , "showLevel" :false } } , "theme" :"default" , "author" :"AnyProxy" , "pdf" :{ "pageNumbers" :true , "fontSize" :12 , "fontFamily" :"Arial" , "paperSize" :"a4" , "chapterMark" :"pagebreak" , "pageBreaksBefore" :"/" , "margin" :{ "right" :62 , "left" :62 , "top" :56 , "bottom" :56 } } , "structure" :{ "langs" :"LANGS.md" , "readme" :"README.md" , "glossary" :"GLOSSARY.md" , "summary" :"SUMMARY.md" } , "variables" :{ } , "title" :"AnyProxy" , "language" :"cn" , "gitbook" :"*" , "description" :"A fully configurable http/https proxy in NodeJS" } , "file" :{ "path" :"README.md" , "mtime" :"2017-12-01T13:25:56.899Z" , "type" :"markdown" } , "gitbook" :{ "version" :"3.2.2" , "time" :"2017-12-01T13:25:58.040Z" } , "basePath" :"." , "book" :{ "language" :"cn" } } ) ;
1627
+ gitbook . page . hasChanged ( { "page" :{ "title" :"简介" , "level" :"1.1" , "depth" :1 , "next" :{ "title" :"快速开始" , "level" :"1.2" , "depth" :1 , "anchor" :"#快速开始" , "path" :"README.md" , "ref" :"README.md#快速开始" , "articles" :[ { "title" :"安装" , "level" :"1.2.1" , "depth" :2 , "anchor" :"#安装" , "path" :"README.md" , "ref" :"README.md#安装" , "articles" :[ ] } , { "title" :"启动" , "level" :"1.2.2" , "depth" :2 , "anchor" :"#启动" , "path" :"README.md" , "ref" :"README.md#启动" , "articles" :[ ] } , { "title" :"其他命令" , "level" :"1.2.3" , "depth" :2 , "anchor" :"#其他命令" , "path" :"README.md" , "ref" :"README.md#其他命令" , "articles" :[ ] } , { "title" :"作为npm模块启动" , "level" :"1.2.4" , "depth" :2 , "anchor" :"#作为npm模块使用" , "path" :"README.md" , "ref" :"README.md#作为npm模块使用" , "articles" :[ ] } ] } , "dir" :"ltr" } , "config" :{ "plugins" :[ ] , "styles" :{ "website" :"styles/website.css" , "pdf" :"styles/pdf.css" , "epub" :"styles/epub.css" , "mobi" :"styles/mobi.css" , "ebook" :"styles/ebook.css" , "print" :"styles/print.css" } , "pluginsConfig" :{ "livereload" :{ } , "highlight" :{ } , "search" :{ } , "lunr" :{ "maxIndexSize" :1000000 , "ignoreSpecialCharacters" :false } , "sharing" :{ "facebook" :true , "twitter" :true , "google" :false , "weibo" :false , "instapaper" :false , "vk" :false , "all" :[ "facebook" , "google" , "twitter" , "weibo" , "instapaper" ] } , "fontsettings" :{ "theme" :"white" , "family" :"sans" , "size" :2 } , "theme-default" :{ "styles" :{ "website" :"styles/website.css" , "pdf" :"styles/pdf.css" , "epub" :"styles/epub.css" , "mobi" :"styles/mobi.css" , "ebook" :"styles/ebook.css" , "print" :"styles/print.css" } , "showLevel" :false } } , "theme" :"default" , "author" :"AnyProxy" , "pdf" :{ "pageNumbers" :true , "fontSize" :12 , "fontFamily" :"Arial" , "paperSize" :"a4" , "chapterMark" :"pagebreak" , "pageBreaksBefore" :"/" , "margin" :{ "right" :62 , "left" :62 , "top" :56 , "bottom" :56 } } , "structure" :{ "langs" :"LANGS.md" , "readme" :"README.md" , "glossary" :"GLOSSARY.md" , "summary" :"SUMMARY.md" } , "variables" :{ } , "title" :"AnyProxy" , "language" :"cn" , "gitbook" :"*" , "description" :"A fully configurable http/https proxy in NodeJS" } , "file" :{ "path" :"README.md" , "mtime" :"2017-12-01T13:58:00.991Z" , "type" :"markdown" } , "gitbook" :{ "version" :"3.2.2" , "time" :"2017-12-01T13:58:02.250Z" } , "basePath" :"." , "book" :{ "language" :"cn" } } ) ;
1636
1628
} ) ;
1637
1629
</ script >
1638
1630
</ div >
0 commit comments