diff options
Diffstat (limited to 'src/api/server/LocalApi.js')
-rw-r--r-- | src/api/server/LocalApi.js | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/api/server/LocalApi.js b/src/api/server/LocalApi.js index 4b1f03f22..644f15b93 100644 --- a/src/api/server/LocalApi.js +++ b/src/api/server/LocalApi.js | |||
@@ -2,14 +2,14 @@ import { ipcRenderer } from 'electron'; | |||
2 | import { session } from '@electron/remote'; | 2 | import { session } from '@electron/remote'; |
3 | import du from 'du'; | 3 | import du from 'du'; |
4 | 4 | ||
5 | import { getServicePartitionsDirectory } from '../../helpers/service-helpers.js'; | 5 | import { getServicePartitionsDirectory } from '../../helpers/service-helpers'; |
6 | 6 | ||
7 | const debug = require('debug')('Ferdi:LocalApi'); | 7 | const debug = require('debug')('Ferdi:LocalApi'); |
8 | 8 | ||
9 | export default class LocalApi { | 9 | export default class LocalApi { |
10 | // Settings | 10 | // Settings |
11 | getAppSettings(type) { | 11 | getAppSettings(type) { |
12 | return new Promise((resolve) => { | 12 | return new Promise(resolve => { |
13 | ipcRenderer.once('appSettings', (event, resp) => { | 13 | ipcRenderer.once('appSettings', (event, resp) => { |
14 | debug('LocalApi::getAppSettings resolves', resp.type, resp.data); | 14 | debug('LocalApi::getAppSettings resolves', resp.type, resp.data); |
15 | resolve(resp); | 15 | resolve(resp); |
@@ -41,11 +41,21 @@ export default class LocalApi { | |||
41 | } | 41 | } |
42 | 42 | ||
43 | async clearCache(serviceId = null) { | 43 | async clearCache(serviceId = null) { |
44 | const s = serviceId ? session.fromPartition(`persist:service-${serviceId}`) : session.defaultSession; | 44 | const s = serviceId |
45 | ? session.fromPartition(`persist:service-${serviceId}`) | ||
46 | : session.defaultSession; | ||
45 | 47 | ||
46 | debug('LocalApi::clearCache resolves', (serviceId || 'clearAppCache')); | 48 | debug('LocalApi::clearCache resolves', serviceId || 'clearAppCache'); |
47 | await s.clearStorageData({ | 49 | await s.clearStorageData({ |
48 | storages: ['appcache', 'cookies', 'filesystem', 'indexdb', 'localstorage', 'shadercache', 'websql', 'serviceworkers', 'cachestorage'], | 50 | storages: [ |
51 | 'appcache', | ||
52 | 'filesystem', | ||
53 | 'indexdb', | ||
54 | 'shadercache', | ||
55 | 'websql', | ||
56 | 'serviceworkers', | ||
57 | 'cachestorage', | ||
58 | ], | ||
49 | quotas: ['temporary', 'persistent', 'syncable'], | 59 | quotas: ['temporary', 'persistent', 'syncable'], |
50 | }); | 60 | }); |
51 | return s.clearCache(); | 61 | return s.clearCache(); |