Compare commits

...

3 Commits

Author SHA1 Message Date
Seednode 172fc38f18 Replace copied-in tzinfo database with -tags timetzdata 2024-01-19 14:56:40 -06:00
Seednode e394824ae5 Changed --case-sensitive to --case-insensitive 2024-01-19 14:43:08 -06:00
Seednode 993be0bb7a Changed --case-sensitive to --case-insensitive 2024-01-19 14:39:53 -06:00
6 changed files with 46 additions and 61 deletions

View File

@ -44,8 +44,6 @@ The restricted paths are:
While this might thwart very basic attacks, the proper solution for most use cases would likely be to add authentication via a reverse proxy. While this might thwart very basic attacks, the proper solution for most use cases would likely be to add authentication via a reverse proxy.
If the `--redact` flag is passed, references to the admin prefix will be redacted in log output.
## Filtering ## Filtering
You can provide a comma-delimited string of alphanumeric patterns to match via the `include=` query parameter, assuming the `-f|--filter` flag is enabled. You can provide a comma-delimited string of alphanumeric patterns to match via the `include=` query parameter, assuming the `-f|--filter` flag is enabled.
@ -152,10 +150,10 @@ Flags:
--audio enable support for audio files --audio enable support for audio files
--binary-prefix use IEC binary prefixes instead of SI decimal prefixes --binary-prefix use IEC binary prefixes instead of SI decimal prefixes
-b, --bind string address to bind to (default "0.0.0.0") -b, --bind string address to bind to (default "0.0.0.0")
--case-sensitive use case-sensitive matching for filters --case-insensitive use case-insensitive matching for filters
--code enable support for source code files --code enable support for source code files
--code-theme string theme for source code syntax highlighting (default "solarized-dark256") --code-theme string theme for source code syntax highlighting (default "solarized-dark256")
--concurrency int maximum concurrency for scan threads (default 2147483647) --concurrency int maximum concurrency for scan threads (default 1024)
-d, --debug display even more verbose logs -d, --debug display even more verbose logs
--disable-buttons disable first/prev/next/last buttons --disable-buttons disable first/prev/next/last buttons
--exit-on-error shut down webserver on error, instead of just printing error --exit-on-error shut down webserver on error, instead of just printing error
@ -165,7 +163,7 @@ Flags:
--fun add a bit of excitement to your day --fun add a bit of excitement to your day
-h, --help help for roulette -h, --help help for roulette
--ignore skip all directories containing a specified filename --ignore skip all directories containing a specified filename
--ignore-file string filename used to indicate directory to be skipped (default ".roulette-ignore") --ignore-file string filename used to indicate directory should be skipped (default ".roulette-ignore")
--images enable support for image files --images enable support for image files
--index generate index of supported file paths at startup --index generate index of supported file paths at startup
--index-file string path to optional persistent index file --index-file string path to optional persistent index file
@ -176,7 +174,6 @@ Flags:
--prefix string root path for http handlers (for reverse proxying) (default "/") --prefix string root path for http handlers (for reverse proxying) (default "/")
--profile register net/http/pprof handlers --profile register net/http/pprof handlers
-r, --recursive recurse into subdirectories -r, --recursive recurse into subdirectories
--redact redact admin prefix in log output
--refresh enable automatic page refresh via query parameter --refresh enable automatic page refresh via query parameter
--russian remove selected images after serving --russian remove selected images after serving
-s, --sort enable sorting -s, --sort enable sorting

View File

@ -52,5 +52,5 @@ for platform in "${platforms[@]}"; do
if [ "${GOOS}" == "windows" ]; then if [ "${GOOS}" == "windows" ]; then
output_name+=".exe" output_name+=".exe"
fi fi
env GOOS="${GOOS}" GOARCH="${GOARCH}" CC="musl-gcc" CGO_ENABLED=0 go build -trimpath -ldflags "${ld_flags}" -o "builds/${output_name}" env GOOS="${GOOS}" GOARCH="${GOARCH}" CC="musl-gcc" CGO_ENABLED=0 go build -trimpath -ldflags "${ld_flags}" -tags timetzdata -o "builds/${output_name}"
done done

View File

