museuminabox / brain

Where the magic happens.
4 stars 0 forks source link

WiFi setup script should report captive portals #119

Closed amcewen closed 4 years ago

amcewen commented 4 years ago

When the configure-wifi script finishes and tests whether it can connect to the Internet, it should be able to spot the difference between couldn't connect at all and got a response but not the page we expected, and work out if that's likely to be a captive portal.

We should report the difference to the user.

george08 commented 4 years ago

"Hmm. I'm trying to connect to that network, but it's asking me for more details, like an extra setting, but we can't provide that."

(or something)

amcewen commented 4 years ago

Got the test page online, and the code written to fetch it and check its contents. Currently it's only wired into the "check for updates" flow (that's easier to test the different scenarios first as it doesn't involve dropping off the WiFi).

At the moment it reports errors just as a string - next step is to implement custom error classes (e.g. in https://medium.com/@xjamundx/custom-javascript-errors-in-es6-aa891b173f87) so I can then handle them correctly. Then add it to the WiFi config flow too.

george08 commented 4 years ago

Cool!

amcewen commented 4 years ago

I've extended the check-for-upgrades and the configure-wifi flows so they (try to) detect any captive portals, and also provide better feedback for WiFi problems.

We'll need three new audio clips please @CharlieMiab, and maybe updates for some of the existing ones. At present the same error clips get used for both the update and the configure-wifi flows, but they can be different if need be.

The flows now are as follows:

Configure WiFi

Check for upgrades

george08 commented 4 years ago

Related (usability issue): https://github.com/museuminabox/brain-dei-mille/issues/25

amcewen commented 4 years ago

For reference, when an Android phone encounters a captive portal it pops up a notification saying "Sign in to WiFi network required", so maybe we could say something like "this WiFi network needs extra sign in steps that we can't complete"?

amcewen commented 4 years ago

This is all done now. If it encounters a captive portal it now forgets that network, so it'll be less likely that someone will accidentally join a captive portal network and then get trapped there.

CharlieMiab commented 4 years ago

Adding the testing I did for the captive portal test .img for reference

In the Royal Armouries Museum:

  1. Turned the Box on and Booped the WiFi Card
  2. Using my iPhone, selected the MuseuminaBox WiFi network and the pop-up appeared.
  3. Chose the 'Royal Armouries Free WiFi' network, left the password field blank and submitted.
  4. Heard the robot-brummie saying 'Give me a second to check if that worked', waited a few seconds, then heard 'I may be behind a captive portal'.

Repeated this process three times, turning the Box off after each try and experienced the same flow as listed above.

ra_wifi_testing