Compare commits

..

No commits in common. "172fc38f18b6acba7d47fd8741d056b6fda22115" and "54225d40742b27c3138f2ed69008c5fbf8bf4597" have entirely different histories.

6 changed files with 61 additions and 46 deletions

View File

@ -44,6 +44,8 @@ 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.
@ -150,10 +152,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-insensitive use case-insensitive matching for filters --case-sensitive use case-sensitive 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 1024) --concurrency int maximum concurrency for scan threads (default 2147483647)
-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
@ -163,7 +165,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 should be skipped (default ".roulette-ignore") --ignore-file string filename used to indicate directory to 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
@ -174,6 +176,7 @@ 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}" -tags timetzdata -o "builds/${output_name}" env GOOS="${GOOS}" GOARCH="${GOARCH}" CC="musl-gcc" CGO_ENABLED=0 go build -trimpath -ldflags "${ld_flags}" -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 (!CaseInsensitive && strings.Contains(p, exclude)) || (CaseInsensitive && strings.Contains(strings.ToLower(p), strings.ToLower(exclude))) { if (CaseSensitive && strings.Contains(p, exclude)) || (!CaseSensitive && 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 (!CaseInsensitive && strings.Contains(p, include)) || (CaseInsensitive && strings.Contains(strings.ToLower(p), strings.ToLower(include))) { if (CaseSensitive && strings.Contains(p, include)) || (!CaseSensitive && 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.3.0" ReleaseVersion string = "6.1.1"
) )
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
CaseInsensitive bool CaseSensitive 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(&CaseInsensitive, "case-insensitive", false, "use case-insensitive matching for filters") rootCmd.Flags().BoolVar(&CaseSensitive, "case-sensitive", false, "use case-sensitive 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" -tags timetzdata -o $app \ go build -trimpath -ldflags "-s -w" -o $app \
&& upx --best --lzma $app \ && upx --best --lzma $app \
&& chmod 500 $app && chmod 500 $app
@ -35,6 +35,12 @@ 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" -tags timetzdata -o $app \ go build -trimpath -ldflags "-s -w" -o $app \
&& upx --best --lzma $app \ && upx --best --lzma $app \
&& chmod 500 $app && chmod 500 $app
@ -35,6 +35,12 @@ 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