persist subscriptions

This commit is contained in:
Sean Yesmunt 2019-04-11 15:18:52 -04:00
parent f670fda6c2
commit f7d975b7bb
3 changed files with 26 additions and 10 deletions

View file

@ -33,7 +33,7 @@ class FilePrice extends React.PureComponent<Props> {
const { costInfo, fetchCostInfo, uri, fetching, claim } = props;
if (costInfo === undefined && !fetching && claim) {
fetchCostInfo(uri);
// fetchCostInfo(uri);
}
};

View file

@ -58,7 +58,7 @@ ipcRenderer.on('navigate-forward', () => {
// @endif
// @if TARGET='web'
const SDK_API_URL = process.env.SDK_API_URL || 'https://api.lbry.tv/api/proxy';
const SDK_API_URL = process.env.SDK_API_URL || 'https://api.piratebay.com/api/proxy';
Lbry.setDaemonConnectionString(SDK_API_URL);
// @endif
@ -89,7 +89,7 @@ Lbryio.setOverride(
const newAuthToken = response.auth_token;
authToken = newAuthToken;
// @if TARGET='web'
document.cookie = cookie.serialize('authToken', authToken);
document.cookie = cookie.serialize('auth_token', authToken);
// @endif
// @if TARGET='app'
ipcRenderer.send('set-auth-token', authToken);
@ -115,7 +115,7 @@ Lbryio.setOverride(
ipcRenderer.send('get-auth-token');
// @endif
// @if TARGET='web'
const { authToken } = cookie.parse(document.cookie);
const { auth_token: authToken } = cookie.parse(document.cookie);
resolve(authToken);
// @endif
}

View file

@ -74,21 +74,37 @@ const walletFilter = createFilter('wallet', ['receiveAddress']);
const searchFilter = createFilter('search', ['options']);
const persistOptions = {
whitelist: ['subscriptions', 'publish', 'wallet', 'content', 'fileInfo', 'app', 'search'],
whitelist: [
// @if TARGET='app'
'publish',
'wallet',
'fileInfo',
// @endif
'content',
'subscriptions',
'app',
'search',
],
// Order is important. Needs to be compressed last or other transforms can't
// read the data
transforms: [walletFilter, contentFilter, fileInfoFilter, appFilter, searchFilter, compressor],
debounce: 10000,
transforms: [
// @if TARGET='app'
walletFilter,
contentFilter,
fileInfoFilter,
// @endif
appFilter,
searchFilter,
compressor,
],
debounce: IS_WEB ? 5000 : 10000,
storage: localForage,
};
// Dont' persist anything on web (for now)
// @if TARGET='app'
window.cacheStore = persistStore(store, persistOptions, err => {
if (err) {
console.error('Unable to load saved settings');
}
});
// @endif
export { store, history };