added children db, simple render
This commit is contained in:
@@ -5,8 +5,11 @@ import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var dbMutex = sync.RWMutex{}
|
||||
|
||||
func get_passes(filename string) (cur_passes []string, err error) {
|
||||
b, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
@@ -49,3 +52,17 @@ func check_password(filename, attempt string) (result bool) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func loadChildren(filename string) (children []Child) {
|
||||
dbMutex.RLock()
|
||||
defer dbMutex.RUnlock()
|
||||
b, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
err = json.Unmarshal(b, &children)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user