|
|
@ -40,12 +40,12 @@ export class UploadRoute extends Route {
|
|
|
|
if (req.session.userId) {
|
|
|
|
if (req.session.userId) {
|
|
|
|
if (profilePic) {
|
|
|
|
if (profilePic) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const fileBasename = this.getFileName() + ".png";
|
|
|
|
const fileBasename = this.getFileName() + ".webp";
|
|
|
|
const filePath = path.join(this.dataDir, fileBasename);
|
|
|
|
const filePath = path.join(this.dataDir, fileBasename);
|
|
|
|
await sharp(profilePic.data)
|
|
|
|
await sharp(profilePic.data)
|
|
|
|
.resize(512, 512)
|
|
|
|
.resize(512, 512)
|
|
|
|
.normalise()
|
|
|
|
.normalise()
|
|
|
|
.png()
|
|
|
|
.webp()
|
|
|
|
.toFile(filePath);
|
|
|
|
.toFile(filePath);
|
|
|
|
fileName = `/${dataDirName}/${fileBasename}`;
|
|
|
|
fileName = `/${dataDirName}/${fileBasename}`;
|
|
|
|
const user = await User.findByPk(req.session.userId);
|
|
|
|
const user = await User.findByPk(req.session.userId);
|
|
|
|