mirror of
https://github.com/koush/scrypted.git
synced 2026-02-09 16:52:18 +00:00
snapshot: better error on empty url
This commit is contained in:
4
plugins/snapshot/package-lock.json
generated
4
plugins/snapshot/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/snapshot",
|
||||
"version": "0.0.12",
|
||||
"version": "0.0.13",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/snapshot",
|
||||
"version": "0.0.12",
|
||||
"version": "0.0.13",
|
||||
"dependencies": {
|
||||
"@koush/axios-digest-auth": "^0.8.5",
|
||||
"@types/node": "^16.6.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/snapshot",
|
||||
"version": "0.0.12",
|
||||
"version": "0.0.13",
|
||||
"description": "Snapshot Plugin for Scrypted",
|
||||
"scripts": {
|
||||
"prepublishOnly": "NODE_ENV=production scrypted-webpack",
|
||||
|
||||
@@ -100,17 +100,23 @@ class SnapshotMixin extends SettingsMixinDeviceBase<Camera> implements Camera {
|
||||
}
|
||||
|
||||
if (!takePicture) {
|
||||
if (!this.storageSettings.values.snapshotUrl && this.mixinDeviceInterfaces.includes(ScryptedInterface.Camera)) {
|
||||
takePicture = async () => {
|
||||
// if operating in full resolution mode, nuke any picture options containing
|
||||
// the requested dimensions that are sent.
|
||||
if (this.storageSettings.values.snapshotResolution === 'Full Resolution' && options)
|
||||
options.picture = undefined;
|
||||
return this.mixinDevice.takePicture(options).then(mo => mediaManager.convertMediaObjectToBuffer(mo, 'image/jpeg'))
|
||||
};
|
||||
if (!this.storageSettings.values.snapshotUrl) {
|
||||
if (this.mixinDeviceInterfaces.includes(ScryptedInterface.Camera)) {
|
||||
takePicture = async () => {
|
||||
// if operating in full resolution mode, nuke any picture options containing
|
||||
// the requested dimensions that are sent.
|
||||
if (this.storageSettings.values.snapshotResolution === 'Full Resolution' && options)
|
||||
options.picture = undefined;
|
||||
return this.mixinDevice.takePicture(options).then(mo => mediaManager.convertMediaObjectToBuffer(mo, 'image/jpeg'))
|
||||
};
|
||||
}
|
||||
else {
|
||||
takePicture = () => {
|
||||
throw new Error('Snapshot Unavailable (snapshotUrl empty, and prebuffer not available or enabled)');
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if (!this.axiosClient) {
|
||||
let username: string;
|
||||
let password: string;
|
||||
|
||||
Reference in New Issue
Block a user