From 5ff78f55a1258f6bed9c15a22fc6564fb9020a9d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 3 Jul 2019 13:24:54 +0100 Subject: [PATCH] Allow localhost as domain --- daemon.py | 5 +++-- epicyon.py | 13 +++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/daemon.py b/daemon.py index c6c70345..e1d46415 100644 --- a/daemon.py +++ b/daemon.py @@ -285,8 +285,9 @@ def runDaemon(domain: str,port=80,https=True,fedList=[],useTor=False) -> None: if len(domain)==0: domain='localhost' if '.' not in domain: - print('Invalid domain: ' + domain) - return + if domain != 'localhost': + print('Invalid domain: ' + domain) + return serverAddress = ('', port) httpd = ThreadingHTTPServer(serverAddress, PubServer) diff --git a/epicyon.py b/epicyon.py index c2ad9f3f..9bf7e5e8 100644 --- a/epicyon.py +++ b/epicyon.py @@ -49,7 +49,7 @@ def str2bool(v): raise argparse.ArgumentTypeError('Boolean value expected.') parser = argparse.ArgumentParser(description='ActivityPub Server') -parser.add_argument('-d','--domain', dest='domain', type=str,default=None, +parser.add_argument('-d','--domain', dest='domain', type=str,default='localhost', help='Domain name of the server') parser.add_argument('-p','--port', dest='port', type=int,default=8085, help='Port number to run on') @@ -61,9 +61,9 @@ parser.add_argument('--postsraw', dest='postsraw', type=str,default=None, help='Show raw json of posts for the given handle') parser.add_argument('-f','--federate', nargs='+',dest='federationList', help='Specify federation list separated by spaces') -parser.add_argument("--https", type=str2bool, nargs='?', +parser.add_argument("--http", type=str2bool, nargs='?', const=True, default=False, - help="Use https") + help="Use http only") parser.add_argument("--tor", type=str2bool, nargs='?', const=True, default=False, help="Route via Tor") @@ -103,7 +103,9 @@ if not args.domain: nickname='admin' domain=args.domain port=args.port -https=args.https +https=True +if args.http: + https=False useTor=args.tor baseDir=args.baseDir if baseDir.endswith('/'): @@ -114,4 +116,7 @@ federationList=[] if args.federationList: federationList=args.federationList.copy() +if not os.path.isdir(baseDir+'/accounts/'+nickname+'@'+domain): + privateKeyPem,publicKeyPem,person,wfEndpoint=createPerson(baseDir,nickname,domain,port,https,True) + runDaemon(domain,port,https,federationList,useTor)