Skip to content

Commit

Permalink
* (bluefox) Widgets were corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Sep 23, 2024
1 parent 8c24105 commit b984571
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 1,564 deletions.
1,543 changes: 0 additions & 1,543 deletions admin/assets/index-C_gL5fg7.js

This file was deleted.

1 change: 0 additions & 1 deletion admin/assets/index-C_gL5fg7.js.map

This file was deleted.

2 changes: 1 addition & 1 deletion admin/index_m.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
document.head.appendChild(script);
</script>
<title>ioBroker.cameras</title>
<script type="module" crossorigin src="./assets/index-C_gL5fg7.js"></script>
<script type="module" crossorigin src="./assets/index-CXwjB4MA.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-BqFSCGOi.css">
</head>
<body>
Expand Down
8 changes: 5 additions & 3 deletions cameras/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function unload(adapter, cam) {
if (adapter.__urlCameras[cam.name]) {
delete adapter.__urlCameras[cam.name];
}
// after last unload, all the resources must be cleared too
// after last unloading, all the resources must be cleared too
if (Object.keys(adapter.__urlCameras)) {
// unload
}
Expand All @@ -41,13 +41,15 @@ function process(adapter, cam) {
cam.runningRequest = null;
return {
body: response.data,
contentType: response.headers['Content-type'] || response.headers['content-type']
contentType: response.headers['Content-type'] || response.headers['content-type'],
};
})
.catch(error => {
if (error.response) {
adapter.log.error(`Cannot read ${cam.url}: ${error.response.data || error}`);
throw new Error(error.response.data || error.response.status);
} else {
adapter.log.error(`Cannot read ${cam.url}: ${error}`);
throw new Error(error.code);
}
});
Expand All @@ -59,4 +61,4 @@ module.exports = {
init,
process,
unload,
};
};
4 changes: 3 additions & 1 deletion cameras/urlBasicAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ function process(adapter, cam) {
})
.catch(error => {
if (error.response) {
adapter.log.error(`Cannot read ${cam.url}: ${error.response.data || error}`);
throw new Error(error.response.data || error.response.status);
} else {
adapter.log.error(`Cannot read ${cam.url}: ${error}`);
throw new Error(error.code);
}
});
Expand All @@ -56,4 +58,4 @@ module.exports = {
init,
process,
unload,
};
};
10 changes: 8 additions & 2 deletions lib/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,19 @@ class ProxyCameras {
res.status(500).send(typeof error !== 'string' ? JSON.stringify(error) : error));
return;
}

this.adapter.log.debug(`Request "${rule.name}" with "${query} on port ${this.config.port}...`);

getUrl(rule.name, query, this.config.port)
.then(file => {
res.setHeader('Content-type', file.contentType);
res.status(200).send(file.body || '');
})
.catch(error =>
res.status(500).send(typeof error !== 'string' ? JSON.stringify(error) : error));
.catch(error => {
const text = error.response ? error.response.data || error : error;
this.adapter.log.error(`Cannot request "${rule.name}" with "${query} on port ${this.config.port}: ${text}`);
res.status(500).send(typeof error !== 'string' ? JSON.stringify(error) : error);
});
});
}
}
Expand Down
13 changes: 0 additions & 13 deletions src/src/Tabs/Cameras.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -472,19 +472,6 @@ class Server extends Component<ServerProps, ServerState> {
this.onCameraSettingsChanged(settings);
}}
/>
<div style={styles.sampleUrl}>
{I18n.t('Local URL')}
:&nbsp;
<a
style={styles.link}
href={`http://${this.props.native.bind}:${this.props.native.port}/${cam.name}?key=${this.props.native.key}`}
target="_blank"
rel="noopener noreferrer"
>
URL: http://{this.props.native.bind}:{this.props.native.port}/{cam.name}?key=
{this.props.native.key}
</a>
</div>
<div style={styles.sampleUrl}>
{I18n.t('Web URL')}
:&nbsp;
Expand Down

0 comments on commit b984571

Please sign in to comment.