Tidy up cvc.js

This commit is contained in:
hgw 2023-10-02 02:11:27 +00:00
parent d44b956aff
commit a87de44e61

View File

@ -1,14 +1,10 @@
const config = require('../config/default.json') const config = require('../config/default.json')
//const uconfig = require('../config/usersettings.json') const uconfig = require('../config/usersettings.json')
const { parentPort, workerData } = require('worker_threads'); const { parentPort, workerData } = require('worker_threads');
//const { d1, d2, d3, d4, d5, d6 } = workerData; //const { d1, d2, d3 } = workerData;
//var user = d1; //var val1 = d1;
//var setting = d2; //var val2 = d2;
//var setting2 = d3; //var val3 = d3;
//var value = d4;
//var value2 = d5;
//var hostmask = d6
const fs = require('fs-extra')
const timer = ms => new Promise(res => setTimeout(res, ms)) const timer = ms => new Promise(res => setTimeout(res, ms))
warningMsg = ''+config.colours.brackets+'['+config.colours.warning+'WARNING'+config.colours.brackets+']' warningMsg = ''+config.colours.brackets+'['+config.colours.warning+'WARNING'+config.colours.brackets+']'
@ -27,26 +23,20 @@ async function sendUpstream(content) {
process.exit() process.exit()
} }
function errorMessage(error, code, extra) { //function errorMessage(error, code, extra) {
consoleLog('[cvc.errorMessage] '+error.code) // consoleLog('[cvc.errorMessage] '+error.code)
if (code == "404") { // if (code == "404") {
var error = errorMsg+" 404: " + extra + " not found" // var error = errorMsg+" 404: " + extra + " not found"
} else if (error.code == "ECONNREFUSED") { // } else if (error.code == "ECONNREFUSED") {
var error = errorMsg+" Connection Refused" // var error = errorMsg+" Connection Refused"
} else if (error.code == "ERR_UNESCAPED_CHARACTERS"){ // } else {
var error = errorMsg+" Unescaped Characters" // var error = errorMsg+" Unknown error"
} else if (code == "INVALID") { // }
var error = errorMsg+' '+extra+' either does not exist or is not a valid feed.' // parentPort.postMessage(error);
} else if (code == "ALREADYEXISTS" ) { // process.exit()
var error = errorMsg+' '+extra+' already exists in your feed list.' //}
} else if (error == "NOFEEDS") { // this is not needed right now but might be in the future
var error = errorMsg+" No saved feeds for "+provfeed
} else {
var error = errorMsg+" Unknown error"
}
parentPort.postMessage(error);
process.exit()
}
function checkValuesExist() { function checkValuesExist() {
const fatalConfigError = new Set(); const fatalConfigError = new Set();