wickrio-bot-api
Advanced tools
Comparing version 5.113.1 to 6.8.1
{ | ||
"name": "wickrio-bot-api", | ||
"version": "5.113.1", | ||
"version": "6.8.1", | ||
"description": "The official Wickr IO Bot API Framework", | ||
@@ -5,0 +5,0 @@ "main": "src/WickrIOBot.js", |
@@ -21,3 +21,3 @@ 'use strict' | ||
addOnToJSON, | ||
adminsOptional, | ||
adminsOptional | ||
) { | ||
@@ -39,6 +39,5 @@ this.supportsVerification = false | ||
if (adminsOptional !== undefined) | ||
this.adminsOptional = adminsOptional | ||
if (adminsOptional !== undefined) this.adminsOptional = adminsOptional | ||
console.log('adminsOptional='+this.adminsOptional) | ||
console.log('adminsOptional=' + this.adminsOptional) | ||
@@ -67,3 +66,6 @@ this.tokenConfig = [ | ||
} | ||
const packageFile = processesFile.replace('processes.json', 'package.json') | ||
const packageFile = processesFile.replace( | ||
'processes.json', | ||
'package.json' | ||
) | ||
if (fs.existsSync(packageFile)) { | ||
@@ -75,7 +77,8 @@ this.packageFile = packageFile | ||
} else { | ||
console.error( | ||
'package.json file does not exist! (' + packageFile + ')' | ||
) | ||
console.error('package.json file does not exist! (' + packageFile + ')') | ||
} | ||
const foreverFile = processesFile.replace('processes.json', 'forever.json') | ||
const foreverFile = processesFile.replace( | ||
'processes.json', | ||
'forever.json' | ||
) | ||
if (fs.existsSync(foreverFile)) { | ||
@@ -87,6 +90,21 @@ this.foreverFile = foreverFile | ||
} else { | ||
console.error( | ||
'forever.json file does not exist! (' + foreverFile + ')' | ||
) | ||
console.error('forever.json file does not exist! (' + foreverFile + ')') | ||
} | ||
const wpmFile = processesFile.replace('processes.json', 'wpm.json') | ||
if (fs.existsSync(wpmFile)) { | ||
this.wpmFile = wpmFile | ||
this.wpm = require(wpmFile) | ||
this.wpmDataStringify = JSON.stringify(this.wpm) | ||
this.wpmDataParsed = JSON.parse(this.wpmDataStringify) | ||
} else { | ||
console.error('wpm.json file does not exist! (' + wpmFile + ')') | ||
} | ||
const pidFile = processesFile.replace( | ||
'processes.json', | ||
'pidLocation.json' | ||
) | ||
if (fs.existsSync(pidFile)) { | ||
this.pidFile = pidFile | ||
console.error('pidLocation.json file does not exist! (' + pidFile + ')') | ||
} | ||
} catch (err) { | ||
@@ -97,4 +115,6 @@ console.error(err) | ||
this.verificationToken = WickrIOConfigure.getVerificationTokens() | ||
this.administratorsToken = WickrIOConfigure.getAdminTokens(this.adminsOptional) | ||
console.log('adminsOptional='+this.adminsOptional) | ||
this.administratorsToken = WickrIOConfigure.getAdminTokens( | ||
this.adminsOptional | ||
) | ||
console.log('adminsOptional=' + this.adminsOptional) | ||
@@ -185,4 +205,4 @@ this.encryptToken = { | ||
default: 'N/A', | ||
} | ||
] | ||
}, | ||
], | ||
} | ||
@@ -408,3 +428,2 @@ } else { | ||
if (tokenList[index].type === 'file') { | ||
@@ -485,7 +504,9 @@ schema.properties[tokenList[index].token] = { | ||
// If this token has a list and the answer was 'yes' then proceed into the list | ||
if (tokenEntry.list === undefined || process.env[tokenEntry.token] === 'no') { | ||
return resolve('Complete for' + tokenEntry.token) | ||
if ( | ||
tokenEntry.list === undefined || | ||
process.env[tokenEntry.token] === 'no' | ||
) { | ||
return resolve('Complete for' + tokenEntry.token) | ||
} | ||
} else { | ||
let dflt = newObjectResult[tokenEntry.token] | ||
@@ -632,3 +653,6 @@ let requiredValue = tokenEntry.required | ||
processesFileDir = '.' | ||
const processesFileBackup = path.join(processesFileDir, 'processes_backup.json') | ||
const processesFileBackup = path.join( | ||
processesFileDir, | ||
'processes_backup.json' | ||
) | ||
@@ -648,2 +672,3 @@ // backup the processes.json file | ||
this.uid = newName | ||
this.wpmName = newName | ||
@@ -654,6 +679,3 @@ // let assign = Object.assign(this.dataParsed.apps[0].name, newName); | ||
// TODO can we just assign all of env? | ||
Object.assign( | ||
this.dataParsed.apps[0].env.tokens, | ||
newObjectResult | ||
) | ||
Object.assign(this.dataParsed.apps[0].env.tokens, newObjectResult) | ||
const configData = this.configureLogger(this.dataParsed) | ||
@@ -706,3 +728,2 @@ if (this.dataParsed.apps[0].env.log_tokens === undefined) { | ||
// console.log(answer); | ||
}) | ||
@@ -718,3 +739,6 @@ } | ||
this.packageDataParsed.scripts.restart = `forever restart ${this.uid}` | ||
fs.writeFileSync(this.packageFile, JSON.stringify(this.packageDataParsed, null, 2)) | ||
fs.writeFileSync( | ||
this.packageFile, | ||
JSON.stringify(this.packageDataParsed, null, 2) | ||
) | ||
console.log('Finished Configuring package!') | ||
@@ -733,4 +757,10 @@ } | ||
this.foreverDataParsed.uid = this.uid | ||
this.foreverDataParsed.sourceDir = this.processesFile.replace('processes.json', '') | ||
fs.writeFileSync(this.foreverFile, JSON.stringify(this.foreverDataParsed, null, 2)) | ||
this.foreverDataParsed.sourceDir = this.processesFile.replace( | ||
'processes.json', | ||
'' | ||
) | ||
fs.writeFileSync( | ||
this.foreverFile, | ||
JSON.stringify(this.foreverDataParsed, null, 2) | ||
) | ||
console.log('Finished Configuring forever!') | ||
@@ -743,2 +773,35 @@ } | ||
async configureWpm() { | ||
try { | ||
if (!fs.existsSync(this.wpmFile)) { | ||
console.error('wpm.json file does not exist!!') | ||
} else { | ||
this.wpmDataParsed.name = this.wpmName | ||
fs.writeFileSync( | ||
this.wpmFile, | ||
JSON.stringify(this.wpmDataParsed, null, 2) | ||
) | ||
console.log('Finished Configuring WPM!') | ||
} | ||
} catch (err) { | ||
console.error(err) | ||
} | ||
} | ||
async configurePid() { | ||
try { | ||
if (!fs.existsSync(this.pidFile)) { | ||
console.error('pidLocation.json file does not exist!!') | ||
} else { | ||
this.wpmDataParsed.name = this.wpmName | ||
const pidLocationString = '/tmp/' + this.uid + '.pid' | ||
fs.closeSync(fs.openSync(pidLocationString, 'w')) | ||
fs.writeFileSync(this.pidFile, pidLocationString) | ||
console.log('Finished Configuring pid location file!') | ||
} | ||
} catch (err) { | ||
console.error(err) | ||
} | ||
} | ||
configureLogger(data) { | ||
@@ -765,2 +828,4 @@ const retObj = {} | ||
await this.configureForever() | ||
await this.configureWpm() | ||
await this.configurePid() | ||
console.log('Finished Configuring!') | ||
@@ -767,0 +832,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
124351
3010
24