flounder

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

commit c2f3bd68f6970764bd232762eafdcf91bda1aa62
parent cdb8fdd2291657fa1dc3a015f8e82241a036f6a3
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Sat, 23 Oct 2021 12:39:19 -0700

add ignore user to homepage

Diffstat:
Mdb.go | 9+++++++--
Mhttp.go | 11++++++-----
2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/db.go b/db.go @@ -4,7 +4,6 @@ import ( "crypto/rand" "database/sql" "fmt" - "golang.org/x/crypto/bcrypt" "io" "io/ioutil" "log" @@ -14,6 +13,8 @@ import ( "sort" "strings" "time" + + "golang.org/x/crypto/bcrypt" ) var DB *sql.DB @@ -173,13 +174,17 @@ func getUsers() ([]User, error) { return users, nil } -func getIndexFiles(admin bool) ([]*File, error) { // cache this function +func getIndexFiles(admin bool) ([]*File, error) { // TODO cache this function result := []*File{} 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", thepath, err) return err // think about } + if info.Name() == "0gitnick" || info.Name() == "szczezuja" { + // Lazy hack + return filepath.SkipDir + } if !admin && info.IsDir() && info.Name() == HiddenFolder { return filepath.SkipDir } diff --git a/http.go b/http.go @@ -3,11 +3,6 @@ package main import ( "bytes" "fmt" - gmi "git.sr.ht/~adnano/go-gemini" - "github.com/gorilla/handlers" - "github.com/gorilla/sessions" - _ "github.com/mattn/go-sqlite3" - "golang.org/x/crypto/bcrypt" "html/template" "io" "io/ioutil" @@ -19,6 +14,12 @@ import ( "path/filepath" "strings" "time" + + gmi "git.sr.ht/~adnano/go-gemini" + "github.com/gorilla/handlers" + "github.com/gorilla/sessions" + _ "github.com/mattn/go-sqlite3" + "golang.org/x/crypto/bcrypt" ) var t *template.Template