Permalink
Browse files

0.6.10

  • Loading branch information...
1 parent 2717551 commit e20da3ffd80dfc70c285d4c408d1eafb575b4c7c @ishay-hola ishay-hola committed Sep 21, 2016
Showing with 138 additions and 87 deletions.
  1. +1 −2 bin/luminati.js
  2. +22 −5 bin/pub/new/app.css
  3. +22 −13 bin/pub/new/app.js
  4. +16 −7 bin/pub/new/index.html
  5. +8 −0 bin/pub/new/proxies.html
  6. +1 −1 bin/pub/new/proxy.html
  7. +51 −26 bin/pub/new/zones.html
  8. +1 −1 index.js
  9. +4 −6 lib/luminati.js
  10. +3 −2 lib/manager.js
  11. +1 −5 lib/parse_username.js
  12. +7 −11 lib/socks.js
  13. +0 −7 lib/version.js
  14. +1 −1 package.json
View
@@ -9,5 +9,4 @@ if (process.platform=='win32')
.on('SIGINT', ()=>process.emit('SIGINT'));
}
const manager = new Manager(process.argv.slice(2));
-manager.on('stop', ()=>process.exit())
-.start();
+manager.on('stop', ()=>process.exit()).start();
View
@@ -35,6 +35,7 @@ a:hover {
padding: 8px 15px;
border-radius: 4px;
margin-bottom: 20px;
+ color: #777;
}
.navigation:after {
content: '';
@@ -44,11 +45,14 @@ a:hover {
.navigation .active {
float: left;
}
+.navigation .active .separator {
+ color: #ccc;
+}
.navigation .items {
float: right;
}
-.navigation .items >span:first-child span {
- display: none;
+.navigation .items .separator {
+ color: #0c334d;
}
.block {
background: #eeeeee;
@@ -152,6 +156,10 @@ a:hover {
overflow: auto;
max-height: calc(100vh - 164px);
}
+.proxies-settings {
+ overflow: auto;
+ max-height: calc(100vh - 190px);
+}
.proxies-panel {
overflow: auto;
}
@@ -172,8 +180,17 @@ table.proxies td, table.proxies th {
opacity: 0.5;
margin: 0 4px;
}
-.proxies-graph:first-child {
- margin-bottom: 48px;
+.proxies-graph {
+ float: left;
+ width: 50%;
+}
+#stats .modal-body h4 {
+ text-align: center;
+}
+#stats .modal-body:after {
+ content: '';
+ display: block;
+ clear: both;
}
.proxies-graph-container {
margin-left: -32px;
@@ -270,7 +287,7 @@ table.proxies td, table.proxies th {
text-align: center;
cursor: default;
}
-#history .modal-dialog, #history_details .modal-dialog {
+#history .modal-dialog, #history_details .modal-dialog, #stats .modal-dialog {
width: auto;
margin-left: 20px;
margin-right: 20px;
View
@@ -9,7 +9,14 @@ var module = angular.module('app', []);
module.run(function($rootScope, $window){
$window.Chart.defaults.global.colors = ['#803690', '#00ADF9', '#46BFBD',
'#FDB45C', '#949FB1', '#4D5360'];
- $rootScope.section = $window.location.pathname.split('/').pop();
+ var l = $window.location.pathname;
+ if (l.match(/zones\/[^\/]+/))
+ {
+ $rootScope.section = 'zones';
+ $rootScope.subsection = l.split('/').pop();
+ }
+ else
+ $rootScope.section = l.split('/').pop();
});
module.factory('$proxies', $proxies);
@@ -166,16 +173,17 @@ module.controller('zones', zones);
zones.$inject = ['$scope', '$http', '$filter'];
function zones($scope, $http, $filter){
var today = new Date();
+ var oneDayAgo = (new Date()).setDate(today.getDate()-1);
var twoDaysAgo = (new Date()).setDate(today.getDate()-2);
- var date_filter = $filter('date');
- var twoMonthsAgo = (new Date()).setMonth(today.getMonth()-2);
+ var oneMonthAgo = (new Date()).setMonth(today.getMonth()-1, 1);
+ var twoMonthsAgo = (new Date()).setMonth(today.getMonth()-2, 1);
$scope.times = [
- {title: 'Today', key: 'back_d0'},
- {title: 'Yesterday', key: 'back_d1'},
- {title: date_filter(twoDaysAgo, 'dd-MMM-yyyy'), key: 'back_d2'},
- {title: 'This Month', key: 'back_m0'},
- {title: 'Last Month', key: 'back_m1'},
- {title: date_filter(twoMonthsAgo, 'MMM-yyyy'), key: 'back_m2'},
+ {title: moment(twoMonthsAgo).format('MMM-YYYY'), key: 'back_m2'},
+ {title: moment(oneMonthAgo).format('MMM-YYYY'), key: 'back_m1'},
+ {title: moment(today).format('MMM-YYYY'), key: 'back_m0'},
+ {title: moment(twoDaysAgo).format('DD-MMM-YYYY'), key: 'back_d2'},
+ {title: moment(oneDayAgo).format('DD-MMM-YYYY'), key: 'back_d1'},
+ {title: moment(today).format('DD-MMM-YYYY'), key: 'back_d0'},
];
var numberFilter = $filter('requests');
var sizeFilter = $filter('bytes');
@@ -504,8 +512,8 @@ function proxies($scope, $http, $proxies, $window){
$scope.show_history = function(proxy){
$scope.history_dialog = [{port: proxy.port}];
};
- $scope.edit_proxy = function(proxy){
- $scope.proxy_dialog = [{proxy: proxy||{}}];
+ $scope.edit_proxy = function(proxy, duplicate){
+ $scope.proxy_dialog = [{proxy: proxy||{}, duplicate: duplicate}];
};
}
@@ -937,15 +945,16 @@ module.controller('proxy', proxy);
proxy.$inject = ['$scope', '$http', '$proxies', '$window'];
function proxy($scope, $http, $proxies, $window){
$scope.init = function(locals){
- $scope.port = locals.proxy.port;
+ $scope.port = locals.duplicate ? '' : locals.proxy.port;
$scope.form = _.cloneDeep(locals.proxy);
+ $scope.form.port = $scope.port;
$scope.consts = $scope.$parent.$parent.$parent.$parent.consts.proxy;
$scope.show_modal = function(){ $window.$('#proxy').modal(); };
$scope.save = function(proxy){
proxy.persist = true;
var data = {proxy: proxy};
var promise;
- if ($scope.port)
+ if ($scope.port&&!locals.duplicate)
promise = $http.put('/api/proxies/'+$scope.port, data);
else
promise = $http.post('/api/proxies', data);
@@ -20,18 +20,27 @@
<div class=navigation>
<div class=active>
<span ng-if=settings.customer>
- <a href=settings>{{settings.customer}}</a> &nbsp;/&nbsp;
+ <a href=/new/settings>{{settings.customer}}</a>
+ <span class=separator>&nbsp;/&nbsp;</span>
+ </span>
+ <span ng-if=!subsection>
+ {{section.title}}
+ </span>
+ <span ng-if=subsection>
+ <a href=/new/{{section.name}}>{{section.title}}</a>
+ <span class=separator>&nbsp;/&nbsp;</span>
+ {{subsection}}
</span>
- {{section.title}}
</div>
<div class=items>
- <span ng-repeat="s in sections" ng-if="s!=section">
- <span> &nbsp;|&nbsp; </span>
- <a href={{s.name}}>{{s.title}}</a>
+ <span ng-repeat="s in sections">
+ <span ng-if="$index&gt;0" class=separator>&nbsp;|&nbsp;</span>
+ <a ng-if=s!=section||subsection href=/new/{{s.name}}>{{s.title}}</a>
+ <span ng-if=s==section&&!subsection>{{s.title}}</span>
</span>
</div>
</div>
- <ng-include src="section.name+'.html'"></ng-include>
+ <ng-include src="'/new/'+section.name+'.html'"></ng-include>
</div>
<div id=confirmation class="modal fade" role=dialog>
<div class=modal-dialog>
@@ -55,7 +64,7 @@ <h4 class=modal-title>{{confirmation.text}}</h4>
</div>
</div>
</div>
- <script data-main=./config.js src=/require.js></script>
+ <script data-main=/new/config.js src=/require.js></script>
</body>
</html>
@@ -22,6 +22,14 @@
<span class="proxies-action-disabled glyphicon glyphicon-pencil"
ng-if=!proxy.persist title="This proxy cannot be edited">
</span>
+ <span class="proxies-action glyphicon glyphicon-duplicate"
+ ng-if=proxy.persist ng-click="edit_proxy(proxy, true)"
+ title=Duplicate>
+ </span>
+ <span class="proxies-action-disabled glyphicon
+ glyphicon-duplicate" ng-if=!proxy.persist
+ title="This proxy cannot be duplicated">
+ </span>
<span class="proxies-action glyphicon glyphicon-stats"
ng-click=show_stats(proxy) title=Statistics>
</span>
@@ -10,7 +10,7 @@ <h4 class=modal-title ng-if=port>
</h4>
<h4 class=modal-title ng-if=!port>Adding Proxy</h4>
</div>
- <div class=modal-body>
+ <div class="modal-body proxies-settings">
<form>
<div class=panel-group id=proxy-tabs>
<div class="panel panel-default">
@@ -5,34 +5,59 @@
<div ng-hide=stats||error class="alert alert-info">
Loading...
</div>
- <div ng-repeat="(zone, properties) in stats" class="panel panel-default">
- <div class=panel-heading>{{zone}}</div>
- <div class=panel-body>
- <table class="table table-hover">
- <thead>
- <tr>
- <th></th>
- <th ng-repeat="time in times">
- {{time.title}}
- </th>
- </tr>
- </thead>
- <tbody>
- <tr ng-repeat="field in fields">
- <th>{{field.title}}</th>
- <td ng-repeat="time in times">
+ <div ng-if=!$root.subsection>
+ <table class="table table-hover" ng-if=stats>
+ <thead>
+ <tr>
+ <th>Zone</th>
+ <th ng-repeat="time in times">
+ {{time.title}}
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr ng-repeat="(zone, properties) in stats">
+ <td><a href=zones/{{zone}}>{{zone}}</a></td>
+ <td ng-repeat="time in times">
+ <span ng-repeat="field in fields" ng-if="field.key=='bw_sum'">
{{field.filter(properties[time.key][field.key])}}
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class=panel-footer>
- <div ng-if="whitelist&&whitelist[zone]">
- <strong>Whitelist</strong>: {{whitelist[zone].join(', ')}}
+ </span>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div ng-if=$root.subsection>
+ <div ng-repeat="(zone, properties) in stats" ng-if=zone==$root.subsection
+ class="panel panel-default">
+ <div class=panel-heading>{{zone}}</div>
+ <div class=panel-body>
+ <table class="table table-hover">
+ <thead>
+ <tr>
+ <th></th>
+ <th ng-repeat="time in times">
+ {{time.title}}
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr ng-repeat="field in fields">
+ <th>{{field.title}}</th>
+ <td ng-repeat="time in times">
+ {{field.filter(properties[time.key][field.key])}}
+ </td>
+ </tr>
+ </tbody>
+ </table>
</div>
- <div ng-if="recent_ips&&recent_ips[zone]" flex>
- <strong>Recent IPs</strong>: {{recent_ips[zone].join(', ')}}
+ <div class=panel-footer>
+ <div ng-if="whitelist&&whitelist[zone]">
+ <strong>Whitelist</strong>: {{whitelist[zone].join(', ')}}
+ </div>
+ <div ng-if="recent_ips&&recent_ips[zone]" flex>
+ <strong>Recent IPs</strong>: {{recent_ips[zone].join(', ')}}
+ </div>
</div>
</div>
</div>
View
@@ -2,5 +2,5 @@
'use strict'; /*jslint node:true, esnext:true*/
const Luminati = require('./lib/luminati.js');
const Manager = require('./lib/manager.js');
-const version = require('./lib/version.js');
+const version = require('./package.json').version;
module.exports = {Luminati, Manager, version};
View
@@ -16,12 +16,12 @@ const parse_username = require('./parse_username.js');
const http_shutdown = require('http-shutdown');
const Socks = require('./socks.js');
const hutil = require('hutil');
-const version = require('./version.js');
+const version = require('../package.json').version;
const etask = hutil.etask;
const qw = hutil.string.qw;
const assign = Object.assign;
module.exports = Luminati;
-const _default = Luminati.default = {
+Luminati.default = {
port: 24000,
zone: process.env.LUMINATI_ZONE||'gen',
log: 'ERROR',
@@ -94,7 +94,7 @@ function Luminati(opt){
https: new https.Agent({keepAlive: true, keepAliveMsecs: 5000,
servername: 'zproxy.luminati.io'}),
}[opt.secure_proxy ? 'https' : 'http'];
- opt = this.opt = _.assign({}, _default, opt);
+ opt = this.opt = _.assign({}, Luminati.default, opt);
if (opt.max_requests || opt.session_duration)
opt.pool_size = opt.pool_size||1;
if (opt.session_duration)
@@ -115,9 +115,7 @@ function Luminati(opt){
this.socks_server = new Socks({local: opt.socks, remote: opt.port,
log: opt.log});
}
- const on_connection = socket=>{
- socket.setNoDelay();
- };
+ const on_connection = socket=>socket.setNoDelay();
this.http_server = http.createServer((req, res, head)=>{
if (req.headers.host=='trigger.domain' ||
/^\/hola_trigger/.test(req.url))
View
@@ -17,7 +17,7 @@ const http_shutdown = require('http-shutdown');
const Luminati = require('./luminati.js');
const Socks = require('./socks.js');
const ssl = require('./ssl.js');
-const version = require('./version.js');
+const version = require('../package.json').version;
const request = require('request');
const http = require('http');
const netmask = require('netmask');
@@ -950,7 +950,8 @@ function*create_web_interface(_this){
app.get(/^\/new\/?$/, (req, res)=>{
res.redirect('/new/settings');
});
- app.get(/^\/new\/(settings|proxies|zones|tools)$/, (req, res, next)=>{
+ app.get(/^\/new\/(settings|proxies|zones|tools)(\/[^\/]+)?$/,
+ (req, res, next)=>{
req.url = '/new/';
next('route');
});
@@ -1,10 +1,6 @@
// LICENSE_CODE ZON ISC
'use strict'; /*jslint node:true, esnext:true*/
const E = module.exports = parse_username;
-const boolean_keys = {
- direct: true,
- raw: true,
-};
function parse_username(username){
let auth = {};
@@ -14,7 +10,7 @@ function parse_username(username){
let key = parts.shift();
if (key=='lum')
continue;
- auth[key] = boolean_keys[key] || parts.shift();
+ auth[key] = {direct: true, raw: true}[key] || parts.shift();
}
return auth;
}
Oops, something went wrong.

0 comments on commit e20da3f

Please sign in to comment.