flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit 383d618d53b72f3ca8aec4643ca60e7a1695f685
parent e8808331dd91745dcbae79724164de0d04bd18a3
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Sat, 31 Oct 2020 09:26:27 -0700

Delete files as part of delete user command

Diffstat:
Madmin.go | 4+++-
Mexample-config.toml | 2+-
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/admin.go b/admin.go @@ -28,6 +28,7 @@ func runAdminCommand() { log.Fatal(err) case "delete-user": username := os.Args[3] + // TODO add confirmation err := deleteUser(username) log.Fatal(err) } @@ -59,10 +60,11 @@ Have fun!` } func deleteUser(username string) error { - // not sure whether we should delete files too _, err := DB.Exec("DELETE FROM user WHERE username = $1", username) if err != nil { return err } + username = filepath.Clean(username) + os.RemoveAll(path.Join(c.FilesDirectory, username)) return nil } diff --git a/example-config.toml b/example-config.toml @@ -13,7 +13,7 @@ FilesDirectory="./files" LogFile="./flounder.log" # Gemini autogenerates self-signed certs -GeminiCertStore="./" +GeminiCertStore="/tmp" # A wildcard TLS cert for HTTPS. # Only required if HttpsEnabled=true