e9ecc4c1f7
CI / test (pull_request) Successful in 2m13s
Fix goroutine-unsafe ULID entropy by wrapping in LockedMonotonicReader. Move PRAGMA foreign_keys outside transaction in v3 migration where SQLite was silently ignoring it. Escape LIKE wildcards in link resolution to prevent false matches. Add non-localhost binding warning, log writeJSON encoder errors, add ?permanent=true for explicit hard delete, preserve title/description during absorb, use millisecond backup timestamps, add path.Clean to spaHandler. Frontend gains checkedJSON() for resp.ok validation, consistent stopPropagation, and shared renderCardSections() to eliminate duplicate rendering.
23 lines
350 B
Go
23 lines
350 B
Go
package ulid
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"sync"
|
|
|
|
"github.com/oklog/ulid/v2"
|
|
)
|
|
|
|
var (
|
|
entropy *ulid.LockedMonotonicReader
|
|
entropyOnce sync.Once
|
|
)
|
|
|
|
func New() string {
|
|
entropyOnce.Do(func() {
|
|
entropy = &ulid.LockedMonotonicReader{
|
|
MonotonicReader: ulid.Monotonic(rand.Reader, 0),
|
|
}
|
|
})
|
|
return ulid.MustNew(ulid.Now(), entropy).String()
|
|
}
|