Skip to content

Commit

Permalink
feat: Allow skipping the wifi credential validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypfer committed Aug 26, 2023
1 parent 7e4fdfe commit 810e2e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,17 @@ class MiioWifiConfigurationCapability extends LinuxWifiConfigurationCapability {
wifiConfig.credentials?.type === ValetudoWifiConfiguration.CREDENTIALS_TYPE.WPA2_PSK &&
wifiConfig.credentials.typeSpecificSettings?.password !== undefined
) {
if (!MiioWifiConfigurationCapability.IS_VALID_PARAMETER(wifiConfig.ssid)) {
if (
!MiioWifiConfigurationCapability.IS_VALID_PARAMETER(wifiConfig.ssid) &&
wifiConfig.metaData.force !== true
) {
throw new Error(`SSID must not contain any of the following characters: ${INVALID_CHARACTERS.join(" ")}`);
}

if (!MiioWifiConfigurationCapability.IS_VALID_PARAMETER(wifiConfig.credentials.typeSpecificSettings.password)) {
if (
!MiioWifiConfigurationCapability.IS_VALID_PARAMETER(wifiConfig.credentials.typeSpecificSettings.password) &&
wifiConfig.metaData.force !== true
) {
throw new Error(`Password must not contain any of the following characters: ${INVALID_CHARACTERS.join(" ")}`);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class WifiConfigurationCapabilityRouter extends CapabilityRouter {
credentials: {
type: req.body.credentials.type,
typeSpecificSettings: typeSpecificSettings
},
metaData: {
force: req.body.metaData?.force === true
}
}));

Expand Down

0 comments on commit 810e2e7

Please sign in to comment.