mirror of
https://github.com/koush/scrypted.git
synced 2026-03-05 19:01:59 +00:00
Merge branch 'main' of github.com:koush/scrypted
This commit is contained in:
@@ -23,7 +23,9 @@ services:
|
||||
volumes:
|
||||
- ~/.scrypted/volume:/server/volume
|
||||
# modify and add the additional volume for Scrypted NVR
|
||||
# - /media/external:/media/external
|
||||
# the following example would mount the /mnt/sda/video path on the host
|
||||
# to the /nvr path inside the docker container.
|
||||
# - /mnt/sda/video:/nvr
|
||||
# logging is noisy and will unnecessarily wear on flash storage.
|
||||
# scrypted has per device in memory logging that is preferred.
|
||||
logging:
|
||||
|
||||
@@ -112,7 +112,16 @@ class WebhookMixin extends SettingsMixinDeviceBase<Settings> {
|
||||
}
|
||||
|
||||
const result = await device[methodOrProperty](...parameters);
|
||||
this.maybeSendMediaObject(response, result, methodOrProperty);
|
||||
if (request.headers['accept']?.includes('application/json')) {
|
||||
response?.send(JSON.stringify({ result }), {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.maybeSendMediaObject(response, result, methodOrProperty);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
this.console.error('webhook action error', e);
|
||||
@@ -123,7 +132,7 @@ class WebhookMixin extends SettingsMixinDeviceBase<Settings> {
|
||||
}
|
||||
else if (allInterfaceProperties.includes(methodOrProperty)) {
|
||||
const value = device[methodOrProperty];
|
||||
if (request.headers['accept'] && request.headers['accept'].indexOf('application/json') !== -1) {
|
||||
if (request.headers['accept']?.includes('application/json')) {
|
||||
response?.send(JSON.stringify({ value }), {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -215,4 +224,4 @@ class WebhookPlugin extends ScryptedDeviceBase implements Settings, MixinProvide
|
||||
}
|
||||
}
|
||||
|
||||
export default new WebhookPlugin();
|
||||
export default new WebhookPlugin();
|
||||
|
||||
Reference in New Issue
Block a user