Fix failed user request in dev mode (#1160)

* Fix failed flask user request in dev mode

* Run frontend lint

* Update frontend build
This commit is contained in:
Jonathan Zernik 2021-09-03 04:22:44 -07:00 committed by GitHub
parent 2f004af883
commit 86c0b4ab86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 61 additions and 61 deletions

View file

@ -5,7 +5,7 @@ clean:
rundev: gen-protos
npm install
REACT_APP_SERVER_PORT=12994 npm start
REACT_APP_DEV_MODE_ENABLED=true REACT_APP_SERVER_PORT=12994 npm start
build: gen-protos
npm install

View file

@ -1,5 +1,4 @@
import React, { useState, useEffect } from 'react';
import clsx from 'clsx';
import {
MenuItem,
Typography,
@ -222,7 +221,6 @@ export default function BuySqueakDialog({
);
}
function MakeSqueakButton() {
return (
<div className={classes.wrapper}>

View file

@ -1,14 +1,11 @@
import React from 'react';
import TimelineDot from '@material-ui/lab/TimelineDot';
import HelpIcon from '@material-ui/icons/Help';
import Avatar from '@material-ui/core/Avatar';
import { useHistory } from 'react-router-dom';
import useStyles from './styles';
import {
getProfileImageSrcString,
} from '../../squeakimages/images';

View file

@ -11,7 +11,6 @@ import {
} from '@material-ui/core';
// styles
import { makeStyles } from '@material-ui/core/styles';
// styles
import useStyles from './styles';
@ -29,7 +28,6 @@ import {
getProfilesRequest,
} from '../../squeakclient/requests';
export default function Profiles() {
const classes = useStyles();
const [profiles, setProfiles] = useState([]);

View file

@ -1,5 +1,4 @@
import { makeStyles } from '@material-ui/styles';
import { green } from '@material-ui/core/colors';
export default makeStyles((theme) => ({
root: {

View file

@ -178,7 +178,7 @@ export default function SqueakPage() {
<Grid container spacing={0}>
<Grid item xs={12} sm={9}>
<Paper className={classes.paper}>
{ancestorSqueaks && SqueakContent()}
{ancestorSqueaks && SqueakContent()}
</Paper>
{waitingForSqueak && <CircularProgress size={48} className={classes.buttonProgress} />}
</Grid>

View file

@ -5,7 +5,6 @@ import {
Button,
Fab,
CircularProgress,
Backdrop,
CardHeader,
Card,
Box,
@ -48,9 +47,7 @@ export default function TimelinePage() {
setWaitingForTimeline(true);
getTimelineSqueakDisplaysRequest(limit, blockHeight, squeakTime, squeakHash, handleLoadedTimeline, alertFailedRequest);
};
const subscribeNewSqueaks = () => {
return subscribeSqueakDisplaysRequest(handleLoadedNewSqueak);
};
const subscribeNewSqueaks = () => subscribeSqueakDisplaysRequest(handleLoadedNewSqueak);
const getNetwork = () => {
getNetworkRequest(setNetwork);
};
@ -78,9 +75,8 @@ export default function TimelinePage() {
setSqueaks((prevSqueaks) => {
if (!prevSqueaks) {
return loadedSqueaks;
} else {
return prevSqueaks.concat(loadedSqueaks);
}
return prevSqueaks.concat(loadedSqueaks);
});
};
@ -88,9 +84,8 @@ export default function TimelinePage() {
setNewSqueaks((prevNewSqueaks) => {
if (!prevNewSqueaks) {
return [newSqueak];
} else {
return prevNewSqueaks.concat(newSqueak);
}
return prevNewSqueaks.concat(newSqueak);
});
};
@ -145,11 +140,12 @@ export default function TimelinePage() {
<>
<Grid item xs={12}>
<div className={classes.wrapper}>
{!waitingForTimeline &&
{!waitingForTimeline
&& (
<Button
variant="contained"
color="primary"
disabled={waitingForTimeline}
variant="contained"
color="primary"
disabled={waitingForTimeline}
onClick={() => {
const latestSqueak = squeaks.slice(-1).pop();
const latestSqueakHeight = (latestSqueak ? latestSqueak.getBlockHeight() : null);
@ -161,7 +157,7 @@ export default function TimelinePage() {
<ReplayIcon />
View more squeaks
</Button>
}
)}
{waitingForTimeline && <CircularProgress size={48} className={classes.buttonProgress} />}
</div>
</Grid>
@ -173,13 +169,14 @@ export default function TimelinePage() {
return (
<Grid container spacing={0}>
<Grid item xs={12} sm={9}>
{squeaks &&
{squeaks
&& (
<Paper className={classes.paper}>
{(squeaks.length > 0)
? SqueaksContent()
: NoSqueaksContent()}
</Paper>
}
)}
{ViewMoreSqueaksButton()}
</Grid>
<Grid item xs={12} sm={3}>
@ -203,17 +200,21 @@ export default function TimelinePage() {
function LoadNewSqueaksContent() {
return (
<>
<Box
display="flex"
width={600} height={0}
alignItems="center"
justifyContent="center"
>
<Fab variant="extended" color="secondary" aria-label="edit" className={classes.refreshFab} onClick={handleClickRefresh}>
<RefreshIcon />
Refresh ({newSqueaks.length} new squeaks)
</Fab>
</Box>
<Box
display="flex"
width={600}
height={0}
alignItems="center"
justifyContent="center"
>
<Fab variant="extended" color="secondary" aria-label="edit" className={classes.refreshFab} onClick={handleClickRefresh}>
<RefreshIcon />
Refresh (
{newSqueaks.length}
{' '}
new squeaks)
</Fab>
</Box>
</>
);

View file

@ -76,9 +76,12 @@ import { SqueakAdminClient } from '../proto/squeak_admin_grpc_web_pb';
console.log('Using SqueakAdminClient');
console.log('The value of REACT_APP_DEV_MODE_ENABLED is:', Boolean(process.env.REACT_APP_DEV_MODE_ENABLED));
const DEV_MODE_ENABLED = process.env.REACT_APP_DEV_MODE_ENABLED;
const RPC_PROXY_PORT = 15081;
const clientUrl = `http://${window.location.hostname}:15081`;
const clientUrl = `http://${window.location.hostname}:${RPC_PROXY_PORT}`;
console.log(`Using clientUrl: ${clientUrl}`);
const client = new SqueakAdminClient(clientUrl);
@ -96,6 +99,10 @@ export function logoutRequest(handleResponse) {
}
export function getUserRequest(handleResponse) {
if (DEV_MODE_ENABLED) {
handleResponse('DEV_MODE');
return;
}
fetch(`${web_host_port}/` + 'user', {
method: 'get',
}).then((response) => response.text()).then((data) => {

View file

@ -1,17 +1,17 @@
{
"files": {
"main.js": "/static/js/main.4093144a.chunk.js",
"main.js.map": "/static/js/main.4093144a.chunk.js.map",
"main.js": "/static/js/main.d102ea6f.chunk.js",
"main.js.map": "/static/js/main.d102ea6f.chunk.js.map",
"runtime-main.js": "/static/js/runtime-main.9f0ba400.js",
"runtime-main.js.map": "/static/js/runtime-main.9f0ba400.js.map",
"static/css/2.ea4ba2f0.chunk.css": "/static/css/2.ea4ba2f0.chunk.css",
"static/js/2.87cf65f5.chunk.js": "/static/js/2.87cf65f5.chunk.js",
"static/js/2.87cf65f5.chunk.js.map": "/static/js/2.87cf65f5.chunk.js.map",
"static/js/2.27af5173.chunk.js": "/static/js/2.27af5173.chunk.js",
"static/js/2.27af5173.chunk.js.map": "/static/js/2.27af5173.chunk.js.map",
"index.html": "/index.html",
"precache-manifest.1b7a8eeba306f7fa0b8fb321413e504e.js": "/precache-manifest.1b7a8eeba306f7fa0b8fb321413e504e.js",
"precache-manifest.0f8a4cb088b97557f0dbc665563e44e3.js": "/precache-manifest.0f8a4cb088b97557f0dbc665563e44e3.js",
"service-worker.js": "/service-worker.js",
"static/css/2.ea4ba2f0.chunk.css.map": "/static/css/2.ea4ba2f0.chunk.css.map",
"static/js/2.87cf65f5.chunk.js.LICENSE.txt": "/static/js/2.87cf65f5.chunk.js.LICENSE.txt",
"static/js/2.27af5173.chunk.js.LICENSE.txt": "/static/js/2.27af5173.chunk.js.LICENSE.txt",
"static/media/font-awesome.min.css": "/static/media/fontawesome-webfont.fee66e71.woff",
"static/media/google.svg": "/static/media/google.695a3160.svg",
"static/media/logo.svg": "/static/media/logo.a0185b04.svg"
@ -19,7 +19,7 @@
"entrypoints": [
"static/js/runtime-main.9f0ba400.js",
"static/css/2.ea4ba2f0.chunk.css",
"static/js/2.87cf65f5.chunk.js",
"static/js/main.4093144a.chunk.js"
"static/js/2.27af5173.chunk.js",
"static/js/main.d102ea6f.chunk.js"
]
}

View file

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/manifest.json"/><title>Squeak Node</title><meta name="description" content="Squeak Node is a frontend for accessing a squeak node"><meta name="keywords" content="squeak, bitcoin, lightning"><meta name="author" content="Flatlogic LLC."><link href="/static/css/2.ea4ba2f0.chunk.css" rel="stylesheet"></head><body style="font-family:Roboto,sans-serif"><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,f,l=r[0],a=r[1],i=r[2],c=0,s=[];c<l.length;c++)f=l[c],Object.prototype.hasOwnProperty.call(o,f)&&o[f]&&s.push(o[f][0]),o[f]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,i||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var a=t[l];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=f(f.s=t[0]))}return e}var n={},o={1:0},u=[];function f(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,f),t.l=!0,t.exports}f.m=e,f.c=n,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,r){if(1&r&&(e=f(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)f.d(t,n,function(r){return e[r]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="/";var l=this["webpackJsonpsqueak-node-frontend"]=this["webpackJsonpsqueak-node-frontend"]||[],a=l.push.bind(l);l.push=r,l=l.slice();for(var i=0;i<l.length;i++)r(l[i]);var p=a;t()}([])</script><script src="/static/js/2.87cf65f5.chunk.js"></script><script src="/static/js/main.4093144a.chunk.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/manifest.json"/><title>Squeak Node</title><meta name="description" content="Squeak Node is a frontend for accessing a squeak node"><meta name="keywords" content="squeak, bitcoin, lightning"><meta name="author" content="Flatlogic LLC."><link href="/static/css/2.ea4ba2f0.chunk.css" rel="stylesheet"></head><body style="font-family:Roboto,sans-serif"><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,f,l=r[0],a=r[1],i=r[2],c=0,s=[];c<l.length;c++)f=l[c],Object.prototype.hasOwnProperty.call(o,f)&&o[f]&&s.push(o[f][0]),o[f]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,i||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var a=t[l];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=f(f.s=t[0]))}return e}var n={},o={1:0},u=[];function f(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,f),t.l=!0,t.exports}f.m=e,f.c=n,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,r){if(1&r&&(e=f(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)f.d(t,n,function(r){return e[r]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="/";var l=this["webpackJsonpsqueak-node-frontend"]=this["webpackJsonpsqueak-node-frontend"]||[],a=l.push.bind(l);l.push=r,l=l.slice();for(var i=0;i<l.length;i++)r(l[i]);var p=a;t()}([])</script><script src="/static/js/2.27af5173.chunk.js"></script><script src="/static/js/main.d102ea6f.chunk.js"></script></body></html>

View file

@ -1,23 +1,23 @@
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "839ed313cc8deb9dc7b1ed1ed1ee1f00",
"revision": "2abb3e1841e2714a857fc1b9ad78b218",
"url": "/index.html"
},
{
"revision": "aa378ba87a38c8ea451a",
"revision": "872f0bd685e845499d74",
"url": "/static/css/2.ea4ba2f0.chunk.css"
},
{
"revision": "aa378ba87a38c8ea451a",
"url": "/static/js/2.87cf65f5.chunk.js"
"revision": "872f0bd685e845499d74",
"url": "/static/js/2.27af5173.chunk.js"
},
{
"revision": "279b8724b89bf7d504758b3fa917239f",
"url": "/static/js/2.87cf65f5.chunk.js.LICENSE.txt"
"url": "/static/js/2.27af5173.chunk.js.LICENSE.txt"
},
{
"revision": "620660cf59dbbc3bf867",
"url": "/static/js/main.4093144a.chunk.js"
"revision": "9cf94de8dd0fbeca0178",
"url": "/static/js/main.d102ea6f.chunk.js"
},
{
"revision": "cc9816de5a8639d377ea",

View file

@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
importScripts(
"/precache-manifest.1b7a8eeba306f7fa0b8fb321413e504e.js"
"/precache-manifest.0f8a4cb088b97557f0dbc665563e44e3.js"
);
self.addEventListener('message', (event) => {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long