Better applink icon support

This commit is contained in:
Johannes Zellner
2022-07-07 14:11:14 +02:00
parent 741c21b368
commit f43fd21929
3 changed files with 28 additions and 5 deletions

View File

@@ -5,7 +5,8 @@ exports = module.exports = {
add,
get,
update,
remove
remove,
getIcon
};
const assert = require('assert'),
@@ -64,3 +65,12 @@ async function remove(req, res, next) {
next(new HttpSuccess(204));
}
async function getIcon(req, res, next) {
assert.strictEqual(typeof req.params.id, 'string');
const [error, icon] = await safe(applinks.getIcon(req.params.id, { original: req.query.original }));
if (error) return next(BoxError.toHttpError(error));
res.send(icon);
}