Skip to content

Commit e1a67ce

Browse files
committed
Merge branch 'release.24.10' into next
2 parents 2849195 + 0378d39 commit e1a67ce

File tree

7 files changed

+918
-1230
lines changed

7 files changed

+918
-1230
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## Version 24.10.x
2+
3+
Dependencies:
4+
- Bump puppeteer from 23.8.0 to 23.9.0
5+
- Bump nodemailer from 6.9.15 to 6.9.16
6+
- Bump countly-sdk-web from 24.4.1 to 24.11.0
7+
- Bump tslib from 2.7.0 to 2.8.1
8+
- Bump form-data from 4.0.0 to 4.0.1
9+
- Bump jimp from 0.22.12 to 1.6.0
10+
- Bump jsdoc from 4.0.3 to 4.0.4
11+
- Bump countly-sdk-nodejs from 22.6.0 to 24.10.0
12+
113
## Version 24.10.3
214
Fixes:
315
- [dashboards] Fixing issue where dashboard widgets go into single column

api/parts/mgmt/apps.js

+8-15
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ appsApi.getAppsDetails = function(params) {
170170
* @param {params} params - params object with args to create app
171171
* @return {object} return promise object;
172172
**/
173-
const iconUpload = function(params) {
173+
const iconUpload = async function(params) {
174174
const appId = params.app_id || common.sanitizeFilename(params.qstring.args.app_id);
175175
if (params.files && params.files.app_image) {
176176
const tmp_path = params.files.app_image.path,
@@ -183,25 +183,18 @@ const iconUpload = function(params) {
183183
return Promise.reject();
184184
}
185185
try {
186-
return jimp.read(tmp_path, function(err, icon) {
187-
if (err) {
188-
log.e(err, err.stack);
189-
fs.unlink(tmp_path, function() {});
190-
return true;
186+
const icon = await jimp.Jimp.read(tmp_path);
187+
const buffer = await icon.cover({h: 72, w: 72}).getBuffer(jimp.JimpMime.png);
188+
countlyFs.saveData("appimages", target_path, buffer, {id: appId + ".png", writeMode: "overwrite"}, function(err3) {
189+
if (err3) {
190+
log.e(err3, err3.stack);
191191
}
192-
icon.cover(72, 72).getBuffer(jimp.MIME_PNG, function(err2, buffer) {
193-
countlyFs.saveData("appimages", target_path, buffer, {id: appId + ".png", writeMode: "overwrite"}, function(err3) {
194-
if (err3) {
195-
log.e(err3, err3.stack);
196-
}
197-
fs.unlink(tmp_path, function() {});
198-
});
199-
});
200192
});
201193
}
202194
catch (e) {
203-
log.e(e.stack);
195+
console.log("Problem uploading app icon", e);
204196
}
197+
fs.unlink(tmp_path, function() {});
205198
}
206199
};
207200

frontend/express/app.js

+18-29
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,7 @@ Promise.all([plugins.dbConnection(countlyConfig), plugins.dbConnection("countly_
16111611
req.body.app_id = req.body.app_image_id;
16121612
}
16131613
var params = paramsGenerator({req, res});
1614-
validateCreate(params, 'global_upload', function() {
1614+
validateCreate(params, 'global_upload', async function() {
16151615
if (!req.session.uid && !req.body.app_image_id) {
16161616
res.end();
16171617
return false;
@@ -1635,25 +1635,18 @@ Promise.all([plugins.dbConnection(countlyConfig), plugins.dbConnection("countly_
16351635
}
16361636
plugins.callMethod("iconUpload", {req: req, res: res, next: next, data: req.body});
16371637
try {
1638-
jimp.read(tmp_path, function(err, icon) {
1639-
if (err) {
1640-
console.log(err, err.stack);
1641-
fs.unlink(tmp_path, function() {});
1642-
res.status(400).send(false);
1643-
return true;
1644-
}
1645-
icon.cover(72, 72).getBuffer(jimp.MIME_PNG, function(err2, buffer) {
1646-
countlyFs.saveData("appimages", target_path, buffer, {id: req.body.app_image_id + ".png", writeMode: "overwrite"}, function() {
1647-
fs.unlink(tmp_path, function() {});
1648-
res.send("appimages/" + req.body.app_image_id + ".png");
1649-
countlyDb.collection('apps').updateOne({_id: countlyDb.ObjectID(req.body.app_image_id)}, {'$set': {'has_image': true}}, function() {});
1650-
});
1651-
}); // save
1638+
const icon = await jimp.Jimp.read(tmp_path);
1639+
const buffer = await icon.cover({h: 72, w: 72}).getBuffer(jimp.JimpMime.png);
1640+
countlyFs.saveData("appimages", target_path, buffer, {id: req.body.app_image_id + ".png", writeMode: "overwrite"}, function() {
1641+
res.send("appimages/" + req.body.app_image_id + ".png");
1642+
countlyDb.collection('apps').updateOne({_id: countlyDb.ObjectID(req.body.app_image_id)}, {'$set': {'has_image': true}}, function() {});
16521643
});
16531644
}
16541645
catch (e) {
1655-
console.log(e.stack);
1646+
console.log("Problem uploading app icon", e);
1647+
res.status(400).send(false);
16561648
}
1649+
fs.unlink(tmp_path, function() {});
16571650
});
16581651
});
16591652

@@ -1695,23 +1688,19 @@ Promise.all([plugins.dbConnection(countlyConfig), plugins.dbConnection("countly_
16951688
}
16961689
plugins.callMethod("iconUpload", {req: req, res: res, next: next, data: req.body});
16971690
try {
1698-
jimp.read(tmp_path, function(err, icon) {
1699-
if (err) {
1700-
console.log(err, err.stack);
1701-
}
1702-
icon.cover(72, 72).getBuffer(jimp.MIME_PNG, function(err2, buffer) {
1703-
countlyFs.saveData("memberimages", target_path, buffer, {id: req.body.member_image_id + ".png", writeMode: "overwrite"}, function() {
1704-
fs.unlink(tmp_path, function() {});
1705-
countlyDb.collection('members').updateOne({_id: countlyDb.ObjectID(req.body.member_image_id + "")}, {'$set': {'member_image': "memberimages/" + req.body.member_image_id + ".png"}}, function() {
1706-
res.send("memberimages/" + req.body.member_image_id + ".png");
1707-
});
1708-
});
1709-
}); // save
1691+
const icon = await jimp.Jimp.read(tmp_path);
1692+
const buffer = await icon.cover({h: 72, w: 72}).getBuffer(jimp.JimpMime.png);
1693+
countlyFs.saveData("memberimages", target_path, buffer, {id: req.body.member_image_id + ".png", writeMode: "overwrite"}, function() {
1694+
countlyDb.collection('members').updateOne({_id: countlyDb.ObjectID(req.body.member_image_id + "")}, {'$set': {'member_image': "memberimages/" + req.body.member_image_id + ".png"}}, function() {
1695+
res.send("memberimages/" + req.body.member_image_id + ".png");
1696+
});
17101697
});
17111698
}
17121699
catch (e) {
1713-
console.log(e.stack);
1700+
console.log("Problem uploading member icon", e);
1701+
res.status(400).send(false);
17141702
}
1703+
fs.unlink(tmp_path, function() {});
17151704
});
17161705
});
17171706

0 commit comments

Comments
 (0)