рабочий вариант, но скороть 10 МБит
build / backend (push) Has been cancelled
build / node-agent (push) Has been cancelled
build / worker (push) Has been cancelled

This commit is contained in:
2026-05-22 21:46:49 +03:00
parent 469fa0e860
commit 20d361a886
280 changed files with 954890 additions and 18524 deletions
@@ -22,7 +22,7 @@ import (
const (
ModeStrict = "strict"
ModeLegacy = "legacy"
ModeCompat = "compat"
ActivationSchemaVersion = "rap.installation.activation.v1"
@@ -60,7 +60,7 @@ type Verifier struct {
func NewVerifier(cfg config.InstallationConfig) (*Verifier, error) {
mode := strings.ToLower(strings.TrimSpace(cfg.AuthorityMode))
if mode == "" {
mode = ModeLegacy
mode = ModeCompat
}
verifier := &Verifier{
mode: mode,
@@ -69,7 +69,7 @@ func NewVerifier(cfg config.InstallationConfig) (*Verifier, error) {
}
switch mode {
case ModeLegacy:
case ModeCompat:
return verifier, nil
case ModeStrict:
publicKey, err := decodeEd25519PublicKey(cfg.ProductRootPublicKeyBase64)
@@ -87,7 +87,7 @@ func NewVerifier(cfg config.InstallationConfig) (*Verifier, error) {
func (v *Verifier) Mode() string {
if v == nil || v.mode == "" {
return ModeLegacy
return ModeCompat
}
return v.mode
}
@@ -162,7 +162,7 @@ func EffectivePlatformRole(ctx context.Context, db postgresplatform.DBTX, verifi
return PlatformRoleUser, nil
}
if verifier == nil || !verifier.Strict() {
return legacyPlatformRole(ctx, db, userID)
return storedPlatformRole(ctx, db, userID)
}
var email string
@@ -220,7 +220,7 @@ END, prg.granted_at DESC
} else if ok {
return role, nil
}
return legacyPlatformRole(ctx, db, userID)
return storedPlatformRole(ctx, db, userID)
}
return bestRole, nil
}
@@ -257,7 +257,7 @@ WHERE u.id = $1::uuid
}
}
func legacyPlatformRole(ctx context.Context, db postgresplatform.DBTX, userID string) (string, error) {
func storedPlatformRole(ctx context.Context, db postgresplatform.DBTX, userID string) (string, error) {
var role string
if err := db.QueryRow(ctx, `SELECT platform_role FROM users WHERE id = $1::uuid`, userID).Scan(&role); err != nil {
if errors.Is(err, pgx.ErrNoRows) {