web build sorta working

This commit is contained in:
Sean Yesmunt 2019-02-22 01:59:50 -05:00
parent 5a97077c9f
commit f25d71d1c3
12 changed files with 129 additions and 1259 deletions

View file

@ -24,8 +24,10 @@
"compile": "electron-webpack && yarn extract-langs",
"build": "yarn compile && electron-builder build",
"build:dir": "yarn build -- --dir -c.compression=store -c.mac.identity=null",
"build:web": "webpack",
"dev": "electron-webpack dev",
"dev:internal-apis": "LBRY_API_URL='http://localhost:8080' yarn dev",
"dev:web": "webpack --watch",
"lint": "eslint 'src/**/*.{js,jsx}' --fix && flow",
"format": "prettier 'src/**/*.{js,jsx,scss,json}' --write",
"flow-defs": "flow-typed install",
@ -53,7 +55,7 @@
"hast-util-sanitize": "^1.1.2",
"keytar": "^4.2.1",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#3ab065b11a52d3e2e6a50a25459f9ff0aac03b13",
"lbry-redux": "lbryio/lbry-redux#00755bef2eaef739a44dc0ad66bd5dece50497ac",
"lbryinc": "lbryio/lbryinc#2334ad53e82c22d6291899785d5292347008f2a9",
"localforage": "^1.7.1",
"mammoth": "^1.4.6",
@ -98,6 +100,7 @@
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.18.0",
"copy-webpack-plugin": "^4.6.0",
"decompress": "^4.2.0",
"del": "^3.0.0",
"devtron": "^1.4.0",
@ -130,7 +133,6 @@
"sass-loader": "^6.0.7",
"webpack": "^3.10.0",
"webpack-build-notifier": "^0.1.23",
"webpack-cli": "^2.0.0",
"yarnhook": "^0.2.0"
},
"engines": {

View file

@ -119,7 +119,9 @@ class App extends React.PureComponent<Props> {
src={Native.imagePath('gerbil-happy.png')}
/>
)}
{/* @if TARGET='app' */}
<SideBar />
{/* @endif */}
<div className="content" id="content">
<Router />
<ModalRouter />

View file

@ -80,10 +80,7 @@ const Header = (props: Props) => {
<WunderBar />
{
// TODO: Make `Menu` add `.active` class to `.navigation` when clicked
}
{/* @if TARGET='app' */}
<div className="header__navigation">
<Button
className="header__navigation-item header__navigation-item--menu"
@ -111,6 +108,7 @@ const Header = (props: Props) => {
/>
)}
</div>
{/* @endif */}
</header>
);
};

View file

