rework on player restriction , exposing rest apis

This commit is contained in:
Ayush Saini 2023-06-19 21:58:35 +05:30
parent af7fb5a586
commit bf4c01c291
10 changed files with 883 additions and 361 deletions

View file

@ -1,8 +1,37 @@
# Released under the MIT License. See LICENSE for details.
clients={}
cachedclients=[]
muted=False
coopmode=False
ips={}
recents=[]
import fcntl
import _ba
import os
clients = {}
cachedclients = []
muted = False
coopmode = False
ips = {}
recents = []
SERVER_DATA_PATH = os.path.join(
_ba.env()["python_directory_user"], "serverData" + os.sep
)
def get_stats_index():
return [x for x in os.listdir(SERVER_DATA_PATH) if "log" in x]
def read_logs(filename):
file_path = SERVER_DATA_PATH+filename
if not os.path.exists(file_path):
return ""
file = open(file_path, "r")
fcntl.flock(file.fileno(), fcntl.LOCK_SH)
contents = ""
try:
contents = file.read()
finally:
fcntl.flock(file.fileno(), fcntl.LOCK_UN)
file.close()
return contents