Merge pull request #2748 from thelounge/xpaw/fix-2747
Only emit upload url to the client that uploaded the file
This commit is contained in:
commit
52ed6f77f4
@ -29,7 +29,7 @@ const whitelist = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
class Uploader {
|
class Uploader {
|
||||||
constructor(client, socket) {
|
constructor(socket) {
|
||||||
const uploader = new SocketIOFileUploadServer();
|
const uploader = new SocketIOFileUploadServer();
|
||||||
const folder = path.join(Helper.getFileUploadPath(), ".tmp");
|
const folder = path.join(Helper.getFileUploadPath(), ".tmp");
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ class Uploader {
|
|||||||
const randomFileName = randomName;
|
const randomFileName = randomName;
|
||||||
const slug = data.file.base;
|
const slug = data.file.base;
|
||||||
const url = `uploads/${randomFileName}/${slug}`;
|
const url = `uploads/${randomFileName}/${slug}`;
|
||||||
client.emit("upload:success", url);
|
socket.emit("upload:success", url);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ function initializeClient(socket, client, token, lastMessage) {
|
|||||||
client.clientAttach(socket.id, token);
|
client.clientAttach(socket.id, token);
|
||||||
|
|
||||||
if (Helper.config.fileUpload.enable) {
|
if (Helper.config.fileUpload.enable) {
|
||||||
new Uploader(client, socket);
|
new Uploader(socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
socket.on("disconnect", function() {
|
socket.on("disconnect", function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user