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

4
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') {
try {
const fileBuffer = Buffer.from(messageObj.fileData, 'base64'); const fileBuffer = Buffer.from(messageObj.fileData, 'base64');
await drive.put(messageObj.filePath, fileBuffer); await drive.put(messageObj.filePath, fileBuffer);
const fileUrl = `http://localhost:${servePort}${messageObj.filePath}`; const fileUrl = `http://localhost:${servePort}${messageObj.filePath}`;
addFileMessage(messageObj.name, messageObj.fileName, fileUrl, messageObj.fileType, messageObj.avatar); 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);
} }