dont print
This commit is contained in:
parent
bf2b5a313c
commit
f1f4df2902
2 changed files with 4 additions and 14 deletions
|
@ -35,14 +35,10 @@ export default function Upload({ roomId }) {
|
||||||
message.header,
|
message.header,
|
||||||
decryptionKeyInternal
|
decryptionKeyInternal
|
||||||
);
|
);
|
||||||
console.log("header", message.header);
|
|
||||||
console.log("state", state);
|
|
||||||
setDecryptState(state);
|
setDecryptState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.type === "FileUploadChunk") {
|
if (message.type === "FileUploadChunk") {
|
||||||
console.log("data", message);
|
|
||||||
|
|
||||||
if (readyToDownload && decryptState) {
|
if (readyToDownload && decryptState) {
|
||||||
for (const { data } of [...pendingDecryption, message]) {
|
for (const { data } of [...pendingDecryption, message]) {
|
||||||
const { message } =
|
const { message } =
|
||||||
|
@ -51,7 +47,6 @@ export default function Upload({ roomId }) {
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
const result = await writeStream.write(message);
|
const result = await writeStream.write(message);
|
||||||
console.log("output", result, message);
|
|
||||||
}
|
}
|
||||||
setPendingDecryption([]);
|
setPendingDecryption([]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -61,7 +56,6 @@ export default function Upload({ roomId }) {
|
||||||
|
|
||||||
if (message.type === "FileUploadComplete") {
|
if (message.type === "FileUploadComplete") {
|
||||||
await writeStream.close();
|
await writeStream.close();
|
||||||
console.log("done!");
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -83,7 +77,6 @@ export default function Upload({ roomId }) {
|
||||||
if (!encryptionKey) return;
|
if (!encryptionKey) return;
|
||||||
if (!selectedFile) return;
|
if (!selectedFile) return;
|
||||||
|
|
||||||
console.log("file", selectedFile);
|
|
||||||
const { state, header } =
|
const { state, header } =
|
||||||
sodium.crypto_secretstream_xchacha20poly1305_init_push(encryptionKey);
|
sodium.crypto_secretstream_xchacha20poly1305_init_push(encryptionKey);
|
||||||
sendCborMessage({
|
sendCborMessage({
|
||||||
|
@ -114,14 +107,12 @@ export default function Upload({ roomId }) {
|
||||||
room_id: roomId,
|
room_id: roomId,
|
||||||
data: encryptedValue,
|
data: encryptedValue,
|
||||||
});
|
});
|
||||||
console.log("sent encrypted chunk", encryptedValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sendCborMessage({
|
sendCborMessage({
|
||||||
type: "FileUploadComplete",
|
type: "FileUploadComplete",
|
||||||
room_id: roomId,
|
room_id: roomId,
|
||||||
});
|
});
|
||||||
console.log("sent done");
|
|
||||||
} finally {
|
} finally {
|
||||||
reader.releaseLock();
|
reader.releaseLock();
|
||||||
}
|
}
|
||||||
|
@ -129,7 +120,6 @@ export default function Upload({ roomId }) {
|
||||||
|
|
||||||
async function selectSaveFile() {
|
async function selectSaveFile() {
|
||||||
const newHandle = await window.showSaveFilePicker();
|
const newHandle = await window.showSaveFilePicker();
|
||||||
console.log("handle", newHandle);
|
|
||||||
setSelectedSaveFile(newHandle);
|
setSelectedSaveFile(newHandle);
|
||||||
|
|
||||||
const writableStream = await newHandle.createWritable();
|
const writableStream = await newHandle.createWritable();
|
||||||
|
|
|
@ -124,7 +124,7 @@ async fn handle_socket(state: AppState, socket: WebSocket) -> Result<()> {
|
||||||
WsMessage::Binary(ref bin) => {
|
WsMessage::Binary(ref bin) => {
|
||||||
let cursor = Cursor::new(bin);
|
let cursor = Cursor::new(bin);
|
||||||
let message = ciborium::from_reader::<Message, _>(cursor)?;
|
let message = ciborium::from_reader::<Message, _>(cursor)?;
|
||||||
println!("received message: {message:?}");
|
// println!("received message: {message:?}");
|
||||||
|
|
||||||
match &message {
|
match &message {
|
||||||
Message::Automerge {
|
Message::Automerge {
|
||||||
|
@ -145,7 +145,7 @@ async fn handle_socket(state: AppState, socket: WebSocket) -> Result<()> {
|
||||||
document
|
document
|
||||||
.receive_sync_message(sync_state, inner_message.clone().0)?;
|
.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
|
// Remove current client, so send to everyone else
|
||||||
let mut connected_clients = room.connected_clients.clone();
|
let mut connected_clients = room.connected_clients.clone();
|
||||||
|
@ -283,8 +283,8 @@ where
|
||||||
I: IntoIterator<Item = Uuid>,
|
I: IntoIterator<Item = Uuid>,
|
||||||
{
|
{
|
||||||
let client_ids = client_ids.into_iter().collect::<Vec<_>>();
|
let client_ids = client_ids.into_iter().collect::<Vec<_>>();
|
||||||
println!("Broadcasting message to {} clients:", client_ids.len());
|
// println!("Broadcasting message to {} clients:", client_ids.len());
|
||||||
println!(" - message: {message:?}");
|
// println!(" - message: {message:?}");
|
||||||
|
|
||||||
stream::iter(
|
stream::iter(
|
||||||
client_ids
|
client_ids
|
||||||
|
|
Loading…
Reference in a new issue