Found on demo-hp with 0.325.0-rc.1: the store (and so the conversion of an old family.json) opened only on the first family request; a box nobody visits through a family gate kept the session values. OpenFamilyStore from main, one INFO line with the count. TestR1112_StartConvertsTheFamilyFile, TestR1112_MainOpensTheFamilyStore, red-proved. Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
1 parent
94f44931dd
commit
6ed223886d
6 files changed
+82
-2
No files matched your search
@@ -88,6 +88,8 @@ type Store struct {
|
||||
mu sync.Mutex
|
||||
members map[string]*Member
|
||||
sessions map[string]Session
|
||||
|
||||
converted int // sessions Open found stored the old way (R-1112) — ConvertedAtOpen, for the start-up log line
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -134,6 +136,7 @@ func Open(dir string) (*Store, error) {
|
||||
}
|
||||
s.sessions[se.FP] = se
|
||||
}
|
||||
s.converted = converted
|
||||
if converted > 0 {
|
||||
s.mu.Lock()
|
||||
err := s.saveLocked()
|
||||
@@ -306,6 +309,14 @@ func (s *Store) Verify(name, password string) bool {
|
||||
return bcrypt.CompareHashAndPassword([]byte(hash), []byte(password)) == nil
|
||||
}
|
||||
|
||||
// ConvertedAtOpen is how many sessions Open found stored the old way and rewrote as fingerprints (0 for a nil store).
|
||||
func (s *Store) ConvertedAtOpen() int {
|
||||
if s == nil {
|
||||
return 0
|
||||
}
|
||||
return s.converted
|
||||
}
|
||||
|
||||
// NewSession starts a session for member ("" = the household) and returns its cookie value — the only time the value
|
||||
// exists outside the browser; the store keeps its Fingerprint. It refuses a member who does not exist.
|
||||
func (s *Store) NewSession(member string) (string, error) {
|
||||
|
||||
Reference in new issue
Block a user