added admin control panel for making posts, with basic authentication

This commit is contained in:
rawleyIfowler
2022-03-02 10:59:56 -06:00
parent a03c75a3e2
commit 8bac0d8407
8 changed files with 109 additions and 22 deletions

View File

@@ -5,7 +5,7 @@ import (
"os"
)
func LoadAdminHash(path string) string {
func LoadAdminHash(path string) [32]byte {
file, err := os.Open(path)
if err != nil {
panic("Could not find DSN for database...")
@@ -14,7 +14,11 @@ func LoadAdminHash(path string) string {
reader := bufio.NewScanner(file)
// The dsn should be the first line of the file
if reader.Scan() {
return reader.Text()
var buff [32]byte
for i, b := range reader.Bytes() {
buff[i] = b
}
return buff
}
panic(path + " is empty...")
}