Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
// Use the MIME type of the first file shared to determine where we redirect.
const routeToRedirectTo = [
audioRoute,
imagesRoute,
videosRoute,
].find((route) => mediaFiles[0].type.startsWith(route.mimePrefix));
const redirectionUrl = routeToRedirectTo ? `/#${routeToRedirectTo.href}` : '/';
// After the POST succeeds, redirect to the main page.
return Response.redirect(redirectionUrl, 303);
};
const cachedMediaHandler = new CacheOnly({
cacheName,
plugins: [
// Support for cache requests that include a Range: header.
new RangeRequestsPlugin(),
],
});
skipWaiting();
clientsClaim();
// This will be replaced by the list of files to precache by
// the `workbox injectManifest` build step.
precacheAndRoute(self.__WB_MANIFEST);
registerRoute(
'/_share-target',