Merge branch 'sw-embed' into 'develop'
ServiceWorker: pass /embed through to the backend See merge request soapbox-pub/soapbox-fe!1723
This commit is contained in:
commit
1debd9c3f9
|
@ -78,7 +78,6 @@ module.exports = {
|
||||||
'space-infix-ops': 'error',
|
'space-infix-ops': 'error',
|
||||||
'space-in-parens': ['error', 'never'],
|
'space-in-parens': ['error', 'never'],
|
||||||
'keyword-spacing': 'error',
|
'keyword-spacing': 'error',
|
||||||
'consistent-return': 'error',
|
|
||||||
'dot-notation': 'error',
|
'dot-notation': 'error',
|
||||||
eqeqeq: 'error',
|
eqeqeq: 'error',
|
||||||
indent: ['error', 2, {
|
indent: ['error', 2, {
|
||||||
|
@ -278,7 +277,6 @@ module.exports = {
|
||||||
files: ['**/*.ts', '**/*.tsx'],
|
files: ['**/*.ts', '**/*.tsx'],
|
||||||
rules: {
|
rules: {
|
||||||
'no-undef': 'off', // https://stackoverflow.com/a/69155899
|
'no-undef': 'off', // https://stackoverflow.com/a/69155899
|
||||||
'consistent-return': 'off',
|
|
||||||
},
|
},
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
},
|
},
|
||||||
|
|
|
@ -92,7 +92,10 @@ module.exports = merge(sharedConfig, {
|
||||||
cacheMaps: [{
|
cacheMaps: [{
|
||||||
// NOTE: This function gets stringified by OfflinePlugin, so don't try
|
// NOTE: This function gets stringified by OfflinePlugin, so don't try
|
||||||
// moving it anywhere else or making it depend on anything outside it!
|
// moving it anywhere else or making it depend on anything outside it!
|
||||||
match: ({ pathname }) => {
|
// https://github.com/NekR/offline-plugin/blob/master/docs/cache-maps.md
|
||||||
|
match: (url) => {
|
||||||
|
const { pathname } = url;
|
||||||
|
|
||||||
const backendRoutes = [
|
const backendRoutes = [
|
||||||
'/.well-known',
|
'/.well-known',
|
||||||
'/activities',
|
'/activities',
|
||||||
|
@ -119,10 +122,8 @@ module.exports = merge(sharedConfig, {
|
||||||
'/unsubscribe',
|
'/unsubscribe',
|
||||||
];
|
];
|
||||||
|
|
||||||
if (pathname) {
|
if (backendRoutes.some(path => pathname.startsWith(path)) || pathname.endsWith('/embed')) {
|
||||||
return backendRoutes.some(path => pathname.startsWith(path));
|
return url;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
requestTypes: ['navigate'],
|
requestTypes: ['navigate'],
|
||||||
|
|
Loading…
Reference in New Issue