From 4f7274fbf256555bba480106b957d3323a057d1e Mon Sep 17 00:00:00 2001 From: Percs <83934299+Percslol@users.noreply.github.com> Date: Wed, 8 May 2024 10:33:16 -0500 Subject: [PATCH] 3.1.2 --- CHANGELOG.md | 22 ++++++++++++++++++++++ package.json | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a7dedf4..f5f29e05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,25 @@ +# 3.1.2 + +- This version of Ultraviolet cleans up some service worker code to make it faster, and also simplifies the service worker by adding `uv.route()` which allows the service worker to easily detect if the worker should route this request. +```js +importScripts('uv.bundle.js'); +importScripts('uv.config.js'); +importScripts(__uv$config.sw || 'uv.sw.js'); + +const uv = new UVServiceWorker(); + +self.addEventListener('fetch', event => { + event.respondWith( + (async ()=>{ + if (uv.route(event)) { + return await uv.fetch(event); + } + return await fetch(event.request); + })() + ); +}); +``` + # v3.1.1 - This version of Ultraviolet upgrades [bare-mux](https://www.npmjs.com/package/@mercuryworkshop/bare-mux). This solves an issue with the bare clients not being found. diff --git a/package.json b/package.json index 0f4b5731..b59cc9de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@titaniumnetwork-dev/ultraviolet", - "version": "3.1.1", + "version": "3.1.2", "description": "Highly sophisticated proxy used for evading internet censorship or accessing websites in a controlled sandbox using the power of service-workers and more!", "main": "lib/index.cjs", "license": "MIT",