Split compose dev/prod and relax contact form friction.
Use compose.dev.yaml and compose.prod.yaml with fixed Go cache mounts, block sudo make dev, build Air outside app/tmp for rootless Docker, soften English spam checks, and simplify contact error copy. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -12,6 +12,9 @@ const (
|
||||
minMessageRunes = 20
|
||||
maxMessageRunes = 8000
|
||||
maxNameRunes = 120
|
||||
|
||||
// Reject non-English only when the detector is fairly confident.
|
||||
englishRejectConfidence = 0.80
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -38,13 +41,15 @@ func ValidateEnglish(name, message string) error {
|
||||
combined := strings.TrimSpace(name) + "\n\n" + msg
|
||||
info := whatlanggo.Detect(combined)
|
||||
|
||||
// Block clearly non-Latin scripts (CJK, Cyrillic, etc.).
|
||||
if info.Script != nil && info.Script != unicode.Latin {
|
||||
return ErrNotEnglish
|
||||
}
|
||||
if info.Lang != whatlanggo.Eng {
|
||||
// Allow uncertain detection; block only confident non-English.
|
||||
if info.Lang != whatlanggo.Eng && info.IsReliable() {
|
||||
return ErrNotEnglish
|
||||
}
|
||||
if !info.IsReliable() && info.Confidence < 0.55 {
|
||||
if info.Lang != whatlanggo.Eng && info.Confidence >= englishRejectConfidence {
|
||||
return ErrNotEnglish
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user