@ -126,20 +126,19 @@ export default class SplashScreen extends React.PureComponent<Props, State> {
// If the wallet is locked, stop doing anything and make the user input their password
// @if TARGET='app'
// xxxif TARGET='app'
if (wallet && wallet.is_locked) {
// Clear the error timeout, it might sit on this step for a while until someone enters their password
if (this.timeout) {
clearTimeout(this.timeout);
}
// @endif
// @if TARGET='web'
console.log('I think web needs this', accountList);
// if (account_list && account_list.encrypted) {
// xxxendif
// xxxif TARGET='web'
// if (accountList && accountList.encrypted) {
// this.setState({
// isRunning: true,
// });
// @endif
// xxxendif
// Make sure there isn't another active modal (like INCOMPATIBLE_DAEMON)
if (launchedModal === false && !modal) {
@ -148,7 +147,7 @@ export default class SplashScreen extends React.PureComponent<Props, State> {
} else if (status.is_running) {
// If we cleared the error timout due to a wallet being locked, make sure to start it back up
if (!this.timeout) {
this.adjustErrorTimeout();
this.adjustErrorTimseout();
}
Lbry.resolve({ urls: 'lbry://one' }).then(() => {

View file

@ -19,7 +19,13 @@ import {
doOpenModal,
doHideModal,
} from 'redux/actions/app';
import { doToast, doBlackListedOutpointsSubscribe, isURIValid, setSearchApi } from 'lbry-redux';
import {
Lbry,
doToast,
doBlackListedOutpointsSubscribe,
isURIValid,
setSearchApi,
} from 'lbry-redux';
import { doNavigate, doHistoryBack, doHistoryForward } from 'redux/actions/navigation';
import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings';
import { doAuthenticate, Lbryio, rewards } from 'lbryinc';
@ -45,6 +51,7 @@ if (process.env.SEARCH_API_URL) {
setSearchApi(process.env.SEARCH_API_URL);
}
// @if TARGET='app'
ipcRenderer.on('navigate-backward', () => {
app.store.dispatch(doHistoryBack());
});
@ -52,6 +59,12 @@ ipcRenderer.on('navigate-backward', () => {
ipcRenderer.on('navigate-forward', () => {
app.store.dispatch(doHistoryForward());
});
// @endif
// @if TARGET='web'
Lbry.setDaemonConnectionString('/api/proxy');
console.log('set string');
// @endif
// We need to override Lbryio for getting/setting the authToken
// We interect with ipcRenderer to get the auth key from a users keyring

View file

@ -13,7 +13,9 @@ import { remote } from 'web/stubs';
// @endif
/* eslint-enable no-redeclare */
// @if TARGET='app'
const win = remote.BrowserWindow.getFocusedWindow();
// @endif
const reducers = {};
@ -173,7 +175,9 @@ reducers[ACTIONS.DOWNLOADING_COMPLETED] = state => {
const { badgeNumber } = state;
// Don't update the badge number if the window is focused
// @if TARGET='app'
if (win && win.isFocused()) return Object.assign({}, state);
// @endif
return Object.assign({}, state, {
badgeNumber: badgeNumber + 1,

View file

@ -1,35 +0,0 @@
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>LBRY</title>
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400italic,600italic,600' rel='stylesheet' type='text/css'>
<link href="./css/all.css" rel="stylesheet" type="text/css" media="screen,print" />
<link rel="icon" type="image/png" href="img/fav/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="img/fav/favicon-194x194.png" sizes="194x194">
<link rel="icon" type="image/png" href="img/fav/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="img/fav/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="img/fav/favicon-16x16.png" sizes="16x16">
<meta name="msapplication-TileColor" content="#155B4A">
<meta name="msapplication-TileImage" content="/img/fav/mstile-144x144.png">
<meta name="theme-color" content="#155B4A">
<style>
body {
background-color: "#155b4a"
}
</style>
</head>
<div id="canvas">
<div class="load-screen" style="color: white; min-height: 100vh; min-width: 100vw; display: flex; flex-direction: column; align-items: center; justify-content: center;">
<img src="img/lbry-white-485x160.png" alt="LBRY">
<div style="margin-top: 24px; width: 325px; text-align: center;">
<h3>
<span>Shutting Down <span class="busy-indicator"></span>
</span>
</h3>
</div>
</div>
</div>
</html>

View file

@ -1 +0,0 @@
lbrynet>=0.8.4

View file

@ -1,35 +0,0 @@
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>LBRY</title>
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400italic,600italic,600' rel='stylesheet' type='text/css'>
<link href="./css/all.css" rel="stylesheet" type="text/css" media="screen,print" />
<link rel="icon" type="image/png" href="img/fav/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="img/fav/favicon-194x194.png" sizes="194x194">
<link rel="icon" type="image/png" href="img/fav/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="img/fav/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="img/fav/favicon-16x16.png" sizes="16x16">
<meta name="msapplication-TileColor" content="#155B4A">
<meta name="msapplication-TileImage" content="/img/fav/mstile-144x144.png">
<meta name="theme-color" content="#155B4A">
<style>
body {
background-color: "#155b4a"
}
</style>
</head>
<div id="canvas">
<div class="load-screen" style="color: white; min-height: 100vh; min-width: 100vw; display: flex; flex-direction: column; align-items: center; justify-content: center;">
<img src="img/lbry-white-485x160.png" alt="LBRY">
<div style="margin-top: 24px; width: 325px; text-align: center;">
<h3>
<span>Starting LBRY Upgrade <span class="busy-indicator"></span>
</span>
</h3>
</div>
</div>
</div>
</html>

View file

@ -1,35 +0,0 @@
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>LBRY</title>
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400italic,600italic,600' rel='stylesheet' type='text/css'>
<link href="./css/all.css" rel="stylesheet" type="text/css" media="screen,print" />
<link rel="icon" type="image/png" href="img/fav/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="img/fav/favicon-194x194.png" sizes="194x194">
<link rel="icon" type="image/png" href="img/fav/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="img/fav/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="img/fav/favicon-16x16.png" sizes="16x16">
<meta name="msapplication-TileColor" content="#155B4A">
<meta name="msapplication-TileImage" content="/img/fav/mstile-144x144.png">
<meta name="theme-color" content="#155B4A">
<style>
body {
background-color: "#155b4a"
}
</style>
</head>
<div id="canvas">
<div class="load-screen" style="color: white; min-height: 100vh; min-width: 100vw; display: flex; flex-direction: column; align-items: center; justify-content: center;">
<img src="img/lbry-white-485x160.png" alt="LBRY">
<div style="margin-top: 24px; width: 325px; text-align: center;">
<h3>
<span>The daemon has unexpectedly shutdown. Goodbye.
</span>
</h3>
</div>
</div>
</div>
</html>

View file

@ -1,6 +1,9 @@
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ELECTRON_RENDERER_PROCESS_ROOT = path.resolve(__dirname, 'src/renderer/');
const STATIC_ROOT = path.resolve(__dirname, 'static/');
const DIST_ROOT = path.resolve(__dirname, 'dist/');
const RENDERER_PROCESS_ROOT = path.resolve(__dirname, 'src/renderer/');
module.exports = env => {
return {
@ -12,10 +15,6 @@ module.exports = env => {
filename: 'bundle.js',
publicPath: '/static/app/',
},
// commented out because of webpack 3
// optimization: {
// minimize: false,
// },
target: 'web',
node: {
fs: 'empty',
@ -50,14 +49,6 @@ module.exports = env => {
],
exclude: /node_modules/,
},
// {
// test: /\.jsx?$/,
// loader: 'babel-loader',
// options: {
// presets: ['env', 'react', 'stage-2'],
// },
// exclude: /node_modules/,
// },
{
test: /\.scss$/,
use: [
@ -67,14 +58,26 @@ module.exports = env => {
],
},
{
test: /\.(png|woff|woff2|eot|ttf|svg|gif)$/,
// loader: 'url-loader?limit=100000'
test: /\.(woff|woff2)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
// outputPath: 'resources/'
outputPath: 'static/font/',
},
},
],
},
{
// All images should use this, but we need to bring them into components
test: /\.(gif|png)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'static/img/',
},
},
],
@ -86,9 +89,18 @@ module.exports = env => {
],
},
resolve: {
modules: [ELECTRON_RENDERER_PROCESS_ROOT, 'node_modules', __dirname],
modules: [RENDERER_PROCESS_ROOT, 'node_modules', __dirname],
extensions: ['.js', '.jsx', '.scss', '.json'],
},
plugins: [
new CopyWebpackPlugin([
{
from: `${STATIC_ROOT}/`,
to: `${DIST_ROOT}/web/static/`,
ignore: ['daemon/**/*', 'font/**/*'],
},
]),
],
externals: [
(function() {
var IGNORES = [

1190
yarn.lock

File diff suppressed because it is too large Load diff