diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index e3cda66f8..c72d2bbe8 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -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: diff --git a/plugins/webhook/src/main.ts b/plugins/webhook/src/main.ts index 4e2f0fbdf..bb2366243 100644 --- a/plugins/webhook/src/main.ts +++ b/plugins/webhook/src/main.ts @@ -112,7 +112,16 @@ class WebhookMixin extends SettingsMixinDeviceBase { } 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 { } 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(); \ No newline at end of file +export default new WebhookPlugin();