Default Random Filename flag.

This commit is contained in:
ZizzyDizzyMC 2021-02-27 21:37:06 -05:00
parent ee762ba596
commit 0f45bce481
3 changed files with 4 additions and 1 deletions

View File

@ -78,6 +78,7 @@ var Config struct {
maxDurationTime uint64
maxDurationSize int64
disableAccessKey bool
defaultRandomFilename bool
}
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.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.defaultRandomFilename, "default-random-filename", true, "Makes it so the random filename is not default if set false. Default true.")
iniflags.Parse()
mux := setup()

View File

@ -91,6 +91,7 @@ func renderTemplate(tpl *pongo2.Template, context pongo2.Context, r *http.Reques
context["extra_footer_text"] = Config.extraFooterText
// Add the context for Config.disableAccessKey
context["disable_access_key"] = Config.disableAccessKey
context["default_randomize"] = Config.defaultRandomFilename
var a string
if Config.authFile == "" {

View File

@ -21,7 +21,7 @@
<span class="hint--top hint--bounce"
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"
checked /> Randomize filename</label>
{% if default_randomized && !(forcerandom) %} checked {% endif %} /> Randomize filename</label>
</span>
<div id="expiry">