Skip to content

Commit 50633ca

Browse files
committed
my changes
1 parent 0d037e4 commit 50633ca

10 files changed

+1662
-25
lines changed

haproxy-webauthn.cfg

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ defaults
44
timeout server 50000ms
55

66
frontend https-in
7-
bind *:7000 ssl crt ./localhostca.pem
7+
bind *:443 ssl crt ./ubiworldca.pem
88
use_backend http_backend
99

1010
backend http_backend
11-
server server1 localhost:8000
11+
redirect scheme https if !{ ssl_fc }
12+
server server1 localhost:8000 check

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
},
2424
"license": "MIT",
2525
"devDependencies": {
26+
"@babel/preset-env": "^7.13.9",
27+
"@babel/preset-react": "^7.12.13",
2628
"@types/cbor": "^2.0.0",
2729
"@types/express": "^4.16.1",
2830
"@types/node": "^11.13.7",
@@ -40,6 +42,7 @@
4042
"tslint": "^5.16.0",
4143
"tslint-eslint-rules": "^5.4.0",
4244
"typescript": "^3.4.5",
45+
"util": "^0.12.3",
4346
"webpack": "^4.30.0",
4447
"webpack-cli": "^3.3.1",
4548
"webpack-dev-middleware": "^3.6.2",
@@ -48,9 +51,11 @@
4851
"dependencies": {
4952
"@types/elliptic": "^6.4.6",
5053
"cbor": "^4.1.5",
54+
"cbor-web": "^7.0.3",
5155
"elliptic": "^6.4.1",
5256
"eosjs": "file:external/eosjs",
5357
"eosjs-ecc": "^4.0.4",
58+
"fast-text-encoding": "^1.0.3",
5459
"node-fetch": "^2.3.0",
5560
"react": "^16.8.6",
5661
"react-dom": "^16.8.6",

src/client/ClientRoot.tsx

+318-8
Large diffs are not rendered by default.

src/client/index.html

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
<head>
55
<meta charset="UTF-8">
6+
<!--<script src='https://unpkg.com/bignumber.js'></script>
7+
<script src='https://unpkg.com/cbor-web'></script>-->
68
<title>Something goes here...</title>
79
</head>
810

src/server/server-loader.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,20 @@ const express = require('express');
22
const webpack = require('webpack');
33
const webpackDevMiddleware = require('webpack-dev-middleware');
44

5+
const fs = require('fs');
6+
57
const app = express();
68
const server = require('http').Server(app);
9+
10+
var options = {
11+
key: fs.readFileSync('./ubiworldca.pem'),
12+
cert: fs.readFileSync('./ubiworldca.pem')
13+
};
14+
15+
const https = require('https');
16+
17+
const serverhttps = https.createServer(options, app);
18+
719
const config = require('../../webpack.config.js');
820
const compiler = webpack(config);
921

@@ -31,12 +43,12 @@ app.use(function (req, res, next) {
3143
getServerMain().router(req, res, next);
3244
})
3345

34-
let io = require('socket.io')(server);
46+
let io = require('socket.io')(serverhttps);
3547
io.on('connection', socket => {
3648
getServerMain().connected(socket);
3749
});
3850

39-
server.listen(8000);
51+
serverhttps.listen(8000);
4052

4153
const formatHost = {
4254
getCanonicalFileName: path => path,

src/server/server.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import * as cbor from 'cbor';
2-
import { Numeric, Serialize } from 'eosjs';
1+
//import * as util from 'util';
2+
//import * as cbor from 'cbor';
3+
//import { Numeric, Serialize } from 'eosjs';
34
import * as express from 'express';
45
import * as fs from 'fs';
56
import * as SocketIO from 'socket.io';
6-
import * as util from 'util';
77
import { Key } from '../common/Key';
88

99
const keysPath = 'keys.json';
1010

1111
let unloadedModule = false;
1212
export const router = express.Router();
1313

14-
const textDecoder = new util.TextDecoder();
14+
//const textDecoder = new util.TextDecoder();
1515

1616
interface AddKeyArgs {
1717
rpid: string;
@@ -58,17 +58,18 @@ async function sendKeys() {
5858

5959
async function addKey(k: AddKeyArgs) {
6060
try {
61-
const decoded = await decodeKey(k);
61+
var r = 9;
62+
/*const decoded = await decodeKey(k);
6263
console.log(decoded);
6364
keys.push(decoded);
6465
fs.writeFileSync(keysPath, JSON.stringify(keys, null, 4));
65-
sendKeys();
66+
sendKeys();*/
6667
} catch (e) {
6768
console.log('??????', e);
6869
socket.emit('err', e.message);
6970
}
7071
}
71-
72+
/*
7273
async function decodeKey(k: AddKeyArgs): Promise<Key> {
7374
// todo: check RP ID hash
7475
// todo: check signature
@@ -134,6 +135,7 @@ async function decodeKey(k: AddKeyArgs): Promise<Key> {
134135
key,
135136
};
136137
}
138+
*/
137139

138140
let socketIO: SocketIO.Server;
139141
export function start(io: SocketIO.Server) {

tsconfig.json

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
22
"compilerOptions": {
3+
"typeRoots": [
4+
//"node_modules",
5+
"node_modules/@types"
6+
],
37
"module": "es2015",
48
"target": "es2017",
59
"outDir": "dist",
@@ -14,6 +18,9 @@
1418
},
1519
"include": [
1620
"src/**/*.ts",
17-
"node_modules/eosjs/**/*.d.ts"
18-
]
21+
"node_modules/eosjs/**/*.d.ts",
22+
"node_modules/@types",
23+
"src/client/customUtils.ts",
24+
//"src/client/utils/customUtils.d.ts"
25+
]
1926
}

tsconfig.server.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"compilerOptions": {
3+
"typeRoots": ["node_modules/@types"],
34
"module": "umd",
45
"target": "es2017",
56
"outDir": "dist",

webpack.config.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const path = require('path');
22
const HtmlWebpackPlugin = require('html-webpack-plugin');
33
const webpack = require('webpack');
4+
const { WebpackError } = require('webpack');
45

56
module.exports = {
67
entry: {
@@ -23,7 +24,11 @@ module.exports = {
2324
]
2425
},
2526
resolve: {
26-
extensions: ['.tsx', '.ts', '.js']
27+
extensions: ['.tsx', '.ts', '.js'],
28+
alias: {
29+
util3: require.resolve("util/"),
30+
utils: path.resolve(__dirname, 'src/client/utils/'),
31+
}
2732
},
2833
devtool: 'inline-source-map',
2934
devServer: {
@@ -40,8 +45,13 @@ module.exports = {
4045
new webpack.NoEmitOnErrorsPlugin(),
4146
],
4247
output: {
48+
libraryExport: 'default', //Nejc's line
4349
filename: '[name].bundle.js',
4450
path: path.resolve(__dirname, 'dist'),
4551
publicPath: '/'
52+
},
53+
node: {
54+
fs: "empty",
55+
net: 'empty'
4656
}
4757
};

0 commit comments

Comments
 (0)