mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-04 15:06:37 +08:00
fix(config): serve public settings and enforce login CAP
Public config now comes from admin as a flat visibility=1 map instead of a cross-plugin query that compared an integer column to "visible". Login and register resolve CaptchaService per request so CAP is not skipped when user applies before cap.
This commit is contained in:
@@ -24,12 +24,10 @@ func setDBService(s contracts.DBService) {
|
||||
dbSvc = s
|
||||
}
|
||||
|
||||
// getDB resolves a GORM handle, preferring the *core.Context when supplied by callers.
|
||||
// getDB resolves a GORM handle from the request/app context, then the Bind fallback.
|
||||
func getDB(ctx context.Context) *gorm.DB {
|
||||
if c, ok := ctx.(*core.Context); ok && c != nil {
|
||||
if s, err := core.Inject[contracts.DBService](c); err == nil && s != nil {
|
||||
return s.DB(ctx)
|
||||
}
|
||||
if s, err := core.InjectFrom[contracts.DBService](ctx); err == nil && s != nil {
|
||||
return s.DB(ctx)
|
||||
}
|
||||
dbMu.RLock()
|
||||
s := dbSvc
|
||||
|
||||
Reference in New Issue
Block a user