mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-04-23 15:31:26 +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'),
|
util = require('./util'),
|
||||||
asyncTask = require("async-task-mgr");
|
asyncTask = require("async-task-mgr");
|
||||||
|
|
||||||
|
//TODO : unstable in windows
|
||||||
var certDir = path.join(util.getUserHome(),"/.anyproxy_certs/"),
|
var certDir = path.join(util.getUserHome(),"/.anyproxy_certs/"),
|
||||||
cmdDir = path.join(__dirname,"..","./cert/"),
|
cmdDir = path.join(__dirname,"..","./cert/"),
|
||||||
cmd_genRoot = path.join(cmdDir,"./gen-rootCA"),
|
cmd_genRoot = path.join(cmdDir,"./gen-rootCA"),
|
||||||
|
@ -115,7 +115,7 @@ function normalizeInfo(id,info){
|
|||||||
singleRecord.reqHeader = info.req.headers;
|
singleRecord.reqHeader = info.req.headers;
|
||||||
singleRecord.startTime = info.startTime;
|
singleRecord.startTime = info.startTime;
|
||||||
singleRecord.reqBody = info.reqBody || "";
|
singleRecord.reqBody = info.reqBody || "";
|
||||||
singleRecord.protocol = info.protocol;
|
singleRecord.protocol = info.protocol || "";
|
||||||
|
|
||||||
//res
|
//res
|
||||||
if(info.endTime){
|
if(info.endTime){
|
||||||
|
@ -4,7 +4,7 @@ module.exports = {
|
|||||||
summary:function(){
|
summary:function(){
|
||||||
var tip = "the default rule for anyproxy, support : CORS. ";
|
var tip = "the default rule for anyproxy, support : CORS. ";
|
||||||
if(isRootCAFileExists){
|
if(isRootCAFileExists){
|
||||||
tip += "\nRoot CA exists, will intercept all https requests for you";
|
tip += "\nRoot CA exists, will intercept all https requests.";
|
||||||
}
|
}
|
||||||
return tip;
|
return tip;
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "anyproxy",
|
"name": "anyproxy",
|
||||||
"version": "2.9.0",
|
"version": "2.9.1",
|
||||||
"description": "A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.",
|
"description": "A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.",
|
||||||
"main": "proxy.js",
|
"main": "proxy.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
15
proxy.js
15
proxy.js
@ -51,9 +51,10 @@ var T_TYPE_HTTP = 0,
|
|||||||
DEFAULT_TYPE = T_TYPE_HTTP;
|
DEFAULT_TYPE = T_TYPE_HTTP;
|
||||||
|
|
||||||
var default_rule = require('./lib/rule_default');
|
var default_rule = require('./lib/rule_default');
|
||||||
|
|
||||||
//may be unreliable in windows
|
//may be unreliable in windows
|
||||||
var anyproxyHome = path.join(util.getUserHome(),"/.anyproxy/");
|
|
||||||
try{
|
try{
|
||||||
|
var anyproxyHome = path.join(util.getUserHome(),"/.anyproxy/");
|
||||||
if(!fs.existsSync(anyproxyHome)){
|
if(!fs.existsSync(anyproxyHome)){
|
||||||
fs.mkdirSync(anyproxyHome);
|
fs.mkdirSync(anyproxyHome);
|
||||||
}
|
}
|
||||||
@ -63,9 +64,7 @@ try{
|
|||||||
if(fs.existsSync(path.join(process.cwd(),'rule.js'))){
|
if(fs.existsSync(path.join(process.cwd(),'rule.js'))){
|
||||||
default_rule = require(path.join(process.cwd(),'rule'));
|
default_rule = require(path.join(process.cwd(),'rule'));
|
||||||
}
|
}
|
||||||
}catch(e){
|
}catch(e){}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//option
|
//option
|
||||||
//option.type : 'http'(default) or 'https'
|
//option.type : 'http'(default) or 'https'
|
||||||
@ -184,11 +183,11 @@ function proxyServer(option){
|
|||||||
|
|
||||||
var tipText,webUrl;
|
var tipText,webUrl;
|
||||||
webUrl = "http://" + ip.address() + ":" + proxyWebPort +"/";
|
webUrl = "http://" + ip.address() + ":" + proxyWebPort +"/";
|
||||||
tipText = "web interface started at : " + webUrl;
|
tipText = "GUI interface started at : " + webUrl;
|
||||||
console.log(color.green(tipText));
|
console.log(color.green(tipText));
|
||||||
|
|
||||||
tipText = "[alpha]qr code to for iOS client: " + webUrl + "qr";
|
// tipText = "[alpha]qr code to for iOS client: " + webUrl + "qr";
|
||||||
console.log(color.green(tipText));
|
// console.log(color.green(tipText));
|
||||||
callback(null);
|
callback(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -197,7 +196,7 @@ function proxyServer(option){
|
|||||||
//final callback
|
//final callback
|
||||||
function(err,result){
|
function(err,result){
|
||||||
if(!err){
|
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));
|
console.log(color.green(tipText));
|
||||||
}else{
|
}else{
|
||||||
var tipText = "err when start proxy server :(";
|
var tipText = "err when start proxy server :(";
|
||||||
|
@ -29,10 +29,48 @@
|
|||||||
width: 220px;
|
width: 220px;
|
||||||
height: 55px;
|
height: 55px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.topHead h1{
|
.topHead .logoWrapper h1{
|
||||||
color: #CCCCCC;
|
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{
|
.topHead .ctrlWrapper{
|
||||||
@ -88,6 +126,11 @@
|
|||||||
table-layout: fixed;
|
table-layout: fixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mainTableWrapper thead{
|
||||||
|
background: #DDD;
|
||||||
|
border-bottom: 1px solid #777;
|
||||||
|
}
|
||||||
|
|
||||||
.mainTableWrapper td,
|
.mainTableWrapper td,
|
||||||
.mainTableWrapper th{
|
.mainTableWrapper th{
|
||||||
padding: 4px 12px;
|
padding: 4px 12px;
|
||||||
@ -205,7 +248,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.http_status{
|
.http_status{
|
||||||
font-weight: 700;
|
/*font-weight: 700;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
.http_status_200{
|
.http_status_200{
|
||||||
|
@ -13,8 +13,11 @@
|
|||||||
<div class="topHead">
|
<div class="topHead">
|
||||||
<div class="logoWrapper">
|
<div class="logoWrapper">
|
||||||
<h1>Anyproxy</h1>
|
<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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="ctrlWrapper">
|
<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"><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>
|
<a href="#" class="J_statusBtn btn_disable"><span class="topBtn"><i class="uk-icon-play"></i>Resume</span></a>
|
||||||
|
19
web/list.js
19
web/list.js
@ -141,7 +141,8 @@ seajs.use(['$', 'Underscore', 'Backbone',"./detail"], function($, _, Backbone,De
|
|||||||
}
|
}
|
||||||
|
|
||||||
//pause btn
|
//pause btn
|
||||||
var ifPause = false;
|
var ifPause = false,
|
||||||
|
indicatorEl = $("#J_indicator");
|
||||||
(function(){
|
(function(){
|
||||||
var statusBtn = $(".J_statusBtn");
|
var statusBtn = $(".J_statusBtn");
|
||||||
statusBtn.on("click",function(e){
|
statusBtn.on("click",function(e){
|
||||||
@ -153,8 +154,12 @@ seajs.use(['$', 'Underscore', 'Backbone',"./detail"], function($, _, Backbone,De
|
|||||||
|
|
||||||
if(/stop/i.test($(this).html()) ){
|
if(/stop/i.test($(this).html()) ){
|
||||||
ifPause = true;
|
ifPause = true;
|
||||||
|
indicatorEl.fadeOut();
|
||||||
|
// indicatorEl.css("visibility","hidden");
|
||||||
}else{
|
}else{
|
||||||
ifPause = false;
|
ifPause = false;
|
||||||
|
indicatorEl.fadeIn();
|
||||||
|
// indicatorEl.css("visibility","visible");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
@ -165,9 +170,11 @@ seajs.use(['$', 'Underscore', 'Backbone',"./detail"], function($, _, Backbone,De
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var socketPort = $("#socketPort").val(),
|
var socketPort = $("#socketPort").val(),
|
||||||
baseUrl = $("#baseUrl").val(),
|
baseUrl = $("#baseUrl").val(),
|
||||||
dataSocket = new WebSocket("ws://" + baseUrl + ":" + socketPort);
|
dataSocket = new WebSocket("ws://" + baseUrl + ":" + socketPort);
|
||||||
dataSocket.onopen = function(){}
|
dataSocket.onopen = function(){
|
||||||
|
indicatorEl.css("visibility","visible");
|
||||||
|
}
|
||||||
|
|
||||||
dataSocket.onmessage = function(event){
|
dataSocket.onmessage = function(event){
|
||||||
if(ifPause) return;
|
if(ifPause) return;
|
||||||
@ -184,8 +191,12 @@ seajs.use(['$', 'Underscore', 'Backbone',"./detail"], function($, _, Backbone,De
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dataSocket.onclose = function(e){
|
||||||
|
}
|
||||||
|
|
||||||
dataSocket.onerror = function(e){
|
dataSocket.onerror = function(e){
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
indicatorEl.css("visibility","hidden");
|
||||||
alert("socket err, please refresh");
|
alert("socket err, please refresh");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user