luci-base: fix error 404 on missing relay protocol 3749/head
authorAnsuel Smith <ansuelsmth@gmail.com>
Thu, 12 Mar 2020 15:46:53 +0000 (16:46 +0100)
committerAnsuel Smith <ansuelsmth@gmail.com>
Thu, 12 Mar 2020 15:46:53 +0000 (16:46 +0100)
Currently relay.js is included in any case even if
the router doesn't have the needed package to use it.
Fix this by checking if the system has this feature.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
modules/luci-base/htdocs/luci-static/resources/network.js

index c79022968ccc99132ab83285e40716f1f8b63dd4..43ae076a0aa853abac4f15d70058ac92e5a8f02b 100644 (file)
@@ -106,7 +106,7 @@ function getProtocolHandlers(cache) {
                        Object.assign(protos, { none: { no_device: false } });
 
                /* Hack: emulate relayd protocol */
-               if (!protos.hasOwnProperty('relay'))
+               if (!protos.hasOwnProperty('relay') && L.hasSystemFeature('relayd'))
                        Object.assign(protos, { relay: { no_device: true } });
 
                Object.assign(_protospecs, protos);