Mercurial > repos > fubar > jbrowse2
diff jb2_webserver.py @ 50:f350467f9433 draft
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
author | fubar |
---|---|
date | Thu, 07 Mar 2024 04:51:43 +0000 |
parents | 460d5b6c5d98 |
children |
line wrap: on
line diff
--- a/jb2_webserver.py Thu Mar 07 00:27:48 2024 +0000 +++ b/jb2_webserver.py Thu Mar 07 04:51:43 2024 +0000 @@ -38,12 +38,11 @@ import os import re import socketserver -import ssl import webbrowser from http.server import SimpleHTTPRequestHandler -DEFAULT_PORT = 8443 +DEFAULT_PORT = 8081 def copy_byte_range(infile, outfile, start=None, stop=None, bufsize=16 * 1024): @@ -154,17 +153,6 @@ class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer): allow_reuse_address = True - def server_bind(self): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) - ctx.load_cert_chain('cert.pem', 'key.pem') - socketserver.TCPServer.server_bind(self) - self.socket = ctx.wrap_socket( self.socket, server_hostname = "127.0.0.1", server_side=False,) - - - def get_request(self): - (socket, addr) = socketserver.TCPServer.get_request(self) - socket.do_handshake() - return (socket, addr) if __name__ == "__main__": parser = argparse.ArgumentParser( @@ -184,16 +172,16 @@ parser.add_argument( "--bind", default="127.0.0.1", - help="IP address to bind to (default: 127.0.0.1)", + help="IP address to bind to (default: 127.0.0.1 - use 0.0.0.0 to allow access on your network)", ) args = parser.parse_args() handler = functools.partial(RangeRequestHandler, directory=args.root) - webbrowser.open(f"https://{args.bind}:{args.port}") + webbrowser.open(f"http://{args.bind}:{args.port}") with ThreadedTCPServer((args.bind, args.port), handler) as httpd: print( - f"Serving HTTPS on {args.bind} port {args.port} (https://{args.bind}:{args.port}/)" + f"Serving HTTP on {args.bind} port {args.port} (http://{args.bind}:{args.port}/)" ) httpd.serve_forever()