فهرست منبع

feat(integrations): add rtlplayground vendor with per-vendor flashing note (#1796)

* feat(integrations): add rtlplayground vendor with per-vendor flashing note (#1782)

* test(httpapi): expect the rtlplayground vendor in the catalog endpoints (#1782)
Nacho 1 ماه پیش
والد
کامیت
cf87229708

+ 8 - 0
app/src/pages/Integrations.tsx

@@ -409,6 +409,14 @@ export default function Integrations({ bare = false }: { bare?: boolean }) {
                   </option>
                 ))}
               </select>
+              {vendorId === 'rtlplayground' && (
+                <p className="mt-1 text-caption text-text-muted">
+                  {t('settings.services.rtlDesc')}{' '}
+                  <a className="text-accent hover:underline" href="https://github.com/gnacho/netpulse/blob/main/docs/AGENTE-RTL-SWITCH.md" target="_blank" rel="noreferrer">{t('settings.services.rtlGuideEs')}</a>
+                  {' · '}
+                  <a className="text-accent hover:underline" href="https://github.com/gnacho/netpulse/blob/main/docs/RTL-SWITCH-BEACON.md" target="_blank" rel="noreferrer">{t('settings.services.rtlGuideEn')}</a>
+                </p>
+              )}
               {!isDemo && lastRefreshedMs > 0 && (
                 <span className="mt-1 block text-caption text-text-muted">
                   {t('integrations.catalog.updated', { time: agoLabel(lastRefreshedMs) })}

+ 0 - 6
app/src/pages/Settings.tsx

@@ -4161,12 +4161,6 @@ function ServicesCard({
           <DialogHeader>
             <DialogTitle className="sr-only">{t('settings.services.externalAgents')}</DialogTitle>
           </DialogHeader>
-          <p className="mb-3 text-sm text-text-muted">
-            {t('settings.services.rtlDesc')}{' '}
-            <a className="text-accent hover:underline" href="https://github.com/gnacho/netpulse/blob/main/docs/AGENTE-RTL-SWITCH.md" target="_blank" rel="noreferrer">{t('settings.services.rtlGuideEs')}</a>
-            {' · '}
-            <a className="text-accent hover:underline" href="https://github.com/gnacho/netpulse/blob/main/docs/RTL-SWITCH-BEACON.md" target="_blank" rel="noreferrer">{t('settings.services.rtlGuideEn')}</a>
-          </p>
           <Integrations bare />
         </DialogContent>
       </Dialog>

+ 3 - 3
server-go/internal/httpapi/integrations_catalog_test.go

@@ -64,7 +64,7 @@ func TestVendorsEndpointServesSeedAndDegradesOffline(t *testing.T) {
 	if !ok {
 		t.Fatalf("vendors missing: %v", body)
 	}
-	if len(rawVendors) != 4 {
+	if len(rawVendors) != 5 {
 		t.Fatalf("seed must be served when offline: %d vendors (%v)", len(rawVendors), rawVendors)
 	}
 	if got := body["lastRefreshedAt"].(float64); got != 0 {
@@ -96,7 +96,7 @@ func TestVendorsRefreshEndpointUpdatesCatalog(t *testing.T) {
 	// Estado inicial: el GET de arranque falla y sirve la semilla.
 	res0 := get(t, ts.URL, "/api/integrations/vendors", cookie)
 	body0 := readJSON(t, res0)
-	if rawVendors0, ok := body0["vendors"].([]any); !ok || len(rawVendors0) != 4 {
+	if rawVendors0, ok := body0["vendors"].([]any); !ok || len(rawVendors0) != 5 {
 		t.Fatalf("seed must be served while the fetch fails: %v", body0)
 	}
 
@@ -149,7 +149,7 @@ func TestVendorsFallbackCatalogHasNoNetwork(t *testing.T) {
 	}
 	body := readJSON(t, res)
 	rawVendors, ok := body["vendors"].([]any)
-	if !ok || len(rawVendors) != 4 {
+	if !ok || len(rawVendors) != 5 {
 		t.Fatalf("fallback catalog must serve the seed: %v", body)
 	}
 	if got := body["lastRefreshedAt"].(float64); got != 0 {

+ 3 - 2
server-go/internal/rintegration/catalog_test.go

@@ -88,6 +88,7 @@ func TestSeedCatalogServesCurrentVendors(t *testing.T) {
 		{"asuswrt", "ssh", "[arm64]", "asuswrt/v", "asuswrt-pusher", "merlin", "1.0.0", "arm64", "asuswrt_1.0.0_linux_arm64.tar.gz"},
 		{"bbox", "local", "[amd64 arm64]", "bbox/v", "netpulse-integrations", "procd", "0.1.0", "amd64", "integrations-supervisor_0.1.0_linux_amd64.tar.gz"},
 		{"unifi", "local", "[amd64]", "unifi/v", "unifi-pusher", "procd", "1.0.0", "amd64", "unifi_1.0.0_linux_amd64.tar.gz"},
+		{"rtlplayground", "local", "[mipsle]", "rtlplayground/v", "rtlplayground-pusher", "procd", "1.2.3", "mipsle", "rtlplayground_1.2.3_linux_mipsle.tar.gz"},
 	}
 	c := NewCatalog(nil)
 	if got := len(c.Current()); got != len(want) {
@@ -128,7 +129,7 @@ func TestCatalogServesSeedWithoutNetwork(t *testing.T) {
 		return nil, nil
 	}
 	vs := c.Vendors(context.Background())
-	if len(vs) != 4 {
+	if len(vs) != 5 {
 		t.Fatalf("seed vendors = %d, want 4", len(vs))
 	}
 	if !c.LastRefreshedAt().IsZero() {
@@ -257,7 +258,7 @@ func TestCatalogFetchFailsNoCacheServesSeed(t *testing.T) {
 	c := NewCatalog(d.DB)
 	c.FetchOverride = failingOverride(&calls)
 	vs := c.Vendors(context.Background())
-	if len(vs) != 4 {
+	if len(vs) != 5 {
 		t.Fatalf("seed must be served when the fetch fails without cache: %d vendors", len(vs))
 	}
 	if _, ok := c.Lookup("routeros"); !ok {

+ 9 - 0
server-go/internal/rintegration/vendors_seed.json

@@ -35,6 +35,15 @@
       "binary": "unifi-pusher",
       "target": "unifi/cmd/unifi-pusher",
       "description": "Read-only UniFi controller pusher covering gateways, switches and APs of one site"
+    },
+    {
+      "id": "rtlplayground",
+      "mode": "local",
+      "arches": ["mipsle"],
+      "tagPrefix": "rtlplayground/v",
+      "binary": "rtlplayground-pusher",
+      "target": "rtlplayground/cmd/rtlplayground-pusher",
+      "description": "Alternative Realtek switch firmware (RTLPlayground fork) that turns RTL837x switches into NetPulse agents; see the flashing guides in the docs"
     }
   ]
 }