add network options, IPv6 for mqtt

This commit is contained in:
MichaelDvP
2021-07-08 10:17:50 +02:00
parent 3ea53a8012
commit 2d7449aeba
17 changed files with 180 additions and 27 deletions

View File

@@ -51,7 +51,11 @@ class NetworkSettingsForm extends React.Component<NetworkStatusFormProps> {
ssid: selectedNetwork.ssid,
password: '',
hostname: props.data.hostname,
static_ip_config: false
static_ip_config: false,
enableIPv6: false,
bandwidth20: false,
tx_power: 20,
nosleep: false
};
props.setData(networkSettings);
}
@@ -145,6 +149,53 @@ class NetworkSettingsForm extends React.Component<NetworkStatusFormProps> {
onChange={handleValueChange('hostname')}
margin="normal"
/>
<TextValidator
validators={['required', 'isNumber', 'minNumber:0', 'maxNumber:20']}
errorMessages={[
'Tx Power is required',
'Must be a number',
'Must be greater than 0dBm ',
'Max value is 20dBm'
]}
name="tx_power"
label="WiFi Tx Power (dBm)"
fullWidth
variant="outlined"
value={data.tx_power}
type="number"
onChange={handleValueChange('tx_power')}
margin="normal"
/>
<BlockFormControlLabel
control={
<Checkbox
value="enableIPv6"
checked={data.enableIPv6}
onChange={handleValueChange('enableIPv6')}
/>
}
label="Enable IPv6"
/>
<BlockFormControlLabel
control={
<Checkbox
value="bandwidth20"
checked={data.bandwidth20}
onChange={handleValueChange('bandwidth20')}
/>
}
label="WiFi Low Bandwidth"
/>
<BlockFormControlLabel
control={
<Checkbox
value="nosleep"
checked={data.nosleep}
onChange={handleValueChange('nosleep')}
/>
}
label="Disable Wifi Sleepmode"
/>
<BlockFormControlLabel
control={
<Checkbox

View File

@@ -37,6 +37,10 @@ export interface NetworkSettings {
password: string;
hostname: string;
static_ip_config: boolean;
enableIPv6: boolean;
bandwidth20: boolean;
nosleep: boolean;
tx_power: number;
local_ip?: string;
gateway_ip?: string;
subnet_mask?: string;

View File

@@ -414,6 +414,16 @@ class EMSESPSettingsForm extends Component<EMSESPSettingsFormProps> {
}
label="Enable ADC"
/>
<BlockFormControlLabel
control={
<Checkbox
checked={data.low_clock}
onChange={handleValueChange('low_clock')}
value="low_clock"
/>
}
label="Low Clockrate (160MHz, changed on next reboot)"
/>
<Grid
container
spacing={0}

View File

@@ -16,6 +16,7 @@ export interface EMSESPSettings {
dallas_parasite: boolean;
led_gpio: number;
hide_led: boolean;
low_clock: boolean;
notoken_api: boolean;
analog_enabled: boolean;
pbutton_gpio: number;

View File

@@ -1,5 +1,6 @@
const ipAddressRegexp = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
const ipv6AddressRegexp = /^([a-fA-F0-9]{0,4}:([a-fA-F0-9]{0,4}:){1,6}[a-fA-F0-9]{0,4})$/;
export default function isIp(ipAddress: string) {
return ipAddressRegexp.test(ipAddress);
return ipAddressRegexp.test(ipAddress) || ipv6AddressRegexp.test(ipAddress);
}