Skip to content

Commit 90967ab

Browse files
committed
dev: add ico support
1 parent 8a3d74d commit 90967ab

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

package-lock.json

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
"json-colorizer": "^3.0.1",
5252
"open": "^10.1.0",
5353
"sharp": "^0.33.5",
54+
"sharp-bmp": "^0.1.5",
55+
"sharp-ico": "^0.1.5",
5456
"simple-git": "^3.25.0",
5557
"string-template": "^1.0.0",
5658
"uuid": "^9.0.1"

src/backend/src/services/AppIconService.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class AppIconService extends BaseService {
2525
static MODULES = {
2626
sharp: require('sharp'),
2727
bmp: require('sharp-bmp'),
28+
ico: require('sharp-ico'),
2829
}
2930

3031
/**
@@ -89,6 +90,12 @@ class AppIconService extends BaseService {
8990
return this.modules.bmp.sharpFromBmp(input);
9091
}
9192

93+
const icotypes = ['image/x-icon', 'image/vnd.microsoft.icon'];
94+
if ( icotypes.includes(type) ) {
95+
const sharps = this.modules.ico.sharpsFromIco(input);
96+
return sharps[0];
97+
}
98+
9299
return this.modules.sharp(input);
93100
}
94101

0 commit comments

Comments
 (0)