mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-04-24 07:01:25 +00:00
update flat-style ui
This commit is contained in:
commit
3a481b09b4
@ -8,6 +8,7 @@ var exec = require('child_process').exec,
|
||||
util = require('./util'),
|
||||
asyncTask = require("async-task-mgr");
|
||||
|
||||
//TODO : unstable in windows
|
||||
var certDir = path.join(util.getUserHome(),"/.anyproxy_certs/"),
|
||||
cmdDir = path.join(__dirname,"..","./cert/"),
|
||||
cmd_genRoot = path.join(cmdDir,"./gen-rootCA"),
|
||||
|
@ -115,7 +115,7 @@ function normalizeInfo(id,info){
|
||||
singleRecord.reqHeader = info.req.headers;
|
||||
singleRecord.startTime = info.startTime;
|
||||
singleRecord.reqBody = info.reqBody || "";
|
||||
singleRecord.protocol = info.protocol;
|
||||
singleRecord.protocol = info.protocol || "";
|
||||
|
||||
//res
|
||||
if(info.endTime){
|
||||
|
@ -4,7 +4,7 @@ module.exports = {
|
||||
summary:function(){
|
||||
var tip = "the default rule for anyproxy, support : CORS. ";
|
||||
if(isRootCAFileExists){
|
||||
tip += "\nRoot CA exists, will intercept all https requests for you";
|
||||
tip += "\nRoot CA exists, will intercept all https requests.";
|
||||
}
|
||||
return tip;
|
||||
},
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "anyproxy",
|
||||
"version": "2.9.0",
|
||||
"version": "2.9.1",
|
||||
"description": "A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.",
|
||||
"main": "proxy.js",
|
||||
"bin": {
|
||||
|
15
proxy.js
15
proxy.js
@ -51,9 +51,10 @@ var T_TYPE_HTTP = 0,
|
||||
DEFAULT_TYPE = T_TYPE_HTTP;
|
||||
|
||||
var default_rule = require('./lib/rule_default');
|
||||
|
||||
//may be unreliable in windows
|
||||
var anyproxyHome = path.join(util.getUserHome(),"/.anyproxy/");
|
||||
try{
|
||||
var anyproxyHome = path.join(util.getUserHome(),"/.anyproxy/");
|
||||
if(!fs.existsSync(anyproxyHome)){
|
||||
fs.mkdirSync(anyproxyHome);
|
||||
}
|
||||
@ -63,9 +64,7 @@ try{
|
||||
if(fs.existsSync(path.join(process.cwd(),'rule.js'))){
|
||||
default_rule = require(path.join(process.cwd(),'rule'));
|
||||
}
|
||||
}catch(e){
|
||||
|
||||
}
|
||||
}catch(e){}
|
||||
|
||||
//option
|
||||
//option.type : 'http'(default) or 'https'
|
||||
@ -184,11 +183,11 @@ function proxyServer(option){
|
||||
|
||||
var tipText,webUrl;
|
||||
webUrl = "http://" + ip.address() + ":" + proxyWebPort +"/";
|
||||
tipText = "web interface started at : " + webUrl;
|
||||
tipText = "GUI interface started at : " + webUrl;
|
||||
console.log(color.green(tipText));
|
||||
|
||||
tipText = "[alpha]qr code to for iOS client: " + webUrl + "qr";
|
||||
console.log(color.green(tipText));
|
||||
// tipText = "[alpha]qr code to for iOS client: " + webUrl + "qr";
|
||||
// console.log(color.green(tipText));
|
||||
callback(null);
|
||||
}
|
||||
}
|
||||
@ -197,7 +196,7 @@ function proxyServer(option){
|
||||
//final callback
|
||||
function(err,result){
|
||||
if(!err){
|
||||
var tipText = (proxyType == T_TYPE_HTTP ? "Http" : "Https") + " proxy started at port " + proxyPort;
|
||||
var tipText = (proxyType == T_TYPE_HTTP ? "Http" : "Https") + " proxy started at " + color.bold(ip.address() + ":" + proxyPort);
|
||||
console.log(color.green(tipText));
|
||||
}else{
|
||||
var tipText = "err when start proxy server :(";
|
||||
|
@ -29,10 +29,48 @@
|
||||
width: 220px;
|
||||
height: 55px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.topHead h1{
|
||||
color: #CCCCCC;
|
||||
.topHead .logoWrapper h1{
|
||||
color: #333;
|
||||
line-height: 55px;
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.topHead .logoWrapper .logo_bottom {
|
||||
position: absolute;
|
||||
left: -25px;
|
||||
bottom: 0px;
|
||||
}
|
||||
|
||||
.anim_rotation{
|
||||
-webkit-animation: rotation 1.2s infinite cubic-bezier(.63,.33,.46,.71);
|
||||
}
|
||||
|
||||
@-webkit-keyframes rotation {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
opacity: 0.1;
|
||||
}
|
||||
|
||||
20% {
|
||||
opacity: 0.1;
|
||||
}
|
||||
|
||||
40% {
|
||||
opacity: 0.25;
|
||||
}
|
||||
|
||||
80% {
|
||||
opacity: 0.1;
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotate(359deg);
|
||||
opacity: 0.1;
|
||||
}
|
||||
}
|
||||
|
||||
.topHead .ctrlWrapper{
|
||||
@ -88,6 +126,11 @@
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
.mainTableWrapper thead{
|
||||
background: #DDD;
|
||||
border-bottom: 1px solid #777;
|
||||
}
|
||||
|
||||
.mainTableWrapper td,
|
||||
.mainTableWrapper th{
|
||||
padding: 4px 12px;
|
||||
@ -205,7 +248,7 @@
|
||||
}
|
||||
|
||||
.http_status{
|
||||
font-weight: 700;
|
||||
/*font-weight: 700;*/
|
||||
}
|
||||
|
||||
.http_status_200{
|
||||
|
@ -13,8 +13,11 @@
|
||||
<div class="topHead">
|
||||
<div class="logoWrapper">
|
||||
<h1>Anyproxy</h1>
|
||||
<img class="logo_bottom anim_rotation" id="J_indicator" src="./logo_bottom.png" width="50" height="50" style="visibility:hidden" />
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="ctrlWrapper">
|
||||
<a href="#" class="J_statusBtn"><span class="topBtn"><i class="uk-icon-stop"></i>Stop</span></a>
|
||||
<a href="#" class="J_statusBtn btn_disable"><span class="topBtn"><i class="uk-icon-play"></i>Resume</span></a>
|
||||
|
15
web/list.js
15
web/list.js
@ -141,7 +141,8 @@ seajs.use(['$', 'Underscore', 'Backbone',"./detail"], function($, _, Backbone,De
|
||||
}
|
||||
|
||||
//pause btn
|
||||
var ifPause = false;
|
||||
var ifPause = false,
|
||||
indicatorEl = $("#J_indicator");
|
||||
(function(){
|
||||
var statusBtn = $(".J_statusBtn");
|
||||
statusBtn.on("click",function(e){
|
||||
@ -153,8 +154,12 @@ seajs.use(['$', 'Underscore', 'Backbone',"./detail"], function($, _, Backbone,De
|
||||
|
||||
if(/stop/i.test($(this).html()) ){
|
||||
ifPause = true;
|
||||
indicatorEl.fadeOut();
|
||||
// indicatorEl.css("visibility","hidden");
|
||||
}else{
|
||||
ifPause = false;
|
||||
indicatorEl.fadeIn();
|
||||
// indicatorEl.css("visibility","visible");
|
||||
}
|
||||
});
|
||||
})();
|
||||
@ -167,7 +172,9 @@ seajs.use(['$', 'Underscore', 'Backbone',"./detail"], function($, _, Backbone,De
|
||||
var socketPort = $("#socketPort").val(),
|
||||
baseUrl = $("#baseUrl").val(),
|
||||
dataSocket = new WebSocket("ws://" + baseUrl + ":" + socketPort);
|
||||
dataSocket.onopen = function(){}
|
||||
dataSocket.onopen = function(){
|
||||
indicatorEl.css("visibility","visible");
|
||||
}
|
||||
|
||||
dataSocket.onmessage = function(event){
|
||||
if(ifPause) return;
|
||||
@ -184,8 +191,12 @@ seajs.use(['$', 'Underscore', 'Backbone',"./detail"], function($, _, Backbone,De
|
||||
}
|
||||
}
|
||||
|
||||
dataSocket.onclose = function(e){
|
||||
}
|
||||
|
||||
dataSocket.onerror = function(e){
|
||||
console.log(e);
|
||||
indicatorEl.css("visibility","hidden");
|
||||
alert("socket err, please refresh");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user