diff --git a/db.go b/db.go index 0f243da..4d31bb8 100644 --- a/db.go +++ b/db.go @@ -43,43 +43,6 @@ type WikiData struct { Locked string } -func hasPassword(title string) (bool, error) { - title = strings.ToLower(title) - if !open { - Open(RuntimeArgs.DatabaseLocation) - defer Close() - } - hasPassword := false - err := db.View(func(tx *bolt.Tx) error { - var err error - b := tx.Bucket([]byte("datas")) - if b == nil { - return fmt.Errorf("db must be opened before loading") - } - k := []byte(title) - val := b.Get(k) - if val == nil { - return nil - } - var p WikiData - err = p.decode(val) - if err != nil { - return err - } - for _, line := range strings.Split(p.CurrentText, "\n") { - if strings.Contains(line, "<") == true && strings.Contains(line, ">") == true && strings.Contains(line, "user") == true && strings.Contains(line, "password") == true && strings.Contains(line, "public") == true { - hasPassword = true - } - } - return nil - }) - if err != nil { - fmt.Printf("Could not get WikiData: %s", err) - return false, err - } - return hasPassword, nil -} - func getCurrentText(title string, version int) (string, []versionsInfo, bool, time.Duration, bool, string) { Open(RuntimeArgs.DatabaseLocation) defer Close()