diff --git a/ci/README.md b/ci/README.md index 3448f9e3..de350a5c 100644 --- a/ci/README.md +++ b/ci/README.md @@ -67,6 +67,10 @@ This directory contains scripts used for the development of code-server. - [./ci/dev/watch.ts](./dev/watch.ts) (`yarn watch`) - Starts a process to build and launch code-server and restart on any code changes. - Example usage in [./doc/CONTRIBUTING.md](../doc/CONTRIBUTING.md). +- [./ci/dev/gen_icons.sh](./ci/dev/gen_icons.sh) (`yarn icons`) + - Generates the various icons from a single `.svg` favicon in + `src/browser/media/favicon.svg`. + - Requires [imagemagick](https://imagemagick.org/index.php) ## build diff --git a/ci/dev/gen_icons.sh b/ci/dev/gen_icons.sh new file mode 100755 index 00000000..edeaefd7 --- /dev/null +++ b/ci/dev/gen_icons.sh @@ -0,0 +1,21 @@ +#!/bin/sh +set -eu + +main() { + cd src/browser/media + + # We need .ico for backwards compatibility. + # The other two are the only icon sizes required by Chrome and + # we use them for stuff like apple-touch-icon as well. + # https://web.dev/add-manifest/ + # + # This should be enough and we can always add more if there are problems. + + # -background defaults to white but we want it transparent. + # https://imagemagick.org/script/command-line-options.php#background + convert -background transparent -resize 256x256 favicon.svg favicon.ico + convert -background transparent -resize 192x192 favicon.svg pwa-icon-192.png + convert -background transparent -resize 512x512 favicon.svg pwa-icon-512.png +} + +main "$@" diff --git a/package.json b/package.json index c9624247..fb309a97 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "lint": "./ci/dev/lint.sh", "test": "./ci/dev/test.sh", "ci": "./ci/dev/ci.sh", - "watch": "VSCODE_IPC_HOOK_CLI= NODE_OPTIONS=--max_old_space_size=32384 ts-node ./ci/dev/watch.ts" + "watch": "VSCODE_IPC_HOOK_CLI= NODE_OPTIONS=--max_old_space_size=32384 ts-node ./ci/dev/watch.ts", + "icons": "./ci/dev/gen_icons.sh" }, "main": "out/node/entry.js", "devDependencies": { diff --git a/src/browser/media/favicon.ico b/src/browser/media/favicon.ico index 98c13ca5..d5e39572 100644 Binary files a/src/browser/media/favicon.ico and b/src/browser/media/favicon.ico differ diff --git a/src/browser/media/favicon.svg b/src/browser/media/favicon.svg new file mode 100644 index 00000000..cc27f7a7 --- /dev/null +++ b/src/browser/media/favicon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/browser/media/manifest.json b/src/browser/media/manifest.json index b33be207..a16709e1 100644 --- a/src/browser/media/manifest.json +++ b/src/browser/media/manifest.json @@ -6,31 +6,11 @@ "background-color": "#fff", "description": "Run editors on a remote server.", "icons": [ - { - "src": "{{CS_STATIC_BASE}}/src/browser/media/pwa-icon-96.png", - "type": "image/png", - "sizes": "96x96" - }, - { - "src": "{{CS_STATIC_BASE}}/src/browser/media/pwa-icon-128.png", - "type": "image/png", - "sizes": "128x128" - }, { "src": "{{CS_STATIC_BASE}}/src/browser/media/pwa-icon-192.png", "type": "image/png", "sizes": "192x192" }, - { - "src": "{{CS_STATIC_BASE}}/src/browser/media/pwa-icon-256.png", - "type": "image/png", - "sizes": "256x256" - }, - { - "src": "{{CS_STATIC_BASE}}/src/browser/media/pwa-icon-384.png", - "type": "image/png", - "sizes": "384x384" - }, { "src": "{{CS_STATIC_BASE}}/src/browser/media/pwa-icon-512.png", "type": "image/png", diff --git a/src/browser/media/pwa-icon-128.png b/src/browser/media/pwa-icon-128.png deleted file mode 100644 index 784c750b..00000000 Binary files a/src/browser/media/pwa-icon-128.png and /dev/null differ diff --git a/src/browser/media/pwa-icon-192.png b/src/browser/media/pwa-icon-192.png index 654db4b9..de116b10 100644 Binary files a/src/browser/media/pwa-icon-192.png and b/src/browser/media/pwa-icon-192.png differ diff --git a/src/browser/media/pwa-icon-256.png b/src/browser/media/pwa-icon-256.png deleted file mode 100644 index 122e55c7..00000000 Binary files a/src/browser/media/pwa-icon-256.png and /dev/null differ diff --git a/src/browser/media/pwa-icon-384.png b/src/browser/media/pwa-icon-384.png deleted file mode 100644 index f7ce48b5..00000000 Binary files a/src/browser/media/pwa-icon-384.png and /dev/null differ diff --git a/src/browser/media/pwa-icon-512.png b/src/browser/media/pwa-icon-512.png index 82cbfd41..5fe72e82 100644 Binary files a/src/browser/media/pwa-icon-512.png and b/src/browser/media/pwa-icon-512.png differ diff --git a/src/browser/media/pwa-icon-96.png b/src/browser/media/pwa-icon-96.png deleted file mode 100644 index 9471052d..00000000 Binary files a/src/browser/media/pwa-icon-96.png and /dev/null differ diff --git a/src/browser/pages/error.html b/src/browser/pages/error.html index 302b202a..516d5457 100644 --- a/src/browser/pages/error.html +++ b/src/browser/pages/error.html @@ -11,9 +11,11 @@ content="style-src 'self'; manifest-src 'self'; img-src 'self' data:; font-src 'self' data:;" />