mirror of
https://github.com/coder/code-server.git
synced 2026-09-13 03:03:19 +02:00
* Update Code to 1.136.1 * Do not click on tab during test file opens It will already be the selected tab, and if any other tab is already open (like the welcome tab), it will click that instead. We disable the welcome page so this is not supposed to actually matter, but that Setting appears not to be working. Also add the quick input widget selector in the disabled downloads test, since if the widget never shows up it would mistakenly pass.
68 lines
2.7 KiB
Diff
68 lines
2.7 KiB
Diff
Add a service worker
|
|
|
|
To test try installing code-server as a PWA.
|
|
|
|
Index: code-server/lib/vscode/src/vs/base/common/product.ts
|
|
===================================================================
|
|
--- code-server.orig/lib/vscode/src/vs/base/common/product.ts
|
|
+++ code-server/lib/vscode/src/vs/base/common/product.ts
|
|
@@ -102,6 +102,10 @@ export interface IProductConfiguration {
|
|
readonly updateEndpoint?: string
|
|
readonly logoutEndpoint?: string
|
|
readonly proxyEndpointTemplate?: string
|
|
+ readonly serviceWorker?: {
|
|
+ readonly path: string;
|
|
+ readonly scope: string;
|
|
+ }
|
|
|
|
readonly version: string;
|
|
readonly date?: string;
|
|
Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts
|
|
===================================================================
|
|
--- code-server.orig/lib/vscode/src/vs/workbench/browser/client.ts
|
|
+++ code-server/lib/vscode/src/vs/workbench/browser/client.ts
|
|
@@ -89,6 +89,10 @@ export class CodeServerClient extends Di
|
|
if (this.productService.logoutEndpoint) {
|
|
this.addLogoutCommand(this.productService.logoutEndpoint);
|
|
}
|
|
+
|
|
+ if (this.productService.serviceWorker) {
|
|
+ await this.registerServiceWorker(this.productService.serviceWorker);
|
|
+ }
|
|
}
|
|
|
|
private checkUpdates(updateEndpoint: string) {
|
|
@@ -161,4 +165,17 @@ export class CodeServerClient extends Di
|
|
});
|
|
}
|
|
}
|
|
+
|
|
+ private async registerServiceWorker(serviceWorker: { path: string; scope: string }) {
|
|
+ if (typeof navigator !== 'undefined' && 'serviceWorker' in navigator) {
|
|
+ try {
|
|
+ await navigator.serviceWorker.register(serviceWorker.path, {
|
|
+ scope: serviceWorker.scope,
|
|
+ });
|
|
+ this.logService.info('[Service Worker] registered');
|
|
+ } catch (error: any) {
|
|
+ this.logService.error('[Service Worker] registration', error as Error);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
}
|
|
Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
|
|
===================================================================
|
|
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
|
|
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
|
|
@@ -404,6 +404,10 @@ export class WebClientServer {
|
|
updateEndpoint: !this._environmentService.args['disable-update-check'] ? rootBase + '/update/check' : undefined,
|
|
logoutEndpoint: this._environmentService.args['auth'] && this._environmentService.args['auth'] !== "none" ? rootBase + '/logout' : undefined,
|
|
proxyEndpointTemplate: process.env.VSCODE_PROXY_URI ?? rootBase + '/proxy/{{port}}/',
|
|
+ serviceWorker: {
|
|
+ scope: vscodeBase + '/',
|
|
+ path: rootBase + '/_static/out/browser/serviceWorker.js',
|
|
+ },
|
|
embedderIdentifier: 'server-distro',
|
|
voiceWsUrl: this._productService.voiceWsUrl,
|
|
extensionsGallery: this._productService.extensionsGallery,
|