Add per-user download directory

This commit is contained in:
Ken-Håvard Lieng 2020-05-17 02:14:35 +02:00
parent 1532b2a8c8
commit 6b5bf4ced1
4 changed files with 6 additions and 4 deletions

View File

@ -5,7 +5,6 @@ port = 80
hexIP = false
verify_certificates = true
download_folder = ""
autoget = false
# Defaults for the client connect form

View File

@ -14,7 +14,6 @@ type Config struct {
Dev bool
HexIP bool
VerifyCertificates bool `mapstructure:"verify_certificates"`
DownloadFolder string `mapstructure:"download_folder"`
Autoget bool
Headers map[string]string
Defaults Defaults

View File

@ -70,7 +70,7 @@ func connectIRC(server *storage.Server, state *State, srcIP []byte) *irc.Client
}
}
i.DownloadFolder = cfg.DownloadFolder
i.DownloadFolder = storage.Path.Downloads(state.user.Username)
i.Autoget = cfg.Autoget
state.setIRC(server.Host, i)

View File

@ -52,6 +52,10 @@ func (d directory) Key(username string) string {
return filepath.Join(d.User(username), "key.pem")
}
func (d directory) Downloads(username string) string {
return filepath.Join(d.User(username), "downloads")
}
func (d directory) Config() string {
return filepath.Join(d.ConfigRoot(), "config.toml")
}