Default Random Filename flag.
This commit is contained in:
parent
ee762ba596
commit
0f45bce481
|
@ -78,6 +78,7 @@ var Config struct {
|
||||||
maxDurationTime uint64
|
maxDurationTime uint64
|
||||||
maxDurationSize int64
|
maxDurationSize int64
|
||||||
disableAccessKey bool
|
disableAccessKey bool
|
||||||
|
defaultRandomFilename bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var Templates = make(map[string]*pongo2.Template)
|
var Templates = make(map[string]*pongo2.Template)
|
||||||
|
@ -315,6 +316,7 @@ func main() {
|
||||||
flag.Uint64Var(&Config.maxDurationTime, "max-duration-time", 0, "Time till expiry for files over max-duration-size")
|
flag.Uint64Var(&Config.maxDurationTime, "max-duration-time", 0, "Time till expiry for files over max-duration-size")
|
||||||
flag.Int64Var(&Config.maxDurationSize, "max-duration-size", 4*1024*1024*1024, "Size of file before max-duration-time is used to determine expiry max time.")
|
flag.Int64Var(&Config.maxDurationSize, "max-duration-size", 4*1024*1024*1024, "Size of file before max-duration-time is used to determine expiry max time.")
|
||||||
flag.BoolVar(&Config.disableAccessKey, "disable-access-key", false, "Disables access key usage")
|
flag.BoolVar(&Config.disableAccessKey, "disable-access-key", false, "Disables access key usage")
|
||||||
|
flag.BoolVar(&Config.defaultRandomFilename, "default-random-filename", true, "Makes it so the random filename is not default if set false. Default true.")
|
||||||
iniflags.Parse()
|
iniflags.Parse()
|
||||||
|
|
||||||
mux := setup()
|
mux := setup()
|
||||||
|
|
|
@ -91,6 +91,7 @@ func renderTemplate(tpl *pongo2.Template, context pongo2.Context, r *http.Reques
|
||||||
context["extra_footer_text"] = Config.extraFooterText
|
context["extra_footer_text"] = Config.extraFooterText
|
||||||
// Add the context for Config.disableAccessKey
|
// Add the context for Config.disableAccessKey
|
||||||
context["disable_access_key"] = Config.disableAccessKey
|
context["disable_access_key"] = Config.disableAccessKey
|
||||||
|
context["default_randomize"] = Config.defaultRandomFilename
|
||||||
|
|
||||||
var a string
|
var a string
|
||||||
if Config.authFile == "" {
|
if Config.authFile == "" {
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<span class="hint--top hint--bounce"
|
<span class="hint--top hint--bounce"
|
||||||
data-hint="Replace the filename with random characters. The file extension is retained">
|
data-hint="Replace the filename with random characters. The file extension is retained">
|
||||||
<label><input {% if forcerandom %} disabled {% endif %} name="randomize" id="randomize" type="checkbox"
|
<label><input {% if forcerandom %} disabled {% endif %} name="randomize" id="randomize" type="checkbox"
|
||||||
checked /> Randomize filename</label>
|
{% if default_randomized && !(forcerandom) %} checked {% endif %} /> Randomize filename</label>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div id="expiry">
|
<div id="expiry">
|
||||||
|
|
Loading…
Reference in New Issue