@ -45,7 +45,7 @@ func (filters *filters) apply(fileList []string) []string {
p := filepath.Base(s) p := filepath.Base(s)
for _, exclude := range filters.excluded { for _, exclude := range filters.excluded {
if (CaseSensitive && strings.Contains(p, exclude)) || (!CaseSensitive && strings.Contains(strings.ToLower(p), strings.ToLower(exclude))) { if (!CaseInsensitive && strings.Contains(p, exclude)) || (CaseInsensitive && strings.Contains(strings.ToLower(p), strings.ToLower(exclude))) {
return true return true
} }
} }
@ -59,7 +59,7 @@ func (filters *filters) apply(fileList []string) []string {
p := filepath.Base(s) p := filepath.Base(s)
for _, include := range filters.included { for _, include := range filters.included {
if (CaseSensitive && strings.Contains(p, include)) || (!CaseSensitive && strings.Contains(strings.ToLower(p), strings.ToLower(include))) { if (!CaseInsensitive && strings.Contains(p, include)) || (CaseInsensitive && strings.Contains(strings.ToLower(p), strings.ToLower(include))) {
return false return false
} }
} }

View File

@ -17,46 +17,46 @@ import (
const ( const (
AllowedCharacters string = `^[A-z0-9.\-_]+$` AllowedCharacters string = `^[A-z0-9.\-_]+$`
ReleaseVersion string = "6.1.1" ReleaseVersion string = "6.3.0"
) )
var ( var (
AdminPrefix string AdminPrefix string
All bool All bool
AllowEmpty bool AllowEmpty bool
Audio bool Audio bool
BinaryPrefix bool BinaryPrefix bool
Bind string Bind string
CaseSensitive bool CaseInsensitive bool
Code bool Code bool
CodeTheme string CodeTheme string
Concurrency int Concurrency int
Debug bool Debug bool
DisableButtons bool DisableButtons bool
ExitOnError bool ExitOnError bool
Fallback bool Fallback bool
Filtering bool Filtering bool
Flash bool Flash bool
Fun bool Fun bool
Ignore bool Ignore bool
IgnoreFile string IgnoreFile string
Images bool Images bool
Index bool Index bool
IndexFile string IndexFile string
Info bool Info bool
MaxFileCount int MaxFileCount int
MinFileCount int MinFileCount int
Port int Port int
Prefix string Prefix string
Profile bool Profile bool
Recursive bool Recursive bool
Refresh bool Refresh bool
Russian bool Russian bool
Sorting bool Sorting bool
Text bool Text bool
Verbose bool Verbose bool
Version bool Version bool
Videos bool Videos bool
RequiredArgs = []string{ RequiredArgs = []string{
"all", "all",
@ -120,7 +120,7 @@ func init() {
rootCmd.Flags().BoolVar(&Audio, "audio", false, "enable support for audio files") rootCmd.Flags().BoolVar(&Audio, "audio", false, "enable support for audio files")
rootCmd.Flags().BoolVar(&BinaryPrefix, "binary-prefix", false, "use IEC binary prefixes instead of SI decimal prefixes") rootCmd.Flags().BoolVar(&BinaryPrefix, "binary-prefix", false, "use IEC binary prefixes instead of SI decimal prefixes")
rootCmd.Flags().StringVarP(&Bind, "bind", "b", "0.0.0.0", "address to bind to") rootCmd.Flags().StringVarP(&Bind, "bind", "b", "0.0.0.0", "address to bind to")
rootCmd.Flags().BoolVar(&CaseSensitive, "case-sensitive", false, "use case-sensitive matching for filters") rootCmd.Flags().BoolVar(&CaseInsensitive, "case-insensitive", false, "use case-insensitive matching for filters")
rootCmd.Flags().BoolVar(&Code, "code", false, "enable support for source code files") rootCmd.Flags().BoolVar(&Code, "code", false, "enable support for source code files")
rootCmd.Flags().StringVar(&CodeTheme, "code-theme", "solarized-dark256", "theme for source code syntax highlighting") rootCmd.Flags().StringVar(&CodeTheme, "code-theme", "solarized-dark256", "theme for source code syntax highlighting")
rootCmd.Flags().IntVar(&Concurrency, "concurrency", 1024, "maximum concurrency for scan threads") rootCmd.Flags().IntVar(&Concurrency, "concurrency", 1024, "maximum concurrency for scan threads")

View File

@ -18,7 +18,7 @@ ARG TARGETOS TARGETARCH
RUN CGO_ENABLED=0 \ RUN CGO_ENABLED=0 \
GOOS=$TARGETOS \ GOOS=$TARGETOS \
GOARCH=$TARGETARCH \ GOARCH=$TARGETARCH \
go build -trimpath -ldflags "-s -w" -o $app \ go build -trimpath -ldflags "-s -w" -tags timetzdata -o $app \
&& upx --best --lzma $app \ && upx --best --lzma $app \
&& chmod 500 $app && chmod 500 $app
@ -35,12 +35,6 @@ USER nonroot
# copy in binary # copy in binary
COPY --from=build --chown=root:root --chmod=0005 /src/$app/$app /$app COPY --from=build --chown=root:root --chmod=0005 /src/$app/$app /$app
# copy in time zone info
COPY --from=build --chown=root:root --chmod=0004 /usr/local/go/lib/time/zoneinfo.zip /
# load time zone info
ENV ZONEINFO=/zoneinfo.zip
# listen on an unprivileged port # listen on an unprivileged port
EXPOSE 8080 EXPOSE 8080

View File

@ -18,7 +18,7 @@ ARG TARGETOS TARGETARCH
RUN CGO_ENABLED=0 \ RUN CGO_ENABLED=0 \
GOOS=$TARGETOS \ GOOS=$TARGETOS \
GOARCH=$TARGETARCH \ GOARCH=$TARGETARCH \
go build -trimpath -ldflags "-s -w" -o $app \ go build -trimpath -ldflags "-s -w" -tags timetzdata -o $app \
&& upx --best --lzma $app \ && upx --best --lzma $app \
&& chmod 500 $app && chmod 500 $app
@ -35,12 +35,6 @@ USER root
# copy in binary # copy in binary
COPY --from=build --chown=root:root --chmod=0005 /src/$app/$app /$app COPY --from=build --chown=root:root --chmod=0005 /src/$app/$app /$app
# copy in time zone info
COPY --from=build --chown=root:root --chmod=0004 /usr/local/go/lib/time/zoneinfo.zip /
# load time zone info
ENV ZONEINFO=/zoneinfo.zip
# listen on an unprivileged port # listen on an unprivileged port
EXPOSE 8080 EXPOSE 8080