diff --git a/handler/routes.go b/handler/routes.go index 2e004e1..819d683 100644 --- a/handler/routes.go +++ b/handler/routes.go @@ -52,7 +52,12 @@ func Favicon(db store.IStore) echo.HandlerFunc { func BrandLogo(db store.IStore) echo.HandlerFunc { return func(c echo.Context) error { - _, err := os.OpenFile(path.Join(db.GetPath(), "branding")+"/logo.png", os.O_RDONLY, 0777) + _, err := os.OpenFile(path.Join(db.GetPath(), "branding")+"/logo.svg", os.O_RDONLY, 0777) + if err == nil { + return c.File(path.Join(db.GetPath(), "branding") + "/logo.svg") + } + + _, err = os.OpenFile(path.Join(db.GetPath(), "branding")+"/logo.png", os.O_RDONLY, 0777) if err == nil { return c.File(path.Join(db.GetPath(), "branding") + "/logo.png") } diff --git a/templates/branding_settings.html b/templates/branding_settings.html index 02443d0..c43d526 100644 --- a/templates/branding_settings.html +++ b/templates/branding_settings.html @@ -26,7 +26,7 @@ Branding Settings -
+
@@ -48,7 +48,7 @@ Branding Settings
@@ -80,10 +80,12 @@ Branding Settings
1. Favicon
Formats accepted: .ico
+
Maximum file size: 5Mb.
Optional - leave blank or clear to continue using current favicon.
2. Brand logo
The logo, displayed in the upper left corner.
-
Formats accepted: .png, .jpg, .jpeg, .gif, .ico
+
Formats accepted: .svg, .png, .jpg, .jpeg, .gif, .ico
+
Maximum file size: 10Mb.
Optional - leave blank or clear to continue using current brand logo.
3. Brand name
The name, displayed in the upper left corner.
@@ -110,12 +112,29 @@ Branding Settings var count = 1; if (typeof document.getElementById("favicon_input").files[0] !== 'undefined') { - readFile(data, 'favicon', "favicon_input"); - count++; + const faviconSize = document.getElementById("favicon_input").files[0].size / 1024 ** 2; + if(faviconSize<=5) { + readFile(data, 'favicon', "favicon_input"); + count++; + } else { + toastr.error("Favicon size is bigger than 5Mb."); + document.getElementById("favicon_input").value = null; + $("#favicon").val($("#favicon_input").val()); + return false; + } + } if (typeof document.getElementById("brand_logo_input").files[0] !== 'undefined') { - readFile(data, 'logo', "brand_logo_input"); - count++; + const logoSize = document.getElementById("brand_logo_input").files[0].size / 1024 ** 2; + if(logoSize<=10) { + readFile(data, 'logo', "brand_logo_input"); + count++; + } else { + toastr.error("Brand logo size is bigger than 10Mb."); + document.getElementById("brand_logo_input").value =null; + $("#brand_logo").val($("#brand_logo_input").val()); + return; + } } function waitForRead() {