Skip to content

Commit

Permalink
dev: add ico support
Browse files Browse the repository at this point in the history
  • Loading branch information
KernelDeimos committed Dec 18, 2024
1 parent 8a3d74d commit 90967ab
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
61 changes: 61 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
"json-colorizer": "^3.0.1",
"open": "^10.1.0",
"sharp": "^0.33.5",
"sharp-bmp": "^0.1.5",
"sharp-ico": "^0.1.5",
"simple-git": "^3.25.0",
"string-template": "^1.0.0",
"uuid": "^9.0.1"
Expand Down
7 changes: 7 additions & 0 deletions src/backend/src/services/AppIconService.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class AppIconService extends BaseService {
static MODULES = {
sharp: require('sharp'),
bmp: require('sharp-bmp'),
ico: require('sharp-ico'),
}

/**
Expand Down Expand Up @@ -89,6 +90,12 @@ class AppIconService extends BaseService {
return this.modules.bmp.sharpFromBmp(input);
}

const icotypes = ['image/x-icon', 'image/vnd.microsoft.icon'];
if ( icotypes.includes(type) ) {
const sharps = this.modules.ico.sharpsFromIco(input);
return sharps[0];
}

return this.modules.sharp(input);
}

Expand Down

0 comments on commit 90967ab

Please sign in to comment.