Add RTSP URL parsing utility and enhance camera settings handling
- Implement parseRTSPUrl function to extract username, password, IP, port, and path from RTSP URLs. - Update CameraSettingFields to utilize parsed RTSP URL data for camera configuration. - Modify WiFiSettingsForm to allow password visibility toggle. - Improve SightingOverview loading and error handling UI. - Adjust NavigationArrow component to reflect updated camera side logic.
This commit is contained in:
@@ -6,6 +6,23 @@ const randomChars = () => {
|
||||
return letter;
|
||||
};
|
||||
|
||||
export function parseRTSPUrl(url: string) {
|
||||
const regex = /rtsp:\/\/([^:]+):([^@]+)@([^:/]+):?(\d+)?(\/.*)?/;
|
||||
const match = url.match(regex);
|
||||
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
username: match[1],
|
||||
password: match[2],
|
||||
ip: match[3],
|
||||
port: match[4] || "554", // default RTSP port
|
||||
path: match[5] || "/",
|
||||
};
|
||||
}
|
||||
|
||||
const generateNumberPlate = () => {
|
||||
const numberPlateLetters = new Array(4);
|
||||
const characters: string[] = [];
|
||||
|
||||
Reference in New Issue
Block a user