mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-04-04 14:04:17 -04:00
Merge branch 'master' into add_janus_rtsp_user
This commit is contained in:
@@ -116,8 +116,8 @@ FfmpegCamera::FfmpegCamera(
|
||||
),
|
||||
mPath(p_path),
|
||||
mSecondPath(p_second_path),
|
||||
mUser(UriEncode(p_user)),
|
||||
mPass(UriEncode(p_pass)),
|
||||
mUser(p_user),
|
||||
mPass(p_pass),
|
||||
mMethod(p_method),
|
||||
mOptions(p_options),
|
||||
hwaccel_name(p_hwaccel_name),
|
||||
|
||||
@@ -48,19 +48,16 @@ void Monitor::JanusManager::load_from_monitor() {
|
||||
janus_endpoint = "127.0.0.1:8088/janus";
|
||||
}
|
||||
|
||||
rtsp_username = "";
|
||||
rtsp_password = "";
|
||||
rtsp_auth_time = std::chrono::steady_clock::now();
|
||||
|
||||
if (Use_RTSP_Restream) {
|
||||
int restream_port = config.min_rtsp_port;
|
||||
if (parent->server_id) {
|
||||
Server server(parent->server_id);
|
||||
rtsp_path = "rtsp://"+server.Hostname();
|
||||
} else {
|
||||
rtsp_path = "rtsp://127.0.0.1";
|
||||
}
|
||||
rtsp_path += ":" + std::to_string(restream_port) + "/" + parent->rtsp_streamname;
|
||||
rtsp_path += ":" + std::to_string(config.min_rtsp_port) + "/" + parent->rtsp_streamname;
|
||||
if (ZM_OPT_USE_AUTH) {
|
||||
SystemTimePoint now = std::chrono::system_clock::now();
|
||||
time_t now_t = std::chrono::system_clock::to_time_t(now);
|
||||
@@ -74,13 +71,11 @@ void Monitor::JanusManager::load_from_monitor() {
|
||||
MYSQL_RES *result = zmDbFetch(sql);
|
||||
if (result) {
|
||||
MYSQL_ROW dbrow = mysql_fetch_row(result);
|
||||
const char *username = dbrow[1];
|
||||
const char *password = dbrow[2];
|
||||
|
||||
std::string auth_key = stringtf("%s%s%s%s%d%d%d%d",
|
||||
config.auth_hash_secret,
|
||||
username,
|
||||
password,
|
||||
dbrow[1], // username
|
||||
dbrow[2], // password
|
||||
(config.auth_hash_ips ? "127.0.0.1" : ""),
|
||||
now_tm.tm_hour,
|
||||
now_tm.tm_mday,
|
||||
@@ -98,13 +93,14 @@ void Monitor::JanusManager::load_from_monitor() {
|
||||
}
|
||||
} else {
|
||||
rtsp_path = parent->path;
|
||||
if (parent->user.length() > 0) {
|
||||
if (!parent->user.empty()) {
|
||||
rtsp_username = escape_json_string(parent->user);
|
||||
rtsp_password = escape_json_string(parent->pass);
|
||||
}
|
||||
rtsp_path = parent->path;
|
||||
}
|
||||
parent->janus_pin = generateKey(16);
|
||||
Debug(1, "Monitor %u assigned secret %s", parent->id, parent->janus_pin.c_str());
|
||||
Debug(1, "Monitor %u assigned secret %s, rtsp url is %s", parent->id, parent->janus_pin.c_str(), rtsp_path.c_str());
|
||||
strncpy(parent->shared_data->janus_pin, parent->janus_pin.c_str(), 17); //copy the null termination, as we're in C land
|
||||
}
|
||||
|
||||
@@ -193,7 +189,7 @@ int Monitor::JanusManager::add_to_janus() {
|
||||
postData += "\", \"videofmtp\" : \"";
|
||||
postData += profile_override;
|
||||
}
|
||||
if (rtsp_username.length() > 0) {
|
||||
if (!rtsp_username.empty()) {
|
||||
postData += "\", \"rtsp_user\" : \"";
|
||||
postData += rtsp_username;
|
||||
postData += "\", \"rtsp_pwd\" : \"";
|
||||
@@ -203,7 +199,7 @@ int Monitor::JanusManager::add_to_janus() {
|
||||
postData += std::to_string(parent->id);
|
||||
if (parent->janus_audio_enabled) postData += ", \"audio\" : true";
|
||||
postData += ", \"video\" : true}}";
|
||||
Warning("Sending %s to %s", postData.c_str(), endpoint.c_str());
|
||||
Debug(1, "Sending %s to %s", postData.c_str(), endpoint.c_str());
|
||||
|
||||
CURLcode res;
|
||||
std::string response;
|
||||
|
||||
@@ -158,7 +158,7 @@ function expr_to_ui(expr, container) {
|
||||
select.append('<option value="">Add MonitorLink</option>');
|
||||
for (monitor_id in monitors) {
|
||||
const monitor = monitors[monitor_id];
|
||||
//if (!array_search(monitor.Id, used_monitorlinks))
|
||||
//if (!array_search(monitor.Id, used_monitorlinks))
|
||||
select.append('<option value="' + monitor.Id + '">' + monitor.Name + ' : All Zones</option>');
|
||||
for ( zone_id in zones ) {
|
||||
const zone = zones[zone_id];
|
||||
|
||||
@@ -132,11 +132,11 @@ function renderAlarmCues(containerEl) {
|
||||
*/
|
||||
cues_div = document.getElementById('alarmCues');
|
||||
const event_length = (eventData.Length > cueFrames[cueFrames.length - 1].Delta) ? eventData.Length : cueFrames[cueFrames.length - 1].Delta;
|
||||
let span_count = 10;
|
||||
let span_seconds = parseInt(event_length / span_count);
|
||||
let span_width = parseInt(containerEl.width() / span_count);
|
||||
const span_count = 10;
|
||||
const span_seconds = parseInt(event_length / span_count);
|
||||
const span_width = parseInt(containerEl.width() / span_count);
|
||||
console.log(span_width, containerEl.width(), span_count);
|
||||
//let span_width =
|
||||
//let span_width =
|
||||
const date = new Date(eventData.StartDateTime);
|
||||
for (let i=0; i < span_count; i += 1) {
|
||||
html += '<span style="left:'+(i*span_width)+'px; width: '+span_width+'px;">'+date.toLocaleTimeString()+'</span>';
|
||||
@@ -848,7 +848,7 @@ function progressBarNav() {
|
||||
if (x<0) x=0;
|
||||
if (x > bar.width()) x = bar.width();
|
||||
|
||||
let seekTime = (x / bar.width()) * parseFloat(eventData.Length);
|
||||
const seekTime = (x / bar.width()) * parseFloat(eventData.Length);
|
||||
|
||||
const indicator = document.getElementById('indicator');
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ function initPage() {
|
||||
window.location.reload(true);
|
||||
});
|
||||
|
||||
document.getElementById("newBtn").addEventListener('click', function (evt) {
|
||||
document.getElementById("newBtn").addEventListener('click', function onNewClick(evt) {
|
||||
evt.preventDefault();
|
||||
window.location = '?view=report';
|
||||
});
|
||||
|
||||
@@ -110,7 +110,7 @@ dataset_indexes = {}; // Associative array from a date String like July 20 to an
|
||||
for (i=0; i < 24; i++) {
|
||||
time_labels[time_labels.length] = `${i}:00`;
|
||||
}
|
||||
months = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ];
|
||||
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||
|
||||
for (event_index=0; event_index < events.length; event_index++) {
|
||||
const event = events[event_index];
|
||||
@@ -128,7 +128,7 @@ for (event_index=0; event_index < events.length; event_index++) {
|
||||
fill: false,
|
||||
borderColor: 'rgb('+parseInt(255*Math.random())+', '+parseInt(255*Math.random())+', '+parseInt(255*Math.random())+')',
|
||||
tension: 0.1,
|
||||
data: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
|
||||
data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user