Toyota Connected: Toyota, Lexus and Subaru as three plugins

One connector, registered once per brand with the brand fixed, so the
panel, the Web App and the Phone App each list Toyota, Lexus and Subaru
separately: own card, own account, own enable switch, own
/api/integrations/{brand} routes and vehicle provider. The brand picker
is gone.

Settings saved before the split under pluginSettings.toyota with brand
L or S move onto their brand's key on read, and are written back on the
next save. Cars linked as provider "toyota" read through their make's
brand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tajniak81andClaude Opus 5.5 committed 2026-11-18 10:32:35 +01:00
1 parent 9d8636ee73
commit 914aeeee23
21 files changed
+837 -471

No files matched your search

+13 -7
View File
@@ -45,9 +45,9 @@
// DELETE /api/admin/plugins/{name} POST /api/admin/plugins/{name}/health
//
// # integrations (per-user plugin settings; superadmin → org admin → user cascade)
// GET /api/integrations/toyota PUT /api/integrations/toyota
// POST /api/integrations/toyota/health
// GET /api/integrations/toyota/vehicles
// GET /api/integrations/{toyota|lexus|subaru} PUT (same)
// POST /api/integrations/{toyota|lexus|subaru}/health
// GET /api/integrations/{toyota|lexus|subaru}/vehicles
// GET /api/integrations/anker-solix PUT /api/integrations/anker-solix
// POST /api/integrations/anker-solix/health
// GET /api/integrations/anker-solix/chargers
@@ -142,6 +142,7 @@ import (
"drivervault/apiserver/internal/ocpp"
"drivervault/apiserver/internal/pb"
"drivervault/apiserver/internal/plugins"
"drivervault/apiserver/internal/plugins/builtin/toyota"
_ "drivervault/apiserver/internal/plugins/builtin" // register built-in plugins
)
@@ -444,10 +445,15 @@ func (s *Server) Handler() http.Handler {
// Integrations — per-user plugin settings under the superadmin → org admin →
// user cascade (see integrations.go). Any authenticated user manages their
// own layer; an org admin may also target their organization's layer.
mux.HandleFunc("GET /api/integrations/toyota", s.handleGetToyota)
mux.HandleFunc("PUT /api/integrations/toyota", s.handlePutToyota)
mux.HandleFunc("POST /api/integrations/toyota/health", s.handleToyotaHealth)
mux.HandleFunc("GET /api/integrations/toyota/vehicles", s.handleToyotaVehicles)
// Toyota, Lexus and Subaru are one connector registered once per brand; each
// gets its own routes, so the apps can show them as three integrations.
for _, b := range toyota.Brands {
base := "/api/integrations/" + b.Name
mux.HandleFunc("GET "+base, s.handleGetToyota)
mux.HandleFunc("PUT "+base, s.handlePutToyota)
mux.HandleFunc("POST "+base+"/health", s.handleToyotaHealth)
mux.HandleFunc("GET "+base+"/vehicles", s.handleToyotaVehicles)
}
mux.HandleFunc("GET /api/integrations/anker-solix", s.handleGetAnker)
mux.HandleFunc("PUT /api/integrations/anker-solix", s.handlePutAnker)
mux.HandleFunc("POST /api/integrations/anker-solix/health", s.handleAnkerHealth)