From a7751dc38bf485e2465a8b11844d8a43c3213988 Mon Sep 17 00:00:00 2001 From: Davide Bongiovanni Date: Tue, 13 Nov 2018 21:35:37 +0100 Subject: [PATCH 1/2] Added query timer --- parts/static/script.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parts/static/script.js b/parts/static/script.js index 83a7bd8..0195bc0 100644 --- a/parts/static/script.js +++ b/parts/static/script.js @@ -1,3 +1,5 @@ +var active_timer = 100; + function init_edit(partID) { $('table#details tr#location td p').hide(); $('#location-dropdown').show(); @@ -254,7 +256,8 @@ function octopartFetch(){ $(document).ready(function() { $.ajaxSetup({ cache: false }); $('.search-bar').on('keyup', function() { - perform_query(); + clearTimeout(active_timer); + active_timer = setTimeout(perform_query, 100); }); $('.checkbox').change( function() { if ( !$('#location').is(':checked') From 40186ad08e1b78da3cdc8717abeb138094870e93 Mon Sep 17 00:00:00 2001 From: Davide Bongiovanni Date: Tue, 13 Nov 2018 21:51:56 +0100 Subject: [PATCH 2/2] Fixed getfile --- parts/server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parts/server.py b/parts/server.py index 8dc168d..dfdafa7 100644 --- a/parts/server.py +++ b/parts/server.py @@ -197,10 +197,10 @@ def getMap(containerID): @app.route('/parts/getfile/') def getfile(filename): - if(re.match('^[\w\-_]+$', filename) == None): + if(re.match('^[\w\-_]+.[p|P][d|D][f|F]$', filename) == None): return 'No injections pls.' - return send_from_directory('/srv/datasheets/', filename + '.pdf') + return send_from_directory('/srv/datasheets/', filename) @app.route('/parts/alter/', methods=['POST']) @requires_auth