yumoqing 2b921a209d sync: local modifications to integrated_crm_app
- Updated app/integrated_crm_app.py, build.sh, conf/config.json
- Added config.ini, schema.sql, send_email.py, test_db_conn.py
- Added full wwwroot/ with bricks framework, all module frontends, login/main UI
2026-04-28 18:54:07 +08:00

56 lines
1020 B
JavaScript

bricks = window.bricks || {};
bricks.UpStreaming = class extends bricks.JsWidget {
/*
{
"url":
}
*/
constructor(opts){
super(opts);
}
async go(){
this.body = new ReadableStream(this);
this.headers = new Headers();
this.headers.append('Content-Type',
'application/octet-stream');
var resp = await fetch(this.url, {
method: 'POST',
headers: this.headers,
duplex: 'full',
body: this.body
});
return resp
}
send(data){
this.stream_ctlr.enqueue(data);
}
finish(){
this.stream_ctlr.close();
}
start(controller){
this.stream_ctlr = controller;
}
}
bricks.down_streaming = async function*(response) {
if (! response){
return;
}
const reader = response.body.getReader();
var value;
var t = 0;
while (true){
done, value = await reader.read();
if (value.done){
break;
}
let result = '';
for (let i = 0; i < value.value.length; i++) {
result += String.fromCharCode(value.value[i]);
}
console.log('audio set url=', result);
yield result;
}
}