2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00

Adds global setting to enable or disable webcam support for barcode scanning

This commit is contained in:
Oliver Walters
2022-05-09 19:46:11 +10:00
parent 77eb978c25
commit 037e057c53
3 changed files with 9 additions and 1 deletions

View File

@ -13,6 +13,7 @@
<table class='table table-striped table-condensed'>
<tbody>
{% include "InvenTree/settings/setting.html" with key="BARCODE_ENABLE" icon="fa-qrcode" %}
{% include "InvenTree/settings/setting.html" with key="BARCODE_WEBCAM_SUPPORT" icon="fa-video" %}
</tbody>
</table>

View File

@ -70,7 +70,7 @@ function onBarcodeScanClicked(e) {
}
function onCameraAvailable(hasCamera, options) {
if ( hasCamera == true ) {
if (hasCamera && global_settings.BARCODE_WEBCAM_SUPPORT) {
// Camera is only acccessible if page is served over secure connection
if ( window.isSecureContext == true ) {
qrScanner = new QrScanner(document.getElementById('barcode_scan_video'), (result) => {