diff --git a/api_sender.html b/api_sender.html index 05ce61b..be7275f 100644 --- a/api_sender.html +++ b/api_sender.html @@ -100,7 +100,7 @@ document.addEventListener('DOMContentLoaded', () => { }); function sendRequest(endpoint, payload) { - return fetch(`http://127.0.0.1:3000/${endpoint}`, { + return fetch(`https://www.servii.fr/api/${endpoint}`, { method: 'POST', headers: { 'Content-Type': 'application/json' diff --git a/unit_test.py b/unit_test.py index 69acaf4..148dcd8 100644 --- a/unit_test.py +++ b/unit_test.py @@ -1,42 +1,14 @@ import file_manager import firebase_manager -db = firebase_manager.firestore_database -users = firebase_manager.auth.list_users().users +def ban_user(user_id: str): + try: + firebase_manager.auth.update_user(user_id, disabled=False) + print("Banned : "+user_id) + except Exception as e: + print("Error banning user "+user_id, "|", str(e), type(e).__name__) -def create_properties_collection(uid, name): - """Create properties collection for a specific server of a user.""" - properties = { - "difficulty": "easy", - "gamemode": "survival", - "force-gamemode": False, - "hardcore": False, - "generate-structures": True, - "motd": "A Minecraft Server", - "pvp": True, - "online-mode": True, - "max-players": 20, - "enable-command-block": False - } - - doc_ref = db.document(f'users/{uid}/servers/{name}') - #doc_ref.set(properties) - doc_ref.delete() - - -def get_servers(uid): - servers_ref = db.collection(f'users/{uid}/servers').stream() - servers_names = [doc.id for doc in servers_ref] - return servers_names - - -if __name__ == 'voituredecourse': - for user in users: - user_id = user.uid - servers = get_servers(user_id) - for server_id in servers: - create_properties_collection(user_id, server_id) if __name__ == '__main__': - print(file_manager.kebab_to_camel_case("enable-command-block")) + ban_user("MpkbDMOO8PQddQgB5VgBQdTMWF53")