Disable service worker media cache and IndexedDB storage (#7932)
Fix #7893 Fix #7615
This commit is contained in:
		
							parent
							
								
									c0fbe9e3a4
								
							
						
					
					
						commit
						2f111b7fbb
					
				
					 2 changed files with 12 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
import { autoPlayGif } from '../../initial_state';
 | 
			
		||||
import { putAccounts, putStatuses } from '../../storage/modifier';
 | 
			
		||||
// import { autoPlayGif } from '../../initial_state';
 | 
			
		||||
// import { putAccounts, putStatuses } from '../../storage/modifier';
 | 
			
		||||
import { normalizeAccount, normalizeStatus } from './normalizer';
 | 
			
		||||
 | 
			
		||||
export const ACCOUNT_IMPORT = 'ACCOUNT_IMPORT';
 | 
			
		||||
| 
						 | 
				
			
			@ -45,7 +45,7 @@ export function importFetchedAccounts(accounts) {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  accounts.forEach(processAccount);
 | 
			
		||||
  putAccounts(normalAccounts, !autoPlayGif);
 | 
			
		||||
  //putAccounts(normalAccounts, !autoPlayGif);
 | 
			
		||||
 | 
			
		||||
  return importAccounts(normalAccounts);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -69,7 +69,7 @@ export function importFetchedStatuses(statuses) {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    statuses.forEach(processStatus);
 | 
			
		||||
    putStatuses(normalStatuses);
 | 
			
		||||
    //putStatuses(normalStatuses);
 | 
			
		||||
 | 
			
		||||
    dispatch(importFetchedAccounts(accounts));
 | 
			
		||||
    dispatch(importStatuses(normalStatuses));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,9 +1,9 @@
 | 
			
		|||
import { freeStorage, storageFreeable } from '../storage/modifier';
 | 
			
		||||
// import { freeStorage, storageFreeable } from '../storage/modifier';
 | 
			
		||||
import './web_push_notifications';
 | 
			
		||||
 | 
			
		||||
function openSystemCache() {
 | 
			
		||||
  return caches.open('mastodon-system');
 | 
			
		||||
}
 | 
			
		||||
// function openSystemCache() {
 | 
			
		||||
//   return caches.open('mastodon-system');
 | 
			
		||||
// }
 | 
			
		||||
 | 
			
		||||
function openWebCache() {
 | 
			
		||||
  return caches.open('mastodon-web');
 | 
			
		||||
| 
						 | 
				
			
			@ -13,8 +13,8 @@ function fetchRoot() {
 | 
			
		|||
  return fetch('/', { credentials: 'include', redirect: 'manual' });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const firefox = navigator.userAgent.match(/Firefox\/(\d+)/);
 | 
			
		||||
const invalidOnlyIfCached = firefox && firefox[1] < 60;
 | 
			
		||||
// const firefox = navigator.userAgent.match(/Firefox\/(\d+)/);
 | 
			
		||||
// const invalidOnlyIfCached = firefox && firefox[1] < 60;
 | 
			
		||||
 | 
			
		||||
// Cause a new version of a registered Service Worker to replace an existing one
 | 
			
		||||
// that is already installed, and replace the currently active worker on open pages.
 | 
			
		||||
| 
						 | 
				
			
			@ -52,7 +52,7 @@ self.addEventListener('fetch', function(event) {
 | 
			
		|||
 | 
			
		||||
      return response;
 | 
			
		||||
    }));
 | 
			
		||||
  } else if (storageFreeable && (ATTACHMENT_HOST ? url.host === ATTACHMENT_HOST : url.pathname.startsWith('/system/'))) {
 | 
			
		||||
  } /* else if (storageFreeable && (ATTACHMENT_HOST ? url.host === ATTACHMENT_HOST : url.pathname.startsWith('/system/'))) {
 | 
			
		||||
    event.respondWith(openSystemCache().then(cache => {
 | 
			
		||||
      return cache.match(event.request.url).then(cached => {
 | 
			
		||||
        if (cached === undefined) {
 | 
			
		||||
| 
						 | 
				
			
			@ -73,5 +73,5 @@ self.addEventListener('fetch', function(event) {
 | 
			
		|||
        return cached;
 | 
			
		||||
      });
 | 
			
		||||
    }));
 | 
			
		||||
  }
 | 
			
		||||
  } */
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue