diff --git a/ci/README.md b/ci/README.md index 3448f9e35..de350a5c3 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 000000000..edeaefd7d --- /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 c96242477..fb309a978 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 98c13ca5e..d5e39572a 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 000000000..cc27f7a7b --- /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 b33be207b..a16709e1e 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 784c750b7..000000000 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 654db4b9f..de116b10c 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 122e55c7d..000000000 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 f7ce48b51..000000000 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 82cbfd41c..5fe72e82f 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 9471052da..000000000 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 302b202a4..516d5457f 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:;" /> {{ERROR_TITLE}} - code-server - + + - + + diff --git a/src/browser/pages/login.html b/src/browser/pages/login.html index fc772f392..1629def43 100644 --- a/src/browser/pages/login.html +++ b/src/browser/pages/login.html @@ -11,9 +11,11 @@ content="style-src 'self'; script-src 'self' 'unsafe-inline'; manifest-src 'self'; img-src 'self' data:; font-src 'self' data:;" /> code-server login - + + - + + diff --git a/src/browser/pages/vscode.html b/src/browser/pages/vscode.html index 727a1ca87..b82e77ad9 100644 --- a/src/browser/pages/vscode.html +++ b/src/browser/pages/vscode.html @@ -24,12 +24,14 @@ - + + - + +