Blockers #2360
3 changed files with 30 additions and 24 deletions
|
@ -171,7 +171,7 @@
|
||||||
"lbrySettings": {
|
"lbrySettings": {
|
||||||
"lbrynetDaemonVersion": "0.32.4",
|
"lbrynetDaemonVersion": "0.32.4",
|
||||||
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip",
|
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip",
|
||||||
"lbrynetDaemonDir": "static",
|
"lbrynetDaemonDir": "static/daemon",
|
||||||
"lbrynetDaemonFileName": "lbrynet"
|
"lbrynetDaemonFileName": "lbrynet"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,11 @@ import { spawn, execSync } from 'child_process';
|
||||||
import { Lbry } from 'lbry-redux';
|
import { Lbry } from 'lbry-redux';
|
||||||
|
|
||||||
export default class Daemon {
|
export default class Daemon {
|
||||||
static path = process.env.LBRY_DAEMON || (
|
static path =
|
||||||
process.env.NODE_ENV === 'production' ? path.join(process.resourcesPath, 'static', 'lbrynet') : path.join(__static, 'lbrynet')
|
process.env.LBRY_DAEMON ||
|
||||||
);
|
(process.env.NODE_ENV === 'production'
|
||||||
|
? path.join(process.resourcesPath, 'static/daemon', 'lbrynet')
|
||||||
|
: path.join(__static, 'daemon/lbrynet'));
|
||||||
subprocess;
|
subprocess;
|
||||||
handlers;
|
handlers;
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ let daemon;
|
||||||
|
|
||||||
const appState = {};
|
const appState = {};
|
||||||
|
|
||||||
const installExtensions = async() => {
|
const installExtensions = async () => {
|
||||||
const devtronExtension = require('devtron');
|
const devtronExtension = require('devtron');
|
||||||
return await devtronExtension.install();
|
return await devtronExtension.install();
|
||||||
};
|
};
|
||||||
|
@ -53,7 +53,7 @@ if (isDev) {
|
||||||
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = true;
|
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
app.on('ready', async() => {
|
app.on('ready', async () => {
|
||||||
let isDaemonRunning = false;
|
let isDaemonRunning = false;
|
||||||
await Lbry.status()
|
await Lbry.status()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -90,20 +90,21 @@ app.on('ready', async() => {
|
||||||
const {
|
const {
|
||||||
default: installExtension,
|
default: installExtension,
|
||||||
REACT_DEVELOPER_TOOLS,
|
REACT_DEVELOPER_TOOLS,
|
||||||
REDUX_DEVTOOLS, REACT_PERF,
|
REDUX_DEVTOOLS,
|
||||||
|
REACT_PERF,
|
||||||
} = require('electron-devtools-installer');
|
} = require('electron-devtools-installer');
|
||||||
|
|
||||||
await installExtension(REACT_DEVELOPER_TOOLS)
|
await installExtension(REACT_DEVELOPER_TOOLS)
|
||||||
.then((name) => console.log(`Added Extension: ${name}`))
|
.then(name => console.log(`Added Extension: ${name}`))
|
||||||
.catch((err) => console.log('An error occurred: ', err));
|
.catch(err => console.log('An error occurred: ', err));
|
||||||
|
|
||||||
await installExtension(REDUX_DEVTOOLS)
|
await installExtension(REDUX_DEVTOOLS)
|
||||||
.then((name) => console.log(`Added Extension: ${name}`))
|
.then(name => console.log(`Added Extension: ${name}`))
|
||||||
.catch((err) => console.log('An error occurred: ', err));
|
.catch(err => console.log('An error occurred: ', err));
|
||||||
|
|
||||||
await installExtension(REACT_PERF)
|
await installExtension(REACT_PERF)
|
||||||
.then((name) => console.log(`Added Extension: ${name}`))
|
.then(name => console.log(`Added Extension: ${name}`))
|
||||||
.catch((err) => console.log('An error occurred: ', err));
|
.catch(err => console.log('An error occurred: ', err));
|
||||||
}
|
}
|
||||||
|
|
||||||
rendererWindow = createWindow(appState);
|
rendererWindow = createWindow(appState);
|
||||||
|
@ -235,7 +236,7 @@ ipcMain.on('version-info-requested', () => {
|
||||||
let json;
|
let json;
|
||||||
try {
|
try {
|
||||||
json = JSON.parse(result);
|
json = JSON.parse(result);
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const tagName = json.tag_name;
|
const tagName = json.tag_name;
|
||||||
|
@ -262,17 +263,20 @@ ipcMain.on('version-info-requested', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const requestLatestRelease = (alreadyRedirected = false) => {
|
const requestLatestRelease = (alreadyRedirected = false) => {
|
||||||
const req = https.get({
|
const req = https.get(
|
||||||
hostname: 'api.github.com',
|
{
|
||||||
path: '/repos/lbryio/lbry-desktop/releases/latest',
|
hostname: 'api.github.com',
|
||||||
headers: { 'user-agent': `LBRY/${localVersion}` },
|
path: '/repos/lbryio/lbry-desktop/releases/latest',
|
||||||
}, res => {
|
headers: { 'user-agent': `LBRY/${localVersion}` },
|
||||||
if (res.statusCode === 301 || res.statusCode === 302) {
|
},
|
||||||
requestLatestRelease(res.headers.location, true);
|
res => {
|
||||||
} else {
|
if (res.statusCode === 301 || res.statusCode === 302) {
|
||||||
onSuccess(res);
|
requestLatestRelease(res.headers.location, true);
|
||||||
|
} else {
|
||||||
|
onSuccess(res);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
|
|
||||||
if (alreadyRedirected) return;
|
if (alreadyRedirected) return;
|
||||||
req.on('error', err => {
|
req.on('error', err => {
|
||||||
|
|
Loading…
Reference in a new issue