Skip to content

Commit

Permalink
Add auth to v4lsetting
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac Connor committed Nov 22, 2024
1 parent 1c2600f commit 7fed03d
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions web/skins/classic/views/js/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ function updatePresetLabels() {

function changeControl(e) {
const input = e.target;
$j.getJSON(monitorUrl+'?request=v4l2_settings&mid='+monitorId+'&'+input.name+'='+input.value)
$j.getJSON(monitorUrl+'?request=v4l2_settings&mid='+monitorId+'&'+input.name+'='+input.value+'&'+auth_relay)
.done(function(evt) {
if (evt.result == 'Ok') {
evt.controls.forEach(function(control) {
Expand All @@ -654,9 +654,12 @@ function changeControl(e) {
}

function getSettingsModal() {
$j.getJSON(monitorUrl + '?request=modal&modal=settings&mid=' + monitorId)
$j.getJSON(monitorUrl + '?request=modal&modal=settings&mid=' + monitorId+'&'+auth_relay)
.done(function(data) {
let modal = $j('#settingsModal');
if (modal.length) modal.remove();
insertModalHtml('settingsModal', data.html);
modal = $j('#settingsModal');
// Manage the Save button
$j('#settingsSubmitModal').click(function(evt) {
evt.preventDefault();
Expand Down Expand Up @@ -748,19 +751,22 @@ function controlSetClicked() {
}

function streamPrepareStart(monitor=null) {
if (canView.Control) {
// Load the settings modal into the DOM
if (monitorType == 'Local') getSettingsModal();
}
// Only enable the settings button for local cameras
if (!canView.Control) {
settingsBtn.prop('disabled', true);
settingsBtn.prop('title', 'Disbled due to lack of Control View permission.');
settingsBtn.prop('title', 'Disabled due to lack of Control View permission.');
} else if (monitorType != 'Local') {
settingsBtn.prop('disabled', true);
settingsBtn.prop('title', 'Settings only available for Local monitors.');
} else {
// Load the settings modal into the DOM
settingsBtn.prop('disabled', false);
getSettingsModal();
// Manage the SETTINGS button
bindButton('#settingsBtn', 'click', null, function onSettingsClick(evt) {
evt.preventDefault();
$j('#settingsModal').modal('show');
});
}

if ((monitorType != 'WebSite') && monitorData.length) {
Expand Down Expand Up @@ -988,11 +994,6 @@ function initPage() {
window.location.reload(true);
});

// Manage the SETTINGS button
bindButton('#settingsBtn', 'click', null, function onSettingsClick(evt) {
evt.preventDefault();
$j('#settingsModal').modal('show');
});

bindButton('#cyclePlayBtn', 'click', null, cycleStart);
bindButton('#cyclePauseBtn', 'click', null, cyclePause);
Expand Down

0 comments on commit 7fed03d

Please sign in to comment.