ultima chance

This commit is contained in:
2026-06-30 02:16:23 -03:00
parent 1fbe319a10
commit 5761deb298
2 changed files with 96 additions and 18 deletions
+20 -4
View File
@@ -548,8 +548,15 @@ async fn sqlite_exec(sqlite_path: &Path, sql: &str) -> Result<()> {
}
fn load_ip_list(input: &str) -> Result<Vec<String>> {
let content =
fs::read_to_string(input).with_context(|| format!("failed to read input CSV {input}"))?;
let content = match fs::read_to_string(input) {
Ok(content) => content,
Err(err) if err.kind() == std::io::ErrorKind::NotFound => {
include_str!("../camfinder-open-rtsp.csv").to_string()
}
Err(err) => {
return Err(anyhow!(err)).with_context(|| format!("failed to read input CSV {input}"));
}
};
let mut ips = Vec::new();
for line in content.lines() {
@@ -682,8 +689,17 @@ impl RtspCredential {
}
fn load_rtsp_credentials(path: &Path) -> Result<Vec<RtspCredential>> {
let content = fs::read_to_string(path)
.with_context(|| format!("failed to read RTSP credential file {}", path.display()))?;
let content = match fs::read_to_string(path) {
Ok(content) => content,
Err(err) if err.kind() == std::io::ErrorKind::NotFound => {
include_str!("../main_ids.json").to_string()
}
Err(err) => {
return Err(anyhow!(err)).with_context(|| {
format!("failed to read RTSP credential file {}", path.display())
});
}
};
let usernames = parse_json_string_array(&content, "usernames")?;
let passwords = parse_json_string_array(&content, "passwords")?;
Ok(build_rtsp_credentials(&usernames, &passwords))