From aa78e3ab1fcae6f618e811ba4e315a7a209f9df2 Mon Sep 17 00:00:00 2001 From: Oleg Lobanov Date: Thu, 23 Jul 2020 12:38:03 +0200 Subject: [PATCH] feat: add param to disable img resizing --- cmd/root.go | 8 +++++ frontend/src/components/files/ListingItem.vue | 7 +++-- frontend/src/utils/constants.js | 4 ++- http/http.go | 3 +- http/preview.go | 29 +++++++++---------- http/static.go | 1 + settings/settings.go | 18 +++++++----- 7 files changed, 42 insertions(+), 28 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index d65d7bf1..2cfb3373 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -59,6 +59,8 @@ func addServerFlags(flags *pflag.FlagSet) { flags.String("socket", "", "socket to listen to (cannot be used with address, port, cert nor key flags)") flags.StringP("baseurl", "b", "", "base url") flags.Int("img-processors", 4, "image processors count") + flags.Bool("disable-thumbnails", false, "disable image thumbnails") + flags.Bool("disable-preview-resize", false, "disable resize of image previews") } var rootCmd = &cobra.Command{ @@ -216,6 +218,12 @@ func getRunParams(flags *pflag.FlagSet, st *storage.Storage) *settings.Server { server.Socket = "" } + _, disableThumbnails := getParamB(flags, "disable-thumbnails") + server.EnableThumbnails = !disableThumbnails + + _, disablePreviewResize := getParamB(flags, "disable-preview-resize") + server.ResizePreview = !disablePreviewResize + return server } diff --git a/frontend/src/components/files/ListingItem.vue b/frontend/src/components/files/ListingItem.vue index 3103a94a..f7a5f85b 100644 --- a/frontend/src/components/files/ListingItem.vue +++ b/frontend/src/components/files/ListingItem.vue @@ -13,7 +13,7 @@ :aria-label="name" :aria-selected="isSelected">
- + {{ icon }}
@@ -31,7 +31,7 @@