2024-09-11 02:15:56 +00:00
|
|
|
import os
|
2024-09-13 02:00:51 +00:00
|
|
|
import shutil
|
|
|
|
from typing import Callable, Union
|
2024-09-09 22:54:14 +00:00
|
|
|
|
2024-09-20 13:54:41 +00:00
|
|
|
from firebase_admin import auth
|
|
|
|
from jwt.api_jws import decode_complete
|
|
|
|
|
2024-07-09 17:40:18 +00:00
|
|
|
import firebase_manager
|
2024-09-14 14:34:00 +00:00
|
|
|
import server_mc_manager
|
|
|
|
from generic_executor import mc_manager
|
2024-07-09 17:40:18 +00:00
|
|
|
|
|
|
|
|
2024-07-10 17:33:54 +00:00
|
|
|
def ban_user(user_id: str):
|
|
|
|
try:
|
|
|
|
firebase_manager.auth.update_user(user_id, disabled=False)
|
2024-08-15 08:49:41 +00:00
|
|
|
print("Banned : " + user_id)
|
2024-07-10 17:33:54 +00:00
|
|
|
except Exception as e:
|
2024-08-15 08:49:41 +00:00
|
|
|
print("Error banning user " + user_id, "|", str(e), type(e).__name__)
|
2024-08-11 09:02:10 +00:00
|
|
|
|
|
|
|
|
2024-09-13 02:00:51 +00:00
|
|
|
def organize_minecraft_files(file_list: list[str], target_directory: str):
|
|
|
|
os.makedirs(target_directory, exist_ok=True)
|
|
|
|
|
|
|
|
for file_name in file_list:
|
|
|
|
if file_name.endswith('.jar'):
|
|
|
|
version = file_name.split('-')[1]
|
|
|
|
version_folder = os.path.join(target_directory, version)
|
|
|
|
|
|
|
|
os.makedirs(version_folder, exist_ok=True)
|
|
|
|
|
|
|
|
source_path = os.path.join(target_directory, file_name)
|
|
|
|
destination_path = os.path.join(version_folder, 'server.jar')
|
|
|
|
|
|
|
|
shutil.move(source_path, destination_path)
|
|
|
|
|
|
|
|
|
2024-07-09 17:40:18 +00:00
|
|
|
if __name__ == '__main__':
|
2024-08-20 16:56:43 +00:00
|
|
|
#ban_user("MpkbDMOO8PQddQgB5VgBQdTMWF53")
|
2024-08-24 11:38:22 +00:00
|
|
|
#file_manager.log_action("gqZN3eCHF3V2er3Py3rlgk8u2t83", "test", "DeleteServer")
|
|
|
|
#firebase_manager.set_servers_not_running()
|
2024-09-13 02:00:51 +00:00
|
|
|
#print(firebase_manager.get_server_field("secret :)", "AMITIE" ,"version"))
|
|
|
|
'''
|
|
|
|
organize_minecraft_files(
|
|
|
|
listdir("/home/hapso/Desktop/Personal/servii-backend/servers/paper"),
|
|
|
|
"/home/hapso/Desktop/Personal/servii-backend/servers/paper")
|
2024-09-14 14:34:44 +00:00
|
|
|
'''
|
2024-09-20 13:54:41 +00:00
|
|
|
token: str = "eyJhbGciOiJSUzI1NiIsImtpZCI6ImUwM2E2ODg3YWU3ZjNkMTAyNzNjNjRiMDU3ZTY1MzE1MWUyOTBiNzIiLCJ0eXAiOiJKV1QifQ.eyJuYW1lIjoiSXR6IFNlbiIsInBpY3R1cmUiOiJodHRwczovL2xoMy5nb29nbGV1c2VyY29udGVudC5jb20vYS9BQ2c4b2NLOElVZHlzcW5kZkxxNFc5ZWlRNlpjTFpkbUVDX29UNXBVaURGQ2gzY2VDZTZXSGxvWD1zOTYtYyIsImlzcyI6Imh0dHBzOi8vc2VjdXJldG9rZW4uZ29vZ2xlLmNvbS9zZXJ2aS1lNjcwNSIsImF1ZCI6InNlcnZpLWU2NzA1IiwiYXV0aF90aW1lIjoxNzI2ODI1ODEzLCJ1c2VyX2lkIjoiTXBrYkRNT084UFFkZFFnQjVWZ0JRZFRNV0Y1MyIsInN1YiI6Ik1wa2JETU9POFBRZGRRZ0I1VmdCUWRUTVdGNTMiLCJpYXQiOjE3MjY4MjU4MTMsImV4cCI6MTcyNjgyOTQxMywiZW1haWwiOiJ0ZWNobm9wcm9kMjU0NTg1NjVAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsImZpcmViYXNlIjp7ImlkZW50aXRpZXMiOnsiZ29vZ2xlLmNvbSI6WyIxMTQ0Mzk0NjEyOTM5OTE1NzU5MTgiXSwiZW1haWwiOlsidGVjaG5vcHJvZDI1NDU4NTY1QGdtYWl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