Merge pull request #2545 from lbryio/returning-users

fix: allow auth token to persist if the browser is closed
This commit is contained in:
Sean Yesmunt 2019-06-13 12:10:49 -04:00 committed by GitHub
commit be89a11904
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,7 +29,7 @@ import { formatLbryUriForWeb } from 'util/uri';
import 'scss/all.scss';
const APPPAGEURL = 'lbry://?';
const COOKIE_EXPIRE_TIME = 60 * 60 * 24 * 365; // 1 year
// @if TARGET='app'
const { autoUpdater } = remote.require('electron-updater');
autoUpdater.logger = remote.require('electron-log');
@ -73,8 +73,11 @@ Lbryio.setOverride(
const newAuthToken = response.auth_token;
authToken = newAuthToken;
// @if TARGET='web'
document.cookie = cookie.serialize('auth_token', authToken);
document.cookie = cookie.serialize('auth_token', authToken, {
maxAge: COOKIE_EXPIRE_TIME,
});
// @endif
// @if TARGET='app'
ipcRenderer.send('set-auth-token', authToken);