forked from svrjs/svrjs
Lint out the codebase
This commit is contained in:
parent
5a3e6765f1
commit
fd5e8ba70e
4 changed files with 41 additions and 42 deletions
15
src/index.js
15
src/index.js
|
@ -687,17 +687,24 @@ if (!disableMods) {
|
||||||
// If there was another error, try creating the temp folder and then the modloader folder again
|
// If there was another error, try creating the temp folder and then the modloader folder again
|
||||||
fs.mkdirSync(process.dirname + "/temp");
|
fs.mkdirSync(process.dirname + "/temp");
|
||||||
try {
|
try {
|
||||||
fs.mkdirSync(process.dirname + "/temp/" + modloaderFolderName);
|
fs.mkdirSync(
|
||||||
|
process.dirname + "/temp/" + modloaderFolderName,
|
||||||
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// If there was another error, throw it
|
// If there was another error, throw it
|
||||||
if (err.code != "EEXIST") throw err;
|
if (err.code != "EEXIST") throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a subfolder for the current mod within the modloader folder
|
|
||||||
fs.mkdirSync(process.dirname + "/temp/" + modloaderFolderName + "/" + modFileRaw);
|
|
||||||
|
|
||||||
|
// Create a subfolder for the current mod within the modloader folder
|
||||||
|
fs.mkdirSync(
|
||||||
|
process.dirname +
|
||||||
|
"/temp/" +
|
||||||
|
modloaderFolderName +
|
||||||
|
"/" +
|
||||||
|
modFileRaw,
|
||||||
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// If there was an error creating the folder, ignore it if it's a known error
|
// If there was an error creating the folder, ignore it if it's a known error
|
||||||
if (err.code != "EEXIST" && err.code != "ENOENT") throw err;
|
if (err.code != "EEXIST" && err.code != "ENOENT") throw err;
|
||||||
|
|
|
@ -199,25 +199,20 @@ module.exports = (req, res, logFacilities, config, next) => {
|
||||||
if (cacheEntry) {
|
if (cacheEntry) {
|
||||||
cb(cacheEntry.hash);
|
cb(cacheEntry.hash);
|
||||||
} else {
|
} else {
|
||||||
crypto.scrypt(
|
crypto.scrypt(password, list[_i].salt, 64, (err, derivedKey) => {
|
||||||
password,
|
if (err) {
|
||||||
list[_i].salt,
|
res.error(500, err);
|
||||||
64,
|
} else {
|
||||||
(err, derivedKey) => {
|
const key = derivedKey.toString("hex");
|
||||||
if (err) {
|
scryptCache.push({
|
||||||
res.error(500, err);
|
hash: key,
|
||||||
} else {
|
password: hashedPassword,
|
||||||
const key = derivedKey.toString("hex");
|
salt: list[_i].salt,
|
||||||
scryptCache.push({
|
addDate: new Date(),
|
||||||
hash: key,
|
});
|
||||||
password: hashedPassword,
|
cb(key);
|
||||||
salt: list[_i].salt,
|
}
|
||||||
addDate: new Date(),
|
});
|
||||||
});
|
|
||||||
cb(key);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (list[_i].pbkdf2) {
|
} else if (list[_i].pbkdf2) {
|
||||||
|
|
|
@ -9,25 +9,22 @@ module.exports = (req, res, logFacilities, config, next) => {
|
||||||
req.originalParsedURL.pathname[req.originalParsedURL.pathname.length - 1] !=
|
req.originalParsedURL.pathname[req.originalParsedURL.pathname.length - 1] !=
|
||||||
"/"
|
"/"
|
||||||
) {
|
) {
|
||||||
fs.stat(
|
fs.stat("." + decodeURIComponent(req.parsedURL.pathname), (err, stats) => {
|
||||||
"." + decodeURIComponent(req.parsedURL.pathname),
|
if (err || !stats.isDirectory()) {
|
||||||
(err, stats) => {
|
try {
|
||||||
if (err || !stats.isDirectory()) {
|
next();
|
||||||
try {
|
} catch (err) {
|
||||||
next();
|
res.error(500, err);
|
||||||
} catch (err) {
|
|
||||||
res.error(500, err);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
res.redirect(
|
|
||||||
req.originalParsedURL.pathname +
|
|
||||||
"/" +
|
|
||||||
req.parsedURL.search +
|
|
||||||
req.parsedURL.hash,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
} else {
|
||||||
);
|
res.redirect(
|
||||||
|
req.originalParsedURL.pathname +
|
||||||
|
"/" +
|
||||||
|
req.parsedURL.search +
|
||||||
|
req.parsedURL.hash,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ if (!process.singleThreaded) {
|
||||||
let oldLog = console.log;
|
let oldLog = console.log;
|
||||||
console.log = (...params) => {
|
console.log = (...params) => {
|
||||||
if (
|
if (
|
||||||
a == "ChildProcess.prototype.send() - Sorry! Not implemented yet"
|
params[0] == "ChildProcess.prototype.send() - Sorry! Not implemented yet"
|
||||||
) {
|
) {
|
||||||
throw new Error("NOT IMPLEMENTED");
|
throw new Error("NOT IMPLEMENTED");
|
||||||
} else {
|
} else {
|
||||||
|
|
Reference in a new issue