dont print

This commit is contained in:
Michael Zhang 2023-08-10 17:56:44 -05:00
parent bf2b5a313c
commit f1f4df2902
2 changed files with 4 additions and 14 deletions

View file

@ -35,14 +35,10 @@ export default function Upload({ roomId }) {
message.header,
decryptionKeyInternal
);
console.log("header", message.header);
console.log("state", state);
setDecryptState(state);
}
if (message.type === "FileUploadChunk") {
console.log("data", message);
if (readyToDownload && decryptState) {
for (const { data } of [...pendingDecryption, message]) {
const { message } =
@ -51,7 +47,6 @@ export default function Upload({ roomId }) {
data
);
const result = await writeStream.write(message);
console.log("output", result, message);
}
setPendingDecryption([]);
} else {
@ -61,7 +56,6 @@ export default function Upload({ roomId }) {
if (message.type === "FileUploadComplete") {
await writeStream.close();
console.log("done!");
}
},
});
@ -83,7 +77,6 @@ export default function Upload({ roomId }) {
if (!encryptionKey) return;
if (!selectedFile) return;
console.log("file", selectedFile);
const { state, header } =
sodium.crypto_secretstream_xchacha20poly1305_init_push(encryptionKey);
sendCborMessage({
@ -114,14 +107,12 @@ export default function Upload({ roomId }) {
room_id: roomId,
data: encryptedValue,
});
console.log("sent encrypted chunk", encryptedValue);
}
sendCborMessage({
type: "FileUploadComplete",
room_id: roomId,
});
console.log("sent done");
} finally {
reader.releaseLock();
}
@ -129,7 +120,6 @@ export default function Upload({ roomId }) {
async function selectSaveFile() {
const newHandle = await window.showSaveFilePicker();
console.log("handle", newHandle);
setSelectedSaveFile(newHandle);
const writableStream = await newHandle.createWritable();

View file

@ -124,7 +124,7 @@ async fn handle_socket(state: AppState, socket: WebSocket) -> Result<()> {
WsMessage::Binary(ref bin) => {
let cursor = Cursor::new(bin);
let message = ciborium::from_reader::<Message, _>(cursor)?;
println!("received message: {message:?}");
// println!("received message: {message:?}");
match &message {
Message::Automerge {
@ -145,7 +145,7 @@ async fn handle_socket(state: AppState, socket: WebSocket) -> Result<()> {
document
.receive_sync_message(sync_state, inner_message.clone().0)?;
}
println!("inner doc: {:?}", room.document);
// println!("inner doc: {:?}", room.document);
// Remove current client, so send to everyone else
let mut connected_clients = room.connected_clients.clone();
@ -283,8 +283,8 @@ where
I: IntoIterator<Item = Uuid>,
{
let client_ids = client_ids.into_iter().collect::<Vec<_>>();
println!("Broadcasting message to {} clients:", client_ids.len());
println!(" - message: {message:?}");
// println!("Broadcasting message to {} clients:", client_ids.len());
// println!(" - message: {message:?}");
stream::iter(
client_ids