Skip to content

Commit

Permalink
- (bluefox) Corrected the error if MAC address cannot be determined
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Sep 21, 2024
1 parent 91c8e80 commit 39c3782
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 15 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Detect IP addresses from:
-->

## Changelog
### **WORK IN PROGRESS**
- (bluefox) Corrected the error if MAC address cannot be determined

### 1.0.6 (2024-09-21)
- (ChrisDietrich) Corrected the link in readme.md
- (bluefox) Corrected the Big-Endian PCAP format
Expand Down
2 changes: 1 addition & 1 deletion admin/custom/customComponents.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/lib/recording.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 19 additions & 8 deletions src-admin/src/ConfigCustomInstancesSelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -703,15 +703,26 @@ class ConfigCustomInstancesSelector extends ConfigGeneric {
const _devices = [
...(ConfigGeneric.getValue(this.props.data, 'devices') || []),
];
const pos = _devices.findIndex(item => item.ip === row.ip);
const pos = _devices.findIndex(item => item.uuid === row.uuid);
if (pos === -1) {
_devices.push({
ip: row.ip,
mac: row.mac,
desc: row.desc,
enabled: true,
uuid: row.uuid,
});
// check if maybe the device with this IP already exists
const posIp = _devices.findIndex(item => item.ip === row.ip);
if (posIp !== -1) {
// Modify ips list
const ips = JSON.parse(JSON.stringify(this.state.ips));
const ipsItem = ips.find(item => item.uuid === row.uuid);
ipsItem.uuid = _devices[posIp].uuid;
_devices[posIp].enabled = true;
this.setState({ ips }, () => this.onChange('devices', _devices));
} else {
_devices.push({
ip: row.ip,
mac: row.mac,
desc: row.desc,
enabled: true,
uuid: row.uuid,
});
}
} else {
_devices.splice(pos, 1);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/recording.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export async function stopAllRecordingsOnFritzBox(ip: string, sid: string): Prom
}

export function getRecordURL(ip: string, sid: string, iface: string, MACs: string[]): string {
const filter = MACs.length ? `ether host ${MACs.join(' || ')}` : '';
const filter = MACs.filter(m => m?.trim()).length ? `ether host ${MACs.filter(m => m?.trim()).join(' || ')}` : '';

return `http://${ip.trim()}/cgi-bin/capture_notimeout?ifaceorminor=${encodeURIComponent(iface.trim())}&snaplen=${MAX_PACKET_LENGTH}${filter ? `&filter=${encodeURIComponent(filter)}` : ''}&capture=Start&sid=${sid}`;
}
Expand Down

0 comments on commit 39c3782

Please sign in to comment.