diff --git a/bin/new-lamassu-register b/bin/new-lamassu-register
index acd23c40..6afdf8f7 100755
--- a/bin/new-lamassu-register
+++ b/bin/new-lamassu-register
@@ -20,7 +20,7 @@ login.generateOTP(name).then(otp => {
if (domain === 'localhost') {
console.log(`https://${domain}:3000/register?otp=${otp}`)
} else {
- console.log(`https://${domain}?otp=${otp}`)
+ console.log(`https://${domain}/register?otp=${otp}`)
}
process.exit(0)
diff --git a/lib/new-admin/admin-server.js b/lib/new-admin/admin-server.js
index 72a5ee04..150c81dd 100644
--- a/lib/new-admin/admin-server.js
+++ b/lib/new-admin/admin-server.js
@@ -1,4 +1,5 @@
const fs = require('fs')
+const path = require('path')
const express = require('express')
const https = require('https')
const cors = require('cors')
@@ -24,6 +25,7 @@ if (!hostname) {
const app = express()
app.use(helmet({ noCache: true }))
app.use(cookieParser())
+app.use(express.static(path.resolve(__dirname, '..', '..', 'public')))
const apolloServer = new ApolloServer({
typeDefs,
@@ -80,6 +82,9 @@ app.get('/api/register', (req, res, next) => {
})
})
+// Everything not on graphql or api/register is redirected to the front-end
+app.get('*', (req, res) => res.sendFile(path.resolve('client', 'build', 'index.html')))
+
const certOptions = {
key: fs.readFileSync(options.keyPath),
cert: fs.readFileSync(options.certPath)
diff --git a/new-lamassu-admin/package-lock.json b/new-lamassu-admin/package-lock.json
index 89443b27..d33803ea 100644
--- a/new-lamassu-admin/package-lock.json
+++ b/new-lamassu-admin/package-lock.json
@@ -6906,8 +6906,7 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"aproba": {
"version": "1.2.0",
@@ -6928,14 +6927,12 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -6950,20 +6947,17 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"core-util-is": {
"version": "1.0.2",
@@ -7080,8 +7074,7 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"ini": {
"version": "1.3.5",
@@ -7093,7 +7086,6 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -7108,7 +7100,6 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@@ -7116,14 +7107,12 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@@ -7142,7 +7131,6 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -7223,8 +7211,7 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"object-assign": {
"version": "4.1.1",
@@ -7236,7 +7223,6 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"wrappy": "1"
}
@@ -7322,8 +7308,7 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -7359,7 +7344,6 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -7379,7 +7363,6 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -7423,14 +7406,12 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
}
}
},
@@ -25314,7 +25295,6 @@
"version": "1.1.11",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -25483,7 +25463,6 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@@ -25491,8 +25470,7 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"minipass": {
"version": "2.9.0",
@@ -25605,8 +25583,7 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"object-assign": {
"version": "4.1.1",
diff --git a/new-lamassu-admin/src/pages/AuthRegister.js b/new-lamassu-admin/src/pages/AuthRegister.js
index e3e1152f..eb151241 100644
--- a/new-lamassu-admin/src/pages/AuthRegister.js
+++ b/new-lamassu-admin/src/pages/AuthRegister.js
@@ -1,17 +1,17 @@
-import React from 'react'
-import { useLocation, useHistory } from 'react-router-dom'
import useAxios from '@use-hooks/axios'
-function useQuery() {
- return new URLSearchParams(useLocation().search)
-}
+import React from 'react'
+
+import { useLocation, useHistory } from 'react-router-dom'
+
+const useQuery = () => new URLSearchParams(useLocation().search)
const AuthRegister = () => {
const history = useHistory()
const query = useQuery()
useAxios({
- url: `https://localhost:8070/api/register?otp=${query.get('otp')}`,
+ url: `/api/register?otp=${query.get('otp')}`,
method: 'GET',
options: {
withCredentials: true
diff --git a/new-lamassu-admin/src/routing/routes.js b/new-lamassu-admin/src/routing/routes.js
index 1c7a95af..c2afad75 100644
--- a/new-lamassu-admin/src/routing/routes.js
+++ b/new-lamassu-admin/src/routing/routes.js
@@ -1,18 +1,29 @@
import * as R from 'ramda'
+
import React from 'react'
+
import { Route, Redirect, Switch } from 'react-router-dom'
import AuthRegister from 'src/pages/AuthRegister'
+
import Commissions from 'src/pages/Commissions'
+
import Funding from 'src/pages/Funding'
+
import Locales from 'src/pages/Locales'
+
import MachineLogs from 'src/pages/MachineLogs'
+
import OperatorInfo from 'src/pages/OperatorInfo/OperatorInfo'
+
import ServerLogs from 'src/pages/ServerLogs'
+
import Services from 'src/pages/Services/Services'
+
import Transactions from 'src/pages/Transactions/Transactions'
import Customers from '../pages/Customers'
+
import MachineStatus from '../pages/maintenance/MachineStatus'
const tree = [
@@ -101,6 +112,11 @@ const Routes = () => (
exact
component={() => }
/>
+ }
+ />