Skip to content

Commit 35c643f

Browse files
author
Casey Boettcher
committed
Multiple IPs working from webui with std POST
1 parent 396ac9f commit 35c643f

File tree

3 files changed

+2
-29
lines changed

3 files changed

+2
-29
lines changed

web/webui.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,9 @@ def process_form(self, api_key, api_password, ip_addresses):
3030
else:
3131
return cherrypy.HTTPError("400: Bad Request", 400)
3232

33-
@cherrypy.expose()
34-
def stop_demo(self):
35-
cherrypy.engine.stop()
36-
3733

3834
if __name__ == '__main__':
3935
webapp = XforceForm('127.0.0.1', 8000)
40-
#d = cherrypy.process.plugins.Daemonizer(cherrypy.engine)
41-
#d.subscribe()
4236
cherrypy.tree.mount(webapp, config='./server.cfg')
4337

4438
if hasattr(cherrypy.engine, 'signal_handler'):
@@ -49,8 +43,4 @@ def stop_demo(self):
4943
cherrypy.engine.console_control_handler.subscribe()
5044

5145
cherrypy.engine.start()
52-
53-
#pidfile = tempfile.TemporaryFile(prefix='xfipchk', suffix='.pid')
54-
#PIDFile(cherrypy.engine, pidfile).subscribe()
55-
5646
cherrypy.engine.block()

web/xfipchk.html

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,13 @@
77
integrity="sha256-tA8y0XqiwnpwmOIl3SGAcFl2RvxHjA8qp0+1uCGmRmg=" crossorigin="anonymous"></script>
88
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.17.0/jquery.validate.js"></script>
99
<script>
10-
function warn_stop()
11-
{
12-
var conf = confirm("This will stop the web server and close your browser tab/window. You will loose any"+
13-
"data returned from X-Force. Proceed?" );
14-
15-
if (conf)
16-
{
17-
$.ajax( {url: "/stop_demo"} );
18-
}
19-
}
2010

2111
function check_ips()
2212
{
2313
var req = $.ajax({'url': '/process_form'});
2414
req.done(function (data){
25-
$.getElementById("results_div").setAttribute("hidden")
26-
$( ".result" ).html( data ); }, "json");
15+
//$.getElementById("results_div").setAttribute("hidden")
16+
$( "#results" ).html( data ); }, "json");
2717
}
2818

2919
</script>
@@ -58,11 +48,6 @@
5848
<button id="submit" form="the_form" onclick="check_ips()">Submit</button> <button id="reset" type="reset" form="the_form" value="reset">Reset</button>
5949
</div>
6050
</form>
61-
<form id="stop_form">
62-
<div id="stop_demo_button">
63-
<button name="stop_demo" form="stop_form" onclick="warn_stop()">Stop Demo</button>
64-
</div>
65-
</form>
6651
</div>
6752
</body>
6853
</html>

xfipchk.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,6 @@ def start_server(address='127.0.0.1', port=8000):
193193
if not os.path.abspath(os.getcwd()).endswith("python_challenge/web"):
194194
os.chdir('./web')
195195
webapp = web.webui.XforceForm(address, port)
196-
d = cherrypy.process.plugins.Daemonizer(cherrypy.engine)
197-
d.subscribe()
198196
cherrypy.tree.mount(webapp, config='./server.cfg')
199197
cherrypy.engine.start()
200198

0 commit comments

Comments
 (0)