diff --git a/burpui/api/async.py b/burpui/api/async.py index 4c00648c..64d1d7dd 100644 --- a/burpui/api/async.py +++ b/burpui/api/async.py @@ -22,6 +22,7 @@ from ..sessions import session_manager from ..ext.async import celery from ..ext.cache import cache from ..config import config +from ..decorators import browser_cache from six import iteritems from zlib import adler32 @@ -754,6 +755,7 @@ class AsyncHistory(History): """ @cache.cached(timeout=1800, key_prefix=cache_key) + @browser_cache(1800) @ns.marshal_with( History.history_fields, code=200, @@ -845,6 +847,7 @@ class AsyncClientsReport(ClientsReport): """ @api.cache.cached(timeout=1800, key_prefix=cache_key) + @browser_cache(1800) @ns.marshal_with( ClientsReport.report_fields, code=200, diff --git a/burpui/api/misc.py b/burpui/api/misc.py index 273fdc4e..9282e8ec 100644 --- a/burpui/api/misc.py +++ b/burpui/api/misc.py @@ -11,6 +11,7 @@ from . import api, cache_key from ..server import BUIServer # noqa from .custom import fields, Resource from ..exceptions import BUIserverException +from ..decorators import browser_cache from ..ext.cache import cache from six import iteritems @@ -325,6 +326,7 @@ class About(Resource): }) @cache.cached(timeout=3600, key_prefix=cache_key) + @browser_cache(3600) @ns.marshal_with(about_fields, code=200, description='Success') @ns.expect(parser) def get(self, server=None): @@ -430,6 +432,7 @@ class History(Resource): }) @cache.cached(timeout=1800, key_prefix=cache_key) + @browser_cache(1800) @ns.marshal_list_with(history_fields, code=200, description='Success') @ns.expect(parser) @ns.doc( diff --git a/burpui/misc/backend/burp1.py b/burpui/misc/backend/burp1.py index b0590cc9..1d482893 100644 --- a/burpui/misc/backend/burp1.py +++ b/burpui/misc/backend/burp1.py @@ -721,7 +721,7 @@ class Burp(BUIbackend): if 'bytes' not in res: res['bytes'] = 0 - if viewkeys(res) & {'start', 'estimated_bytes', 'bytes_in'}: + if set(['start', 'estimated_bytes', 'bytes_in']) <= set(viewkeys(res)): try: diff = time.time() - int(res['start']) byteswant = int(res['estimated_bytes']) diff --git a/burpui/misc/backend/burp2.py b/burpui/misc/backend/burp2.py index 5e36dcbb..7629172e 100644 --- a/burpui/misc/backend/burp2.py +++ b/burpui/misc/backend/burp2.py @@ -640,8 +640,9 @@ class Burp(Burp1): return ret backup = None + phases = ['working', 'finishing'] for back in client['backups']: - if 'flags' in back and 'working' in back['flags']: + if 'flags' in back and any([x in back['flags'] for x in phases]): backup = back break # check we found a working backup @@ -681,9 +682,14 @@ class Burp(Burp1): else: ret[name] = counter['count'] + for phase in phases: + if phase in backup['flags']: + ret['phase'] = phase + break + if 'bytes' not in ret: ret['bytes'] = 0 - if viewkeys(ret) & {'time_start', 'estimated_bytes', 'bytes'}: + if set(['time_start', 'estimated_bytes', 'bytes']) <= set(viewkeys(ret)): try: diff = time.time() - int(ret['time_start']) byteswant = int(ret['estimated_bytes']) diff --git a/burpui/templates/calendar.html b/burpui/templates/calendar.html index 14793cea..1b14f91d 100644 --- a/burpui/templates/calendar.html +++ b/burpui/templates/calendar.html @@ -14,8 +14,6 @@

Calendar{% if cname %} of {{ cname }}{% if server %} on {{ server }}{% endif %}{% elif server %} of {{ server }}{% endif %}

-
-
-
+
{% endblock %} diff --git a/burpui/templates/js/calendar.js b/burpui/templates/js/calendar.js index d2cac5cf..d51a7b32 100644 --- a/burpui/templates/js/calendar.js +++ b/burpui/templates/js/calendar.js @@ -19,54 +19,44 @@ var _client = function() {}; var _clients = function() {}; var _servers = function() {}; -var app = angular.module('MainApp', ['ngSanitize', 'ui.calendar', 'ui.bootstrap']); +$(document).ready(function() { -app.controller('CalendarCtrl', function($scope, $http, $compile, uiCalendarConfig) { - $scope.eventSources = []; - - $scope.eventRender = function( event, element, view ) { + myEventRender = function( event, element, view ) { element.attr({ - 'tooltip-placement': 'bottom', - 'uib-tooltip': event.title+' Duration: '+_time_human_readable((new Date(event.end) - new Date(event.start))/1000), - 'tooltip-append-to-body': true, + 'title': event.title+', Duration: '+_time_human_readable((new Date(event.end) - new Date(event.start))/1000), }); - $compile(element)($scope); }; - $scope.uiConfig = { - calendar: { - {{ macros.translate_calendar() }} - editable: false, - eventLimit: true, - firstDay: 1, - header:{ - left: 'month,listWeek', - center: 'title', - right: 'today prev,next' - }, - monthNames: moment.months(), - monthNamesShort: moment.monthsShort(), - dayNames: moment.weekdays(), - dayNamesShort: moment.weekdaysShort(), - eventRender: $scope.eventRender, - viewRender: function(view, element) { - $scope.fetchEvents(view.start.format(), view.end.format()); - } - } - }; - - $scope.fetchEvents = function(start, end) { + fetchEvents = function(start, end) { {% if config.WITH_CELERY -%} var feed_url = '{{ url_for("api.async_history", client=cname, server=server) }}?start='+start+'&end='+end; {% else -%} var feed_url = '{{ url_for("api.history", client=cname, server=server) }}?start='+start+'&end='+end; {% endif -%} - $http.get(feed_url, { headers: { 'X-From-UI': true } }) - .success(function(data, status, headers, config) { - $scope.eventSources.splice(0); - angular.forEach(data, function(source) { - $scope.eventSources.push(source); + $.get(feed_url) + .done(function(data) { + cal = $('#calendar') + cal.fullCalendar('removeEventSources'); + $.each(data, function(i, source) { + source.cache = true; + cal.fullCalendar('addEventSource', source); }); }); }; + + $('#calendar').fullCalendar({ + {{ macros.translate_calendar() }} + editable: false, + eventLimit: true, + firstDay: 1, + header:{ + left: 'month,listWeek', + center: 'title', + right: 'today prev,next' + }, + eventRender: myEventRender, + viewRender: function(view, element) { + fetchEvents(view.start.format(), view.end.format()); + } + }); }); diff --git a/burpui/templates/layout.html b/burpui/templates/layout.html index 4edad567..86f12947 100644 --- a/burpui/templates/layout.html +++ b/burpui/templates/layout.html @@ -79,7 +79,7 @@ {% endif -%} - {% if about or live or calendar or settings or ng_controller -%} + {% if about or live or settings or ng_controller -%} @@ -110,9 +110,6 @@ {% if calendar -%} - - - {% if g.locale and g.locale != 'en' -%}