diff --git a/server.py b/server.py index 093684a..58d5913 100644 --- a/server.py +++ b/server.py @@ -24,7 +24,20 @@ class MyServer(BaseHTTPRequestHandler): # lists accounts on a pretty HTML + CSS # making sure there is no XSS possible on account names elif parts[0] == 'mirrors': - self.wfile.write(bytes('HTML', "utf-8")) + html = """ + + + + Pixelfed IG Mirrors + + + +
{mirrors}
+ + +""" + self.wfile.write(bytes(html, "utf-8")) return @@ -74,10 +87,15 @@ class MyServer(BaseHTTPRequestHandler): if __name__ == "__main__": addr = '0.0.0.0' port = 8080 + if len(sys.argv) > 1: - addr = sys.argv[1] - if len(sys.argv) > 2: - port = sys.argv[2] + arg = sys.argv[1].strip() + if ':' in arg: + ps = arg.split(':') + addr = ps[0] + port = int(ps[1]) + else: + port = int(arg) webServer = HTTPServer((addr, port), MyServer) print("Server started http://%s:%s" % (addr, port))