Sponsor: fix machine id panic on startup with plant config (#29542)

This commit is contained in:
andig 2026-05-01 21:43:30 +02:00 • committed by GitHub
parent 1169a3c8b9
commit 516a6841bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View file

@ -36,9 +36,12 @@ var (
mu sync.RWMutex
Subject, Token, ActivationKey string
ExpiresAt time.Time
machineID = machine.ProtectedID("evcc-sponsor")
)
func machineID() string {
return machine.ProtectedID("evcc-sponsor")
}
const unavailable = "sponsorship unavailable"
func IsAuthorized() bool {
@ -68,7 +71,7 @@ func ActivateSponsorship(licenseKey, email string) (string, error) {
res, err := client.Activate(ctx, &pb.ActivateRequest{
Key: licenseKey,
Email: email,
MachineId: machineID,
MachineId: machineID(),
})
if err != nil {

View file

@ -39,7 +39,7 @@ func checkHardware(vendor string, metadata map[string]string) string {
client := pb.NewAuthClient(conn)
res, err := client.IsAuthorizedHardware(ctx, &pb.HardwareRequest{
MachineId: machineID,
MachineId: machineID(),
Vendor: vendor,
Metadata: metadata,
})