final changes for windows path issues

This commit is contained in:
Andrew 2022-01-19 15:14:56 -05:00
parent e7f51ce65a
commit 6f860e967c
2 changed files with 28 additions and 0 deletions

View File

@ -904,7 +904,13 @@ class PanelHandler(BaseHandler):
server_obj = self.controller.servers.get_server_obj(server_id)
if superuser:
server_path = self.get_argument('server_path', None)
if helper.is_os_windows():
server_path = helper.wtol_path(server_path)
server_path.replace(' ', '^ ')
log_path = self.get_argument('log_path', None)
if helper.is_os_windows():
log_path = helper.wtol_path(log_path)
log_path.replace(' ', '^ ')
executable = self.get_argument('executable', None)
execution_command = self.get_argument('execution_command', None)
server_ip = self.get_argument('server_ip', None)
@ -973,6 +979,9 @@ class PanelHandler(BaseHandler):
server_obj = self.controller.servers.get_server_obj(server_id)
if superuser:
backup_path = bleach.clean(self.get_argument('backup_path', None))
if helper.is_os_windows():
backup_path = helper.wtol_path(backup_path)
backup_path.replace(' ', '^ ')
else:
backup_path = server_obj.backup_path
max_backups = bleach.clean(self.get_argument('max_backups', None))

View File

@ -9,6 +9,8 @@ from app.classes.web.base_handler import BaseHandler
from app.classes.models.crafty_permissions import Enum_Permissions_Crafty
from app.classes.minecraft.serverjars import server_jar_obj
from app.classes.shared.helpers import helper
import libgravatar
import requests
logger = logging.getLogger(__name__)
@ -81,6 +83,23 @@ class ServerHandler(BaseHandler):
} if api_key is not None else None,
'superuser': superuser
}
if helper.get_setting("allow_nsfw_profile_pictures"):
rating = "x"
else:
rating = "g"
if exec_user['email'] != 'default@example.com' or "":
g = libgravatar.Gravatar(libgravatar.sanitize_email(exec_user['email']))
url = g.get_image(size=80, default="404", force_default=False, rating=rating, filetype_extension=False, use_ssl=True) # + "?d=404"
if requests.head(url).status_code != 404:
profile_url = url
else:
profile_url = "/static/assets/images/faces-clipart/pic-3.png"
else:
profile_url = "/static/assets/images/faces-clipart/pic-3.png"
page_data['user_image'] = profile_url
if superuser:
page_data['roles'] = list_roles