-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new endpoints for crypto onboarding
- Loading branch information
Cafe137
committed
Mar 15, 2022
1 parent
f81ede7
commit 80e1b3d
Showing
13 changed files
with
247 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
const { shell } = require('electron') | ||
const { runApiServer } = require('./src/api-server') | ||
const { runElectronTray } = require('./src/electron') | ||
const { runLauncher } = require('./src/launcher') | ||
const { runStaticServer } = require('./src/static-server') | ||
const { port, runServer } = require('./src/server') | ||
const { getStatus } = require('./src/status') | ||
|
||
if (require('./src/api-server').getStatus().status === 2) { | ||
if (getStatus().status === 2) { | ||
runLauncher() | ||
} else { | ||
shell.openExternal('http://localhost:5002') | ||
shell.openExternal(`http://localhost:${port}/installer/`) | ||
} | ||
runElectronTray() | ||
runStaticServer() | ||
runApiServer() | ||
runServer() |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const { load, dump } = require('js-yaml') | ||
const { readFileSync, writeFileSync } = require('fs') | ||
const { FAILSAFE_SCHEMA } = require('js-yaml') | ||
|
||
function getPath() { | ||
return 'config.yaml' | ||
} | ||
|
||
function readConfigYaml() { | ||
const raw = readFileSync(getPath(), 'utf-8') | ||
const data = load(raw, { | ||
schema: FAILSAFE_SCHEMA | ||
}) | ||
return data | ||
} | ||
|
||
function writeConfigYaml(newValues) { | ||
const data = readConfigYaml() | ||
for (const [key, value] of Object.entries(newValues)) { | ||
data[key] = value | ||
} | ||
writeFileSync(getPath(), dump(data)) | ||
} | ||
|
||
module.exports = { | ||
readConfigYaml, | ||
writeConfigYaml | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const { readFileSync, existsSync } = require('fs') | ||
const { load } = require('js-yaml') | ||
const { readConfigYaml } = require('./config-yaml') | ||
|
||
function getStatus() { | ||
const statusObject = { | ||
status: 0, | ||
address: null, | ||
config: null | ||
} | ||
if (!existsSync('config.yaml') || !existsSync('data-dir')) { | ||
return statusObject | ||
} | ||
statusObject.config = readConfigYaml() | ||
const { address } = JSON.parse(readFileSync('data-dir/keys/swarm.key')) | ||
statusObject.address = address | ||
if (!statusObject.config['block-hash']) { | ||
statusObject.status = 1 | ||
return statusObject | ||
} | ||
statusObject.status = 2 | ||
return statusObject | ||
} | ||
|
||
module.exports = { getStatus } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
{ | ||
"files": { | ||
"main.css": "/static/css/main.3814743f.css", | ||
"main.js": "/static/js/main.b4ff9f8c.js", | ||
"index.html": "/index.html", | ||
"main.3814743f.css.map": "/static/css/main.3814743f.css.map", | ||
"main.b4ff9f8c.js.map": "/static/js/main.b4ff9f8c.js.map" | ||
"main.css": "/installer/static/css/main.3814743f.css", | ||
"main.js": "/installer/static/js/main.59899838.js", | ||
"index.html": "/installer/index.html", | ||
"main.3814743f.css.map": "/installer/static/css/main.3814743f.css.map", | ||
"main.59899838.js.map": "/installer/static/js/main.59899838.js.map" | ||
}, | ||
"entrypoints": [ | ||
"static/css/main.3814743f.css", | ||
"static/js/main.b4ff9f8c.js" | ||
"static/js/main.59899838.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><script defer="defer" src="/static/js/main.b4ff9f8c.js"></script><link href="/static/css/main.3814743f.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html> | ||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/installer/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/installer/logo192.png"/><link rel="manifest" href="/installer/manifest.json"/><title>React App</title><script defer="defer" src="/installer/static/js/main.59899838.js"></script><link href="/installer/static/css/main.3814743f.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html> |
6 changes: 3 additions & 3 deletions
6
static/installer/static/js/main.b4ff9f8c.js → static/installer/static/js/main.59899838.js
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
.../installer/static/js/main.b4ff9f8c.js.map → .../installer/static/js/main.59899838.js.map
Large diffs are not rendered by default.
Oops, something went wrong.