Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jon49/sw

Package Overview
Dependencies
Maintainers
0
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jon49/sw - npm Package Compare versions

Comparing version 0.12.14 to 0.13.0

28

lib/routes.ts

@@ -1,4 +0,4 @@

let { html, links } =
let { html, links, db, globalDb } =
// @ts-ignore
self.app as { links: { file: string, url: string }[], html: Function }
self.app as { links: { file: string, url: string }[], html: Function, db: any, globalDb: any }

@@ -102,2 +102,3 @@ if (!links) {

for (const r of self.app.routes) {
// @ts-ignore
if (r.file

@@ -148,4 +149,22 @@ && (r.route instanceof RegExp && r.route.test(url.pathname)

let isPost = method === "post"
if (!isPost && !url.pathname.endsWith("/")) return cacheResponse(url.pathname, event)
if (!isPost) {
if (!url.pathname.endsWith("/")) {
return cacheResponse(url.pathname, event)
}
if (url.searchParams.get("login") === "success") {
await globalDb.setLoggedIn(true)
}
let lastUrl: string | undefined
if (url.pathname === "/web/" && (lastUrl = (await db.get("last-url"))?.url)) {
url = new URL(lastUrl)
} else if (url.searchParams.has("pushUrl") || url.searchParams.has("hz")) {
let saveUrl = new URL(url.href)
saveUrl.searchParams.delete("pushUrl")
saveUrl.searchParams.delete("hz")
await db.set("last-url", { url: saveUrl.href }, { sync: false })
}
}
let handlers =

@@ -180,3 +199,3 @@ <RouteHandler<RouteGetArgs | RoutePostArgs> | null>

if (isHtml(result)) {
if (req.url.includes("hz")) {
if (url.searchParams.has("hz")) {
result = html`<template>${result}</template>`

@@ -374,2 +393,1 @@ }

2

package.json
{
"name": "@jon49/sw",
"version": "0.12.14",
"version": "0.13.0",
"description": "Packages for MVC service workers.",

@@ -5,0 +5,0 @@ "type": "module",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc