Merge branch 'develop' into cheeks-fixes

This commit is contained in:
Andrew Kingston 2023-07-10 17:44:03 +01:00 committed by GitHub
commit be7e262919
6 changed files with 89 additions and 2 deletions

View File

@ -22,6 +22,16 @@ server {
proxy_pass http://127.0.0.1:4001; proxy_pass http://127.0.0.1:4001;
} }
location /embed {
rewrite /embed/(.*) /app/$1 break;
proxy_pass http://127.0.0.1:4001;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header x-budibase-embed "true";
add_header x-budibase-embed "true";
add_header Content-Security-Policy "frame-ancestors *";
}
location = / { location = / {
proxy_pass http://127.0.0.1:4001; proxy_pass http://127.0.0.1:4001;
} }

View File

@ -1,5 +1,5 @@
{ {
"version": "2.8.3-alpha.3", "version": "2.8.6-alpha.0",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*" "packages/*"

View File

@ -2,11 +2,12 @@
import { Button, Modal } from "@budibase/bbui" import { Button, Modal } from "@budibase/bbui"
import ImportQueriesModal from "./RestImportQueriesModal.svelte" import ImportQueriesModal from "./RestImportQueriesModal.svelte"
export let datasourceId
let importQueriesModal let importQueriesModal
</script> </script>
<Modal bind:this={importQueriesModal}> <Modal bind:this={importQueriesModal}>
<ImportQueriesModal createDatasource={false} datasourceId={"todo"} /> <ImportQueriesModal createDatasource={false} {datasourceId} />
</Modal> </Modal>
<div class="button"> <div class="button">

View File

@ -3223,6 +3223,46 @@
"key": "allowManualEntry", "key": "allowManualEntry",
"defaultValue": false "defaultValue": false
}, },
{
"type": "boolean",
"label": "Play sound on scan",
"key": "beepOnScan",
"defaultValue": false
},
{
"type": "select",
"label": "Sound pitch",
"key": "beepFrequency",
"dependsOn": "beepOnScan",
"defaultValue": 2637,
"options": [
{
"label": "Low",
"value": 2096
},
{
"label": "Regular",
"value": 2637
},
{
"label": "High",
"value": 3136
},
{ "label": "Custom", "value": "custom" }
]
},
{
"type": "number",
"label": "Sound frequency (Hz)",
"key": "customFrequency",
"defaultValue": 1046,
"min": 20,
"max": 8000,
"dependsOn": {
"setting": "beepFrequency",
"value": "custom"
}
},
{ {
"type": "validation/string", "type": "validation/string",
"label": "Validation", "label": "Validation",

View File

@ -8,6 +8,10 @@
export let disabled = false export let disabled = false
export let allowManualEntry = false export let allowManualEntry = false
export let scanButtonText = "Scan code" export let scanButtonText = "Scan code"
export let beepOnScan = false
export let beepFrequency = 2637
export let customFrequency = 1046
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
let videoEle let videoEle
@ -21,8 +25,13 @@
fps: 25, fps: 25,
qrbox: { width: 250, height: 250 }, qrbox: { width: 250, height: 250 },
} }
const audioCtx = new (window.AudioContext || window.webkitAudioContext)()
const onScanSuccess = decodedText => { const onScanSuccess = decodedText => {
if (value != decodedText) { if (value != decodedText) {
if (beepOnScan) {
beep()
}
dispatch("change", decodedText) dispatch("change", decodedText)
} }
} }
@ -84,6 +93,27 @@
} }
camModal.hide() camModal.hide()
} }
const beep = () => {
const oscillator = audioCtx.createOscillator()
const gainNode = audioCtx.createGain()
oscillator.connect(gainNode)
gainNode.connect(audioCtx.destination)
const frequency =
beepFrequency === "custom" ? customFrequency : beepFrequency
oscillator.frequency.value = frequency
oscillator.type = "square"
const duration = 420
const endTime = audioCtx.currentTime + duration / 1000
gainNode.gain.setValueAtTime(1, audioCtx.currentTime)
gainNode.gain.exponentialRampToValueAtTime(0.001, endTime)
oscillator.start()
oscillator.stop(endTime)
}
</script> </script>
<div class="scanner-video-wrapper"> <div class="scanner-video-wrapper">

View File

@ -11,6 +11,9 @@
export let onChange export let onChange
export let allowManualEntry export let allowManualEntry
export let scanButtonText export let scanButtonText
export let beepOnScan
export let beepFrequency
export let customFrequency
let fieldState let fieldState
let fieldApi let fieldApi
@ -42,6 +45,9 @@
disabled={fieldState.disabled} disabled={fieldState.disabled}
{allowManualEntry} {allowManualEntry}
scanButtonText={scanText} scanButtonText={scanText}
{beepOnScan}
{beepFrequency}
{customFrequency}
/> />
{/if} {/if}
</Field> </Field>