Ejemplo n.º 1
0
 def __wrapper(*args, **kwargs):
     # set cross headers
     if request.remote_addr != "127.0.0.1": ## not local access, need check password
         auth_key = request.params.get('auth_key')
         if auth_key is None:
             raise CommonException(-2, "auth_key is empty.")
         default_auth_key = core_server_helper.execute("getConfig", {"key": "auth_key"})
         if auth_key != default_auth_key:
             raise CommonException(-2, "auth_key is error.")
     return fn(*args, **kwargs)
Ejemplo n.º 2
0
def list_dir(dir_id):
    fs_item_list = []
    if dir_id is None:
        fs_item_list = fs.list_root_dir()
    else:
        result = core_server_helper.execute("getPath",
                                            {"id": str(dir_id)})
        fs_item_list = fs.list_dir(result)
    start_id = core_server_helper.execute("getStartId",
                                        {"idNum": len(fs_item_list)})
    dict_obj = {}
    for item in fs_item_list:
        item["id"] = start_id
        dict_obj[str(start_id)] = item["fullPath"]
        start_id += 1
        if item["kind"] == "0":
            item["state"] = "closed"
            item.pop("size")
        else:
            item["state"] = "open"
    result = core_server_helper.execute("putIdPathMap",
                                        dict_obj)
    return fs_item_list
Ejemplo n.º 3
0
def save_config():
    core_server_helper.execute("saveConfig", {})
Ejemplo n.º 4
0
def update_config(key, value):
    core_server_helper.execute("updateConfig", {"key": key, "value": value})
    core_server_helper.execute("saveConfig", {})
Ejemplo n.º 5
0
def get_config(config_key):
    return core_server_helper.execute("getConfig", {"key": config_key})
Ejemplo n.º 6
0
def reload_dir():
    result = core_server_helper.execute("reloadDir", None)
    return None