diff --git a/modules/Archive/endpoints/command.py b/modules/Archive/endpoints/command.py index 7da0ea8..ea92935 100644 --- a/modules/Archive/endpoints/command.py +++ b/modules/Archive/endpoints/command.py @@ -9,15 +9,13 @@ if TYPE_CHECKING: class Command(Resource): def post(self): + db : Database = app.databases["Archive"] auth = request.headers.get('auth') if auth is not None: hash_obj = hashlib.sha256(auth.encode('utf-8')) if hash_obj.hexdigest() == "63a3b0dba950e1015a110486518e5ceff8cff415041aba3dedb8dc5aa3b3dd16": - db : Database = app.databases["Archive"] query = request.data.decode("utf-8") - print("auth success") - print(query) - #result = db.db.run_command(query) + result = db.db.run_command(query) else: result = None else: @@ -26,15 +24,13 @@ class Command(Resource): class CommandOld(Resource): def post(self): + db : Database = app.databases["ArchiveOld"] auth = request.headers.get('auth') if auth is not None: hash_obj = hashlib.sha256(auth.encode('utf-8')) if hash_obj.hexdigest() == "63a3b0dba950e1015a110486518e5ceff8cff415041aba3dedb8dc5aa3b3dd16": - db : Database = app.databases["ArchiveOld"] query = request.data.decode("utf-8") - print("auth success") - print(query) - #result = db.db.run_command(query) + result = db.db.run_command(query) else: result = None else: diff --git a/modules/Archive/endpoints/commands.py b/modules/Archive/endpoints/commands.py index d25ec38..d51ea97 100644 --- a/modules/Archive/endpoints/commands.py +++ b/modules/Archive/endpoints/commands.py @@ -10,16 +10,13 @@ if TYPE_CHECKING: class Commands(Resource): def post(self): + db : Database = app.databases["Archive"] auth = request.headers.get('auth') if auth is not None: hash_obj = hashlib.sha256(auth.encode('utf-8')) if hash_obj.hexdigest() == "63a3b0dba950e1015a110486518e5ceff8cff415041aba3dedb8dc5aa3b3dd16": - db : Database = app.databases["Archive"] data = json.loads(request.data) - print("auth success") - print(data) - result = "ok" - #result = db.db.run_commands(data) + result = db.db.run_commands(data) else: result = None else: @@ -28,16 +25,13 @@ class Commands(Resource): class CommandsOld(Resource): def post(self): + db : Database = app.databases["ArchiveOld"] auth = request.headers.get('auth') if auth is not None: hash_obj = hashlib.sha256(auth.encode('utf-8')) if hash_obj.hexdigest() == "63a3b0dba950e1015a110486518e5ceff8cff415041aba3dedb8dc5aa3b3dd16": - db : Database = app.databases["ArchiveOld"] data = json.loads(request.data) - print("auth success") - print(data) - result = "ok" - #result = db.db.run_commands(data) + result = db.db.run_commands(data) else: result = None else: