Skip to content

Commit 4355006

Browse files
committed
Fix web extensions breaking when the commit changes
By just using the marketplace directly instead of going through the backend. I am not sure what the point is when searching extensions already goes directly to the marketplace anyway. But also remove the prefix that breaks this as well because otherwise existing installations will break.
1 parent 6ba153f commit 4355006

7 files changed

+54
-20
lines changed

patches/display-language.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
199199

200200
const workbenchWebConfiguration = {
201201
remoteAuthority,
202-
@@ -345,6 +348,7 @@ export class WebClientServer {
202+
@@ -338,6 +341,7 @@ export class WebClientServer {
203203
WORKBENCH_NLS_BASE_URL: vscodeBase + (nlsBaseUrl ? `${nlsBaseUrl}${this._productService.commit}/${this._productService.version}/` : ''),
204204
BASE: base,
205205
VS_BASE: vscodeBase,

patches/logout.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
4646
updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined,
4747
+ logoutEndpoint: this._environmentService.args['auth'] ? base + '/logout' : undefined,
4848
embedderIdentifier: 'server-distro',
49-
extensionsGallery: {
50-
...this._productService.extensionsGallery,
49+
extensionsGallery: this._productService.extensionsGallery,
50+
},
5151
Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts
5252
===================================================================
5353
--- code-server.orig/lib/vscode/src/vs/workbench/browser/client.ts

patches/marketplace.diff

+43-9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ Add Open VSX default and an env var for marketplace, fix old marketplace
33
Our old marketplace only supports `serviceUrl` but this causes the marketplace
44
to be disabled entirely so this moves the template var check to fix that.
55

6+
This also removes serverRootPath from the web extension route because that will
7+
include the commit. When you update code-server (including this update) the web
8+
extension will continue using the old path since it is stored in the browser but
9+
the path will 404 because the commit no longer matches. This change is only to
10+
support current installations though because this patch also removes the
11+
in-between and has web extensions install directly from the marketplace.
12+
613
This can be tested by setting EXTENSIONS_GALLERY set to:
714

815
'{"serviceUrl": "https://extensions.coder.com/api"}'
@@ -32,22 +39,49 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
3239
===================================================================
3340
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
3441
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
35-
@@ -308,14 +308,14 @@ export class WebClientServer {
42+
@@ -111,7 +111,7 @@ export class WebClientServer {
43+
const serverRootPath = getRemoteServerRootPath(_productService);
44+
this._staticRoute = `${serverRootPath}/static`;
45+
this._callbackRoute = `${serverRootPath}/callback`;
46+
- this._webExtensionRoute = `${serverRootPath}/web-extension-resource`;
47+
+ this._webExtensionRoute = `/web-extension-resource`;
48+
}
49+
50+
/**
51+
@@ -308,14 +308,7 @@ export class WebClientServer {
3652
codeServerVersion: this._productService.codeServerVersion,
3753
rootEndpoint: base,
3854
embedderIdentifier: 'server-distro',
3955
- extensionsGallery: this._webExtensionResourceUrlTemplate ? {
40-
+ extensionsGallery: {
41-
...this._productService.extensionsGallery,
56+
- ...this._productService.extensionsGallery,
4257
- 'resourceUrlTemplate': this._webExtensionResourceUrlTemplate.with({
43-
+ 'resourceUrlTemplate': this._webExtensionResourceUrlTemplate ? this._webExtensionResourceUrlTemplate.with({
44-
scheme: 'http',
45-
authority: remoteAuthority,
46-
path: `${this._webExtensionRoute}/${this._webExtensionResourceUrlTemplate.authority}${this._webExtensionResourceUrlTemplate.path}`
58+
- scheme: 'http',
59+
- authority: remoteAuthority,
60+
- path: `${this._webExtensionRoute}/${this._webExtensionResourceUrlTemplate.authority}${this._webExtensionResourceUrlTemplate.path}`
4761
- }).toString(true)
4862
- } : undefined
49-
+ }).toString(true) : undefined
50-
+ }
63+
+ extensionsGallery: this._productService.extensionsGallery,
5164
},
5265
callbackRoute: this._callbackRoute
5366
};
67+
Index: code-server/lib/vscode/src/vs/workbench/services/extensionResourceLoader/common/extensionResourceLoader.ts
68+
===================================================================
69+
--- code-server.orig/lib/vscode/src/vs/workbench/services/extensionResourceLoader/common/extensionResourceLoader.ts
70+
+++ code-server/lib/vscode/src/vs/workbench/services/extensionResourceLoader/common/extensionResourceLoader.ts
71+
@@ -16,7 +16,6 @@ import { getServiceMachineId } from 'vs/
72+
import { IStorageService } from 'vs/platform/storage/common/storage';
73+
import { TelemetryLevel } from 'vs/platform/telemetry/common/telemetry';
74+
import { getTelemetryLevel, supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
75+
-import { getRemoteServerRootPath } from 'vs/platform/remote/common/remoteHosts';
76+
77+
export const WEB_EXTENSION_RESOURCE_END_POINT = 'web-extension-resource';
78+
79+
@@ -60,7 +59,7 @@ export abstract class AbstractExtensionR
80+
private readonly _environmentService: IEnvironmentService,
81+
private readonly _configurationService: IConfigurationService,
82+
) {
83+
- this._webExtensionResourceEndPoint = `${getRemoteServerRootPath(_productService)}/${WEB_EXTENSION_RESOURCE_END_POINT}/`;
84+
+ this._webExtensionResourceEndPoint = `/${WEB_EXTENSION_RESOURCE_END_POINT}/`;
85+
if (_productService.extensionsGallery) {
86+
this._extensionGalleryResourceUrlTemplate = _productService.extensionsGallery.resourceUrlTemplate;
87+
this._extensionGalleryAuthority = this._extensionGalleryResourceUrlTemplate ? this._getExtensionGalleryAuthority(URI.parse(this._extensionGalleryResourceUrlTemplate)) : undefined;

patches/proxy-uri.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
7474
logoutEndpoint: this._environmentService.args['auth'] ? base + '/logout' : undefined,
7575
+ proxyEndpointTemplate: base + '/proxy/{{port}}',
7676
embedderIdentifier: 'server-distro',
77-
extensionsGallery: {
78-
...this._productService.extensionsGallery,
77+
extensionsGallery: this._productService.extensionsGallery,
78+
},
7979
Index: code-server/lib/vscode/src/vs/workbench/browser/web.main.ts
8080
===================================================================
8181
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.main.ts

patches/service-worker.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
3030
+ path: base + '/_static/out/browser/serviceWorker.js',
3131
+ },
3232
embedderIdentifier: 'server-distro',
33-
extensionsGallery: {
34-
...this._productService.extensionsGallery,
33+
extensionsGallery: this._productService.extensionsGallery,
34+
},
3535
Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts
3636
===================================================================
3737
--- code-server.orig/lib/vscode/src/vs/workbench/browser/client.ts

patches/telemetry.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -208,5 +208,5 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
208208
},
209209
+ enableTelemetry: this._productService.enableTelemetry,
210210
embedderIdentifier: 'server-distro',
211-
extensionsGallery: {
212-
...this._productService.extensionsGallery,
211+
extensionsGallery: this._productService.extensionsGallery,
212+
},

patches/update-check.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
111111
rootEndpoint: base,
112112
+ updateEndpoint: !this._environmentService.args['disable-update-check'] ? base + '/update/check' : undefined,
113113
embedderIdentifier: 'server-distro',
114-
extensionsGallery: {
115-
...this._productService.extensionsGallery,
114+
extensionsGallery: this._productService.extensionsGallery,
115+
},
116116
Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
117117
===================================================================
118118
--- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts

0 commit comments

Comments
 (0)