cleanup
parent
7680c2fb98
commit
7da0fc9640
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"sourceMaps": "inline",
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"targets": {
|
||||
"node": "current"
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
cabana
|
||||
certs
|
||||
node_modules
|
||||
static
|
||||
test
|
||||
config.js
|
|
@ -0,0 +1 @@
|
|||
.gitignore
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"root": true,
|
||||
"extends": [
|
||||
"airbnb-base"
|
||||
],
|
||||
"env": {
|
||||
"es6": true,
|
||||
"node": true,
|
||||
"browser": false // do we need this? none of this code will ever run on a browswer
|
||||
"node": true
|
||||
},
|
||||
"plugins": [
|
||||
"no-floating-promise"
|
||||
|
@ -16,6 +16,17 @@
|
|||
// retropilot: this seems dumb. do whatever looks nice.
|
||||
"arrow-body-style": "off",
|
||||
|
||||
// specify the maximum length of a line in your program
|
||||
// https://eslint.org/docs/rules/max-len
|
||||
// retropilot: ignore comments
|
||||
"max-len": ["error", 100, 2, {
|
||||
"ignoreUrls": true,
|
||||
"ignoreComments": true,
|
||||
"ignoreRegExpLiterals": true,
|
||||
"ignoreStrings": true,
|
||||
"ignoreTemplateLiterals": true
|
||||
}],
|
||||
|
||||
// disallow use of unary operators, ++ and --
|
||||
// http://eslint.org/docs/rules/no-plusplus
|
||||
// retropilot: we allow them in the for loop
|
||||
|
@ -31,17 +42,6 @@
|
|||
// retropilot: permit referencing functions before they're defined
|
||||
"no-use-before-define": ["error", { "functions": false }],
|
||||
|
||||
// specify the maximum length of a line in your program
|
||||
// https://eslint.org/docs/rules/max-len
|
||||
// retropilot: ignore comments
|
||||
"max-len": ["error", 100, 2, {
|
||||
"ignoreUrls": true,
|
||||
"ignoreComments": true,
|
||||
"ignoreRegExpLiterals": true,
|
||||
"ignoreStrings": true,
|
||||
"ignoreTemplateLiterals": true
|
||||
}],
|
||||
|
||||
// TODO: fix and remove
|
||||
// retropilot: we are in the process of removing all of these
|
||||
"no-unused-vars": ["warn", { "vars": "all", "args": "after-used", "ignoreRestSiblings": true }],
|
||||
|
|
|
@ -21,7 +21,7 @@ function mkDirByPathSync(targetDir, { isRelativeToScript = false } = {}) {
|
|||
const { sep } = path;
|
||||
const initDir = path.isAbsolute(targetDir) ? sep : '';
|
||||
|
||||
const baseDir = isRelativeToScript ? global.__basedir : '.';
|
||||
const baseDir = isRelativeToScript ? __dirname : '.';
|
||||
|
||||
return targetDir.split(sep).reduce((parentDir, childDir) => {
|
||||
const curDir = path.resolve(baseDir, parentDir, childDir);
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import 'dotenv/config';
|
||||
import http from 'http';
|
||||
import log4js from 'log4js';
|
||||
import { dirname } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
log4js.configure({
|
||||
appenders: { logfile: { type: 'file', filename: 'server.log' }, out: { type: 'console' } /* {type: "file", filename: "server1.log"} */ },
|
||||
|
@ -15,11 +13,6 @@ process.on('unhandledRejection', (error, p) => {
|
|||
console.dir(error.stack);
|
||||
});
|
||||
|
||||
// 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;
|
||||
|
||||
const main = async () => {
|
||||
const logger = log4js.getLogger('default');
|
||||
const httpServer = http.createServer(await require('./app').default);
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import 'dotenv/config';
|
||||
import crypto from 'crypto';
|
||||
import fs from 'fs';
|
||||
import path, { dirname } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import path from 'path';
|
||||
|
||||
import log4js from 'log4js';
|
||||
import dirTree from 'directory-tree';
|
||||
|
@ -13,20 +12,16 @@ import ffprobeStatic from 'ffprobe-static';
|
|||
|
||||
import orm from '../models/index.model';
|
||||
|
||||
const startTime = Date.now();
|
||||
let lastCleaningTime = 0;
|
||||
let startTime = Date.now();
|
||||
|
||||
log4js.configure({
|
||||
appenders: { logfile: { type: 'file', filename: 'worker.log' }, out: { type: 'console' } },
|
||||
categories: { default: { appenders: ['out', 'logfile'], level: 'info' } }
|
||||
appenders: { logfile: { type: 'file', filename: 'worker.log' }, out: { type: 'console' } },
|
||||
categories: { default: { appenders: ['out', 'logfile'], level: 'info' } },
|
||||
});
|
||||
|
||||
const logger = log4js.getLogger('default');
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
global.__basedir = __dirname;
|
||||
|
||||
function initializeStorage() {
|
||||
const verifiedPath = mkDirByPathSync(process.env.STORAGE_PATH, { isRelativeToScript: (process.env.STORAGE_PATH.indexOf('/') !== 0) });
|
||||
if (verifiedPath != null) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
import jwt from 'jsonwebtoken';
|
||||
import crypto from 'crypto';
|
||||
import jwt from 'jsonwebtoken';
|
||||
|
||||
const devicePrivateKey = "-----BEGIN RSA PRIVATE KEY-----\n" +
|
||||
"MIIEowIBAAKCAQEAwhH9PqBd/R/QPvcf1Gom5Vp+zYb1+DLjiFMC7a1lNvV8MUqK\n" +
|
||||
|
@ -65,7 +64,6 @@ function getSerial() {
|
|||
}
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
makeJWT, getImei, getSerial, rougePublicKey, devicePubKey, devicePrivateKey, alreadyRegisteredEmail, newUserEmail
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue