luci-base: fix error 404 on missing relay protocol
authorAnsuel Smith <ansuelsmth@gmail.com>
Thu, 12 Mar 2020 15:46:53 +0000 (16:46 +0100)
committerJo-Philipp Wich <jo@mein.io>
Thu, 7 May 2020 17:40:49 +0000 (19:40 +0200)
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>
(cherry picked from commit 3d70d3e5d786383b8754200cf065713b191bdead)

modules/luci-base/htdocs/luci-static/resources/network.js

index 6dadcb7307162b2b50636e9a00f2a39191b3d2f7..5c6d732d67f18b6e9a4ec5fb5be0433ea1b8f93d 100644 (file)
@@ -108,7 +108,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);