Replace --refresh-interval flag with --refresh
This commit is contained in:
parent
0e7cb2bb36
commit
6b70741a68
|
@ -58,7 +58,7 @@ The remaining four endpoints—`/available_extensions`, `/enabled_extensions`, `
|
|||
|
||||
## Refresh
|
||||
|
||||
If the `--refresh-interval` flag is passed and a positive-value `refresh=<integer><unit>` query parameter is provided, the page will reload after that interval.
|
||||
If the `--refresh` flag is passed and a positive-value `refresh=<integer><unit>` query parameter is provided, the page will reload after that interval.
|
||||
|
||||
This can be used to generate a sort of slideshow of files.
|
||||
|
||||
|
@ -125,7 +125,7 @@ Flags:
|
|||
--prefix string root path for http handlers (for reverse proxying) (default "/")
|
||||
--profile register net/http/pprof handlers
|
||||
-r, --recursive recurse into subdirectories
|
||||
--refresh-interval enable automatic page refresh via query parameter
|
||||
--refresh enable automatic page refresh via query parameter
|
||||
--russian remove selected images after serving
|
||||
-s, --sort enable sorting
|
||||
--text enable support for text files
|
||||
|
|
|
@ -32,7 +32,7 @@ var (
|
|||
Prefix string
|
||||
Profile bool
|
||||
Recursive bool
|
||||
RefreshInterval bool
|
||||
Refresh bool
|
||||
Russian bool
|
||||
Sorting bool
|
||||
Text bool
|
||||
|
@ -80,7 +80,7 @@ func init() {
|
|||
rootCmd.Flags().StringVar(&Prefix, "prefix", "/", "root path for http handlers (for reverse proxying)")
|
||||
rootCmd.Flags().BoolVar(&Profile, "profile", false, "register net/http/pprof handlers")
|
||||
rootCmd.Flags().BoolVarP(&Recursive, "recursive", "r", false, "recurse into subdirectories")
|
||||
rootCmd.Flags().BoolVar(&RefreshInterval, "refresh-interval", false, "enable automatic page refresh via query parameter")
|
||||
rootCmd.Flags().BoolVar(&Refresh, "refresh", false, "enable automatic page refresh via query parameter")
|
||||
rootCmd.Flags().BoolVar(&Russian, "russian", false, "remove selected images after serving")
|
||||
rootCmd.Flags().BoolVarP(&Sorting, "sort", "s", false, "enable sorting")
|
||||
rootCmd.Flags().BoolVar(&Text, "text", false, "enable support for text files")
|
||||
|
|
|
@ -19,7 +19,7 @@ func refreshInterval(r *http.Request) (int64, string) {
|
|||
duration, err := time.ParseDuration(interval)
|
||||
|
||||
switch {
|
||||
case err != nil || duration == 0 || !RefreshInterval:
|
||||
case err != nil || duration == 0 || !Refresh:
|
||||
return 0, "0ms"
|
||||
case duration < 500*time.Millisecond:
|
||||
return 500, "500ms"
|
||||
|
@ -86,7 +86,7 @@ func generateQueryParams(filters *filters, sortOrder, refreshInterval string) st
|
|||
hasParams = true
|
||||
}
|
||||
|
||||
if RefreshInterval {
|
||||
if Refresh {
|
||||
if hasParams {
|
||||
queryParams.WriteString("&")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue