diff --git a/Makefile b/Makefile index cf7832c..24d023d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: test test: - devcontainer features test + devcontainer features test --filter "$$DEVCONTAINER_FEATURE_TEST_FILTER" .PHONY: docs docs: src/code-server/README.md diff --git a/src/code-server/README.md b/src/code-server/README.md index b24bb47..02a1cb6 100644 --- a/src/code-server/README.md +++ b/src/code-server/README.md @@ -15,10 +15,11 @@ VS Code in the browser | Options Id | Description | Type | Default Value | |-----|-----|-----|-----| +| appName | The name to use in branding. Will be shown in titlebar and welcome message. | string | - | | auth | The type of authentication to use. When 'password' is selected, code-server will auto-generate a password. 'none' disables authentication entirely. | string | password | | cert | Path to certificate. A self signed certificate is generated if none is provided. | string | - | -| certHost | hostname to use when generating a self signed certificate. | string | - | -| certKey | path to certificate key when using non-generated cert. | string | - | +| certHost | Hostname to use when generating a self signed certificate. | string | - | +| certKey | Path to certificate key when using non-generated cert. | string | - | | disableFileDownloads | Disable file downloads from Code. When enabled, users will not be able to download files from the editor. | boolean | false | | disableFileUploads | Disable file uploads to Code. When enabled, users will not be able to upload files to the editor. | boolean | false | | disableGettingStartedOverride | Disable the coder/coder override in the Help: Getting Started page. | boolean | false | @@ -26,13 +27,19 @@ VS Code in the browser | disableTelemetry | Disable telemetry reporting. | boolean | false | | disableUpdateCheck | Disable update check. Without this flag, code-server checks every 6 hours against the latest GitHub release and notifies once a week when updates are available. | boolean | false | | disableWorkspaceTrust | Disable Workspace Trust feature. This only affects the current session. | boolean | false | +| enableProposedAPI | Comma-separated list of VS Code extension IDs to enable proposed API features for. | string | - | | extensions | Comma-separated list of VS Code extensions to install. Format: 'publisher.extension[@version]' (e.g., 'ms-python.python,ms-azuretools.vscode-docker'). | string | - | | host | The address to bind to for the code-server. Use '0.0.0.0' to listen on all interfaces. | string | 127.0.0.1 | +| locale | Set VS Code display language and language shown on the login page. Format should be an IETF language tag (e.g., 'en', 'fr', 'zh-CN'). | string | - | | logFile | Path to a file to send stdout and stderr logs to from code-server. | string | /tmp/code-server.log | | port | The port to bind to for the code-server. | string | 8080 | +| proxyDomain | Domain used for proxying ports. | string | - | | socket | Path to a socket. When specified, host and port will be ignored. | string | - | | socketMode | File mode of the socket when using the socket option. | string | - | +| trustedOrigins | Comma-separated list of trusted-origins to disable origin check for. Useful if not able to access reverse proxy configuration. | string | - | +| verbose | Enable verbose logging. | boolean | false | | version | The version of code-server to install. If empty, installs the latest version. | string | - | +| welcomeText | Text to show on login page. | string | - | | workspace | Path to the workspace or folder to open on startup. Can be a directory or a .code-workspace file. | string | - | diff --git a/src/code-server/devcontainer-feature.json b/src/code-server/devcontainer-feature.json index abebdcb..f58b60b 100644 --- a/src/code-server/devcontainer-feature.json +++ b/src/code-server/devcontainer-feature.json @@ -4,6 +4,11 @@ "version": "1.0.0", "description": "VS Code in the browser", "options": { + "appName": { + "type": "string", + "default": "", + "description": "The name to use in branding. Will be shown in titlebar and welcome message." + }, "auth": { "type": "string", "enum": ["password", "none"], @@ -18,12 +23,12 @@ "certHost": { "type": "string", "default": "", - "description": "hostname to use when generating a self signed certificate." + "description": "Hostname to use when generating a self signed certificate." }, "certKey": { "type": "string", "default": "", - "description": "path to certificate key when using non-generated cert." + "description": "Path to certificate key when using non-generated cert." }, "disableFileDownloads": { "type": "boolean", @@ -60,6 +65,11 @@ "default": false, "description": "Disable Workspace Trust feature. This only affects the current session." }, + "enableProposedAPI": { + "type": "string", + "default": "", + "description": "Comma-separated list of VS Code extension IDs to enable proposed API features for." + }, "extensions": { "type": "string", "default": "", @@ -70,6 +80,11 @@ "default": "127.0.0.1", "description": "The address to bind to for the code-server. Use '0.0.0.0' to listen on all interfaces." }, + "locale": { + "type": "string", + "default": "", + "description": "Set VS Code display language and language shown on the login page. Format should be an IETF language tag (e.g., 'en', 'fr', 'zh-CN')." + }, "logFile": { "type": "string", "default": "/tmp/code-server.log", @@ -80,6 +95,11 @@ "default": "8080", "description": "The port to bind to for the code-server." }, + "proxyDomain": { + "type": "string", + "default": "", + "description": "Domain used for proxying ports." + }, "socket": { "type": "string", "default": "", @@ -90,11 +110,26 @@ "default": "", "description": "File mode of the socket when using the socket option." }, + "trustedOrigins": { + "type": "string", + "default": "", + "description": "Comma-separated list of trusted-origins to disable origin check for. Useful if not able to access reverse proxy configuration." + }, + "verbose": { + "type": "boolean", + "default": false, + "description": "Enable verbose logging." + }, "version": { "type": "string", "default": "", "description": "The version of code-server to install. If empty, installs the latest version." }, + "welcomeText": { + "type": "string", + "default": "", + "description": "Text to show on login page." + }, "workspace": { "type": "string", "default": "", diff --git a/src/code-server/install.sh b/src/code-server/install.sh index c621425..da27dff 100644 --- a/src/code-server/install.sh +++ b/src/code-server/install.sh @@ -10,7 +10,6 @@ fi curl -fsSL https://code-server.dev/install.sh | sh -s -- $CODE_SERVER_INSTALL_ARGS IFS=',' read -ra extensions <<<"$EXTENSIONS" -declare -p extensions for extension in "${extensions[@]}" do @@ -75,6 +74,38 @@ if [[ -n "$SOCKETMODE" ]]; then FLAGS+=(--socket-mode "$SOCKETMODE") fi +if [[ -n "$LOCALE" ]]; then + FLAGS+=(--locale "$LOCALE") +fi + +if [[ -n "$APPNAME" ]]; then + FLAGS+=(--app-name "$APPNAME") +fi + +if [[ -n "$WELCOMETEXT" ]]; then + FLAGS+=(--welcome-text "$WELCOMETEXT") +fi + +if [[ "$VERBOSE" == "true" ]]; then + FLAGS+=(--verbose) +fi + +IFS=',' read -ra trusted_origins <<<"$TRUSTEDORIGINS" + +for trusted_origin in "${trusted_origins[@]}"; do + FLAGS+=(--trusted-origins "$trusted_origin") +done + +IFS=',' read -ra proposed_api_extensions <<<"$ENABLEPROPOSEDAPI" + +for extension in "${proposed_api_extensions[@]}"; do + FLAGS+=(--enable-proposed-api "$extension") +done + +if [[ "$PROXYDOMAIN" ]]; then + FLAGS+=(--proxy-domain "$PROXYDOMAIN") +fi + cat > /usr/local/bin/code-server-entrypoint <