diff --git a/host/service/ubios/service.go b/host/service/ubios/service.go index db55a404..2c17fd62 100644 --- a/host/service/ubios/service.go +++ b/host/service/ubios/service.go @@ -12,6 +12,7 @@ package ubios import ( "bufio" "os" + "os/exec" "strings" "github.com/nextdns/nextdns/host/service" @@ -23,8 +24,18 @@ type Service struct { systemd.Service } +func isUnifi() bool { + if st, _ := os.Stat("/data/unifi"); st != nil && st.IsDir() { + return true + } + if err := exec.Command("ubnt-device-info", "firmware").Run(); err == nil { + return true + } + return false +} + func New(c service.Config) (Service, error) { - if st, _ := os.Stat("/data/unifi"); st == nil || !st.IsDir() { + if !isUnifi() { return Service{}, service.ErrNotSupported } srv := Service{ diff --git a/install.sh b/install.sh index 5ff0a1bd..ec22f9ae 100755 --- a/install.sh +++ b/install.sh @@ -101,13 +101,13 @@ uninstall() { precheck() { if [ -e "/data/unifi" ] && [ -f "/run/dnsfilter/dnsfilter" ]; then log_warn "UDM Content Filtering and/or Ad Blocking feature is enabled." - log_warn "Please disable it to use NextDNS." + log_warn "Please disable it to use NextDNS." log_warn "" log_warn " To disable Content Filtering, go to Settings > Network." log_warn " For each network, set the Content Filtering feature to None." - log_warn "" - log_warn " To disable Ad Blocking, go to Settings > Application Firewall" - log_warn " In the General tab, uncheck the Ad Blocking checkbox." + log_warn "" + log_warn " To disable Ad Blocking, go to Settings > Application Firewall" + log_warn " In the General tab, uncheck the Ad Blocking checkbox." log_warn "" while [ -f "/run/dnsfilter/dnsfilter" ]; do sleep 1 @@ -1038,9 +1038,9 @@ bin_location() { ;; synology) echo "/usr/local/bin/nextdns" - ;; + ;; darwin) - echo "$(brew --prefix 2>/dev/null || echo /usr/local)/bin/nextdns" + echo "$(brew --prefix 2>/dev/null || echo /usr/local)/bin/nextdns" ;; asuswrt-merlin|ddwrt) echo "/jffs/nextdns/nextdns" diff --git a/router/ubios/setup.go b/router/ubios/setup.go index 5c195892..b76148b6 100644 --- a/router/ubios/setup.go +++ b/router/ubios/setup.go @@ -17,8 +17,18 @@ type Router struct { ClientReporting bool } +func isUnifi() bool { + if st, _ := os.Stat("/data/unifi"); st != nil && st.IsDir() { + return true + } + if err := exec.Command("ubnt-device-info", "firmware").Run(); err == nil { + return true + } + return false +} + func New() (*Router, bool) { - if st, _ := os.Stat("/data/unifi"); st == nil || !st.IsDir() { + if !isUnifi() { return nil, false } return &Router{