Import convert
parent
8e61ac9493
commit
1e58cad622
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -57,4 +57,4 @@ const config = {
|
|||
},
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
export default config;
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
export const API_VERSION_NOT_PROVIDED = 'API VERSION MUST BE INCLUDED';
|
||||
|
||||
export default '';
|
|
@ -1,10 +1,11 @@
|
|||
const orm = require('../models/index.model');
|
||||
import orm from '../models/index.model';
|
||||
|
||||
// TODO move everythijng away from this dumb intertwined style
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const devices = require('./devices');
|
||||
const authentication = require('./authentication');
|
||||
import devices from './devices';
|
||||
|
||||
import authentication from './authentication';
|
||||
|
||||
async function isCurrentUserAdmin(hardFail, req) {
|
||||
const account = await authentication.getAuthenticatedAccount(req);
|
||||
|
@ -40,7 +41,7 @@ async function banAccount(ban, userId) {
|
|||
return { success: false, status: 500, data: { banned: false } };
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
banAccount,
|
||||
isCurrentUserAdmin,
|
||||
};
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
const crypto = require('crypto');
|
||||
const jsonwebtoken = require('jsonwebtoken');
|
||||
|
||||
const config = require('../config');
|
||||
const orm = require('../models/index.model');
|
||||
import crypto from 'crypto';
|
||||
import jsonwebtoken from 'jsonwebtoken';
|
||||
import config from '../config';
|
||||
import orm from '../models/index.model';
|
||||
|
||||
let logger;
|
||||
|
||||
|
@ -106,7 +105,7 @@ async function getAccountFromJWT(jwt, limitData) {
|
|||
return account;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
validateJWT,
|
||||
getAuthenticatedAccount,
|
||||
changePassword,
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
const sanitize = require('sanitize')();
|
||||
const { Op } = require('sequelize');
|
||||
const crypto = require('crypto');
|
||||
const dirTree = require('directory-tree');
|
||||
const config = require('../config');
|
||||
const authenticationController = require('./authentication');
|
||||
const orm = require('../models/index.model');
|
||||
const usersController = require('./users');
|
||||
import sanitizeFactory from 'sanitize';
|
||||
const sanitize = sanitizeFactory();
|
||||
import { Op } from 'sequelize';
|
||||
import crypto from 'crypto';
|
||||
import dirTree from 'directory-tree';
|
||||
import config from '../config';
|
||||
import authenticationController from './authentication';
|
||||
import orm from '../models/index.model';
|
||||
import usersController from './users';
|
||||
|
||||
async function pairDevice(account, qrString) {
|
||||
if (qrString === undefined || qrString === null) {
|
||||
|
@ -327,7 +328,7 @@ async function createDongle(dongleId, accountId, imei, serial, publicKey) {
|
|||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
pairDevice,
|
||||
unpairDevice,
|
||||
setDeviceNickname,
|
||||
|
|
|
@ -35,10 +35,10 @@ function simpleStringify(object) {
|
|||
}
|
||||
|
||||
function formatDate(timestampMs) {
|
||||
return new Date(timestampMs).toISOString().replace(/T/, ' ').replace(/\..+/, '');
|
||||
return new Date(parseInt(timestampMs)).toISOString().replace(/T/, ' ').replace(/\..+/, '');
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
formatDuration,
|
||||
simpleStringify,
|
||||
formatDate,
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
/* eslint-disable global-require, no-unused-vars */
|
||||
|
||||
import authentication from './authentication';
|
||||
import helpers from './helpers';
|
||||
import storage from './storage';
|
||||
import mailing from './mailing';
|
||||
import users from './users';
|
||||
import admin from './admin';
|
||||
import devices from './devices';
|
||||
// TO DO, finish up removing this callback stuff
|
||||
module.exports = {
|
||||
authentication: require('./authentication'),
|
||||
helpers: require('./helpers'),
|
||||
storage: require('./storage'),
|
||||
mailing: require('./mailing'),
|
||||
users: require('./users'),
|
||||
admin: require('./admin'),
|
||||
devices: require('./devices'),
|
||||
export default {
|
||||
authentication,
|
||||
helpers,
|
||||
storage,
|
||||
mailing,
|
||||
users,
|
||||
admin,
|
||||
devices,
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const nodemailer = require('nodemailer');
|
||||
const log4js = require('log4js');
|
||||
const config = require('../config');
|
||||
import nodemailer from 'nodemailer';
|
||||
import log4js from 'log4js';
|
||||
import config from '../config';
|
||||
|
||||
const logger = log4js.getLogger('default');
|
||||
const transporter = nodemailer.createTransport(
|
||||
|
@ -47,6 +47,6 @@ async function sendEmailVerification(token, email) {
|
|||
return info;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
sendEmailVerification,
|
||||
};
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const { execSync } = require('child_process');
|
||||
const log4js = require('log4js');
|
||||
const config = require('../config');
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import { execSync } from 'child_process';
|
||||
import log4js from 'log4js';
|
||||
import config from '../config.js';
|
||||
|
||||
const logger = log4js.getLogger('default');
|
||||
|
||||
|
@ -121,7 +121,7 @@ async function getTotalStorageUsed() {
|
|||
|
||||
setInterval(updateTotalStorageUsed, 120000);
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
initializeStorage,
|
||||
mkDirByPathSync,
|
||||
writeFileSync,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const crypto = require('crypto');
|
||||
const config = require('../config');
|
||||
const orm = require('../models/index.model');
|
||||
import crypto from 'crypto';
|
||||
import config from '../config';
|
||||
import orm from '../models/index.model';
|
||||
|
||||
async function getAccountFromId(id) {
|
||||
return orm.models.accounts.findByPk(id);
|
||||
|
@ -83,7 +83,7 @@ async function getAllUsers() {
|
|||
return orm.models.accounts.findAll({ attributes: ['id', 'last_ping', 'created', 'admin', 'banned'] });
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
createAccount,
|
||||
verifyEmailToken,
|
||||
getAccountFromId,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
export default {
|
||||
apps: [{
|
||||
name: 'Retropilot Service',
|
||||
script: './server.js',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const { DataTypes } = require('sequelize');
|
||||
import { DataTypes } from 'sequelize';
|
||||
|
||||
module.exports = (sequelize) => {
|
||||
export default (sequelize) => {
|
||||
sequelize.define('athena_action_log', {
|
||||
id: {
|
||||
allowNull: false,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const { DataTypes } = require('sequelize');
|
||||
import { DataTypes } from 'sequelize';
|
||||
|
||||
module.exports = (sequelize) => {
|
||||
export default (sequelize) => {
|
||||
sequelize.define('athena_returned_data', {
|
||||
id: {
|
||||
allowNull: false,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const { DataTypes } = require('sequelize');
|
||||
import { DataTypes } from 'sequelize';
|
||||
|
||||
module.exports = (sequelize) => {
|
||||
export default (sequelize) => {
|
||||
sequelize.define('device_authorised_users', {
|
||||
id: {
|
||||
allowNull: false,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const { DataTypes } = require('sequelize');
|
||||
import { DataTypes } from 'sequelize';
|
||||
|
||||
module.exports = (sequelize) => {
|
||||
export default (sequelize) => {
|
||||
sequelize.define(
|
||||
'device',
|
||||
{
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
import { DataTypes } from 'sequelize';
|
||||
|
||||
export default (sequelize) => {
|
||||
sequelize.define(
|
||||
'drive_segments',
|
||||
{
|
||||
id: {
|
||||
allowNull: false,
|
||||
autoIncrement: true,
|
||||
primaryKey: true,
|
||||
type: DataTypes.INTEGER,
|
||||
},
|
||||
segment_id: {
|
||||
allowNull: false,
|
||||
type: DataTypes.INTEGER,
|
||||
},
|
||||
drive_identifier: {
|
||||
allowNull: true,
|
||||
type: DataTypes.TEXT,
|
||||
},
|
||||
dongle_id: {
|
||||
allowNull: true,
|
||||
type: DataTypes.INTEGER,
|
||||
},
|
||||
duration: {
|
||||
allowedNull: true,
|
||||
type: DataTypes.NUMBER,
|
||||
},
|
||||
distance_meters: {
|
||||
allowNull: true,
|
||||
type: DataTypes.NUMBER,
|
||||
},
|
||||
upload_complete: {
|
||||
allowNull: true,
|
||||
type: DataTypes.BOOLEAN,
|
||||
},
|
||||
is_processed: {
|
||||
allowNull: true,
|
||||
type: DataTypes.BOOLEAN,
|
||||
},
|
||||
is_stalled: {
|
||||
allowNull: true,
|
||||
type: DataTypes.BOOLEAN,
|
||||
},
|
||||
created: {
|
||||
allowNull: true,
|
||||
type: DataTypes.INTEGER,
|
||||
},
|
||||
process_attempts: {
|
||||
allowNull: true,
|
||||
type: DataTypes.BOOLEAN,
|
||||
},
|
||||
},
|
||||
{
|
||||
timestamps: false,
|
||||
},
|
||||
);
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
const { DataTypes } = require('sequelize');
|
||||
import { DataTypes } from 'sequelize';
|
||||
|
||||
module.exports = (sequelize) => {
|
||||
export default (sequelize) => {
|
||||
sequelize.define(
|
||||
'drives',
|
||||
{
|
||||
|
|
|
@ -1,27 +1,41 @@
|
|||
/* eslint-disable no-restricted-syntax */
|
||||
/* eslint-disable global-require */
|
||||
|
||||
const { Sequelize } = require('sequelize');
|
||||
import { Sequelize } from 'sequelize';
|
||||
import devices from './devices.model';
|
||||
import drives from './drives.model';
|
||||
import users from './users.model';
|
||||
import athena_action_log from './athena_action_log.model';
|
||||
import athena_returned_data from './athena_returned_data.model';
|
||||
import device_authorised_users from './device_authorised_users.model';
|
||||
import drive_segments from './drive_segments.model';
|
||||
import config from '../config';
|
||||
|
||||
const sequelize = new Sequelize({
|
||||
dialect: 'sqlite',
|
||||
storage: 'database.sqlite',
|
||||
|
||||
username: 'postgres',
|
||||
password: config.sqltemp,
|
||||
database: 'retro-dev',
|
||||
host: '127.0.0.1',
|
||||
port: 5432,
|
||||
dialect: 'postgres',
|
||||
|
||||
});
|
||||
|
||||
sequelize.options.logging = () => {};
|
||||
|
||||
const modelDefiners = [
|
||||
require('./devices.model'),
|
||||
require('./drives.model'),
|
||||
require('./users.model'),
|
||||
require('./athena_action_log.model'),
|
||||
require('./athena_returned_data.model'),
|
||||
require('./device_authorised_users.model'),
|
||||
require('./drive_segments.model'),
|
||||
devices,
|
||||
drives,
|
||||
users,
|
||||
athena_action_log,
|
||||
athena_returned_data,
|
||||
device_authorised_users,
|
||||
drive_segments,
|
||||
];
|
||||
|
||||
for (const modelDefiner of modelDefiners) {
|
||||
modelDefiner(sequelize);
|
||||
}
|
||||
|
||||
module.exports = sequelize;
|
||||
export default sequelize;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const { DataTypes } = require('sequelize');
|
||||
import { DataTypes } from 'sequelize';
|
||||
|
||||
module.exports = (sequelize) => {
|
||||
export default (sequelize) => {
|
||||
sequelize.define('accounts', {
|
||||
id: {
|
||||
allowNull: false,
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
"mocha": "^8.4.0",
|
||||
"multer": "^1.4.2",
|
||||
"nodemailer": "^6.6.0",
|
||||
"pg": "^8.7.1",
|
||||
"proper-lockfile": "^4.1.2",
|
||||
"sanitize": "^2.1.0",
|
||||
"sequelize": "^6.6.5",
|
||||
|
@ -43,7 +44,8 @@
|
|||
"supertest": "^6.1.3",
|
||||
"uuid": "^8.3.2",
|
||||
"websocket": "^1.0.34",
|
||||
"ws": "^8.2.3"
|
||||
"ws": "^8.2.3",
|
||||
"yup": "^0.32.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.6.0",
|
||||
|
@ -52,6 +54,17 @@
|
|||
"eslint-plugin-no-floating-promise": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/runtime": {
|
||||
"version": "7.16.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz",
|
||||
"integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==",
|
||||
"dependencies": {
|
||||
"regenerator-runtime": "^0.13.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@commaai/capnp-json": {
|
||||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@commaai/capnp-json/-/capnp-json-0.8.1.tgz",
|
||||
|
@ -234,6 +247,11 @@
|
|||
"integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/lodash": {
|
||||
"version": "4.14.178",
|
||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.178.tgz",
|
||||
"integrity": "sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw=="
|
||||
},
|
||||
"node_modules/@types/ms": {
|
||||
"version": "0.7.31",
|
||||
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz",
|
||||
|
@ -721,6 +739,14 @@
|
|||
"node": ">=0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer-writer": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz",
|
||||
"integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/buffers": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz",
|
||||
|
@ -3294,6 +3320,11 @@
|
|||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
},
|
||||
"node_modules/lodash-es": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
|
||||
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="
|
||||
},
|
||||
"node_modules/lodash.includes": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
|
||||
|
@ -3649,6 +3680,11 @@
|
|||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
|
||||
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
|
||||
},
|
||||
"node_modules/nanoclone": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/nanoclone/-/nanoclone-0.2.1.tgz",
|
||||
"integrity": "sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA=="
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "3.1.20",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz",
|
||||
|
@ -4100,6 +4136,11 @@
|
|||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/packet-reader": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz",
|
||||
"integrity": "sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ=="
|
||||
},
|
||||
"node_modules/parent-module": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
||||
|
@ -4170,11 +4211,80 @@
|
|||
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/pg": {
|
||||
"version": "8.7.1",
|
||||
"resolved": "https://registry.npmjs.org/pg/-/pg-8.7.1.tgz",
|
||||
"integrity": "sha512-7bdYcv7V6U3KAtWjpQJJBww0UEsWuh4yQ/EjNf2HeO/NnvKjpvhEIe/A/TleP6wtmSKnUnghs5A9jUoK6iDdkA==",
|
||||
"dependencies": {
|
||||
"buffer-writer": "2.0.0",
|
||||
"packet-reader": "1.0.0",
|
||||
"pg-connection-string": "^2.5.0",
|
||||
"pg-pool": "^3.4.1",
|
||||
"pg-protocol": "^1.5.0",
|
||||
"pg-types": "^2.1.0",
|
||||
"pgpass": "1.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"pg-native": ">=2.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"pg-native": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/pg-connection-string": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.5.0.tgz",
|
||||
"integrity": "sha512-r5o/V/ORTA6TmUnyWZR9nCj1klXCO2CEKNRlVuJptZe85QuhFayC7WeMic7ndayT5IRIR0S0xFxFi2ousartlQ=="
|
||||
},
|
||||
"node_modules/pg-int8": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz",
|
||||
"integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==",
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/pg-pool": {
|
||||
"version": "3.4.1",
|
||||
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.4.1.tgz",
|
||||
"integrity": "sha512-TVHxR/gf3MeJRvchgNHxsYsTCHQ+4wm3VIHSS19z8NC0+gioEhq1okDY1sm/TYbfoP6JLFx01s0ShvZ3puP/iQ==",
|
||||
"peerDependencies": {
|
||||
"pg": ">=8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/pg-protocol": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.5.0.tgz",
|
||||
"integrity": "sha512-muRttij7H8TqRNu/DxrAJQITO4Ac7RmX3Klyr/9mJEOBeIpgnF8f9jAfRz5d3XwQZl5qBjF9gLsUtMPJE0vezQ=="
|
||||
},
|
||||
"node_modules/pg-types": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
|
||||
"integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==",
|
||||
"dependencies": {
|
||||
"pg-int8": "1.0.1",
|
||||
"postgres-array": "~2.0.0",
|
||||
"postgres-bytea": "~1.0.0",
|
||||
"postgres-date": "~1.0.4",
|
||||
"postgres-interval": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/pgpass": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz",
|
||||
"integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==",
|
||||
"dependencies": {
|
||||
"split2": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/picomatch": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz",
|
||||
|
@ -4186,6 +4296,41 @@
|
|||
"url": "https://github.com/sponsors/jonschlinkert"
|
||||
}
|
||||
},
|
||||
"node_modules/postgres-array": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
|
||||
"integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/postgres-bytea": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz",
|
||||
"integrity": "sha1-AntTPAqokOJtFy1Hz5zOzFIazTU=",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/postgres-date": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz",
|
||||
"integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/postgres-interval": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz",
|
||||
"integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==",
|
||||
"dependencies": {
|
||||
"xtend": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prelude-ls": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
|
||||
|
@ -4219,6 +4364,11 @@
|
|||
"signal-exit": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/property-expr": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/property-expr/-/property-expr-2.0.4.tgz",
|
||||
"integrity": "sha512-sFPkHQjVKheDNnPvotjQmm3KD3uk1fWKUN7CrpdbwmUx3CrG3QiM8QpTSimvig5vTXmTvjz7+TDvXOI9+4rkcg=="
|
||||
},
|
||||
"node_modules/proxy-addr": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
||||
|
@ -4364,6 +4514,11 @@
|
|||
"node": ">=8.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/regenerator-runtime": {
|
||||
"version": "0.13.9",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz",
|
||||
"integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA=="
|
||||
},
|
||||
"node_modules/regexpp": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz",
|
||||
|
@ -4743,6 +4898,14 @@
|
|||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz",
|
||||
"integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ=="
|
||||
},
|
||||
"node_modules/split2": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/split2/-/split2-4.1.0.tgz",
|
||||
"integrity": "sha512-VBiJxFkxiXRlUIeyMQi8s4hgvKCSjtknJv/LVYbrgALPwf5zSKmEwV9Lst25AkvMDnvxODugjdl6KZgwKM1WYQ==",
|
||||
"engines": {
|
||||
"node": ">= 10.x"
|
||||
}
|
||||
},
|
||||
"node_modules/sqlite": {
|
||||
"version": "4.0.23",
|
||||
"resolved": "https://registry.npmjs.org/sqlite/-/sqlite-4.0.23.tgz",
|
||||
|
@ -5204,6 +5367,11 @@
|
|||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/toposort": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz",
|
||||
"integrity": "sha1-riF2gXXRVZ1IvvNUILL0li8JwzA="
|
||||
},
|
||||
"node_modules/toposort-class": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/toposort-class/-/toposort-class-1.0.1.tgz",
|
||||
|
@ -5782,9 +5950,34 @@
|
|||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/yup": {
|
||||
"version": "0.32.11",
|
||||
"resolved": "https://registry.npmjs.org/yup/-/yup-0.32.11.tgz",
|
||||
"integrity": "sha512-Z2Fe1bn+eLstG8DRR6FTavGD+MeAwyfmouhHsIUgaADz8jvFKbO/fXc2trJKZg+5EBjh4gGm3iU/t3onKlXHIg==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@types/lodash": "^4.14.175",
|
||||
"lodash": "^4.17.21",
|
||||
"lodash-es": "^4.17.21",
|
||||
"nanoclone": "^0.2.1",
|
||||
"property-expr": "^2.0.4",
|
||||
"toposort": "^2.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": {
|
||||
"version": "7.16.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz",
|
||||
"integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==",
|
||||
"requires": {
|
||||
"regenerator-runtime": "^0.13.4"
|
||||
}
|
||||
},
|
||||
"@commaai/capnp-json": {
|
||||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@commaai/capnp-json/-/capnp-json-0.8.1.tgz",
|
||||
|
@ -5937,6 +6130,11 @@
|
|||
"integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=",
|
||||
"dev": true
|
||||
},
|
||||
"@types/lodash": {
|
||||
"version": "4.14.178",
|
||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.178.tgz",
|
||||
"integrity": "sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw=="
|
||||
},
|
||||
"@types/ms": {
|
||||
"version": "0.7.31",
|
||||
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz",
|
||||
|
@ -6313,6 +6511,11 @@
|
|||
"resolved": "https://registry.npmjs.org/buffer-indexof-polyfill/-/buffer-indexof-polyfill-1.0.2.tgz",
|
||||
"integrity": "sha512-I7wzHwA3t1/lwXQh+A5PbNvJxgfo5r3xulgpYDB5zckTu/Z9oUK9biouBKQUjEqzaz3HnAT6TYoovmE+GqSf7A=="
|
||||
},
|
||||
"buffer-writer": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz",
|
||||
"integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw=="
|
||||
},
|
||||
"buffers": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz",
|
||||
|
@ -8285,6 +8488,11 @@
|
|||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
},
|
||||
"lodash-es": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
|
||||
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="
|
||||
},
|
||||
"lodash.includes": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
|
||||
|
@ -8575,6 +8783,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"nanoclone": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/nanoclone/-/nanoclone-0.2.1.tgz",
|
||||
"integrity": "sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA=="
|
||||
},
|
||||
"nanoid": {
|
||||
"version": "3.1.20",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz",
|
||||
|
@ -8910,6 +9123,11 @@
|
|||
"integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=",
|
||||
"dev": true
|
||||
},
|
||||
"packet-reader": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz",
|
||||
"integrity": "sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ=="
|
||||
},
|
||||
"parent-module": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
||||
|
@ -8962,16 +9180,89 @@
|
|||
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
|
||||
"optional": true
|
||||
},
|
||||
"pg": {
|
||||
"version": "8.7.1",
|
||||
"resolved": "https://registry.npmjs.org/pg/-/pg-8.7.1.tgz",
|
||||
"integrity": "sha512-7bdYcv7V6U3KAtWjpQJJBww0UEsWuh4yQ/EjNf2HeO/NnvKjpvhEIe/A/TleP6wtmSKnUnghs5A9jUoK6iDdkA==",
|
||||
"requires": {
|
||||
"buffer-writer": "2.0.0",
|
||||
"packet-reader": "1.0.0",
|
||||
"pg-connection-string": "^2.5.0",
|
||||
"pg-pool": "^3.4.1",
|
||||
"pg-protocol": "^1.5.0",
|
||||
"pg-types": "^2.1.0",
|
||||
"pgpass": "1.x"
|
||||
}
|
||||
},
|
||||
"pg-connection-string": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.5.0.tgz",
|
||||
"integrity": "sha512-r5o/V/ORTA6TmUnyWZR9nCj1klXCO2CEKNRlVuJptZe85QuhFayC7WeMic7ndayT5IRIR0S0xFxFi2ousartlQ=="
|
||||
},
|
||||
"pg-int8": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz",
|
||||
"integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw=="
|
||||
},
|
||||
"pg-pool": {
|
||||
"version": "3.4.1",
|
||||
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.4.1.tgz",
|
||||
"integrity": "sha512-TVHxR/gf3MeJRvchgNHxsYsTCHQ+4wm3VIHSS19z8NC0+gioEhq1okDY1sm/TYbfoP6JLFx01s0ShvZ3puP/iQ==",
|
||||
"requires": {}
|
||||
},
|
||||
"pg-protocol": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.5.0.tgz",
|
||||
"integrity": "sha512-muRttij7H8TqRNu/DxrAJQITO4Ac7RmX3Klyr/9mJEOBeIpgnF8f9jAfRz5d3XwQZl5qBjF9gLsUtMPJE0vezQ=="
|
||||
},
|
||||
"pg-types": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
|
||||
"integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==",
|
||||
"requires": {
|
||||
"pg-int8": "1.0.1",
|
||||
"postgres-array": "~2.0.0",
|
||||
"postgres-bytea": "~1.0.0",
|
||||
"postgres-date": "~1.0.4",
|
||||
"postgres-interval": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"pgpass": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz",
|
||||
"integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==",
|
||||
"requires": {
|
||||
"split2": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"picomatch": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz",
|
||||
"integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw=="
|
||||
},
|
||||
"postgres-array": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
|
||||
"integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA=="
|
||||
},
|
||||
"postgres-bytea": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz",
|
||||
"integrity": "sha1-AntTPAqokOJtFy1Hz5zOzFIazTU="
|
||||
},
|
||||
"postgres-date": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz",
|
||||
"integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q=="
|
||||
},
|
||||
"postgres-interval": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz",
|
||||
"integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==",
|
||||
"requires": {
|
||||
"xtend": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"prelude-ls": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
|
||||
|
@ -8999,6 +9290,11 @@
|
|||
"signal-exit": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"property-expr": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/property-expr/-/property-expr-2.0.4.tgz",
|
||||
"integrity": "sha512-sFPkHQjVKheDNnPvotjQmm3KD3uk1fWKUN7CrpdbwmUx3CrG3QiM8QpTSimvig5vTXmTvjz7+TDvXOI9+4rkcg=="
|
||||
},
|
||||
"proxy-addr": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
||||
|
@ -9112,6 +9408,11 @@
|
|||
"picomatch": "^2.2.1"
|
||||
}
|
||||
},
|
||||
"regenerator-runtime": {
|
||||
"version": "0.13.9",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz",
|
||||
"integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA=="
|
||||
},
|
||||
"regexpp": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz",
|
||||
|
@ -9386,6 +9687,11 @@
|
|||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz",
|
||||
"integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ=="
|
||||
},
|
||||
"split2": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/split2/-/split2-4.1.0.tgz",
|
||||
"integrity": "sha512-VBiJxFkxiXRlUIeyMQi8s4hgvKCSjtknJv/LVYbrgALPwf5zSKmEwV9Lst25AkvMDnvxODugjdl6KZgwKM1WYQ=="
|
||||
},
|
||||
"sqlite": {
|
||||
"version": "4.0.23",
|
||||
"resolved": "https://registry.npmjs.org/sqlite/-/sqlite-4.0.23.tgz",
|
||||
|
@ -9732,6 +10038,11 @@
|
|||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
|
||||
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
|
||||
},
|
||||
"toposort": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz",
|
||||
"integrity": "sha1-riF2gXXRVZ1IvvNUILL0li8JwzA="
|
||||
},
|
||||
"toposort-class": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/toposort-class/-/toposort-class-1.0.1.tgz",
|
||||
|
@ -10178,6 +10489,20 @@
|
|||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
||||
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="
|
||||
},
|
||||
"yup": {
|
||||
"version": "0.32.11",
|
||||
"resolved": "https://registry.npmjs.org/yup/-/yup-0.32.11.tgz",
|
||||
"integrity": "sha512-Z2Fe1bn+eLstG8DRR6FTavGD+MeAwyfmouhHsIUgaADz8jvFKbO/fXc2trJKZg+5EBjh4gGm3iU/t3onKlXHIg==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@types/lodash": "^4.14.175",
|
||||
"lodash": "^4.17.21",
|
||||
"lodash-es": "^4.17.21",
|
||||
"nanoclone": "^0.2.1",
|
||||
"property-expr": "^2.0.4",
|
||||
"toposort": "^2.0.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
"version": "1.0.0",
|
||||
"description": "replacement for comma.ai backend and useradmin dashboard. can be combined with a modified cabana instance.",
|
||||
"main": "server.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "mocha",
|
||||
"start": "node server.js",
|
||||
"start": "node --es-module-specifier-resolution=node server.js",
|
||||
"prod": "node server.js && node worker.js",
|
||||
"lint": "eslint . --ext .js",
|
||||
"lint:fix": "eslint . --ext .js --fix"
|
||||
|
@ -39,6 +40,7 @@
|
|||
"mocha": "^8.4.0",
|
||||
"multer": "^1.4.2",
|
||||
"nodemailer": "^6.6.0",
|
||||
"pg": "^8.7.1",
|
||||
"proper-lockfile": "^4.1.2",
|
||||
"sanitize": "^2.1.0",
|
||||
"sequelize": "^6.6.5",
|
||||
|
@ -47,7 +49,8 @@
|
|||
"supertest": "^6.1.3",
|
||||
"uuid": "^8.3.2",
|
||||
"websocket": "^1.0.34",
|
||||
"ws": "^8.2.3"
|
||||
"ws": "^8.2.3",
|
||||
"yup": "^0.32.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.6.0",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const router = require('express').Router();
|
||||
const controllers = require('../../controllers');
|
||||
import express from 'express';
|
||||
import controllers from '../../controllers';
|
||||
|
||||
const router = express.Router();
|
||||
function runAsyncWrapper(callback) {
|
||||
return function wrapper(req, res, next) {
|
||||
callback(req, res, next)
|
||||
|
@ -103,4 +104,4 @@ router.get('/device/:dongle_id/athena/reboot', runAsyncWrapper(async (req, res)
|
|||
res.send('ok');
|
||||
}));
|
||||
|
||||
module.exports = router;
|
||||
export default router;
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
/* eslint-disable */
|
||||
const router = require('express').Router();
|
||||
const bodyParser = require('body-parser');
|
||||
const crypto = require('crypto');
|
||||
const log4js = require('log4js');
|
||||
const storageController = require('../controllers/storage');
|
||||
const helperController = require('../controllers/helpers');
|
||||
const mailingController = require('../controllers/mailing');
|
||||
const deviceController = require('../controllers/devices');
|
||||
const config = require('../config');
|
||||
const authenticationController = require('./../controllers/authentication');
|
||||
import express from 'express';
|
||||
import bodyParser from 'body-parser';
|
||||
import crypto from 'crypto';
|
||||
import log4js from 'log4js';
|
||||
import storageController from '../controllers/storage';
|
||||
import helperController from '../controllers/helpers';
|
||||
import mailingController from '../controllers/mailing';
|
||||
import deviceController from '../controllers/devices';
|
||||
import config from '../config';
|
||||
import authenticationController from './../controllers/authentication';
|
||||
|
||||
const logger = log4js.getLogger('default');
|
||||
const router = express.Router();
|
||||
|
||||
|
||||
function runAsyncWrapper(callback) {
|
||||
return function wrapper(req, res, next) {
|
||||
|
@ -428,4 +430,4 @@ router.get('/useradmin/cabana_drive/:extendedRouteIdentifier', runAsyncWrapper(a
|
|||
});
|
||||
}));
|
||||
|
||||
module.exports = router;
|
||||
export default router;
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
const bodyParser = require('body-parser');
|
||||
const router = require('express').Router();
|
||||
import bodyParser from 'body-parser';
|
||||
import express from 'express';
|
||||
import authenticationController from '../../controllers/authentication';
|
||||
|
||||
const authenticationController = require('../../controllers/authentication');
|
||||
/* eslint-disable no-unused-vars */
|
||||
const userController = require('../../controllers/users');
|
||||
const config = require('../../config');
|
||||
/* eslint-enable no-unused-vars */
|
||||
import userController from '../../controllers/users';
|
||||
|
||||
import config from '../../config';
|
||||
/* eslint-enable no-unused-vars */
|
||||
const router = express.Router();
|
||||
async function isAuthenticated(req, res, next) {
|
||||
const account = await authenticationController.getAuthenticatedAccount(req);
|
||||
|
||||
|
@ -85,4 +86,4 @@ router.get('/session/get', async (req, res) => {
|
|||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
export default router;
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
const router = require('express').Router();
|
||||
const crypto = require('crypto');
|
||||
const dirTree = require('directory-tree');
|
||||
const config = require('../../config');
|
||||
import express from 'express';
|
||||
import crypto from 'crypto';
|
||||
import dirTree from 'directory-tree';
|
||||
import bodyParser from 'body-parser';
|
||||
import deviceSchema from '../../schema/routes/devices.mjs';
|
||||
import config from '../../config';
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
const userController = require('../../controllers/users');
|
||||
const deviceController = require('../../controllers/devices');
|
||||
const authenticationController = require('../../controllers/authentication');
|
||||
/* eslint-enable no-unused-vars */
|
||||
import userController from '../../controllers/users';
|
||||
|
||||
import deviceController from '../../controllers/devices';
|
||||
import authenticationController from '../../controllers/authentication';
|
||||
/* eslint-enable no-unused-vars */
|
||||
const router = express.Router();
|
||||
async function isAuthenticated(req, res, next) {
|
||||
const account = await authenticationController.getAuthenticatedAccount(req);
|
||||
|
||||
|
@ -30,6 +33,31 @@ router.get('/retropilot/0/devices', isAuthenticated, async (req, res) => {
|
|||
return res.json({ success: true, data: dongles });
|
||||
});
|
||||
|
||||
/*
|
||||
{
|
||||
version: "1.0"
|
||||
2fa: {
|
||||
tokenProvided: false,
|
||||
token: 000000
|
||||
unixTime: 00000
|
||||
},
|
||||
modifications: {
|
||||
nicname: x
|
||||
publicKey: x
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
router.put('/retropilot/0/device/:dongle_id/', [isAuthenticated, bodyParser.json()], async (req, res) => {
|
||||
if (!req.account) {
|
||||
return res.json({ success: false, msg: 'NOT_AUTHENTICATED' });
|
||||
}
|
||||
|
||||
const { body } = req;
|
||||
console.log(deviceSchema.MutateDevice.isValid(body));
|
||||
});
|
||||
|
||||
router.get('/retropilot/0/device/:dongle_id/drives/:drive_identifier/segment', isAuthenticated, async (req, res) => {
|
||||
if (!req.account) {
|
||||
return res.json({ success: false, msg: 'NOT_AUTHENTICATED' });
|
||||
|
@ -97,9 +125,9 @@ router.get('/retropilot/0/device/:dongle_id/crashlogs', isAuthenticated, async (
|
|||
return res.json({ success: false, msg: isUserAuthorised.msg });
|
||||
}
|
||||
|
||||
const bootlogs = await deviceController.getCrashlogs(req.params.dongle_id);
|
||||
const crashlogs = await deviceController.getCrashlogs(req.params.dongle_id);
|
||||
|
||||
return res.json({ success: true, data: bootlogs });
|
||||
return res.json({ success: true, data: crashlogs });
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
export default router;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
const router = require('express').Router();
|
||||
|
||||
import express from 'express';
|
||||
/* eslint-disable no-unused-vars */
|
||||
const authenticationController = require('../../controllers/authentication');
|
||||
const userController = require('../../controllers/users');
|
||||
const deviceController = require('../../controllers/devices');
|
||||
const models = require('../../models/index.model');
|
||||
/* eslint-enable no-unused-vars */
|
||||
import authenticationController from '../../controllers/authentication';
|
||||
|
||||
import userController from '../../controllers/users';
|
||||
import deviceController from '../../controllers/devices';
|
||||
import models from '../../models/index.model';
|
||||
/* eslint-enable no-unused-vars */
|
||||
const router = express.Router();
|
||||
const whitelistParams = {
|
||||
getmessage: true,
|
||||
getversion: true,
|
||||
|
@ -174,4 +174,4 @@ router.get('/dongle/:dongle_id/temp/nav/:lat/:long', async (req, res) => {
|
|||
});
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
export default router;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const bodyParser = require('body-parser');
|
||||
import bodyParser from 'body-parser';
|
||||
const router = require('express').Router();
|
||||
|
||||
const userController = require('../../controllers/users');
|
||||
import userController from '../../controllers/users';
|
||||
|
||||
router.post('/retropilot/0/register/email', bodyParser.urlencoded({ extended: true }), async (req, res) => {
|
||||
const { email, password } = req.body;
|
||||
|
@ -32,4 +32,4 @@ router.get('/retropilot/0/register/verify/:token', bodyParser.urlencoded({ exten
|
|||
return res.status(500).json({ success: false, msg: 'contact server admin' });
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
export default router;
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
/* eslint-disable global-require */
|
||||
module.exports = {
|
||||
useradmin: require('./useradmin'),
|
||||
api: require('./api'),
|
||||
useradminapi: require('./userAdminApi'),
|
||||
admin: require('./administration/adminApi'),
|
||||
realtime: require('./api/realtime'),
|
||||
|
||||
deviceApi: require('./api/devices'),
|
||||
authenticationApi: require('./api/authentication'),
|
||||
import useradmin from './useradmin';
|
||||
import api from './api';
|
||||
import useradminapi from './userAdminApi';
|
||||
import admin from './administration/adminApi';
|
||||
import realtime from './api/realtime';
|
||||
import deviceApi from './api/devices';
|
||||
import authenticationApi from './api/authentication';
|
||||
|
||||
export default {
|
||||
useradmin,
|
||||
api,
|
||||
useradminapi,
|
||||
admin,
|
||||
realtime,
|
||||
deviceApi,
|
||||
authenticationApi,
|
||||
};
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
/* eslint-disable max-len */
|
||||
const router = require('express').Router();
|
||||
const bodyParser = require('body-parser');
|
||||
const cookieParser = require('cookie-parser');
|
||||
const config = require('../config');
|
||||
const controllers = require('../controllers');
|
||||
const deviceController = require('../controllers/devices');
|
||||
import express from 'express';
|
||||
import bodyParser from 'body-parser';
|
||||
import cookieParser from 'cookie-parser';
|
||||
import config from '../config';
|
||||
import controllers from '../controllers';
|
||||
import deviceController from '../controllers/devices';
|
||||
|
||||
// TODO Remove this, pending on removing all auth logic from routes
|
||||
const router = express.Router();
|
||||
router.use(cookieParser());
|
||||
|
||||
function runAsyncWrapper(callback) {
|
||||
|
@ -505,4 +506,4 @@ router.get('/useradmin/drive/:dongleId/:driveIdentifier', runAsyncWrapper(async
|
|||
}))
|
||||
*/
|
||||
|
||||
module.exports = router;
|
||||
export default router;
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
const router = require('express').Router();
|
||||
const bodyParser = require('body-parser');
|
||||
const crypto = require('crypto');
|
||||
const htmlspecialchars = require('htmlspecialchars');
|
||||
const dirTree = require('directory-tree');
|
||||
const cookieParser = require('cookie-parser');
|
||||
const log4js = require('log4js');
|
||||
const config = require('../config');
|
||||
const authenticationController = require('../controllers/authentication');
|
||||
const storageController = require('../controllers/storage');
|
||||
const helperController = require('../controllers/helpers');
|
||||
const mailingController = require('../controllers/mailing');
|
||||
const deviceController = require('../controllers/devices');
|
||||
const userController = require('../controllers/users');
|
||||
import express from 'express';
|
||||
import bodyParser from 'body-parser';
|
||||
import crypto from 'crypto';
|
||||
import htmlspecialchars from 'htmlspecialchars';
|
||||
import dirTree from 'directory-tree';
|
||||
import cookieParser from 'cookie-parser';
|
||||
import log4js from 'log4js';
|
||||
import config from '../config';
|
||||
import authenticationController from '../controllers/authentication';
|
||||
import storageController from '../controllers/storage';
|
||||
import helperController from '../controllers/helpers';
|
||||
import mailingController from '../controllers/mailing';
|
||||
import deviceController from '../controllers/devices';
|
||||
import userController from '../controllers/users';
|
||||
|
||||
const logger = log4js.getLogger('default');
|
||||
let models;
|
||||
|
||||
const router = express.Router();
|
||||
// TODO Remove this, pending on removing all auth logic from routes
|
||||
router.use(cookieParser());
|
||||
|
||||
|
@ -119,14 +119,16 @@ router.post('/useradmin/register/token', bodyParser.urlencoded({ extended: true
|
|||
} else if (req.body.password !== req.body.password2 || req.body.password.length < 3) {
|
||||
infoText = 'The passwords you entered did not match or were shorter than 3 characters, please try again.<br><br>';
|
||||
} else {
|
||||
const result = userController._dirtyCreateAccount(
|
||||
const result = await userController._dirtyCreateAccount(
|
||||
email,
|
||||
crypto.createHash('sha256').update(req.body.password + config.applicationSalt).digest('hex'),
|
||||
Date.now(),
|
||||
false,
|
||||
);
|
||||
|
||||
if (result.lastID) {
|
||||
console.log(result);
|
||||
|
||||
if (result.dataValues) {
|
||||
logger.info(`USERADMIN REGISTRATION - created new account #${result.lastID} with email ${email}`);
|
||||
return res.redirect(`/useradmin?status=${encodeURIComponent('Successfully registered')}`);
|
||||
}
|
||||
|
@ -174,10 +176,13 @@ router.get('/useradmin/register', runAsyncWrapper(async (req, res) => {
|
|||
}));
|
||||
|
||||
router.get('/useradmin/overview', runAsyncWrapper(async (req, res) => {
|
||||
const account = await authenticationController.getAuthenticatedAccount(req);
|
||||
if (account == null) {
|
||||
let account = await authenticationController.getAuthenticatedAccount(req);
|
||||
if (account === null) {
|
||||
return res.redirect(`/useradmin?status=${encodeURIComponent('Invalid or expired session')}`);
|
||||
}
|
||||
|
||||
account = account.dataValues;
|
||||
|
||||
const devices = await deviceController.getDevices(account.id);
|
||||
|
||||
let response = `<html style="font-family: monospace">
|
||||
|
@ -629,4 +634,4 @@ router.get('/useradmin/drive/:dongleId/:driveIdentifier', runAsyncWrapper(async
|
|||
return res.status(200).send(response);
|
||||
}));
|
||||
|
||||
module.exports = router;
|
||||
export default router;
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
import * as yup from 'yup';
|
||||
|
||||
export const NestedMFA = yup.object().shape({
|
||||
MFAType: yup.string().required(),
|
||||
MFAToken: yup.string().required(),
|
||||
clientTime: yup.string().optional(),
|
||||
});
|
||||
|
||||
export default {
|
||||
|
||||
};
|
|
@ -0,0 +1,15 @@
|
|||
import * as yup from 'yup';
|
||||
import { API_VERSION_NOT_PROVIDED } from '../../consistency/terms';
|
||||
|
||||
export const MutateDevice = yup.object().shape({
|
||||
version: yup.string().required(API_VERSION_NOT_PROVIDED),
|
||||
mutations: {
|
||||
nicknake: yup.string().optional(),
|
||||
publicKey: yup.string().optional(),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
};
|
51
server.js
51
server.js
|
@ -1,14 +1,30 @@
|
|||
/* eslint-disable global-require */
|
||||
const fs = require('fs');
|
||||
const log4js = require('log4js');
|
||||
const lockfile = require('proper-lockfile');
|
||||
const http = require('http');
|
||||
const https = require('https');
|
||||
const express = require('express');
|
||||
const cors = require('cors');
|
||||
const rateLimit = require('express-rate-limit');
|
||||
const cookieParser = require('cookie-parser');
|
||||
const storageController = require('./controllers/storage');
|
||||
import fs from 'fs';
|
||||
|
||||
import log4js from 'log4js';
|
||||
import lockfile from 'proper-lockfile';
|
||||
import http from 'http';
|
||||
import https from 'https';
|
||||
import express from 'express';
|
||||
import cors from 'cors';
|
||||
import rateLimit from 'express-rate-limit';
|
||||
import cookieParser from 'cookie-parser';
|
||||
import storageController from './controllers/storage.js';
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
import webWebsocket from './websocket/web/index.js';
|
||||
|
||||
import athena from './websocket/athena/index.js';
|
||||
import routers from './routes/index.js';
|
||||
import orm from './models/index.model.js';
|
||||
import controllers from './controllers/index.js';
|
||||
import router from './routes/api/realtime.js';
|
||||
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
import config from './config.js';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { dirname } from 'path';
|
||||
|
||||
process.on('unhandledRejection', (error, p) => {
|
||||
console.log('=== UNHANDLED REJECTION ===');
|
||||
|
@ -22,19 +38,12 @@ log4js.configure({
|
|||
|
||||
const logger = log4js.getLogger('default');
|
||||
// TODO evaluate if this is the best way to determine the root of project
|
||||
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
global.__basedir = __dirname;
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
const webWebsocket = require('./websocket/web');
|
||||
const athena = require('./websocket/athena');
|
||||
const routers = require('./routes');
|
||||
const orm = require('./models/index.model');
|
||||
const controllers = require('./controllers');
|
||||
const router = require('./routes/api/realtime');
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
const config = require('./config');
|
||||
|
||||
function runAsyncWrapper(callback) {
|
||||
return function wrapper(req, res, next) {
|
||||
callback(req, res, next)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
const jwt = require('jsonwebtoken')
|
||||
const crypto = require('crypto')
|
||||
import jwt from 'jsonwebtoken';
|
||||
import crypto from 'crypto';
|
||||
|
||||
const devicePrivateKey = "-----BEGIN RSA PRIVATE KEY-----\n" +
|
||||
"MIIEowIBAAKCAQEAwhH9PqBd/R/QPvcf1Gom5Vp+zYb1+DLjiFMC7a1lNvV8MUqK\n" +
|
||||
|
@ -66,6 +66,6 @@ function getSerial() {
|
|||
|
||||
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
makeJWT, getImei, getSerial, rougePublicKey, devicePubKey, devicePrivateKey, alreadyRegisteredEmail, newUserEmail
|
||||
}
|
||||
};
|
|
@ -1,10 +1,10 @@
|
|||
const request = require('supertest');
|
||||
const dummyGenerator = require('./../dummyGenerator');
|
||||
import request from 'supertest';
|
||||
import dummyGenerator from './../dummyGenerator';
|
||||
let app;
|
||||
|
||||
|
||||
|
||||
module.exports = (server) => {
|
||||
export default (server) => {
|
||||
app = server;
|
||||
|
||||
describe('/v2/pilotauth/ - Testing device registration', function() {
|
||||
|
@ -71,4 +71,4 @@ module.exports = (server) => {
|
|||
});
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
const request = require('supertest');
|
||||
const dummyGenerator = require('./../dummyGenerator');
|
||||
import request from 'supertest';
|
||||
import dummyGenerator from './../dummyGenerator';
|
||||
let app;
|
||||
|
||||
|
||||
|
||||
module.exports = (server) => {
|
||||
export default (server) => {
|
||||
app = server;
|
||||
|
||||
describe('/api', function() {
|
||||
|
@ -43,4 +43,4 @@ module.exports = (server) => {
|
|||
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
const request = require('supertest');
|
||||
const dummyGenerator = require('./../dummyGenerator');
|
||||
import request from 'supertest';
|
||||
import dummyGenerator from './../dummyGenerator';
|
||||
let app;
|
||||
|
||||
|
||||
|
||||
module.exports = (server) => {
|
||||
export default (server) => {
|
||||
app = server;
|
||||
|
||||
describe('/useradmin', function() {
|
||||
|
@ -49,4 +49,4 @@ module.exports = (server) => {
|
|||
});
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const request = require('supertest');
|
||||
const server = require('../server');
|
||||
const config = require('../config');
|
||||
import request from 'supertest';
|
||||
import server from '../server';
|
||||
import config from '../config';
|
||||
|
||||
// TODO better way to only run tests once server is up
|
||||
describe('loading express', () => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* eslint-disable no-underscore-dangle */
|
||||
let wss;
|
||||
const { v4: uuid } = require('uuid');
|
||||
const orm = require('../../models/index.model');
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import orm from '../../models/index.model';
|
||||
|
||||
let realtime;
|
||||
|
||||
|
@ -56,7 +56,7 @@ async function realtimeCallback(callback) {
|
|||
realtime = callback;
|
||||
}
|
||||
|
||||
module.exports = (websocketServer) => {
|
||||
export default (websocketServer) => {
|
||||
wss = websocketServer;
|
||||
|
||||
return {
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
const WebSocket = require('ws');
|
||||
const cookie = require('cookie');
|
||||
const jsonwebtoken = require('jsonwebtoken');
|
||||
const httpsServer = require('https');
|
||||
const httpServer = require('http');
|
||||
const { readFileSync } = require('fs');
|
||||
const log4js = require('log4js');
|
||||
const models = require('../../models/index.model');
|
||||
const config = require('../../config');
|
||||
import WebSocket, { WebSocketServer } from 'ws'; import cookie from 'cookie';
|
||||
import jsonwebtoken from 'jsonwebtoken';
|
||||
import httpsServer from 'https';
|
||||
import httpServer from 'http';
|
||||
import { readFileSync } from 'fs';
|
||||
import log4js from 'log4js';
|
||||
import models from '../../models/index.model';
|
||||
import config from '../../config';
|
||||
import helperFunctions from './helpers';
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const authenticationController = require('../../controllers/authentication');
|
||||
const deviceController = require('../../controllers/devices');
|
||||
import authenticationController from '../../controllers/authentication';
|
||||
|
||||
import deviceController from '../../controllers/devices';
|
||||
|
||||
const logger = log4js.getLogger('default');
|
||||
|
||||
|
@ -29,7 +30,7 @@ function __server() {
|
|||
server = httpServer.createServer();
|
||||
}
|
||||
|
||||
wss = new WebSocket.WebSocketServer({ server }, { path: '/ws/v2/', handshakeTimeout: 500 });
|
||||
wss = new WebSocketServer({ server }, { path: '/ws/v2/', handshakeTimeout: 500 });
|
||||
|
||||
const interval = setInterval(() => {
|
||||
wss.clients.forEach((ws) => {
|
||||
|
@ -174,6 +175,6 @@ wss.retropilotFunc = {
|
|||
|
||||
};
|
||||
|
||||
helpers = require('./helpers')(wss);
|
||||
helpers = helperFunctions();
|
||||
|
||||
module.exports = helpers;
|
||||
export default helpers;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
const authenticationController = require('../../controllers/authentication');
|
||||
const deviceController = require('../../controllers/devices');
|
||||
const athenaRealtime = require('../athena/index');
|
||||
import authenticationController from '../../controllers/authentication';
|
||||
|
||||
import deviceController from '../../controllers/devices';
|
||||
import athenaRealtime from '../athena/index';
|
||||
|
||||
// Checks if device is currently online in Athena
|
||||
|
||||
|
@ -57,7 +58,7 @@ async function takeSnapshot(ws, msg) {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
isDongleOnline,
|
||||
rebootDongle,
|
||||
takeSnapshot,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const deviceController = require('../../controllers/devices');
|
||||
import deviceController from '../../controllers/devices';
|
||||
|
||||
let wss;
|
||||
|
||||
|
@ -44,7 +44,7 @@ async function passData(dongleId, msg) {
|
|||
return true;
|
||||
}
|
||||
|
||||
module.exports = (websocket) => {
|
||||
export default (websocket) => {
|
||||
wss = websocket;
|
||||
|
||||
return {
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
const WebSocket = require('ws');
|
||||
const cookie = require('cookie');
|
||||
const httpServer = require('http');
|
||||
const log4js = require('log4js');
|
||||
const config = require('../../config');
|
||||
let controls = require('./controls');
|
||||
import WebSocket, { WebSocketServer } from 'ws';
|
||||
import cookie from 'cookie';
|
||||
import httpServer from 'http';
|
||||
import log4js from 'log4js';
|
||||
import config from '../../config.js';
|
||||
import controlsFunction from './controls.js';
|
||||
import authenticationController from '../../controllers/authentication.js';
|
||||
|
||||
const authenticationController = require('../../controllers/authentication');
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const deviceController = require('../../controllers/devices');
|
||||
import deviceController from '../../controllers/devices';
|
||||
|
||||
import athenaRealtime from '../athena/index.js';
|
||||
import realtimeCommands from './commands.js';
|
||||
|
||||
const logger = log4js.getLogger('default');
|
||||
|
||||
const athenaRealtime = require('../athena/index');
|
||||
|
||||
const realtimeCommands = require('./commands');
|
||||
|
||||
let server;
|
||||
let wss;
|
||||
let controls;
|
||||
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
function __server() {
|
||||
server = httpServer.createServer();
|
||||
|
||||
wss = new WebSocket.WebSocketServer({ server }, { path: '/realtime/v1', handshakeTimeout: 500 });
|
||||
wss = new WebSocketServer({ server }, { path: '/realtime/v1', handshakeTimeout: 500 });
|
||||
|
||||
server.listen(config.clientSocket.port, config.clientSocket.host, () => {
|
||||
logger.info(`Web(Server) - UP @ ${config.clientSocket.host}:${config.clientSocket.port}`);
|
||||
|
@ -104,11 +104,11 @@ async function manageConnection(ws, req) {
|
|||
|
||||
const websocketServer = __server();
|
||||
|
||||
controls = controls(websocketServer);
|
||||
controls = controlsFunction(websocketServer);
|
||||
|
||||
athenaRealtime.realtimeCallback(controls);
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
controls,
|
||||
websocketServer,
|
||||
};
|
||||
|
|
32
worker.js
32
worker.js
|
@ -1,23 +1,19 @@
|
|||
/* eslint-disable */
|
||||
const config = require('./config');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
const log4js = require('log4js');
|
||||
import config from './config';
|
||||
|
||||
const sqlite3 = require('sqlite3');
|
||||
const { open } = require('sqlite');
|
||||
|
||||
const lockfile = require('proper-lockfile');
|
||||
|
||||
const jwt = require('jsonwebtoken');
|
||||
|
||||
const dirTree = require('directory-tree');
|
||||
const { execSync } = require('child_process');
|
||||
|
||||
const Reader = require('@commaai/log_reader');
|
||||
var ffprobe = require('ffprobe'),
|
||||
ffprobeStatic = require('ffprobe-static');
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import crypto from 'crypto';
|
||||
import log4js from 'log4js';
|
||||
import sqlite3 from 'sqlite3';
|
||||
import { open } from 'sqlite';
|
||||
import lockfile from 'proper-lockfile';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import dirTree from 'directory-tree';
|
||||
import { execSync } from 'child_process';
|
||||
import Reader from '@commaai/log_reader';
|
||||
import ffprobe from 'ffprobe';
|
||||
import ffprobeStatic from 'ffprobe-static';
|
||||
|
||||
var db = null;
|
||||
|
||||
|
|
Loading…
Reference in New Issue