Skip to content

Commit 152dcae

Browse files
committed
Bring back service worker fix
Looks like we lost this, and using type module causes cookies not to be sent which causes auth issues.
1 parent 21efa1e commit 152dcae

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

patches/webview.diff

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,19 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index
7171

7272
<meta http-equiv="Content-Security-Policy"
7373
- content="default-src 'none'; script-src 'sha256-q+WTr+fBXpLLE3++yWNaxT6BTWQtsKscoeIlynBRk4E=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
74-
+ content="default-src 'none'; script-src 'sha256-TRhQKOVfHYg34NwPrDGzFSP3l32HL8sgSHYg4kYl0ho=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
74+
+ content="default-src 'none'; script-src 'sha256-m1DlJtsIJd46QuWYNcsaYIG1xI+9FyjKQu+cfp+zq5Q=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
7575

7676
<!-- Disable pinch zooming -->
7777
<meta name="viewport"
78+
@@ -253,7 +253,7 @@
79+
}
80+
81+
const swPath = encodeURI(`service-worker.js?v=${expectedWorkerVersion}&vscode-resource-base-authority=${searchParams.get('vscode-resource-base-authority')}&remoteAuthority=${searchParams.get('remoteAuthority') ?? ''}`);
82+
- navigator.serviceWorker.register(swPath, { type: 'module', updateViaCache: 'none' })
83+
+ navigator.serviceWorker.register(swPath)
84+
.then(async registration => {
85+
if (navigator.serviceWorker.controller) {
86+
// A previous SW is already controlling. Force an update
7887
@@ -332,6 +332,12 @@
7988

8089
const hostname = location.hostname;

0 commit comments

Comments
 (0)