diff --git a/src/main.go b/src/main.go index ee6c008..10d5a19 100644 --- a/src/main.go +++ b/src/main.go @@ -17,6 +17,7 @@ import ( "log/slog" "mime/multipart" "net/http" + "net/url" "os" "os/signal" "path/filepath" @@ -312,25 +313,23 @@ func UploadFile(file *multipart.FileHeader, fileName, contentType string, c fibe // if there *is* exif, parse it if err == nil { tag, err := x.Get(exif.Orientation) - if err != nil { - return "", fmt.Errorf("failed to get orientation: %v", err) - } + if err == nil { + if tag.Count == 1 && tag.Format() == tiff.IntVal { + orientation, err := tag.Int(0) + if err != nil { + return "", fmt.Errorf("failed to get orientation: %v", err) + } - if tag.Count == 1 && tag.Format() == tiff.IntVal { - orientation, err := tag.Int(0) - if err != nil { - return "", fmt.Errorf("failed to get orientation: %v", err) - } + slog.Debug("Orientation tag found", "orientation", orientation) - slog.Debug("Orientation tag found", "orientation", orientation) - - switch orientation { - case 3: - img = imaging.Rotate180(img) - case 6: - img = imaging.Rotate270(img) - case 8: - img = imaging.Rotate90(img) + switch orientation { + case 3: + img = imaging.Rotate180(img) + case 6: + img = imaging.Rotate270(img) + case 8: + img = imaging.Rotate90(img) + } } } } @@ -381,7 +380,7 @@ func UploadFile(file *multipart.FileHeader, fileName, contentType string, c fibe } } - iconPath = "/uploads/" + fileName + iconPath = "/uploads/" + url.PathEscape(fileName) return iconPath, nil } diff --git a/src/styles/main.scss b/src/styles/main.scss index 1828323..2ebfdd7 100644 --- a/src/styles/main.scss +++ b/src/styles/main.scss @@ -84,6 +84,7 @@ input:not(.search) { transition-duration: 150ms; transition-timing-function: cubic-bezier(0.45, 0, 0.55, 1); box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); + contain: layout style paint; &:not(.admin) { &:hover { @@ -113,12 +114,12 @@ input:not(.search) { } /* Div that holds the image */ -.link-card div:has(img):first-child { +.link-card div[data-img-container] { flex-shrink: 0; margin-right: 0.5rem; } -.link-card div:first-child img { +.link-card div[data-img-container] img { user-select: none; border-radius: 0.375rem; aspect-ratio: 1/1; @@ -126,10 +127,33 @@ input:not(.search) { } /* Div that holds the text */ -.link-card div:nth-child(2) { +.link-card div[data-text-container] { word-break: break-all; } -.link-card div:nth-child(2) p { +.link-card div[data-text-container] p { color: var(--color-subtle); +} + + +.categoy-header { + display: flex; + align-items: center; +} + +.category-header div[data-img-container] { + @apply shrink-0 relative mr-2 h-full flex items-center justify-center size-8; +} + +.categoy-header div[data-img-container] img { + user-select: none; + object-fit: cover; + aspect-ratio: 1/1; +} + +.category-header h2 { + text-transform: capitalize; + word-break: break-all; + border-width: 1px; + border-color: #0000; } \ No newline at end of file diff --git a/src/templates/views/admin/index.hbs b/src/templates/views/admin/index.hbs index c4b3e74..e12308d 100644 --- a/src/templates/views/admin/index.hbs +++ b/src/templates/views/admin/index.hbs @@ -17,24 +17,14 @@
{{#each Categories}} -
-
- {{this.Name}} - +
+
+ {{this.Name}}
-

{{this.Name}}

+

{{this.Name}}

-
- -
- -
+

{{this.Name}}

-

{{this.Description}}

+ +

{{this.Description}}

-
- -
-
{{/each}} -
+
@@ -179,6 +158,91 @@
+ + + + + + + + + + diff --git a/src/templates/views/index.hbs b/src/templates/views/index.hbs index 0e35309..dceb7a9 100644 --- a/src/templates/views/index.hbs +++ b/src/templates/views/index.hbs @@ -76,17 +76,17 @@