all repos — flounder @ 04c6d55b8d4967f11c4f7e795c7379469e0587d4

A small site builder for the Gemini protocol

index fix
alex wennerberg alex@alexwennerberg.com
Sat, 24 Oct 2020 14:38:40 -0700
commit

04c6d55b8d4967f11c4f7e795c7379469e0587d4

parent

821746c4cd42fecad123995d2013f3c2f549df24

2 files changed, 11 insertions(+), 8 deletions(-)

jump to
M main.gomain.go

@@ -61,17 +61,20 @@ }

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 {
M schema.sqlschema.sql

@@ -3,7 +3,7 @@ id INTEGER PRIMARY KEY NOT NULL,

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')) );