Compare commits
No commits in common. "172fc38f18b6acba7d47fd8741d056b6fda22115" and "54225d40742b27c3138f2ed69008c5fbf8bf4597" have entirely different histories.
172fc38f18
...
54225d4074
|
@ -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.
|
||||
|
||||
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.
|
||||
|
||||
|
@ -150,10 +152,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-insensitive use case-insensitive matching for filters
|
||||
--case-sensitive use case-sensitive 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 1024)
|
||||
--concurrency int maximum concurrency for scan threads (default 2147483647)
|
||||
-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
|
||||
|
@ -163,7 +165,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 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
|
||||
--index generate index of supported file paths at startup
|
||||
--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 "/")
|
||||
--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
|
||||
|
|
2
build.sh
2
build.sh
|
@ -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}" -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
|
||||
|
|
|
@ -45,7 +45,7 @@ func (filters *filters) apply(fileList []string) []string {
|
|||
p := filepath.Base(s)
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ func (filters *filters) apply(fileList []string) []string {
|
|||
p := filepath.Base(s)
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
76
cmd/root.go
76
cmd/root.go
|
@ -17,46 +17,46 @@ import (
|
|||
|
||||
const (
|
||||
AllowedCharacters string = `^[A-z0-9.\-_]+$`
|
||||
ReleaseVersion string = "6.3.0"
|
||||
ReleaseVersion string = "6.1.1"
|
||||
)
|
||||
|
||||
var (
|
||||
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
|
||||
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
|
||||
|
||||
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(&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().StringVar(&CodeTheme, "code-theme", "solarized-dark256", "theme for source code syntax highlighting")
|
||||
rootCmd.Flags().IntVar(&Concurrency, "concurrency", 1024, "maximum concurrency for scan threads")
|
||||
|
|
|
@ -18,7 +18,7 @@ ARG TARGETOS TARGETARCH
|
|||
RUN CGO_ENABLED=0 \
|
||||
GOOS=$TARGETOS \
|
||||
GOARCH=$TARGETARCH \
|
||||
go build -trimpath -ldflags "-s -w" -tags timetzdata -o $app \
|
||||
go build -trimpath -ldflags "-s -w" -o $app \
|
||||
&& upx --best --lzma $app \
|
||||
&& chmod 500 $app
|
||||
|
||||
|
@ -35,6 +35,12 @@ 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
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ ARG TARGETOS TARGETARCH
|
|||
RUN CGO_ENABLED=0 \
|
||||
GOOS=$TARGETOS \
|
||||
GOARCH=$TARGETARCH \
|
||||
go build -trimpath -ldflags "-s -w" -tags timetzdata -o $app \
|
||||
go build -trimpath -ldflags "-s -w" -o $app \
|
||||
&& upx --best --lzma $app \
|
||||
&& chmod 500 $app
|
||||
|
||||
|
@ -35,6 +35,12 @@ 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
|
||||
|
||||
|
|
Loading…
Reference in New Issue