mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-16 02:17:46 +01:00
Add Camera Wizard tweaks (#20889)
* digest auth backend * frontend * i18n * update field description language to include note about onvif specific credentials * mask util helper function * language * mask passwords in http-flv and others where a url param is password
This commit is contained in:
@@ -71,3 +71,26 @@ export async function detectReolinkCamera(
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mask credentials in RTSP URIs for display
|
||||
*/
|
||||
export function maskUri(uri: string): string {
|
||||
try {
|
||||
// Handle RTSP URLs with user:pass@host format
|
||||
const rtspMatch = uri.match(/rtsp:\/\/([^:]+):([^@]+)@(.+)/);
|
||||
if (rtspMatch) {
|
||||
return `rtsp://${rtspMatch[1]}:${"*".repeat(4)}@${rtspMatch[3]}`;
|
||||
}
|
||||
|
||||
// Handle HTTP/HTTPS URLs with password query parameter
|
||||
const urlObj = new URL(uri);
|
||||
if (urlObj.searchParams.has("password")) {
|
||||
urlObj.searchParams.set("password", "*".repeat(4));
|
||||
return urlObj.toString();
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
return uri;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user