add debug, last try for now

This commit is contained in:
Raven Scott 2024-06-09 06:44:26 -04:00
parent d5ea2abb7a
commit 5ff2460d23

12
app.js
View File

@ -121,10 +121,14 @@ async function initialize() {
await drive.put(`/icons/${username}.png`, avatarBuffer); await drive.put(`/icons/${username}.png`, avatarBuffer);
updateIcon(username, avatarBuffer); updateIcon(username, avatarBuffer);
} else if (messageObj.type === 'file') { } else if (messageObj.type === 'file') {
const fileBuffer = Buffer.from(messageObj.fileData, 'base64'); try {
await drive.put(messageObj.filePath, fileBuffer); const fileBuffer = Buffer.from(messageObj.fileData, 'base64');
const fileUrl = `http://localhost:${servePort}${messageObj.filePath}`; await drive.put(messageObj.filePath, fileBuffer);
addFileMessage(messageObj.name, messageObj.fileName, fileUrl, messageObj.fileType, messageObj.avatar); const fileUrl = `http://localhost:${servePort}${messageObj.filePath}`;
addFileMessage(messageObj.name, messageObj.fileName, fileUrl, messageObj.fileType, messageObj.avatar);
} catch (error) {
console.error('Error putting file:', error);
}
} else { } else {
onMessageAdded(messageObj.name, messageObj.message, messageObj.avatar); onMessageAdded(messageObj.name, messageObj.message, messageObj.avatar);
} }