Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
var path = require('path');
var fs = require('fs');
var ZSchema = require("z-schema");
var validator = new ZSchema();
var errors = require('../errors/errors');
var logger = require('tracer').colorConsole();
var tools = require('../tools');
class JsonValidator {
constructor(schemaPath, watchDir) {
this.schemaMap = {};
tools.consoleLog("===========================");
tools.consoleLog("JsonValidator 初始化开始..");
schemaPath = schemaPath || './schema';
let schemaDir = path.resolve(schemaPath);
tools.consoleLog('schema 目录:', schemaDir);
watchDir = watchDir || ['/api/admin', '/api/open', '/api/inner'];
watchDir.forEach(function (e) {
e = e.substring(e.indexOf('/', 1));
// console.log('-----------------', e);
import path from 'path'
import tracer from 'tracer'
// 日志
const dailyfile = tracer.dailyfile({
root: path.join(__dirname, '../../logs'),
maxLogFiles: 10,
format: '{{timestamp}} {{message}}',
dateformat: 'mm-dd HH:MM:ss',
})
// 打印
const colorConsole = tracer.colorConsole()
// 绑定
export default {
log: colorConsole.log,
trace: colorConsole.trace,
debug: colorConsole.debug,
info(...args: any[]) {
colorConsole.info.apply(null, args)
dailyfile.info.apply(null, args)
},
warn(...args: any[]) {
colorConsole.warn.apply(null, args)
dailyfile.warn.apply(null, args)
},
error(...args: any[]) {
colorConsole.error.apply(null, args)
'use strict';
var ObjectID = require("mongodb").ObjectID;
var ezmongo = require('../../orm/mongo');
var logger = require('tracer').colorConsole();
// var ZSchema = require("z-schema");
// var validator = new ZSchema();
let Validator=require('../JsonValidator');
var errors = require('../../errors/errors');
function BaseService(table) {
this.collection = table;
var pathSchema = require('path').resolve('./schema') + '/collection/' + table + '.json';
if (process.env.debug) {
logger.info("加载schema: " + pathSchema);
}
try {
this.schema = require(pathSchema);
var passportSocketIo = require('passport.socketio');
var uuid = require('node-uuid');
var logger = require('tracer').colorConsole();
var colors = require('colors');
var logger = require('tracer').colorConsole({
filters : [
colors.cyan, //default filter
//the last item can be custom filter. here is "warn" and "error" filter
{
warn : colors.yellow,
error : [colors.red, colors.bold ]
}
]
});
var R = require('ramda');
// TODO: don't hardcode
var colorScheme = [
{
dir: 'app/',
to: 's/j/app/index'
}
],
build_directory: 'build/'
}
*/
var
fs = require('fs'),
tracer = require("tracer").colorConsole(),
fs_more = require('../util/fs-more'),
path = require('path'),
CONFIG_FILE = 'publish.json';
function PrePublish(options){
this.cwd = options.cwd;
};
PrePublish.prototype = {
run: function(callback){
console.log('预打包开始...');
this._getConfig();
//Version: 0.1.2 - Added MyID call to pass client username
//Version: 0.1.1 - Cleanup of profanity filter.
var chatConfig = require('./../configurations/chat');
var config = require('./../configurations/config');
var log = require('tracer').colorConsole(config.loggingConfig);
var swearjar = require('swearjar');
var auth = require('../auth.js');
module.exports = function (sio) {
var io = sio.of('/chat');
io.use(auth.authSocket)
io.on('connection', function(socket) {
//Decoded Token
var token = socket.user;
var username = token.name;
socket.emit('MyID', {name: username});
socket.on('clientMessage',function(data) {
if (chatConfig.profanityFilter){
var logger = require('tracer').colorConsole();
var request = require( 'request-promise' );
var invariant = require( 'invariant' );
var _ = require( 'underscore');
var xpath = require('xpath'),
dom = require('xmldom').DOMParser;
var GET_HOST_URL = 'http://dyna.dnsever.com/gethost.php';
var GET_IP_URL = 'http://dyna.dnsever.com/getip.php';
var UPDATE_URL = "http://dyna.dnsever.com/update.php";
function _transformXML( body ) {
return new dom().parseFromString( body );
}
var realIpAddr = '';
var today = -1;
'use strict';
const _ = require('underscore'),
processing = require('./libs/processing'),
parser = require('./libs/parser'),
logger = require('tracer').colorConsole();
/**
*
* @constructor
*/
function ParseBoy() {}
/**
*
* @param PreparedFile
* @param cbGetResume
*/
ParseBoy.prototype.parseFile = function(PreparedFile, cbGetResume) {
logger.trace('I\'m working with "' + PreparedFile.name + '" now');
parser.parse(PreparedFile, cbGetResume);
};
var async = require('async');
var fs = require('fs');
var util = require('util');
var os = require('os');
var path = require('path');
var exec = require('child_process').exec;
var tilelive = require('tilelive');
var argv = require('minimist')(process.argv.slice(2));
var mkdirp = require('mkdirp');
var console = require('tracer').colorConsole();
require('mbtiles').registerProtocols(tilelive);
require('tilelive-tmsource')(tilelive);
var program = require('commander');
program
.version(0.1)
.option('-z, --minimum-zoom ', 'Minimum zoom level to process (defaults to 0).', parseInt)
.option('-Z, --maximum-zoom ', 'Maximum zoom level to process (defaults to 6).', parseInt)
.option('-b, --bucket ', 'Bucket in which to upload results (defaults to \'bathy\').')
.option('-c, --concurrency ', 'Number of concurrent tile operations (defaults to 2).', parseInt)
.option('--starting-tile ', 'Starting position of upload process (in the event that you want to start processing from a specific tile)')
.option('--limit ', 'Limit to total number of tiles to be processed (defaults to 0)')
.parse(process.argv);
let path = require('path');
let fs = require('fs');
let logger = require('tracer').colorConsole();
let client;
module.exports = class Redis{
static connect(url,app_name){
let redisClient = require('redis');
client = redisClient.createClient(url||process.env.redis_url);
client.on('error',function(err){
logger.error(err);
});
let defaultKeys=require('./redisDefaultKeys');
Redis.load(defaultKeys,'common');
let keyPath=process.env.app_root+(process.env.my_redis_key_path||'/redisKeys.js');
try {