MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / clientPathMatches

Function clientPathMatches

apps/ui/public/sw.js:51–63  ·  view source on GitHub ↗

Exact same-origin path/search/hash compare. No substring matching.

(clientUrl, targetPath)

Source from the content-addressed store, hash-verified

49
50/** Exact same-origin path/search/hash compare. No substring matching. */
51function clientPathMatches(clientUrl, targetPath) {
52 try {
53 const parsed = new URL(clientUrl);
54
55 if (parsed.origin !== self.location.origin) {
56 return false;
57 }
58
59 return `${parsed.pathname}${parsed.search}${parsed.hash}` === targetPath;
60 } catch {
61 return false;
62 }
63}
64
65self.addEventListener("push", (event) => {
66 let payload = { title: "Notification", body: "", url: null };

Callers 1

sw.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected