mirror of
https://github.com/hubHarmony/servii-backend.git
synced 2024-11-18 05:50:31 +00:00
15059a7063
Created a subscription system, and added different permission levels to the users depending on their subscription
45 lines
1.5 KiB
Python
45 lines
1.5 KiB
Python
import os
|
|
import shutil
|
|
|
|
import firebase_manager
|
|
from firebase_manager import firestore_database
|
|
|
|
|
|
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 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)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
#ban_user("MpkbDMOO8PQddQgB5VgBQdTMWF53")
|
|
#file_manager.log_action("gqZN3eCHF3V2er3Py3rlgk8u2t83", "test", "DeleteServer")
|
|
#firebase_manager.set_servers_not_running()
|
|
#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")
|
|
'''
|
|
print(firebase_manager.get_user_from_mail("technoprod25458565@gmail.com"))
|
|
print(firebase_manager.get_user_field("MpkbDMOO8PQddQgB5VgBQdTMWF53", "test"))
|
|
pass
|