Add aero support and a switcher backend

This commit is contained in:
Ryan Wilson
2024-09-23 14:16:16 -04:00
parent ecc1ec9815
commit 15514e2862
4 changed files with 19 additions and 15 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ import { NextRequest } from 'next/server'
export async function GET(_req: NextRequest, { params }: { params: { uv: string } }) {
const requestedFile = params.uv
if (requestedFile === 'uv.config.js' || requestedFile === 'sw.js') {
if (requestedFile === 'uv.config.js') {
const file = fs.readFileSync(process.cwd() + `/src/lib/uv/${requestedFile}`)
const fileBlob = new Blob([file])
return new Response(fileBlob, {
-14
View File
@@ -1,14 +0,0 @@
/*global UVServiceWorker,__uv$config*/
/*
* Stock service worker script.
* Users can provide their own sw.js if they need to extend the functionality of the service worker.
* Ideally, this will be registered under the scope in uv.config.js so it will not need to be modified.
* However, if a user changes the location of uv.bundle.js/uv.config.js or sw.js is not relative to them, they will need to modify this script locally.
*/
importScripts('/uv/uv.bundle.js');
importScripts('/uv/uv.config.js');
importScripts(__uv$config.sw || '/uv/uv.sw.js');
const sw = new UVServiceWorker();
self.addEventListener('fetch', (event) => event.respondWith(sw.fetch(event)));