2024-09-11 02:15:56 +00:00
|
|
|
import os
|
2024-09-13 02:00:51 +00:00
|
|
|
import shutil
|
2024-09-20 13:54:41 +00:00
|
|
|
|
2024-07-09 17:40:18 +00:00
|
|
|
import firebase_manager
|
|
|
|
|
|
|
|
|
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-26 10:04:35 +00:00
|
|
|
users_ref = firebase_manager.firestore_database.collection('users')
|
|
|
|
|
|
|
|
# Stream all documents in the users collection
|
|
|
|
users = users_ref.stream()
|
|
|
|
|
|
|
|
# Iterate over each user document
|
|
|
|
for user in users:
|
|
|
|
# Update each document to add the 'subscription' field
|
|
|
|
user_ref = users_ref.document(user.id)
|
|
|
|
user_ref.update({'subscription': 0})
|
2024-09-13 02:00:51 +00:00
|
|
|
pass
|