code-server/patches/insecure-notification.diff
Olivier Benz fc6064dcd3
Update Code to 1.94.2 (#7026)
* Update Code to 1.94.2

* Convert from yarn to npm

This is to match VS Code.  We were already partially using npm for the
releases so this is some nice alignment.

* Update caniuse-lite

This was complaining on every unit test.

* Update eslint

I was having a bunch of dependency conflicts and eslint seemed to be the
culprit so I just removed it and set it up again, since it seems things
have changed quite a bit.

* Update test dependencies

I was getting oom when running the unit tests...updating seems to work.

* Remove package.json `scripts` property in release

The new pre-install script was being included, which is dev-only.

This was always the intent; did not realize jq's merge was recursive.

* Remove jest and devDependencies in release as well

* Update test extension dependencies

This appears to be conflicting with the root dependencies.

* Fix playwright exec

npm does not let you run binaries like yarn does, as far as I know.

* Fix import of server-main.js

* Fix several tests by waiting for selectors
2024-10-17 20:32:21 -08:00

62 lines
1.8 KiB
Diff

Add a notification when accessing code-server in an insecure context
This is done because otherwise when things like the clipboard do not work users
may think code-server is broken. Ideally there would be a notification at the
point where these things are used instead of this though.
To test access over something like an HTTP domain or an IP address (not
localhost). For example:
1. run code-server
2. use ngrok to expose code-server
3. access via HTTP
4. look for notification in bottom right
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
@@ -1,7 +1,10 @@
import { Disposable } from "../../base/common/lifecycle.js";
+import { localize } from '../../nls.js';
+import { INotificationService, Severity } from '../../platform/notification/common/notification.js';
export class CodeServerClient extends Disposable {
constructor (
+ @INotificationService private notificationService: INotificationService,
) {
super();
}
@@ -42,5 +45,31 @@ export class CodeServerClient extends Di
}
});
}
+
+ if (!window.isSecureContext) {
+ this.notificationService.notify({
+ severity: Severity.Warning,
+ message: localize(
+ 'insecureContext',
+ "{0} is being accessed in an insecure context. Web views, the clipboard, and other functionality may not work as expected.",
+ 'code-server',
+ ),
+ actions: {
+ primary: [
+ {
+ id: 'understand',
+ label: localize('confirmInsecure', "I understand"),
+ tooltip: '',
+ class: undefined,
+ enabled: true,
+ checked: true,
+ run: () => {
+ return Promise.resolve();
+ },
+ },
+ ],
+ },
+ });
+ }
}
}