ServiceWorker: don't redirect API routes with appShell

draftjs
Alex Gleason 2021-10-20 22:07:48 -05:00
rodzic 387e3b2c9e
commit c9590abd18
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 26 dodań i 1 usunięć

Wyświetl plik

@ -81,10 +81,35 @@ module.exports = merge(sharedConfig, {
'packs/emoji/**/*',
],
ServiceWorker: {
cacheName: 'soapbox',
// entry: join(__dirname, '../app/soapbox/service_worker/entry.js'),
// cacheName: 'soapbox',
minify: true,
},
cacheMaps: [{
match: requestUrl => {
const backendRoutes = [
'/api',
'/pleroma',
'/nodeinfo',
'/socket',
'/oauth',
'/auth/password',
'/.well-known/webfinger',
'/static',
'/main/ostatus',
'/ostatus_subscribe',
'/pghero',
'/sidekiq',
];
const isBackendRoute = ({ pathname }) => {
return backendRoutes.some(pathname.startsWith);
};
return isBackendRoute(requestUrl) && requestUrl;
},
requestTypes: ['navigate'],
}],
safeToUseOptionalCaches: true,
appShell: join(FE_SUBDIRECTORY, '/'),
}),