コード例 #1
0
def parseCommandLine(args):
    """
    :type args: list[str]
    """
    if args[0] == "-h":
        print("python UniSkinServer.py [switch] [params ...]")
        print("   -c [username] [new_password] // force change the password")
    elif args[0] == "-c":
        cfg=server_config.getConfigure()
        db=server_config.DatabaseProvider(cfg.database_path)
        user_name = args[1]
        pwd = args[2]
        if (db.user_exists(user_name)):
            db.change_pwd(user_name, pwd)
            print("Password changed")
        else:
            print("User not exists.")
    else:
        print("Unknown Command. Try -h")
コード例 #2
0
    :type args: list[str]
    """
    if args[0] == "-h":
        print("python UniSkinServer.py [switch] [params ...]")
        print("   -c [username] [new_password] // force change the password")
    elif args[0] == "-c":
        cfg=server_config.getConfigure()
        db=server_config.DatabaseProvider(cfg.database_path)
        user_name = args[1]
        pwd = args[2]
        if (db.user_exists(user_name)):
            db.change_pwd(user_name, pwd)
            print("Password changed")
        else:
            print("User not exists.")
    else:
        print("Unknown Command. Try -h")

if __name__=="__main__":
    if (len(sys.argv) > 1):
        parseCommandLine(sys.argv[1:])
    else:

        global cfg,db,texture_cache
        cfg=server_config.getConfigure()
        if cfg is None:
            print("Error Occurred, check your config please.")
        else:
            db=server_config.DatabaseProvider(cfg.database_path)
            texture_cache=server_config.TextureManager(db.get_cursor(),cfg.texture_path)
            run_server(cfg)
コード例 #3
0
              (r"/static/(.*)",    tornado.web.StaticFileHandler,{"path":"static"}),

              (r"/reg",   WebRegisterHandler),
              (r"/login", WebLoginHandler),
              (r"/logout", WebLogoutHandler),
              (r"/update",WebProfileUpdateHandler),
              (r"/data",  WebDataAccessHandler),
              (r"/upload",WebSkinModificationHandle),

              (r".*", tornado.web.ErrorHandler,{"status_code":404})]

    try:
        application=tornado.web.Application(handlers,debug=True)
        application.listen(cfg.port)
        print("Starting UniSkinServer on port:",cfg.port)
        sessionManager=server_config.SessionManager()
        tornado.ioloop.IOLoop.instance().start()
    except Exception as e:
        print(e)
        print("Now server quit.")

if __name__=="__main__":
    global cfg,db,texture_cache
    cfg=server_config.getConfigure()
    if cfg==None:
        print("Error Occured, check your config please.")
    else:
        db=server_config.DatabaseProvider(cfg.database_path)
        texture_cache=server_config.TextureManager(db.get_cursor(),cfg.texture_path)
        run_server(cfg)