fix(media): eliminar duplicacao de payload base64 no envio e otimizar limites websocket

This commit is contained in:
Winícius 2026-11-21 23:11:30 -03:00
parent add449610b
commit 5b5d707a36
8 changed files with 690 additions and 117 deletions

762
app.js

File diff suppressed because it is too large Load Diff

View File

@ -4411,13 +4411,24 @@ function setupChatEvents() {
if (!file || !file.type.startsWith('image/') || file.type === 'image/gif' || file.type === 'image/svg+xml') {
const reader = new FileReader();
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({
name: file.name,
mimeType: file.type || 'application/octet-stream',
size: file.size,
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);
@ -5211,8 +5222,7 @@ function setupChatEvents() {
attachment: attachmentToSend ? {
name: attachmentToSend.name,
mimeType: attachmentToSend.mimeType,
size: attachmentToSend.size,
dataBase64: attachmentToSend.dataBase64
size: attachmentToSend.size
} : undefined
}));

Binary file not shown.

Binary file not shown.

View File

@ -1,9 +1,9 @@
{
"version": "1.0.30",
"buildId": "2b19b259",
"releasedAt": "2026-11-22T01:45:51.720Z",
"buildId": "80e2a090",
"releasedAt": "2026-11-22T02:08:06.061Z",
"bundleUrl": "/bundles/bundle-1.0.30.zip",
"latestUrl": "/bundles/bundle-latest.zip",
"checksum": "51f053551f194cc6c082dedbbab16fc05a50ab5c81e8b497131e723c0e3c48ce",
"sizeBytes": 74104
"checksum": "6c29b0b1a4fd55a8ec77b89647273c243e8246492d76092394dbbeb755ea4dbe",
"sizeBytes": 74169
}

View File

@ -71,7 +71,7 @@ spec:
EOF
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
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}..."
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..."
kubectl delete pod "${POD_NAME}" -n "${NAMESPACE}" --grace-period=0 --force >/dev/null 2>&1 || true
rm -f "${CONTEXT_TAR}"
if [ "${PHASE}" != "Succeeded" ]; then
echo "ERRO: O build do Kaniko falhou com status: ${PHASE}" >&2
if [ "${EXIT_CODE}" != "0" ]; then
echo "ERRO: O build do Kaniko falhou com exitCode: ${EXIT_CODE}" >&2
exit 1
fi

View File

@ -157,7 +157,7 @@ export class GatewayDaemon {
}
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', () => {
console.log('[Gateway] Conectado com sucesso ao Relay Server!');

View File

@ -82,8 +82,8 @@ const server = http.createServer(createRelayHttpHandler({
}));
// Setup dos Servidores WebSocket
const wssGateway = new WebSocketServer({ noServer: true, maxPayload: 150 * 1024 * 1024 });
const wssClient = 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: 200 * 1024 * 1024 });
server.on('upgrade', (request, socket, head) => {
const { pathname } = new URL(request.url, `http://${request.headers.host}`);