self.finish(json.dumps(data))
def get_current_user(self):
+ main_config = config.get_main()
+
try:
scheme, token = self.request.headers.get('Authorization', '').split()
if scheme.lower() == 'basic':
user, pwd = base64.decodestring(token).split(':')
- main_config = config.get_main()
if user == main_config.get('@admin_username') and pwd == main_config.get('@admin_password'):
return 'admin'
else:
logging.error('authentication failed for user %(user)s' % {'user': user})
- except:
- pass
+ except: # no authentication info provided
+ if not main_config.get('@normal_password') and not self.get_argument('logout', None):
+ return 'normal'
return None
}
function doLogout() {
- $.ajax({
- url: '/',
- username: ' ',
- password: 'logout' + new Date().getTime(),
- complete: function () {
- window.location.href = '/?logout=true';
- }
- });
-
/* IE is always a breed apart */
- if (document.execCommand) {
- try {
- document.execCommand('ClearAuthenticationCache');
- }
- catch (e) {
+ if (window.ActiveXObject && document.execCommand) {
+ if (document.execCommand('ClearAuthenticationCache')) {
+ window.location.href = '/?logout=true';
}
-
- window.location.href = '/?logout=true';
+ }
+ else {
+ var username = ' ';
+ var password = 'logout' + new Date().getTime();
+
+ $.ajax({
+ url: '/?logout=true',
+ username: username,
+ password: password,
+ complete: function () {
+ window.location.href = '/?logout=true';
+ }
+ });
}
}
/* logout button */
$('div.button.logout-button').click(doLogout);
+
+ /* read-only entries */
+ $('#streamingSnapshotUrlEntry:text, #streamingMjpgUrlEntry:text, #streamingEmbedUrlEntry:text').click(function () {
+ this.select();
+ });
}
$('#textOverlaySwitch').parent().next('table.settings').find('tr.settings-item').each(markHide);
}
- /* video streaming switch */
+ /* video streaming */
if (!$('#videoStreamingSwitch').get(0).checked) {
$('#videoStreamingSwitch').parent().next('table.settings').find('tr.settings-item').not('.local-streaming').each(markHide);
}
-
- /* streaming server resize switch */
+ if (!$('#streamingSnapshotUrlEntry').val()) {
+ $('#streamingSnapshotUrlEntry').parents('tr:eq(0)').each(markHide);
+ }
+ if (!$('#streamingMjpgUrlEntry').val()) {
+ $('#streamingMjpgUrlEntry').parents('tr:eq(0)').each(markHide);
+ }
+ if (!$('#streamingEmbedUrlEntry').val()) {
+ $('#streamingEmbedUrlEntry').parents('tr:eq(0)').each(markHide);
+ }
if (!$('#streamingServerResizeSwitch').get(0).checked) {
$('#streamingResolutionSlider').parents('tr:eq(0)').each(markHide);
}
$('#streamingPortEntry').val(dict['streaming_port']);
$('#streamingMotion')[0].checked = dict['streaming_motion'];
+ var cameraUrl = location.protocol + '//' + location.host + '/picture/' + dict.id + '/';
+ $('#streamingSnapshotUrlEntry').val(cameraUrl + 'current/');
+ if (dict.proto == 'motioneye') {
+ $('#streamingMjpgUrlEntry').val('');
+ }
+ else {
+ $('#streamingMjpgUrlEntry').val(location.protocol + '//' + location.host.split(':')[0] + ':' + dict.streaming_port);
+ }
+ $('#streamingEmbedUrlEntry').val(cameraUrl + 'frame/');
+
/* still images */
$('#stillImagesSwitch')[0].checked = dict['still_images'];
$('#imageFileNameEntry').val(dict['image_file_name']);
}
endProgress();
- var addCameraOption = $('#addCameraSelect').find('option[value=add]');
- addCameraOption.before('<option value="' + data.id + '">' + data.name + '</option>');
- $('#addCameraSelect').val(data.id).change();
+ var cameraOption = $('#cameraSelect').find('option[value=add]');
+ cameraOption.before('<option value="' + data.id + '">' + data.name + '</option>');
+ $('#cameraSelect').val(data.id).change();
recreateCameraFrames();
});
}
<tr class="settings-item">
<td class="settings-item-label"><span class="settings-item-label">Surveillance Password</span></td>
<td class="settings-item-value"><input type="password" class="styled general" id="normalPasswordEntry"></td>
- <td><span class="help-mark" title="the password for the surveillance user">?</span></td>
+ <td><span class="help-mark" title="the password for the surveillance user (leave empty for passwordless surveillance)">?</span></td>
</tr>
<tr class="settings-item advanced-setting{% if not timezones %} hidden{% endif %}">
<td class="settings-item-label"><span class="settings-item-label">Time Zone</span></td>
<td class="settings-item-value"><input type="checkbox" class="styled streaming" id="streamingMotion"></td>
<td><span class="help-mark" title="enable this if you want a lower frame rate for the live streaming when no motion is detected">?</span></td>
</tr>
+ <tr class="settings-item advanced-setting local-streaming">
+ <td class="settings-item-label"><span class="settings-item-label">Snapshot URL</span></td>
+ <td class="settings-item-value"><input type="text" class="styled streaming" id="streamingSnapshotUrlEntry" readonly="readonly"></td>
+ <td><span class="help-mark" title="a URL that provides a JPEG image with the most recent snapshot of the camera">?</span></td>
+ </tr>
+ <tr class="settings-item advanced-setting">
+ <td class="settings-item-label"><span class="settings-item-label">Streaming URL</span></td>
+ <td class="settings-item-value"><input type="text" class="styled streaming" id="streamingMjpgUrlEntry" readonly="readonly"></td>
+ <td><span class="help-mark" title="a URL that provides a MJPEG stream of the camera (there is no password protection for this URL!)">?</span></td>
+ </tr>
+ <tr class="settings-item advanced-setting local-streaming">
+ <td class="settings-item-label"><span class="settings-item-label">Embed URL</span></td>
+ <td class="settings-item-value"><input type="text" class="styled streaming" id="streamingEmbedUrlEntry" readonly="readonly"></td>
+ <td><span class="help-mark" title="a URL that provides a minimal HTML document containing the camera frame, ready to be embedded">?</span></td>
+ </tr>
</table>
<div class="settings-section-title"><input type="checkbox" class="styled section still-images" id="stillImagesSwitch">Still Images</div>