Skip to content

Commit cedbc99

Browse files
committed
patches: start patching 1.70
1 parent 7b029aa commit cedbc99

File tree

8 files changed

+122
-277
lines changed

8 files changed

+122
-277
lines changed

patches/base-path.diff

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Index: code-server/lib/vscode/src/vs/base/common/network.ts
1010
===================================================================
1111
--- code-server.orig/lib/vscode/src/vs/base/common/network.ts
1212
+++ code-server/lib/vscode/src/vs/base/common/network.ts
13-
@@ -157,7 +157,9 @@ class RemoteAuthoritiesImpl {
13+
@@ -162,7 +162,9 @@ class RemoteAuthoritiesImpl {
1414
return URI.from({
1515
scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,
1616
authority: `${host}:${port}`,
@@ -118,26 +118,24 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
118118
===================================================================
119119
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
120120
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
121-
@@ -267,14 +267,10 @@ export class WebClientServer {
121+
@@ -267,15 +267,7 @@ export class WebClientServer {
122122
return res.end();
123123
}
124124

125-
- let originalHost = req.headers['x-original-host'];
126-
- if (Array.isArray(originalHost)) {
127-
- originalHost = originalHost[0];
128-
- }
129-
- const remoteAuthority = originalHost || req.headers.host;
125+
- const getFirstHeader = (headerName: string) => {
126+
- const val = req.headers[headerName];
127+
- return Array.isArray(val) ? val[0] : val;
128+
- };
129+
-
130+
- const remoteAuthority = getFirstHeader('x-original-host') || getFirstHeader('x-forwarded-host') || req.headers.host;
130131
- if (!remoteAuthority) {
131132
- return serveError(req, res, 400, `Bad request.`);
132133
- }
133-
+ // It is not possible to reliably detect the remote authority on the server
134-
+ // in all cases. Set this to something invalid to make sure we catch code
135-
+ // that is using this when it should not.
136-
+ const remoteAuthority = 'remote';
134+
+ const remoteAuthority = "remote"
137135

138136
function asJSON(value: unknown): string {
139137
return JSON.stringify(value).replace(/"/g, '"');
140-
@@ -297,6 +293,8 @@ export class WebClientServer {
138+
@@ -298,6 +290,8 @@ export class WebClientServer {
141139
scopes: [['user:email'], ['repo']]
142140
} : undefined;
143141

@@ -146,28 +144,28 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
146144

147145
const workbenchWebConfiguration = {
148146
remoteAuthority,
149-
@@ -308,6 +306,7 @@ export class WebClientServer {
147+
@@ -309,6 +303,7 @@ export class WebClientServer {
150148
workspaceUri: resolveWorkspaceURI(this._environmentService.args['default-workspace']),
151149
productConfiguration: <Partial<IProductConfiguration>>{
152150
codeServerVersion: this._productService.codeServerVersion,
153151
+ rootEndpoint: base,
154152
embedderIdentifier: 'server-distro',
155153
extensionsGallery: this._webExtensionResourceUrlTemplate ? {
156154
...this._productService.extensionsGallery,
157-
@@ -328,8 +327,10 @@ export class WebClientServer {
155+
@@ -326,8 +321,10 @@ export class WebClientServer {
158156
const values: { [key: string]: string } = {
159157
WORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration),
160158
WORKBENCH_AUTH_SESSION: authSessionInfo ? asJSON(authSessionInfo) : '',
161159
- WORKBENCH_WEB_BASE_URL: this._staticRoute,
162-
- WORKBENCH_NLS_BASE_URL: nlsBaseUrl ? `${nlsBaseUrl}${this._productService.commit}/${this._productService.version}/` : '',
160+
- WORKBENCH_NLS_BASE_URL: nlsBaseUrl ? `${nlsBaseUrl}${!nlsBaseUrl.endsWith('/') ? '/' : ''}${this._productService.commit}/${this._productService.version}/` : '',
163161
+ WORKBENCH_WEB_BASE_URL: vscodeBase + this._staticRoute,
164-
+ WORKBENCH_NLS_BASE_URL: vscodeBase + (nlsBaseUrl ? `${nlsBaseUrl}${this._productService.commit}/${this._productService.version}/` : ''),
162+
+ WORKBENCH_NLS_BASE_URL: vscodeBase + (nlsBaseUrl ? `${nlsBaseUrl}${!nlsBaseUrl.endsWith('/') ? '/' : ''}${this._productService.commit}/${this._productService.version}/` : ''),
165163
+ BASE: base,
166164
+ VS_BASE: vscodeBase,
167165
};
168166

169167

170-
@@ -419,3 +420,70 @@ export class WebClientServer {
168+
@@ -417,3 +414,70 @@ export class WebClientServer {
171169
return res.end(data);
172170
}
173171
}

patches/cli-window-open.diff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Index: code-server/lib/vscode/src/vs/server/node/remoteTerminalChannel.ts
2626
readonly onExecuteCommand = this._onExecuteCommand.event;
2727

2828
constructor(
29-
@@ -240,20 +240,20 @@ export class RemoteTerminalChannel exten
29+
@@ -241,20 +241,20 @@ export class RemoteTerminalChannel exten
3030
const ipcHandlePath = createRandomIPCHandle();
3131
env.VSCODE_IPC_HOOK_CLI = ipcHandlePath;
3232
const commandsExecuter: ICommandsExecuter = {
@@ -52,7 +52,7 @@ Index: code-server/lib/vscode/src/vs/server/node/remoteTerminalChannel.ts
5252
let resolve!: (data: any) => void;
5353
let reject!: (err: any) => void;
5454
const result = new Promise<T>((_resolve, _reject) => {
55-
@@ -276,6 +276,7 @@ export class RemoteTerminalChannel exten
55+
@@ -277,6 +277,7 @@ export class RemoteTerminalChannel exten
5656
});
5757
this._onExecuteCommand.fire({
5858
reqId,

patches/disable-downloads.diff

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
1212
===================================================================
1313
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.api.ts
1414
+++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
15-
@@ -250,6 +250,11 @@ export interface IWorkbenchConstructionO
15+
@@ -267,6 +267,11 @@ export interface IWorkbenchConstructionO
1616
*/
1717
readonly userDataPath?: string
1818

@@ -52,7 +52,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/environment/browser/envi
5252
+ }
5353
+
5454
@memoize
55-
get settingsResource(): URI { return joinPath(this.userRoamingDataHome, 'settings.json'); }
55+
get argvResource(): URI { return joinPath(this.userRoamingDataHome, 'argv.json'); }
5656

5757
Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
5858
===================================================================
@@ -66,7 +66,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
6666

6767
/* ----- server setup ----- */
6868

69-
@@ -94,6 +95,7 @@ export interface ServerParsedArgs {
69+
@@ -95,6 +96,7 @@ export interface ServerParsedArgs {
7070
/* ----- code-server ----- */
7171
'disable-update-check'?: boolean;
7272
'auth'?: string
@@ -78,7 +78,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
7878
===================================================================
7979
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
8080
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
81-
@@ -300,6 +300,7 @@ export class WebClientServer {
81+
@@ -297,6 +297,7 @@ export class WebClientServer {
8282
remoteAuthority,
8383
webviewEndpoint: vscodeBase + this._staticRoute + '/out/vs/workbench/contrib/webview/browser/pre',
8484
userDataPath: this._environmentService.userDataPath,
@@ -90,47 +90,42 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
9090
===================================================================
9191
--- code-server.orig/lib/vscode/src/vs/workbench/browser/contextkeys.ts
9292
+++ code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
93-
@@ -7,12 +7,11 @@ import { Event } from 'vs/base/common/ev
93+
@@ -7,7 +7,7 @@ import { Event } from 'vs/base/common/ev
9494
import { Disposable } from 'vs/base/common/lifecycle';
9595
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
96-
import { InputFocusedContext, IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsDevelopmentContext, IsIOSContext } from 'vs/platform/contextkey/common/contextkeys';
96+
import { InputFocusedContext, IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsDevelopmentContext, IsIOSContext, ProductQualityContext } from 'vs/platform/contextkey/common/contextkeys';
9797
-import { SplitEditorsVertically, InEditorZenModeContext, ActiveEditorCanRevertContext, ActiveEditorGroupLockedContext, ActiveEditorCanSplitInGroupContext, SideBySideEditorActiveContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, ActiveEditorContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, ActiveEditorGroupEmptyContext, MultipleEditorGroupsContext, EditorTabsVisibleContext, IsCenteredLayoutContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorReadonlyContext, EditorAreaVisibleContext, ActiveEditorAvailableEditorIdsContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext } from 'vs/workbench/common/contextkeys';
9898
+import { SplitEditorsVertically, InEditorZenModeContext, ActiveEditorCanRevertContext, ActiveEditorGroupLockedContext, ActiveEditorCanSplitInGroupContext, SideBySideEditorActiveContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, ActiveEditorContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, ActiveEditorGroupEmptyContext, MultipleEditorGroupsContext, EditorTabsVisibleContext, IsCenteredLayoutContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorReadonlyContext, EditorAreaVisibleContext, ActiveEditorAvailableEditorIdsContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext, IsEnabledFileDownloads } from 'vs/workbench/common/contextkeys';
9999
import { TEXT_DIFF_EDITOR_ID, EditorInputCapabilities, SIDE_BY_SIDE_EDITOR_ID, DEFAULT_EDITOR_ASSOCIATION } from 'vs/workbench/common/editor';
100100
import { trackFocus, addDisposableListener, EventType } from 'vs/base/browser/dom';
101101
import { preferredSideBySideGroupDirection, GroupDirection, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
102-
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
103-
-import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
104-
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
105-
import { WorkbenchState, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
106-
import { IWorkbenchLayoutService, Parts, positionToString } from 'vs/workbench/services/layout/browser/layoutService';
107-
@@ -24,6 +23,7 @@ import { IEditorResolverService } from '
108-
import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/browser/panecomposite';
102+
@@ -25,6 +25,7 @@ import { IPaneCompositePartService } fro
109103
import { Schemas } from 'vs/base/common/network';
110104
import { WebFileSystemAccess } from 'vs/platform/files/browser/webFileSystemAccess';
105+
import { IProductService } from 'vs/platform/product/common/productService';
111106
+import { IBrowserWorkbenchEnvironmentService } from '../services/environment/browser/environmentService';
112107

113108
export class WorkbenchContextKeysHandler extends Disposable {
114109
private inputFocusedContext: IContextKey<boolean>;
115-
@@ -75,7 +75,7 @@ export class WorkbenchContextKeysHandler
110+
@@ -76,7 +77,7 @@ export class WorkbenchContextKeysHandler
116111
@IContextKeyService private readonly contextKeyService: IContextKeyService,
117112
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
118113
@IConfigurationService private readonly configurationService: IConfigurationService,
119114
- @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
120115
+ @IBrowserWorkbenchEnvironmentService private readonly environmentService: IBrowserWorkbenchEnvironmentService,
116+
@IProductService private readonly productService: IProductService,
121117
@IEditorService private readonly editorService: IEditorService,
122118
@IEditorResolverService private readonly editorResolverService: IEditorResolverService,
123-
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService,
124-
@@ -194,6 +194,9 @@ export class WorkbenchContextKeysHandler
119+
@@ -198,6 +199,9 @@ export class WorkbenchContextKeysHandler
120+
// Auxiliary Bar
125121
this.auxiliaryBarVisibleContext = AuxiliaryBarVisibleContext.bindTo(this.contextKeyService);
126122
this.auxiliaryBarVisibleContext.set(this.layoutService.isVisible(Parts.AUXILIARYBAR_PART));
127-
123+
+
128124
+ // code-server
129125
+ IsEnabledFileDownloads.bindTo(this.contextKeyService).set(this.environmentService.isEnabledFileDownloads ?? true)
130-
+
126+
131127
this.registerListeners();
132128
}
133-
134129
Index: code-server/lib/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts
135130
===================================================================
136131
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts

patches/display-language.diff

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
1717
===================================================================
1818
--- code-server.orig/lib/vscode/src/vs/server/node/serverServices.ts
1919
+++ code-server/lib/vscode/src/vs/server/node/serverServices.ts
20-
@@ -202,6 +202,9 @@ export async function setupServerService
20+
@@ -214,6 +214,9 @@ export async function setupServerService
2121
const channel = new ExtensionManagementChannel(extensionManagementService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority));
2222
socketServer.registerChannel('extensions', channel);
2323

@@ -31,14 +31,10 @@ Index: code-server/lib/vscode/src/vs/base/common/platform.ts
3131
===================================================================
3232
--- code-server.orig/lib/vscode/src/vs/base/common/platform.ts
3333
+++ code-server/lib/vscode/src/vs/base/common/platform.ts
34-
@@ -80,8 +80,19 @@ if (typeof navigator === 'object' && !is
35-
_isIOS = (_userAgent.indexOf('Macintosh') >= 0 || _userAgent.indexOf('iPad') >= 0 || _userAgent.indexOf('iPhone') >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;
36-
_isLinux = _userAgent.indexOf('Linux') >= 0;
37-
_isWeb = true;
38-
- _locale = navigator.language;
39-
+ _locale = LANGUAGE_DEFAULT;
34+
@@ -92,6 +92,16 @@ if (typeof navigator === 'object' && !is
35+
_locale = configuredLocale || LANGUAGE_DEFAULT;
36+
4037
_language = _locale;
41-
+
4238
+ const el = typeof document !== 'undefined' && document.getElementById('vscode-remote-nls-configuration');
4339
+ const rawNlsConfig = el && el.getAttribute('data-settings');
4440
+ if (rawNlsConfig) {
@@ -66,21 +62,19 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.html
6662
<!-- Workbench Icon/Manifest/CSS -->
6763
<link rel="icon" href="{{BASE}}/_static/src/browser/media/favicon-dark-support.svg" />
6864
<link rel="alternate icon" href="{{BASE}}/_static/src/browser/media/favicon.ico" type="image/x-icon" />
69-
@@ -43,17 +46,27 @@
70-
self.webPackagePaths[key] = `${baseUrl}/node_modules/${key}/${self.webPackagePaths[key]}`;
71-
});
72-
73-
- // Set up nls if the user is not using the default language (English)
65+
@@ -46,15 +49,26 @@
66+
// Set up nls if the user is not using the default language (English)
7467
const nlsConfig = {};
75-
- const locale = navigator.language;
68+
const locale = window.localStorage.getItem('vscode.nls.locale') || navigator.language;
7669
- if (!locale.startsWith('en')) {
7770
- nlsConfig['vs/nls'] = {
7871
- availableLanguages: {
7972
- '*': locale
8073
- },
81-
- baseUrl: '{{WORKBENCH_NLS_BASE_URL}}'
74+
- translationServiceUrl: '{{WORKBENCH_NLS_BASE_URL}}'
8275
- };
8376
- }
77+
-
8478
+ try {
8579
+ nlsConfig['vs/nls'] = JSON.parse(document.getElementById("vscode-remote-nls-configuration").getAttribute("data-settings"))
8680
+ if (nlsConfig['vs/nls']._resolvedLanguagePackCoreLocation) {
@@ -101,14 +95,14 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.html
10195
+ }
10296
+ }
10397
+ } catch (error) { /* Probably fine. */ }
104-
10598
require.config({
10699
baseUrl: `${baseUrl}/out`,
100+
recordStats: true,
107101
Index: code-server/lib/vscode/src/vs/platform/environment/common/environmentService.ts
108102
===================================================================
109103
--- code-server.orig/lib/vscode/src/vs/platform/environment/common/environmentService.ts
110104
+++ code-server/lib/vscode/src/vs/platform/environment/common/environmentService.ts
111-
@@ -108,7 +108,7 @@ export abstract class AbstractNativeEnvi
105+
@@ -105,7 +105,7 @@ export abstract class AbstractNativeEnvi
112106
return URI.file(join(vscodePortable, 'argv.json'));
113107
}
114108

@@ -190,7 +184,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
190184
import { CharCode } from 'vs/base/common/charCode';
191185
import { getRemoteServerRootPath } from 'vs/platform/remote/common/remoteHosts';
192186

193-
@@ -295,6 +296,8 @@ export class WebClientServer {
187+
@@ -292,6 +293,8 @@ export class WebClientServer {
194188

195189
const base = relativeRoot(getOriginalUrl(req))
196190
const vscodeBase = relativePath(getOriginalUrl(req))
@@ -199,8 +193,8 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
199193

200194
const workbenchWebConfiguration = {
201195
remoteAuthority,
202-
@@ -338,6 +341,7 @@ export class WebClientServer {
203-
WORKBENCH_NLS_BASE_URL: vscodeBase + (nlsBaseUrl ? `${nlsBaseUrl}${this._productService.commit}/${this._productService.version}/` : ''),
196+
@@ -332,6 +335,7 @@ export class WebClientServer {
197+
WORKBENCH_NLS_BASE_URL: vscodeBase + (nlsBaseUrl ? `${nlsBaseUrl}${!nlsBaseUrl.endsWith('/') ? '/' : ''}${this._productService.commit}/${this._productService.version}/` : ''),
204198
BASE: base,
205199
VS_BASE: vscodeBase,
206200
+ NLS_CONFIGURATION: asJSON(nlsConfiguration),
@@ -219,7 +213,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
219213

220214
/* ----- server setup ----- */
221215

222-
@@ -96,6 +97,7 @@ export interface ServerParsedArgs {
216+
@@ -97,6 +98,7 @@ export interface ServerParsedArgs {
223217
'disable-update-check'?: boolean;
224218
'auth'?: string
225219
'disable-file-downloads'?: boolean;
@@ -231,7 +225,7 @@ Index: code-server/lib/vscode/src/vs/workbench/workbench.web.main.ts
231225
===================================================================
232226
--- code-server.orig/lib/vscode/src/vs/workbench/workbench.web.main.ts
233227
+++ code-server/lib/vscode/src/vs/workbench/workbench.web.main.ts
234-
@@ -109,6 +109,12 @@ registerSingleton(IDiagnosticsService, N
228+
@@ -113,6 +113,12 @@ registerSingleton(ILanguagePackService,
235229

236230
//#region --- workbench contributions
237231

@@ -246,14 +240,17 @@ Index: code-server/lib/vscode/src/vs/workbench/workbench.web.main.ts
246240

247241
Index: code-server/lib/vscode/src/vs/platform/languagePacks/browser/languagePacks.ts
248242
===================================================================
249-
--- /dev/null
243+
--- code-server.orig/lib/vscode/src/vs/platform/languagePacks/browser/languagePacks.ts
250244
+++ code-server/lib/vscode/src/vs/platform/languagePacks/browser/languagePacks.ts
251-
@@ -0,0 +1,18 @@
245+
@@ -4,7 +4,24 @@
246+
*--------------------------------------------------------------------------------------------*/
247+
248+
import { ILanguagePackItem, LanguagePackBaseService } from 'vs/platform/languagePacks/common/languagePacks';
252249
+import { ProxyChannel } from 'vs/base/parts/ipc/common/ipc';
253250
+import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
254251
+import { ILanguagePackService } from 'vs/platform/languagePacks/common/languagePacks';
255252
+import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
256-
+
253+
257254
+// @ts-ignore: interface is implemented via proxy
258255
+export class LanguagePackService implements ILanguagePackService {
259256
+
@@ -267,3 +264,6 @@ Index: code-server/lib/vscode/src/vs/platform/languagePacks/browser/languagePack
267264
+}
268265
+
269266
+registerSingleton(ILanguagePackService, LanguagePackService, true);
267+
export class WebLanguagePacksService extends LanguagePackBaseService {
268+
// Web doesn't have a concept of language packs, so we just return an empty array
269+
getInstalledLanguages(): Promise<ILanguagePackItem[]> {

0 commit comments

Comments
 (0)