spr-networks / super

📡 SPR: Open Source, secure, user friendly and fast wifi routers for your home. One wifi password per device. Ad Blocking & Privacy Blocklists. Policy Based Network Access
https://www.supernetworks.org/
BSD 3-Clause "New" or "Revised" License
196 stars 13 forks source link

UI: devices view fails when the example device has been deleted and no other non vpn only devices are present #320

Closed lts-rad closed 6 months ago

lts-rad commented 6 months ago

page redirects to validate. no otp code hsa been set

image
lts-rad commented 6 months ago

user reports this is not just virtual mode.

looking into it, the only request that is failing is the ouis lookup which 404s. then the UI incorrectly handles the 404 to validate the otp code

lts-rad commented 6 months ago

bug does not appear to reproduce with this change

        if (macs && macs.length > 0) {
          // set device oui if avail
          deviceAPI
            .ouis(macs)
            .then((ouis) => {
              let devs = devices.map((d) => {
                let oui = ouis.find((o) => o.MAC == d.MAC)
                d.oui = oui ? oui.Vendor : ''
                return d
              })

              setList(devs.sort(sortDevices))
            })
            .catch((err) => {})
        }

but we need a more extensive fix

lts-rad commented 6 months ago

the issue is the empty lookup triggers the redirect http://127.0.0.1:8009/plugins/lookup/ouis/ which incorrectly assumes otp failure

lts-rad commented 6 months ago

this is fixed correctly by 18f7882c8e8972aa8ba35680c47d012f71a5b4ac