fix(media): eliminar duplicacao de payload base64 no envio e otimizar limites websocket
This commit is contained in:
parent
add449610b
commit
5b5d707a36
@ -4411,13 +4411,24 @@ function setupChatEvents() {
|
|||||||
if (!file || !file.type.startsWith('image/') || file.type === 'image/gif' || file.type === 'image/svg+xml') {
|
if (!file || !file.type.startsWith('image/') || file.type === 'image/gif' || file.type === 'image/svg+xml') {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.onload = (e) => {
|
reader.onload = (e) => {
|
||||||
const dataUrl = e.target.result;
|
const dataUrl = e.target.result || '';
|
||||||
|
const commaIdx = dataUrl.indexOf(',');
|
||||||
|
const dataBase64 = commaIdx >= 0 ? dataUrl.slice(commaIdx + 1) : '';
|
||||||
resolve({
|
resolve({
|
||||||
name: file.name,
|
name: file.name,
|
||||||
mimeType: file.type || 'application/octet-stream',
|
mimeType: file.type || 'application/octet-stream',
|
||||||
size: file.size,
|
size: file.size,
|
||||||
dataUrl,
|
dataUrl,
|
||||||
dataBase64: (dataUrl || '').split(',')[1] || ''
|
dataBase64
|
||||||
|
});
|
||||||
|
};
|
||||||
|
reader.onerror = () => {
|
||||||
|
resolve({
|
||||||
|
name: file.name,
|
||||||
|
mimeType: file.type || 'application/octet-stream',
|
||||||
|
size: file.size,
|
||||||
|
dataUrl: '',
|
||||||
|
dataBase64: ''
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(file);
|
||||||
@ -5211,8 +5222,7 @@ function setupChatEvents() {
|
|||||||
attachment: attachmentToSend ? {
|
attachment: attachmentToSend ? {
|
||||||
name: attachmentToSend.name,
|
name: attachmentToSend.name,
|
||||||
mimeType: attachmentToSend.mimeType,
|
mimeType: attachmentToSend.mimeType,
|
||||||
size: attachmentToSend.size,
|
size: attachmentToSend.size
|
||||||
dataBase64: attachmentToSend.dataBase64
|
|
||||||
} : undefined
|
} : undefined
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"version": "1.0.30",
|
"version": "1.0.30",
|
||||||
"buildId": "2b19b259",
|
"buildId": "80e2a090",
|
||||||
"releasedAt": "2026-11-22T01:45:51.720Z",
|
"releasedAt": "2026-11-22T02:08:06.061Z",
|
||||||
"bundleUrl": "/bundles/bundle-1.0.30.zip",
|
"bundleUrl": "/bundles/bundle-1.0.30.zip",
|
||||||
"latestUrl": "/bundles/bundle-latest.zip",
|
"latestUrl": "/bundles/bundle-latest.zip",
|
||||||
"checksum": "51f053551f194cc6c082dedbbab16fc05a50ab5c81e8b497131e723c0e3c48ce",
|
"checksum": "6c29b0b1a4fd55a8ec77b89647273c243e8246492d76092394dbbeb755ea4dbe",
|
||||||
"sizeBytes": 74104
|
"sizeBytes": 74169
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ spec:
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
echo "3. Aguardando inicialização do ambiente de transferência..."
|
echo "3. Aguardando inicialização do ambiente de transferência..."
|
||||||
while ! kubectl get pod "${POD_NAME}" -n "${NAMESPACE}" -o jsonpath='{.status.initContainerStatuses[0].state.running}' 2>/dev/null | grep -q true; do
|
while [ -z "$(kubectl get pod "${POD_NAME}" -n "${NAMESPACE}" -o jsonpath='{.status.initContainerStatuses[0].state.running.startedAt}' 2>/dev/null || true)" ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -82,13 +82,20 @@ kubectl exec -n "${NAMESPACE}" "${POD_NAME}" -c prep -- touch /workspace/ready
|
|||||||
echo "5. Executando build Kaniko e push para ${IMAGE_DEST}..."
|
echo "5. Executando build Kaniko e push para ${IMAGE_DEST}..."
|
||||||
kubectl logs -f -n "${NAMESPACE}" "${POD_NAME}" -c kaniko
|
kubectl logs -f -n "${NAMESPACE}" "${POD_NAME}" -c kaniko
|
||||||
|
|
||||||
PHASE=$(kubectl get pod "${POD_NAME}" -n "${NAMESPACE}" -o jsonpath='{.status.phase}')
|
# Aguarda encerramento do container kaniko
|
||||||
|
EXIT_CODE=""
|
||||||
|
for _ in $(seq 1 15); do
|
||||||
|
EXIT_CODE=$(kubectl get pod "${POD_NAME}" -n "${NAMESPACE}" -o jsonpath='{.status.containerStatuses[0].state.terminated.exitCode}' 2>/dev/null || true)
|
||||||
|
if [ -n "${EXIT_CODE}" ]; then break; fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
echo "6. Limpando Pod construtor e arquivos temporários..."
|
echo "6. Limpando Pod construtor e arquivos temporários..."
|
||||||
kubectl delete pod "${POD_NAME}" -n "${NAMESPACE}" --grace-period=0 --force >/dev/null 2>&1 || true
|
kubectl delete pod "${POD_NAME}" -n "${NAMESPACE}" --grace-period=0 --force >/dev/null 2>&1 || true
|
||||||
rm -f "${CONTEXT_TAR}"
|
rm -f "${CONTEXT_TAR}"
|
||||||
|
|
||||||
if [ "${PHASE}" != "Succeeded" ]; then
|
if [ "${EXIT_CODE}" != "0" ]; then
|
||||||
echo "ERRO: O build do Kaniko falhou com status: ${PHASE}" >&2
|
echo "ERRO: O build do Kaniko falhou com exitCode: ${EXIT_CODE}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -157,7 +157,7 @@ export class GatewayDaemon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log(`[Gateway] Conectando ao Relay Server em ${this.relayUrl}...`);
|
console.log(`[Gateway] Conectando ao Relay Server em ${this.relayUrl}...`);
|
||||||
this.ws = new WebSocket(this.relayUrl, { maxPayload: 150 * 1024 * 1024 });
|
this.ws = new WebSocket(this.relayUrl, { maxPayload: 200 * 1024 * 1024 });
|
||||||
|
|
||||||
this.ws.on('open', () => {
|
this.ws.on('open', () => {
|
||||||
console.log('[Gateway] Conectado com sucesso ao Relay Server!');
|
console.log('[Gateway] Conectado com sucesso ao Relay Server!');
|
||||||
|
|||||||
@ -82,8 +82,8 @@ const server = http.createServer(createRelayHttpHandler({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// Setup dos Servidores WebSocket
|
// Setup dos Servidores WebSocket
|
||||||
const wssGateway = new WebSocketServer({ noServer: true, maxPayload: 150 * 1024 * 1024 });
|
const wssGateway = new WebSocketServer({ noServer: true, maxPayload: 200 * 1024 * 1024 });
|
||||||
const wssClient = new WebSocketServer({ noServer: true, maxPayload: 150 * 1024 * 1024 });
|
const wssClient = new WebSocketServer({ noServer: true, maxPayload: 200 * 1024 * 1024 });
|
||||||
|
|
||||||
server.on('upgrade', (request, socket, head) => {
|
server.on('upgrade', (request, socket, head) => {
|
||||||
const { pathname } = new URL(request.url, `http://${request.headers.host}`);
|
const { pathname } = new URL(request.url, `http://${request.headers.host}`);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user