diff --git a/cmd/root.go b/cmd/root.go index c2d70db..7aed9e5 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -12,7 +12,7 @@ import ( ) const ( - Version string = "0.69.0" + Version string = "0.69.1" ) var ( diff --git a/cmd/web.go b/cmd/web.go index 900d19e..cfb9e22 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -266,7 +266,7 @@ func serveMedia(paths []string, Regexes *Regexes, index *Index, registeredFormat htmlBody.WriteString(`a{color:inherit;display:block;height:100%;width:100%;text-decoration:none;}`) htmlBody.WriteString(`img{margin:auto;display:block;max-width:97%;max-height:97%;object-fit:scale-down;`) htmlBody.WriteString(`position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);}`) - htmlBody.WriteString((fileType.Css(queryParams, fileUri, filePath, fileName, mimeType))) + htmlBody.WriteString(fileType.Css) htmlBody.WriteString(``) htmlBody.WriteString((fileType.Title(queryParams, fileUri, filePath, fileName, mimeType))) htmlBody.WriteString(``) diff --git a/formats/audio.go b/formats/audio.go index 7b90d17..db4acc4 100644 --- a/formats/audio.go +++ b/formats/audio.go @@ -10,9 +10,7 @@ import ( func RegisterAudioFormats() *SupportedFormat { return &SupportedFormat{ - Css: func(queryParams, fileUri, filePath, fileName, mime string) string { - return `` - }, + Css: ``, Title: func(queryParams, fileUri, filePath, fileName, mime string) string { return fmt.Sprintf(`%s`, fileName) }, diff --git a/formats/images.go b/formats/images.go index 0ef1931..5ca3e3a 100644 --- a/formats/images.go +++ b/formats/images.go @@ -24,9 +24,7 @@ type Dimensions struct { func RegisterImageFormats() *SupportedFormat { return &SupportedFormat{ - Css: func(queryParams, fileUri, filePath, fileName, mime string) string { - return `` - }, + Css: ``, Title: func(queryParams, fileUri, filePath, fileName, mime string) string { dimensions, err := ImageDimensions(filePath) if err != nil { diff --git a/formats/text.go b/formats/text.go index 64ee81e..7906f65 100644 --- a/formats/text.go +++ b/formats/text.go @@ -13,9 +13,7 @@ import ( func RegisterTextFormats() *SupportedFormat { return &SupportedFormat{ - Css: func(queryParams, fileUri, filePath, fileName, mime string) string { - return `pre{margin:.5rem;}` - }, + Css: `pre{margin:.5rem;}`, Title: func(queryParams, fileUri, filePath, fileName, mime string) string { return fmt.Sprintf(`%s`, fileName) }, diff --git a/formats/types.go b/formats/types.go index 579dcbf..d27e0c4 100644 --- a/formats/types.go +++ b/formats/types.go @@ -10,16 +10,13 @@ import ( "os" ) -type FormatFunction func(queryParams, fileUri, filePath, fileName, mime string) string -type ValidateFunction func(filePath string) bool - type SupportedFormat struct { - Css FormatFunction - Title FormatFunction - Body FormatFunction + Css string + Title func(queryParams, fileUri, filePath, fileName, mime string) string + Body func(queryParams, fileUri, filePath, fileName, mime string) string Extensions []string MimeTypes []string - Validate ValidateFunction + Validate func(filePath string) bool } type SupportedFormats struct { diff --git a/formats/video.go b/formats/video.go index d7565f4..e6f18e9 100644 --- a/formats/video.go +++ b/formats/video.go @@ -10,9 +10,7 @@ import ( func RegisterVideoFormats() *SupportedFormat { return &SupportedFormat{ - Css: func(queryParams, fileUri, filePath, fileName, mime string) string { - return `` - }, + Css: ``, Title: func(queryParams, fileUri, filePath, fileName, mime string) string { return fmt.Sprintf(`%s`, fileName) },