Add custom images for logos

This commit is contained in:
Andrew 2024-08-30 09:45:34 -04:00
parent d145dd595b
commit 78c6e7950a
5 changed files with 10 additions and 7 deletions

1
.gitignore vendored
View File

@ -21,6 +21,7 @@ venv.bak/
/import/ /import/
/imports/ /imports/
/servers/ /servers/
/app/frontend/static/assets/images/custom/
/app/frontend/static/assets/images/auth/custom/ /app/frontend/static/assets/images/auth/custom/
/backups/ /backups/
/temp/ /temp/

View File

@ -905,13 +905,13 @@ class PanelHandler(BaseHandler):
self.helper.ensure_dir_exists( self.helper.ensure_dir_exists(
os.path.join( os.path.join(
self.controller.project_root, self.controller.project_root,
"app/frontend/static/assets/images/auth/custom", "app/frontend/static/assets/images/custom",
) )
) )
for item in os.listdir( for item in os.listdir(
os.path.join( os.path.join(
self.controller.project_root, self.controller.project_root,
"app/frontend/static/assets/images/auth/custom", "app/frontend/static/assets/images/custom",
) )
): ):
if item not in page_data["backgrounds"]: if item not in page_data["backgrounds"]:

View File

@ -39,8 +39,10 @@ config_json_schema = {
customize_json_schema = { customize_json_schema = {
"type": "object", "type": "object",
"properties": { "properties": {
"photo": {"type": "string"}, "bg_photo": {"type": "string"},
"opacity": {"type": "string"}, "bg_opacity": {"type": "string"},
"logo_long": {"type": "string"},
"logo_square": {"type" "string"},
}, },
"additionalProperties": False, "additionalProperties": False,
"minProperties": 1, "minProperties": 1,
@ -302,7 +304,7 @@ class ApiCraftyCustomizeIndexHandler(BaseApiHandler):
FileHelpers.del_file( FileHelpers.del_file(
os.path.join( os.path.join(
self.controller.project_root, self.controller.project_root,
f"app/frontend/static/assets/images/auth/custom/{data['photo']}", f"app/frontend/static/assets/images/custom/{data['photo']}",
) )
) )
current = self.controller.cached_login current = self.controller.cached_login

View File

@ -69,7 +69,7 @@ class ApiFilesUploadHandler(BaseApiHandler):
u_type = "admin_config" u_type = "admin_config"
self.upload_dir = os.path.join( self.upload_dir = os.path.join(
self.controller.project_root, self.controller.project_root,
"app/frontend/static/assets/images/auth/custom", "app/frontend/static/assets/images/custom",
) )
accepted_types = IMAGE_MIME_TYPES accepted_types = IMAGE_MIME_TYPES
elif upload_type == "import": elif upload_type == "import":

View File

@ -377,7 +377,7 @@
var src_path = "../../static/assets/images/auth/".concat($("#photo").val()); var src_path = "../../static/assets/images/auth/".concat($("#photo").val());
} }
else { else {
var src_path = "../../static/assets/images/auth/custom/".concat($("#photo").val()); var src_path = "../../static/assets/images/custom/".concat($("#photo").val());
} }
img.src = src_path; img.src = src_path;
} }