flounder

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

commit 04c6d55b8d4967f11c4f7e795c7379469e0587d4
parent 821746c4cd42fecad123995d2013f3c2f549df24
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Sat, 24 Oct 2020 14:38:40 -0700

index fix

Diffstat:
Mmain.go | 17++++++++++-------
Mschema.sql | 2+-
2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/main.go b/main.go @@ -61,17 +61,20 @@ func checkIfValidFile(filename string, fileBytes []byte) error { func getIndexFiles() ([]*File, error) { // cache this function result := []*File{} - err := filepath.Walk(c.FilesDirectory, func(path string, info os.FileInfo, err error) error { + err := filepath.Walk(c.FilesDirectory, func(thepath string, info os.FileInfo, err error) error { if err != nil { - log.Printf("Failure accessing a path %q: %v\n", path, err) + log.Printf("Failure accessing a path %q: %v\n", thepath, err) return err // think about } // make this do what it should - result = append(result, &File{ - Name: info.Name(), - Creator: "alex", - UpdatedTime: info.ModTime(), - }) + if !info.IsDir() { + creatorFolder, _ := path.Split(thepath) + result = append(result, &File{ + Name: info.Name(), + Creator: path.Base(creatorFolder), + UpdatedTime: info.ModTime(), + }) + } return nil }) if err != nil { diff --git a/schema.sql b/schema.sql @@ -3,7 +3,7 @@ CREATE TABLE user ( username TEXT NOT NULL UNIQUE, email TEXT NOT NULL UNIQUE, password_hash TEXT NOT NULL, - active boolean NOT NULL DEFAULT false, + approved boolean NOT NULL DEFAULT false, created_at INTEGER DEFAULT (strftime('%s', 'now')) );