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.
If the `--redact` flag is passed, references to the admin prefix will be redacted in log output.
## 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.
@ -152,10 +150,10 @@ Flags:
--audio enable support for audio files
--binary-prefix use IEC binary prefixes instead of SI decimal prefixes
-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-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
--disable-buttons disable first/prev/next/last buttons
--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
-h, --help help for roulette
--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
--index generate index of supported file paths at startup
--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 "/")
--profile register net/http/pprof handlers
-r, --recursive recurse into subdirectories
--redact redact admin prefix in log output
--refresh enable automatic page refresh via query parameter
--russian remove selected images after serving
-s, --sort enable sorting

View File

@ -52,5 +52,5 @@ for platform in "${platforms[@]}"; do
if [ "${GOOS}" == "windows" ]; then
output_name+=".exe"
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

View File

@ -45,7 +45,7 @@ func (filters *filters) apply(fileList []string) []string {
p := filepath.Base(s)
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
}
}
@ -59,7 +59,7 @@ func (filters *filters) apply(fileList []string) []string {
p := filepath.Base(s)
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
}
}

View File

@ -17,46 +17,46 @@ import (
const (
AllowedCharacters string = `^[A-z0-9.\-_]+$`
ReleaseVersion string = "6.1.1"
ReleaseVersion string = "6.3.0"
)
var (
AdminPrefix string
All bool
AllowEmpty bool
Audio bool
BinaryPrefix bool
Bind string
CaseSensitive bool
Code bool
CodeTheme string
Concurrency int
Debug bool
DisableButtons bool
ExitOnError bool
Fallback bool
Filtering bool
Flash bool
Fun bool
Ignore bool
IgnoreFile string
Images bool
Index bool
IndexFile string
Info bool
MaxFileCount int
MinFileCount int
Port int
Prefix string
Profile bool
Recursive bool
Refresh bool
Russian bool
Sorting bool
Text bool
Verbose bool
Version bool
Videos bool
AdminPrefix string
All bool
AllowEmpty bool
Audio bool
BinaryPrefix bool
Bind string
CaseInsensitive bool
Code bool
CodeTheme string
Concurrency int
Debug bool
DisableButtons bool
ExitOnError bool
Fallback bool
Filtering bool
Flash bool
Fun bool
Ignore bool
IgnoreFile string
Images bool
Index bool
IndexFile string
Info bool
MaxFileCount int
MinFileCount int
Port int
Prefix string
Profile bool
Recursive bool
Refresh bool
Russian bool
Sorting bool
Text bool
Verbose bool
Version bool
Videos bool
RequiredArgs = []string{
"all",
@ -120,7 +120,7 @@ func init() {
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().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().StringVar(&CodeTheme, "code-theme", "solarized-dark256", "theme for source code syntax highlighting")
rootCmd.Flags().IntVar(&Concurrency, "concurrency", 1024, "maximum concurrency for scan threads")

View File

@ -18,7 +18,7 @@ ARG TARGETOS TARGETARCH
RUN CGO_ENABLED=0 \
GOOS=$TARGETOS \
GOARCH=$TARGETARCH \
go build -trimpath -ldflags "-s -w" -o $app \
go build -trimpath -ldflags "-s -w" -tags timetzdata -o $app \
&& upx --best --lzma $app \
&& chmod 500 $app
@ -35,12 +35,6 @@ USER nonroot
# copy in binary
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
EXPOSE 8080

View File

@ -18,7 +18,7 @@ ARG TARGETOS TARGETARCH
RUN CGO_ENABLED=0 \
GOOS=$TARGETOS \
GOARCH=$TARGETARCH \
go build -trimpath -ldflags "-s -w" -o $app \
go build -trimpath -ldflags "-s -w" -tags timetzdata -o $app \
&& upx --best --lzma $app \
&& chmod 500 $app
@ -35,12 +35,6 @@ USER root
# copy in binary
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
EXPOSE 8080