keep auth_token in a cookie on web
This commit is contained in:
parent
6dff40ac5e
commit
f670fda6c2
4 changed files with 19 additions and 9 deletions
|
@ -74,6 +74,7 @@
|
|||
"classnames": "^2.2.5",
|
||||
"codemirror": "^5.39.2",
|
||||
"connected-react-router": "^6.3.2",
|
||||
"cookie": "^0.3.1",
|
||||
"copy-webpack-plugin": "^4.6.0",
|
||||
"country-data": "^0.0.31",
|
||||
"cross-env": "^5.2.0",
|
||||
|
|
|
@ -121,7 +121,11 @@ export default class FirstRun extends PureComponent<Props> {
|
|||
<div className="card__content">
|
||||
<p>{__("Check out some of the neat content below me. I'll see you around!")}</p>
|
||||
<div className="card__actions">
|
||||
<Button button="primary" onClick={completeFirstRun} label={__('See You Later')} />
|
||||
<Button
|
||||
button="primary"
|
||||
onClick={completeFirstRun}
|
||||
label={__('Lets Get Started')}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Help>
|
||||
|
|
|
@ -21,17 +21,16 @@ import {
|
|||
import { Lbry, doToast, isURIValid, setSearchApi } from 'lbry-redux';
|
||||
import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings';
|
||||
import { doAuthenticate, Lbryio, rewards, doBlackListedOutpointsSubscribe } from 'lbryinc';
|
||||
import(
|
||||
/* webpackChunkName: "styles" */
|
||||
/* webpackPrefetch: true */
|
||||
'scss/all.scss'
|
||||
);
|
||||
import { store, history } from 'store';
|
||||
import pjson from 'package.json';
|
||||
import app from './app';
|
||||
import analytics from './analytics';
|
||||
import doLogWarningConsoleMessage from './logWarningConsoleMessage';
|
||||
import { ConnectedRouter } from 'connected-react-router';
|
||||
import cookie from 'cookie';
|
||||
import(/* webpackChunkName: "styles" */
|
||||
/* webpackPrefetch: true */
|
||||
'scss/all.scss');
|
||||
|
||||
const APPPAGEURL = 'lbry://?';
|
||||
|
||||
|
@ -67,7 +66,7 @@ Lbry.setDaemonConnectionString(SDK_API_URL);
|
|||
// We interect with ipcRenderer to get the auth key from a users keyring
|
||||
// We keep a local variable for authToken beacuse `ipcRenderer.send` does not
|
||||
// contain a response, so there is no way to know when it's been set
|
||||
// @if TARGET='app'
|
||||
|
||||
let authToken;
|
||||
Lbryio.setOverride(
|
||||
'setAuthToken',
|
||||
|
@ -89,6 +88,9 @@ Lbryio.setOverride(
|
|||
|
||||
const newAuthToken = response.auth_token;
|
||||
authToken = newAuthToken;
|
||||
// @if TARGET='web'
|
||||
document.cookie = cookie.serialize('authToken', authToken);
|
||||
// @endif
|
||||
// @if TARGET='app'
|
||||
ipcRenderer.send('set-auth-token', authToken);
|
||||
// @endif
|
||||
|
@ -112,10 +114,13 @@ Lbryio.setOverride(
|
|||
|
||||
ipcRenderer.send('get-auth-token');
|
||||
// @endif
|
||||
// @if TARGET='web'
|
||||
const { authToken } = cookie.parse(document.cookie);
|
||||
resolve(authToken);
|
||||
// @endif
|
||||
}
|
||||
})
|
||||
);
|
||||
// @endif
|
||||
|
||||
rewards.setCallback('claimFirstRewardSuccess', () => {
|
||||
app.store.dispatch(doOpenModal(MODALS.FIRST_REWARD));
|
||||
|
|
|
@ -2696,7 +2696,7 @@ cookie-signature@1.0.6:
|
|||
resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c"
|
||||
integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw=
|
||||
|
||||
cookie@0.3.1:
|
||||
cookie@0.3.1, cookie@^0.3.1:
|
||||
version "0.3.1"
|
||||
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"
|
||||
integrity sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=
|
||||
|
|
Loading…
Reference in a new issue