git: 1ce6a8bf7e93 - main - www/code-server: Fix extension installation

From: Jochen Neumeister <joneum_at_FreeBSD.org>
Date: Mon, 07 Sep 2026 00:59:42 UTC
The branch main has been updated by joneum:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1ce6a8bf7e93e0a01f761401c1d84c8e30af87c8

commit 1ce6a8bf7e93e0a01f761401c1d84c8e30af87c8
Author:     Jochen Neumeister <joneum@FreeBSD.org>
AuthorDate: 2026-09-07 00:58:41 +0000
Commit:     Jochen Neumeister <joneum@FreeBSD.org>
CommitDate: 2026-09-07 00:59:26 +0000

    www/code-server: Fix extension installation
    
    VS Code's platform detection does not know FreeBSD and falls back to
    "Web", so the extension service rejected every non-web extension with
    "not available in code-server for the Web platform". Treat FreeBSD as
    Linux in platform.ts, the same way editors/vscode does, so extensions
    can be installed.
    
    Obtained from:  editors/vscode
    Sponsored by:   Netzkommune GmbH
---
 www/code-server/Makefile                             |  1 +
 .../patch-lib_vscode_src_vs_base_common_platform.ts  | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/www/code-server/Makefile b/www/code-server/Makefile
index 37cdd3b83b81..49a0f1877c20 100644
--- a/www/code-server/Makefile
+++ b/www/code-server/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	code-server
 DISTVERSION=	4.135.0
+PORTREVISION=	1
 CATEGORIES=	www
 MASTER_SITES=	https://github.com/joneum/FreeBSD-CodeServer/releases/download/code-server-${DISTVERSION}/:code_server \
 		https://github.com/github/copilot-cli/releases/download/v${COPILOT_CLI_VERSION}/:copilot_cli
diff --git a/www/code-server/files/patch-lib_vscode_src_vs_base_common_platform.ts b/www/code-server/files/patch-lib_vscode_src_vs_base_common_platform.ts
new file mode 100644
index 000000000000..41d06fee6c0d
--- /dev/null
+++ b/www/code-server/files/patch-lib_vscode_src_vs_base_common_platform.ts
@@ -0,0 +1,20 @@
+--- lib/vscode/src/vs/base/common/platform.ts.orig
++++ lib/vscode/src/vs/base/common/platform.ts
+@@ -74,7 +74,7 @@
+ if (typeof nodeProcess === 'object') {
+ 	_isWindows = (nodeProcess.platform === 'win32');
+ 	_isMacintosh = (nodeProcess.platform === 'darwin');
+-	_isLinux = (nodeProcess.platform === 'linux');
++	_isLinux = (nodeProcess.platform === 'linux' || nodeProcess.platform === 'freebsd');
+ 	_isLinuxSnap = _isLinux && !!nodeProcess.env['SNAP'] && !!nodeProcess.env['SNAP_REVISION'];
+ 	_isElectron = isElectronProcess;
+ 	_isCI = !!nodeProcess.env['CI'] || !!nodeProcess.env['BUILD_ARTIFACTSTAGINGDIRECTORY'] || !!nodeProcess.env['GITHUB_WORKSPACE'];
+@@ -100,7 +100,7 @@
+ 	_isWindows = _userAgent.indexOf('Windows') >= 0;
+ 	_isMacintosh = _userAgent.indexOf('Macintosh') >= 0;
+ 	_isIOS = (_userAgent.indexOf('Macintosh') >= 0 || _userAgent.indexOf('iPad') >= 0 || _userAgent.indexOf('iPhone') >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;
+-	_isLinux = _userAgent.indexOf('Linux') >= 0;
++	_isLinux = (_userAgent.indexOf('Linux') >= 0 || _userAgent.indexOf('FreeBSD') >= 0);
+ 	_isMobile = _userAgent?.indexOf('Mobi') >= 0;
+ 	_isWeb = true;
+ 	_language = nls.getNLSLanguage() || LANGUAGE_DEFAULT;