mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Appease the linter again
This commit is contained in:
parent
bf6d0d0368
commit
1279784cc7
@ -19,9 +19,9 @@ class import3:
|
|||||||
console.info("Crafty cannot find the path you entered. Does Crafty's user have permission to access it?")
|
console.info("Crafty cannot find the path you entered. Does Crafty's user have permission to access it?")
|
||||||
console.info("Please run the import3 command again and enter a valid path.")
|
console.info("Please run the import3 command again and enter a valid path.")
|
||||||
else:
|
else:
|
||||||
with open (os.path.join(folder, "users.json")) as f:
|
with open (os.path.join(folder, "users.json"), encoding="utf-8") as f:
|
||||||
user_json = json.loads(f.read())
|
user_json = json.loads(f.read())
|
||||||
with open (os.path.join(folder, "mc_settings.json")) as f:
|
with open (os.path.join(folder, "mc_settings.json", encoding="utf-8")) as f:
|
||||||
servers_json = json.loads(f.read())
|
servers_json = json.loads(f.read())
|
||||||
self.import_users(user_json)
|
self.import_users(user_json)
|
||||||
self.import_servers(servers_json, self.controller)
|
self.import_servers(servers_json, self.controller)
|
||||||
@ -43,15 +43,16 @@ class import3:
|
|||||||
# If there is only one server to import json needs to call the data differently
|
# If there is only one server to import json needs to call the data differently
|
||||||
if isinstance(json_data, list):
|
if isinstance(json_data, list):
|
||||||
for server in json_data:
|
for server in json_data:
|
||||||
new_server_id = controller.import_jar_server(server_name=server['server_name'], server_path=server['server_path'], server_jar=server['server_jar'],
|
new_server_id = controller.import_jar_server(server_name=server['server_name'], server_path=server['server_path'],
|
||||||
min_mem=(int(server['memory_min'])/1000), max_mem=(int(server['memory_max'])/1000), port=server['server_port'])
|
server_jar=server['server_jar'], min_mem=(int(server['memory_min'])/1000),
|
||||||
|
max_mem=(int(server['memory_max'])/1000), port=server['server_port'])
|
||||||
console.info(f"Imported server {server['server_name']}[{server['id']}] from Crafty 3 to new server id {new_server_id}")
|
console.info(f"Imported server {server['server_name']}[{server['id']}] from Crafty 3 to new server id {new_server_id}")
|
||||||
logger.info(f"Imported server {server['server_name']}[{server['id']}] from Crafty 3 to new server id {new_server_id}")
|
logger.info(f"Imported server {server['server_name']}[{server['id']}] from Crafty 3 to new server id {new_server_id}")
|
||||||
else:
|
else:
|
||||||
new_server_id = controller.import_jar_server(server_name=json_data['server_name'], server_path=json_data['server_path'], server_jar=json_data['server_jar'],
|
new_server_id = controller.import_jar_server(server_name=json_data['server_name'], server_path=json_data['server_path'],
|
||||||
min_mem=(int(json_data['memory_min'])/1000), max_mem=(int(json_data['memory_max'])/1000), port=json_data['server_port'])
|
server_jar=json_data['server_jar'], min_mem=(int(json_data['memory_min'])/1000),
|
||||||
|
max_mem=(int(json_data['memory_max'])/1000), port=json_data['server_port'])
|
||||||
console.info(f"Imported server {json_data['server_name']}[{json_data['id']}] from Crafty 3 to new server id {new_server_id}")
|
console.info(f"Imported server {json_data['server_name']}[{json_data['id']}] from Crafty 3 to new server id {new_server_id}")
|
||||||
logger.info(f"Imported server {json_data['server_name']}[{json_data['id']}] from Crafty 3 to new server id {new_server_id}")
|
logger.info(f"Imported server {json_data['server_name']}[{json_data['id']}] from Crafty 3 to new server id {new_server_id}")
|
||||||
|
|
||||||
|
|
||||||
import3 = import3()
|
import3 = import3()
|
@ -96,7 +96,7 @@ class PublicHandler(BaseHandler):
|
|||||||
if page == 'login':
|
if page == 'login':
|
||||||
|
|
||||||
next_page = "/public/login"
|
next_page = "/public/login"
|
||||||
if (self.request.query):
|
if self.request.query:
|
||||||
next_page = '/public/login?'+self.request.query
|
next_page = '/public/login?'+self.request.query
|
||||||
|
|
||||||
entered_username = bleach.clean(self.get_argument('username'))
|
entered_username = bleach.clean(self.get_argument('username'))
|
||||||
@ -112,7 +112,7 @@ class PublicHandler(BaseHandler):
|
|||||||
#self.clear_cookie("user")
|
#self.clear_cookie("user")
|
||||||
#self.clear_cookie("user_data")
|
#self.clear_cookie("user_data")
|
||||||
self.clear_cookie("token")
|
self.clear_cookie("token")
|
||||||
if (self.request.query):
|
if self.request.query:
|
||||||
self.redirect(f'/public/login?error_msg={error_msg}&{self.request.query}')
|
self.redirect(f'/public/login?error_msg={error_msg}&{self.request.query}')
|
||||||
else:
|
else:
|
||||||
self.redirect(f'/public/login?error_msg={error_msg}')
|
self.redirect(f'/public/login?error_msg={error_msg}')
|
||||||
@ -124,7 +124,7 @@ class PublicHandler(BaseHandler):
|
|||||||
#self.clear_cookie("user")
|
#self.clear_cookie("user")
|
||||||
#self.clear_cookie("user_data")
|
#self.clear_cookie("user_data")
|
||||||
self.clear_cookie("token")
|
self.clear_cookie("token")
|
||||||
if (self.request.query):
|
if self.request.query:
|
||||||
self.redirect(f'/public/login?error_msg={error_msg}&{self.request.query}')
|
self.redirect(f'/public/login?error_msg={error_msg}&{self.request.query}')
|
||||||
else:
|
else:
|
||||||
self.redirect(f'/public/login?error_msg={error_msg}')
|
self.redirect(f'/public/login?error_msg={error_msg}')
|
||||||
@ -160,7 +160,7 @@ class PublicHandler(BaseHandler):
|
|||||||
error_msg = "Inncorrect username or password. Please try again."
|
error_msg = "Inncorrect username or password. Please try again."
|
||||||
# log this failed login attempt
|
# log this failed login attempt
|
||||||
self.controller.management.add_to_audit_log(user_data.user_id, "Tried to log in", 0, self.get_remote_ip())
|
self.controller.management.add_to_audit_log(user_data.user_id, "Tried to log in", 0, self.get_remote_ip())
|
||||||
if (self.request.query):
|
if self.request.query:
|
||||||
self.redirect(f'/public/login?error_msg={error_msg}&{self.request.query}')
|
self.redirect(f'/public/login?error_msg={error_msg}&{self.request.query}')
|
||||||
else:
|
else:
|
||||||
self.redirect(f'/public/login?error_msg={error_msg}')
|
self.redirect(f'/public/login?error_msg={error_msg}')
|
||||||
|
Loading…
Reference in New Issue
Block a user