sindresorhus/Actions

Action: 'Join Wifi' does not support open wifi networks (aka local wifi with no password)

bluemodena opened this issue · 5 comments

Description

I am using the 'Join Wifi' action to join a local (no internet access) wifi network with no password. it is fairly typical of simple wifi devices like this to not have a password. How do I escape or enter null in the password field in the shortcut so that it run without error?
joinWifiShortcut

macOS/iOS version

iOS 17.5.1

Shortcut URL

No response

I've never coded in Swift before but I dug in to the apple code to see if what I am asking for it possible. Just need a configurable way to indicate is the configuration is an open wifi network, and then call the appropriate method.
The network’s passphrase credential: for WPA or WPA2 personal networks, 8-63 characters; for static 64-bit WEP, 10 hexadecimal digits; for static 128-bit WEP, 26 hexadecimal digits. Which is why when I enter null for the password, it doesn't work,

https://developer.apple.com/documentation/networkextension/nehotspotconfiguration
Class NEHotspotConfiguration() support multiple configurations.
init(ssid: String)
Creates a new hotspot configuration, identified by an SSID, for an open Wi-Fi network.
init(ssid: String, passphrase: String, isWEP: Bool)
Creates a new hotspot configuration, identified by an SSID, for a protected WEP or WPA/WPA2
personal Wi-Fi network.

private func join() async throws {
#if !os(macOS)
let configuration = NEHotspotConfiguration(
ssid: ssid,
passphrase: password,
isWEP: isWEP
)
configuration.hidden = isHidden
// if open wifi
try await NEHotspotConfigurationManager.shared.apply(ssid)
// else
try await NEHotspotConfigurationManager.shared.apply(configuration)
#endif
}

Hope this helps

This is fixed in the latest TestFlight build: https://testflight.apple.com/join/fJGUrsZx

Oh wow, that is great. I'm away from home this weekend and don't have access to my open wifi camera right now. I'll try it out Sunday evening

Crap sorry.. Hit the wrong button

Sindre, I can confirm this now works with open WiFi networks. Thank you for addressing this so quickly!

I wasn't sure if there was something else you need to do before I close this issue, but it is OK to close it.