mirror of
https://github.com/cdr/code-server.git
synced 2025-12-08 09:23:00 +01:00
This will ensure it always matches or is underneath the allowed service worker scope. Fixes #2076.
18 lines
451 B
TypeScript
18 lines
451 B
TypeScript
import { getOptions, normalize } from "../common/util"
|
|
|
|
const options = getOptions()
|
|
|
|
import "./pages/error.css"
|
|
import "./pages/global.css"
|
|
import "./pages/login.css"
|
|
|
|
if ("serviceWorker" in navigator) {
|
|
const path = normalize(`${options.csStaticBase}/dist/serviceWorker.js`)
|
|
navigator.serviceWorker
|
|
.register(path, {
|
|
scope: (options.base ?? "") + "/",
|
|
})
|
|
.then(() => {
|
|
console.log("[Service Worker] registered")
|
|
})
|
|
}
|