fix: misspellings

This commit is contained in:
ner committed 2024-10-25 12:56:28 +03:00
1 parent d8363ca250
commit f3b90f30c3
10 files changed
+109 -2636

No files matched your search

+28 -29
View File
@@ -1,11 +1,13 @@
'use client'; 'use client';
import { Bookmark, Copy, Heart, Play, Star } from 'lucide-react'; import { Bookmark, Copy, Heart, Play, Star } from 'lucide-react';
import Link from 'next/link'; import { useRouter } from 'next/navigation';
import showTorrentsModal from '@/components/Preview/components/Torrents'; import showTorrentsModal from '@/components/Preview/components/Torrents';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
import ButtonsGroup from '@/components/ui/buttons-group';
import useShowState, { useMutateShowState } from '@/hooks/useShowState'; import useShowState, { useMutateShowState } from '@/hooks/useShowState';
import useTheme from '@/hooks/useTheme';
import { cn } from '@/lib/utils'; import { cn } from '@/lib/utils';
interface Props { interface Props {
@@ -15,27 +17,24 @@ interface Props {
} }
const Actions = ({ onClose, show, className }: Props) => { const Actions = ({ onClose, show, className }: Props) => {
const router = useRouter();
const [theme] = useTheme();
const state = useShowState({ showId: show.id, showType: show.type }); const state = useShowState({ showId: show.id, showType: show.type });
const toggle = useMutateShowState(show); const toggle = useMutateShowState(show);
const groupClassName = 'flex bg-input gap-[1px] rounded-md md:flex-grow-0 flex-grow';
const leftClassName = 'h-8 gap-1 flex-grow border-r-0 rounded-none rounded-l-md md:px-3 px-2';
const rightClassName = 'h-8 gap-1 flex-grow border-l-0 rounded-none rounded-r-md md:px-3 px-2';
return ( return (
<div className={cn('flex gap-2 flex-wrap md:flex-grow-0 flex-grow', className)}> <div className={cn('flex gap-2 flex-wrap md:flex-grow-0 flex-grow', className)}>
<div className={cn(groupClassName, 'pointer-events-none')}> <ButtonsGroup className='pointer-events-none'>
<Button aria-label='Show rating' className={leftClassName} variant='outline'> <Button aria-label='Show rating' variant='outline'>
<Star size={14} /> <Star size={14} />
</Button> </Button>
<Button className={rightClassName} variant='outline'> <Button variant='outline'>{show.rating.toFixed(1)}</Button>
{show.rating.toFixed(1)} </ButtonsGroup>
</Button> <ButtonsGroup>
</div>
<div className={groupClassName}>
<Button <Button
aria-label='Toggle favorite' aria-label='Toggle favorite'
className={leftClassName}
variant='outline' variant='outline'
disabled={toggle.list === 'favorite' && toggle.isPending} disabled={toggle.list === 'favorite' && toggle.isPending}
onClick={() => toggle.mutate({ list: 'favorite', value: !state?.favorite })} onClick={() => toggle.mutate({ list: 'favorite', value: !state?.favorite })}
@@ -44,28 +43,28 @@ const Actions = ({ onClose, show, className }: Props) => {
</Button> </Button>
<Button <Button
aria-label='Toggle watch list' aria-label='Toggle watch list'
className={rightClassName}
variant='outline' variant='outline'
disabled={toggle.list === 'watchlist' && toggle.isPending} disabled={toggle.list === 'watchlist' && toggle.isPending}
onClick={() => toggle.mutate({ list: 'watchlist', value: !state?.watchlist })} onClick={() => toggle.mutate({ list: 'watchlist', value: !state?.watchlist })}
> >
<Bookmark size={14} className={cn({ 'fill-secondary-foreground': state?.watchlist })} /> <Bookmark size={14} className={cn({ 'fill-secondary-foreground': state?.watchlist })} />
</Button> </Button>
</div> </ButtonsGroup>
<div className={cn(groupClassName, 'gap-0')}> <ButtonsGroup className='gap-0'>
<Link
className='flex grow'
href={`/similar?id=${show.id}&title=${encodeURIComponent(show.title)}&type=${show.type}`}
onClick={onClose}
>
<Button aria-label='Similar show' className={leftClassName} variant='outline'>
<Copy size={14} />
Similar
</Button>
</Link>
<Button <Button
aria-label='Watch show' onClick={() => {
className={cn(rightClassName, 'bg-red-700')} onClose?.();
router.push(`/similar?id=${show.id}&title=${encodeURIComponent(show.title)}&type=${show.type}`);
}}
aria-label='Similar show'
variant='outline'
>
<Copy size={14} />
Similar
</Button>
<Button
aria-label='Watch'
className={cn({ 'bg-red-600': theme === 'light', 'bg-red-700': theme === 'dark' })}
variant='destructive' variant='destructive'
onClick={() => onClick={() =>
showTorrentsModal({ showTorrentsModal({
@@ -79,7 +78,7 @@ const Actions = ({ onClose, show, className }: Props) => {
<Play size={15} /> <Play size={15} />
Watch Watch
</Button> </Button>
</div> </ButtonsGroup>
</div> </div>
); );
}; };
@@ -1,9 +1,12 @@
import { FC, Fragment } from 'react'; import { FC, Fragment } from 'react';
import { Cast, Copy, ListVideo, Magnet, Play } from 'lucide-react'; import { Cast, ListVideo, Magnet, Play } from 'lucide-react';
import { Sort } from '@/api/parsers'; import { Sort } from '@/api/parsers';
import { Quality } from '@/api/parsers/yts/models'; import { Quality } from '@/api/parsers/yts/models';
import { Button } from '@/components/ui/button';
import ButtonsGroup from '@/components/ui/buttons-group';
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
import { cn } from '@/lib/utils';
import { providers } from '../../constants'; import { providers } from '../../constants';
import { useCastMagnet, usePrefix } from '../../hooks/useMagnetHosts'; import { useCastMagnet, usePrefix } from '../../hooks/useMagnetHosts';
@@ -18,10 +21,11 @@ interface Props {
sort: Sort; sort: Sort;
sortable: boolean; sortable: boolean;
provider: string; provider: string;
year: number;
onChangeSort: (sort: Sort) => void; onChangeSort: (sort: Sort) => void;
} }
const TorrentsTable: FC<Props> = ({ title, torrents, backdrop, sort, sortable, provider, onChangeSort }) => { const TorrentsTable: FC<Props> = ({ title, torrents, backdrop, sort, sortable, provider, year, onChangeSort }) => {
const prefix = usePrefix(); const prefix = usePrefix();
const cast = useCastMagnet(); const cast = useCastMagnet();
@@ -31,7 +35,7 @@ const TorrentsTable: FC<Props> = ({ title, torrents, backdrop, sort, sortable, p
<Table className='overflow-hidden rounded-xl'> <Table className='overflow-hidden rounded-xl'>
{Boolean(torrents?.length) && ( {Boolean(torrents?.length) && (
<TableHeader> <TableHeader>
<TableRow> <TableRow className='hover:bg-transparent'>
<TableHead className='hidden px-2 md:table-cell'>Title</TableHead> <TableHead className='hidden px-2 md:table-cell'>Title</TableHead>
<TableHead className='hidden px-2 md:table-cell'>Resolution</TableHead> <TableHead className='hidden px-2 md:table-cell'>Resolution</TableHead>
<TableHeadSortable sortable={sortable} title='Size' sort={Sort.size} value={sort} onChange={onChangeSort} /> <TableHeadSortable sortable={sortable} title='Size' sort={Sort.size} value={sort} onChange={onChangeSort} />
@@ -59,18 +63,20 @@ const TorrentsTable: FC<Props> = ({ title, torrents, backdrop, sort, sortable, p
const supportedForCast = prefix && !prefix.includes('{host}'); const supportedForCast = prefix && !prefix.includes('{host}');
const yearView = torrent.year && year.toString() != torrent.year && `[${torrent.year}]`;
return ( return (
<Fragment key={torrent.magnet + torrent.id}> <Fragment key={torrent.magnet + torrent.id}>
<TableRow className='table-row border-b-0 md:hidden'> <TableRow className='table-row border-b-0 hover:bg-transparent md:hidden'>
<TableCell className='break-all p-2' colSpan={colSpan}> <TableCell className='break-all p-2' colSpan={colSpan}>
<span className='flex w-full flex-wrap items-center gap-3'> <span className='flex w-full flex-wrap items-center gap-3'>
{torrent.title} {torrent.year && `[${torrent.year}]`} {torrent.quality && `[${torrent.quality}]`} {torrent.title} {yearView} {torrent.quality && `[${torrent.quality}]`}
</span> </span>
</TableCell> </TableCell>
</TableRow> </TableRow>
<TableRow> <TableRow className='hover:bg-transparent'>
<TableCell className='hidden break-all p-2 md:table-cell' title={torrent.originalTitle}> <TableCell className='hidden break-all p-2 md:table-cell' title={torrent.originalTitle}>
{torrent.title} {torrent.year && `[${torrent.year}]`}{' '} {torrent.title} {yearView}{' '}
<span className='uppercase'>{torrent.source && `[${torrent.source}]`}</span> <span className='uppercase'>{torrent.source && `[${torrent.source}]`}</span>
</TableCell> </TableCell>
<TableCell className='hidden p-2 md:table-cell'> <TableCell className='hidden p-2 md:table-cell'>
@@ -81,48 +87,40 @@ const TorrentsTable: FC<Props> = ({ title, torrents, backdrop, sort, sortable, p
</TableCell> </TableCell>
<TableCell className='truncate p-2'>{torrent.seeders}</TableCell> <TableCell className='truncate p-2'>{torrent.seeders}</TableCell>
<TableCell className='p-1 pr-2 text-center'> <TableCell className='p-1 pr-2 text-center'>
<div className='no-scrollbar flex max-w-full justify-end gap-2 overflow-auto'> <ButtonsGroup className='ml-auto w-fit grow-0'>
{supportedForStream && ( {supportedForStream && (
<div <Button
className='flex size-8 cursor-pointer items-center justify-center rounded-md border' variant='destructive'
className={cn('flex-grow-0 px-3 bg-red-600')}
onClick={() => showPlayer({ magnet: torrent.magnet, backdrop, title })} onClick={() => showPlayer({ magnet: torrent.magnet, backdrop, title })}
title='Play show' title='Play'
> >
<Play size={20} /> <Play size={15} />
</div> </Button>
)} )}
<a <Button
href={`${process.env.NEXT_PUBLIC_TORRENT_PROXY}/stream?m3u&link=${encodeURIComponent( variant='outline'
torrent.magnet className='relative grow-0 px-3'
)}`} title='Play using your native video player'
className='flex size-8 items-center justify-center rounded-md border'
title='Open using you native video player'
> >
<a
className='absolute left-0 top-0 size-full'
href={`${process.env.NEXT_PUBLIC_TORRENT_PROXY}/stream?m3u&link=${encodeURIComponent(
torrent.magnet
)}`}
/>
<ListVideo size={20} /> <ListVideo size={20} />
</a> </Button>
<a <Button className='relative grow-0 px-3' variant='outline' title='Download magnet'>
href={torrent.magnet} <a className='absolute left-0 top-0 size-full' href={torrent.magnet} />
className='flex size-8 items-center justify-center rounded-md border'
title='Download magnet'
>
<Magnet size={20} /> <Magnet size={20} />
</a> </Button>
<div
className='flex size-8 cursor-pointer items-center justify-center rounded-md border'
onClick={() => navigator.clipboard.writeText(torrent.magnet)}
title='Copy magnet into clipboard'
>
<Copy size={20} />
</div>
{supportedForCast && ( {supportedForCast && (
<div <Button className='grow-0 px-3' variant='outline' onClick={() => cast(torrent.magnet!)}>
onClick={() => cast(torrent.magnet!)}
className='flex size-8 cursor-pointer items-center justify-center rounded-md border'
>
<Cast size={20} /> <Cast size={20} />
</div> </Button>
)} )}
</div> </ButtonsGroup>
</TableCell> </TableCell>
</TableRow> </TableRow>
</Fragment> </Fragment>
@@ -89,6 +89,7 @@ const showTorrentsModal = create(({ title, year, imdbID, backdrop, onResolve }:
return ( return (
<TabsContent className='pb-1' key={provider.key} value={provider.key}> <TabsContent className='pb-1' key={provider.key} value={provider.key}>
<TorrentsTable <TorrentsTable
year={year}
title={title} title={title}
backdrop={backdrop} backdrop={backdrop}
sort={sort} sort={sort}
+12 -8
View File
@@ -41,13 +41,17 @@ const Preview: FC<Props> = ({ show: baseShow, className, onClose, poster }) => {
<div className='order-3 mb-4 flex w-full flex-wrap gap-5 whitespace-nowrap text-sm md:order-2'> <div className='order-3 mb-4 flex w-full flex-wrap gap-5 whitespace-nowrap text-sm md:order-2'>
<span>{new Date(show.release).getFullYear()}</span> <span>{new Date(show.release).getFullYear()}</span>
{show.runtime && <span>{show.runtime} minutes</span>} {Boolean(show.runtime) && (
<span> <span className='animate-fade-aside-slide-in opacity-0'>{show.runtime} minutes</span>
{show.genres )}
?.slice(0, 3) {Boolean(show.genres) && (
.map(({ name }) => name) <span className='animate-fade-aside-slide-in opacity-0'>
.join(' | ')} {show.genres
</span> ?.slice(0, 3)
.map(({ name }) => name)
.join(' | ')}
</span>
)}
</div> </div>
<Actions className='order-1 mb-4 mt-1 md:order-2 md:mt-0' show={show} onClose={onClose} /> <Actions className='order-1 mb-4 mt-1 md:order-2 md:mt-0' show={show} onClose={onClose} />
@@ -68,9 +72,9 @@ export const showPreviewModal = create(({ onResolve, onClose, show }: Props & In
<Preview <Preview
show={show} show={show}
onClose={() => { onClose={() => {
window.scrollTo({ top: 0, behavior: 'smooth' });
onClose?.(); onClose?.();
onResolve(); onResolve();
window.scrollTo({ top: 0, behavior: 'smooth' });
}} }}
/> />
</Modal> </Modal>
+25
View File
@@ -0,0 +1,25 @@
import { Children, cloneElement, FC, isValidElement, ReactElement, ReactNode } from 'react';
import { cn } from '@/lib/utils';
interface Props {
children: ReactNode;
className?: string;
}
const ButtonsGroup: FC<Props> = ({ children, className }) => (
<div className={cn('flex bg-input gap-[1px] rounded-md md:flex-grow-0 flex-grow group', className)}>
{Children.map(children, (child) => {
if (!isValidElement(child)) return null;
return cloneElement(child as ReactElement<{ className?: string }>, {
className: cn(
'h-8 gap-1 flex-grow md:px-3 px-2 [&:not(:first-child):not(:last-child)]:border-x-0 rounded-none first:border-r-0 first:rounded-l-md last:border-l-0 last:rounded-r-md',
child.props.className
)
});
})}
</div>
);
export default ButtonsGroup;
+2 -1
View File
@@ -14,7 +14,8 @@ const nextConfig = {
}; };
const withPWA = require('next-pwa')({ const withPWA = require('next-pwa')({
dest: 'public' dest: 'public',
disable: process.env.NODE_ENV === 'development'
}); });
module.exports = withPWA(nextConfig); module.exports = withPWA(nextConfig);
+2 -2
View File
@@ -21,9 +21,9 @@ const Providers: FC<Props> = ({ children, theme }) => {
return ( return (
<QueryClientProvider client={queryClient}> <QueryClientProvider client={queryClient}>
<ThemeProvider theme={theme}>{children}</ThemeProvider> <ThemeProvider theme={theme}>{children}</ThemeProvider>
<ModalContainer exitTimeout={500} enterTimeout={0} /> <ModalContainer exitTimeout={0} enterTimeout={0} />
<Toaster /> <Toaster />
<ReactQueryDevtools initialIsOpen={true} /> <ReactQueryDevtools initialIsOpen={false} />
</QueryClientProvider> </QueryClientProvider>
); );
}; };
+1 -101
View File
@@ -1,101 +1 @@
/** if(!self.define){let e,s={};const n=(n,a)=>(n=new URL(n+".js",a).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(a,i)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(s[t])return;let c={};const r=e=>n(e,t),f={module:{uri:t},exports:c,require:r};s[t]=Promise.all(a.map((e=>f[e]||r(e)))).then((e=>(i(...e),c)))}}define(["./workbox-4754cb34"],(function(e){"use strict";importScripts(),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"/_next/app-build-manifest.json",revision:"a3cd5f95f7db0d1d05cdd80d39fbbcc3"},{url:"/_next/static/8_22PWCS83fHwArrknWWz/_buildManifest.js",revision:"2ec694eb52ae4f523f265a46bae4d768"},{url:"/_next/static/8_22PWCS83fHwArrknWWz/_ssgManifest.js",revision:"b6652df95db52feb4daf4eca35380933"},{url:"/_next/static/chunks/152.e619d8b05424829e.js",revision:"e619d8b05424829e"},{url:"/_next/static/chunks/23-e95fe3862375276d.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/26.286553a5ff2812fc.js",revision:"286553a5ff2812fc"},{url:"/_next/static/chunks/276.c3c1130f2adade69.js",revision:"c3c1130f2adade69"},{url:"/_next/static/chunks/344.05938a041227e582.js",revision:"05938a041227e582"},{url:"/_next/static/chunks/37-f6e2aef0dac1a9f4.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/383.78d47f7582340f53.js",revision:"78d47f7582340f53"},{url:"/_next/static/chunks/408-9f4330d448d111de.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/460.ac20021c7496f1d6.js",revision:"ac20021c7496f1d6"},{url:"/_next/static/chunks/497.a16beaad36f500fe.js",revision:"a16beaad36f500fe"},{url:"/_next/static/chunks/61.e269d4a699fba0b6.js",revision:"e269d4a699fba0b6"},{url:"/_next/static/chunks/621-fa4d2ff1cf645813.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/673.362c29137dd3e968.js",revision:"362c29137dd3e968"},{url:"/_next/static/chunks/693-2767062d917b3456.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/695.156d21364de6e419.js",revision:"156d21364de6e419"},{url:"/_next/static/chunks/755.5cd959eac5682527.js",revision:"5cd959eac5682527"},{url:"/_next/static/chunks/792.b51012549074b93f.js",revision:"b51012549074b93f"},{url:"/_next/static/chunks/810.6105e84414768b0d.js",revision:"6105e84414768b0d"},{url:"/_next/static/chunks/922.9ce4bf0553cfb724.js",revision:"9ce4bf0553cfb724"},{url:"/_next/static/chunks/957-cded7f5705dab153.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/app/(site)/favorites/page-ffb6640ca3724ba2.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/app/(site)/loading-96645736797edde7.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/app/(site)/page-43d5ab309b47f26e.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/app/(site)/popular/page-243e61f0cd1ad4c8.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/app/(site)/similar/page-3421aec886d9bdf2.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/app/(site)/starring/page-fa8f2c845631e4fa.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/app/(site)/top/page-f6114c36b62ccf16.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/app/(site)/watch-list/page-f94b41f0047b2259.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/app/_not-found/page-aa0c8e90320336c2.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/app/layout-2d41dd83e95d492b.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/c8bcbd21.63daf74955ffea8b.js",revision:"63daf74955ffea8b"},{url:"/_next/static/chunks/fd9d1056-bdf7d185613ab264.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/framework-f66176bb897dc684.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/main-af50ab4bffe3e017.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/main-app-51cdaff1a81e6b49.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/pages/_app-6a626577ffa902a4.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/pages/_error-1be831200e60c5c0.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/chunks/polyfills-42372ed130431b0a.js",revision:"846118c33b2c0e922d7b3a7676f81f6f"},{url:"/_next/static/chunks/webpack-c237893ea1bfcd3a.js",revision:"8_22PWCS83fHwArrknWWz"},{url:"/_next/static/css/0d5f6452b2682b9b.css",revision:"0d5f6452b2682b9b"},{url:"/_next/static/css/9c0cd24400449eee.css",revision:"9c0cd24400449eee"},{url:"/_next/static/media/46c21389e888bf13-s.woff2",revision:"272930c09ba14c81bb294be1fe18b049"},{url:"/_next/static/media/8888a3826f4a3af4-s.p.woff2",revision:"792477d09826b11d1e5a611162c9797a"},{url:"/_next/static/media/eafabf029ad39a43-s.p.woff2",revision:"43751174b6b810eb169101a20d8c26f8"},{url:"/_next/static/media/f5767adec246cdc1-s.woLine truncated
* Copyright 2018 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// If the loader is already loaded, just stop.
if (!self.define) {
let registry = {};
// Used for `eval` and `importScripts` where we can't get script URL by other means.
// In both cases, it's safe to use a global var because those functions are synchronous.
let nextDefineUri;
const singleRequire = (uri, parentUri) => {
uri = new URL(uri + ".js", parentUri).href;
return registry[uri] || (
new Promise(resolve => {
if ("document" in self) {
const script = document.createElement("script");
script.src = uri;
script.onload = resolve;
document.head.appendChild(script);
} else {
nextDefineUri = uri;
importScripts(uri);
resolve();
}
})
.then(() => {
let promise = registry[uri];
if (!promise) {
throw new Error(`Module ${uri} didn’t register its module`);
}
return promise;
})
);
};
self.define = (depsNames, factory) => {
const uri = nextDefineUri || ("document" in self ? document.currentScript.src : "") || location.href;
if (registry[uri]) {
// Module is already loading or loaded.
return;
}
let exports = {};
const require = depUri => singleRequire(depUri, uri);
const specialDeps = {
module: { uri },
exports,
require
};
registry[uri] = Promise.all(depsNames.map(
depName => specialDeps[depName] || require(depName)
)).then(deps => {
factory(...deps);
return exports;
});
};
}
define(['./workbox-e43f5367'], (function (workbox) { 'use strict';
importScripts();
self.skipWaiting();
workbox.clientsClaim();
workbox.registerRoute("/", new workbox.NetworkFirst({
"cacheName": "start-url",
plugins: [{
cacheWillUpdate: async ({
request,
response,
event,
state
}) => {
if (response && response.type === 'opaqueredirect') {
return new Response(response.body, {
status: 200,
statusText: 'OK',
headers: response.headers
});
}
return response;
}
}]
}), 'GET');
workbox.registerRoute(/.*/i, new workbox.NetworkOnly({
"cacheName": "dev",
plugins: []
}), 'GET');
}));
//# sourceMappingURL=sw.js.map
+1
View File
@@ -0,0 +1 @@
define(["exports"],(function(t){"use strict";try{self["workbox:core:6.5.4"]&&_()}catch(t){}const e=(t,...e)=>{let s=t;return e.length>0&&(s+=` :: ${JSON.stringify(e)}`),s};class s extends Error{constructor(t,s){super(e(t,s)),this.name=t,this.details=s}}try{self["workbox:routing:6.5.4"]&&_()}catch(t){}const n=t=>t&&"object"==typeof t?t:{handle:t};class r{constructor(t,e,s="GET"){this.handler=n(e),this.match=t,this.method=s}setCatchHandler(t){this.catchHandler=n(t)}}class i extends r{constructor(t,e,s){super((({url:e})=>{const s=t.exec(e.href);if(s&&(e.origin===location.origin||0===s.index))return s.slice(1)}),e,s)}}class a{constructor(){this.t=new Map,this.i=new Map}get routes(){return this.t}addFetchListener(){self.addEventListener("fetch",(t=>{const{request:e}=t,s=this.handleRequest({request:e,event:t});s&&t.respondWith(s)}))}addCacheListener(){self.addEventListener("message",(t=>{if(t.data&&"CACHE_URLS"===t.data.type){const{payload:e}=t.data,s=Promise.all(e.urlsToCache.map((e=>{"string"==typeof e&&(e=[e]);const s=new Request(...e);return this.handleRequest({request:s,event:t})})));t.waitUntil(s),t.ports&&t.ports[0]&&s.then((()=>t.ports[0].postMessage(!0)))}}))}handleRequest({request:t,event:e}){const s=new URL(t.url,location.href);if(!s.protocol.startsWith("http"))return;const n=s.origin===location.origin,{params:r,route:i}=this.findMatchingRoute({event:e,request:t,sameOrigin:n,url:s});let a=i&&i.handler;const o=t.method;if(!a&&this.i.has(o)&&(a=this.i.get(o)),!a)return;let c;try{c=a.handle({url:s,request:t,event:e,params:r})}catch(t){c=Promise.reject(t)}const h=i&&i.catchHandler;return c instanceof Promise&&(this.o||h)&&(c=c.catch((async n=>{if(h)try{return await h.handle({url:s,request:t,event:e,params:r})}catch(t){t instanceof Error&&(n=t)}if(this.o)return this.o.handle({url:s,request:t,event:e});throw n}))),c}findMatchingRoute({url:t,sameOrigin:e,request:s,event:n}){const r=this.t.get(s.method)||[];for(const i of r){let r;const a=i.match({url:t,sameOrigin:e,request:s,event:n});if(a)return r=a,(Array.isArray(r)&&0===r.length||a.constructor===Object&&0===Object.keys(a).length||"boolean"==typeof a)&&(r=void 0),{route:i,params:r}}return{}}setDefaultHandler(t,e="GET"){this.i.set(e,n(t))}setCatchHandler(t){this.o=n(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(t){if(!this.t.has(t.method))throw new s("unregister-route-but-not-found-with-method",{method:t.method});const e=this.t.get(t.method).indexOf(t);if(!(e>-1))throw new s("unregister-route-route-not-registered");this.t.get(t.method).splice(e,1)}}let o;const c=()=>(o||(o=new a,o.addFetchListener(),o.addCacheListener()),o);function h(t,e,n){let a;if("string"==typeof t){const s=new URL(t,location.href);a=new r((({url:t})=>t.href===s.href),e,n)}else if(t instanceof RegExp)a=new i(t,e,n);else if("function"==typeof t)a=new r(t,e,n);else{if(!(t instanceof r))throw new s("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});a=t}return c().registerRoute(a),a}try{self["workbox:strategies:6.5.4"]&&_()}catch(t){}const u={cacheWillUpdate:async({response:t})=>200===t.status||0===t.status?t:null},l={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!=typeof registration?registration.scope:""},f=t=>[l.prefix,t,l.suffix].filter((t=>t&&t.length>0)).join("-"),w=t=>t||f(l.precache),d=t=>t||f(l.runtime);function p(t,e){const s=new URL(t);for(const t of e)s.searchParams.delete(t);return s.href}class y{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}const g=new Set;function m(t){return"string"==typeof t?new Request(t):t}class v{constructor(t,e){this.h={},Object.assign(this,e),this.event=e.event,this.u=t,this.l=new y,this.p=[],this.m=[...t.plugins],this.v=new Map;for(const t of this.m)this.v.set(t,{});this.event.waitUntil(this.l.promise)}async fetch(t){const{event:e}=this;let n=m(t);if("navigate"===n.mode&&e instanceof FetchEvent&&e.preloadResponse){const t=await e.preloadResponse;if(t)return t}const r=this.hasCallback("fetchDidFail")?n.clone():null;try{for(const t of this.iterateCallbacks("requestWillFetch"))n=await t({request:n.clone(),event:e})}catch(t){if(t instanceof Error)throw new s("plugin-error-request-will-fetch",{thrownErrorMessage:t.message})}const i=n.clone();try{let t;t=await fetch(n,"navigate"===n.mode?void 0:this.u.fetchOptions);for(const s of this.iterateCallbacks("fetchDidSucceed"))t=await s({event:e,request:i,response:t});return t}catch(t){throw r&&await this.runCallbacks("fetchDidFail",{error:t,event:e,originalRequest:r.clone(),request:i.clone()}),t}}async fetchAndCachePut(t){const e=await this.fetch(t),s=e.clone();return this.waitUntil(this.cachePut(t,s)),e}async cacheMatch(t){const e=m(t);let s;const{cacheName:n,matchOptions:r}=this.u,i=await this.getCacheKey(e,"read"),a=Object.assign(Object.assign({},r),{cacheName:n});s=await caches.match(i,a);for(constLine truncated
File diff suppressed because it is too large. Load diff