Merge pull request #2129 from lbryio/rc-fixes

Rc fixes
This commit is contained in:
Sean Yesmunt 2018-12-03 11:09:16 -05:00 committed by GitHub
commit 820886202d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 24 deletions

View file

@ -64,7 +64,7 @@ if (isDev) {
}
app.on('ready', async () => {
const processListArgs = process.platform === 'win32' ? 'lbrynet' : 'lbrynet start';
const processListArgs = process.platform === 'win32' ? 'lbrynet.exe' : 'lbrynet start';
const processList = await findProcess('name', processListArgs);
const isDaemonRunning = processList.length > 0;

View file

@ -82,7 +82,7 @@ class TransactionList extends React.PureComponent<Props> {
<p className="card__content">{emptyMessage || __('No transactions to list.')}</p>
)}
{!slim &&
!!transactionList.length && (
!!transactions.length && (
<div className="card__actions card__actions--between">
<FileExporter
data={transactionList}

View file

@ -34,35 +34,49 @@ autoUpdater.logger = remote.require('electron-log');
// We need to override Lbryio for getting/setting the authToken
// We interect with ipcRenderer to get the auth key from a users keyring
Lbryio.setOverride('setAuthToken', status => {
Lbryio.call(
'user',
'new',
{
auth_token: '',
language: 'en',
app_id: status.installation_id,
},
'post'
).then(response => {
if (!response.auth_token) {
throw new Error(__('auth_token is missing from response'));
}
// 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
let authToken;
Lbryio.setOverride(
'setAuthToken',
status =>
new Promise(resolve => {
Lbryio.call(
'user',
'new',
{
auth_token: '',
language: 'en',
app_id: status.installation_id,
},
'post'
).then(response => {
if (!response.auth_token) {
throw new Error(__('auth_token is missing from response'));
}
ipcRenderer.send('set-auth-token', response.auth_token);
});
});
const newAuthToken = response.auth_token;
authToken = newAuthToken;
ipcRenderer.send('set-auth-token', authToken);
resolve();
});
})
);
Lbryio.setOverride(
'getAuthToken',
() =>
new Promise(resolve => {
ipcRenderer.once('auth-token-response', (event, token) => {
Lbryio.authToken = token;
resolve(token);
});
if (authToken) {
resolve(authToken);
} else {
ipcRenderer.once('auth-token-response', (event, token) => {
Lbryio.authToken = token;
resolve(token);
});
ipcRenderer.send('get-auth-token');
ipcRenderer.send('get-auth-token');
}
})
);

View file

@ -77,6 +77,10 @@
}
// Code
pre {
white-space: normal;
}
code {
margin: 16px 0;
padding: 8px;