Upgrade to jsli 2.0
This commit is contained in:
parent
486ce04a3e
commit
07179d6c83
|
@ -8,7 +8,7 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@calzoneman/jsli": "^1.0.1",
|
||||
"@calzoneman/jsli": "^2.0.1",
|
||||
"bcrypt": "^0.8.5",
|
||||
"bluebird": "^2.10.1",
|
||||
"body-parser": "^1.14.0",
|
||||
|
|
|
@ -8,9 +8,8 @@
|
|||
var Config = require("./config");
|
||||
var db = require("./database");
|
||||
var Promise = require("bluebird");
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('bgtask');
|
||||
const LOGGER = require('@calzoneman/jsli')('bgtask');
|
||||
|
||||
var init = null;
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
// @flow
|
||||
import crypto from 'crypto';
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
import * as urlparse from 'url';
|
||||
import { CamoConfig } from './configuration/camoconfig';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('camo');
|
||||
const LOGGER = require('@calzoneman/jsli')('camo');
|
||||
|
||||
function isWhitelisted(camoConfig: CamoConfig, url: string): boolean {
|
||||
const whitelistedDomains = camoConfig.getWhitelistedDomains();
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import Promise from 'bluebird';
|
||||
import { ChannelStateSizeError } from '../errors';
|
||||
import db from '../database';
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('dbstore');
|
||||
|
||||
const LOGGER = require('@calzoneman/jsli')('dbstore');
|
||||
const SIZE_LIMIT = 1048576;
|
||||
const QUERY_CHANNEL_DATA = 'SELECT `key`, `value` FROM channel_data WHERE channel_id = ?';
|
||||
|
||||
|
|
|
@ -10,9 +10,8 @@ import Promise from 'bluebird';
|
|||
import { EventEmitter } from 'events';
|
||||
import { throttle } from '../util/throttle';
|
||||
import Logger from '../logger';
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('channel');
|
||||
const LOGGER = require('@calzoneman/jsli')('channel');
|
||||
|
||||
const USERCOUNT_THROTTLE = 10000;
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
var FilterList = require("cytubefilters");
|
||||
var ChannelModule = require("./module");
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('filters');
|
||||
const LOGGER = require('@calzoneman/jsli')('filters');
|
||||
|
||||
/*
|
||||
* Converts JavaScript-style replacements ($1, $2, etc.) with
|
||||
|
|
|
@ -2,9 +2,8 @@ var Vimeo = require("cytube-mediaquery/lib/provider/vimeo");
|
|||
var ChannelModule = require("./module");
|
||||
var Config = require("../config");
|
||||
var InfoGetter = require("../get-info");
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('mediarefresher');
|
||||
const LOGGER = require('@calzoneman/jsli')('mediarefresher');
|
||||
|
||||
function MediaRefresherModule(channel) {
|
||||
ChannelModule.apply(this, arguments);
|
||||
|
|
|
@ -8,9 +8,8 @@ var Flags = require("../flags");
|
|||
var db = require("../database");
|
||||
var CustomEmbedFilter = require("../customembed").filter;
|
||||
var XSS = require("../xss");
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('playlist');
|
||||
const LOGGER = require('@calzoneman/jsli')('playlist');
|
||||
|
||||
const MAX_ITEMS = Config.get("playlist.max-items");
|
||||
// Limit requestPlaylist to once per 60 seconds
|
||||
|
|
|
@ -4,11 +4,10 @@ var nodemailer = require("nodemailer");
|
|||
var net = require("net");
|
||||
var YAML = require("yamljs");
|
||||
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
import { loadFromToml } from 'cytube-common/lib/configuration/configloader';
|
||||
import { CamoConfig } from './configuration/camoconfig';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('config');
|
||||
const LOGGER = require('@calzoneman/jsli')('config');
|
||||
|
||||
var defaults = {
|
||||
mysql: {
|
||||
|
|
|
@ -2,9 +2,8 @@ import io from 'socket.io';
|
|||
import Socket from 'socket.io/lib/socket';
|
||||
import * as Metrics from 'cytube-common/lib/metrics/metrics';
|
||||
import { JSONFileMetricsReporter } from 'cytube-common/lib/metrics/jsonfilemetricsreporter';
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('counters');
|
||||
const LOGGER = require('@calzoneman/jsli')('counters');
|
||||
|
||||
var counters = {};
|
||||
var server = null;
|
||||
|
|
|
@ -5,11 +5,10 @@ var tables = require("./database/tables");
|
|||
var net = require("net");
|
||||
var util = require("./utilities");
|
||||
import * as Metrics from 'cytube-common/lib/metrics/metrics';
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
import knex from 'knex';
|
||||
import { GlobalBanDB } from './db/globalban';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('database');
|
||||
const LOGGER = require('@calzoneman/jsli')('database');
|
||||
|
||||
let db = null;
|
||||
let globalBanDB = null;
|
||||
|
|
|
@ -2,9 +2,8 @@ var $util = require("../utilities");
|
|||
var bcrypt = require("bcrypt");
|
||||
var db = require("../database");
|
||||
var Config = require("../config");
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('database/accounts');
|
||||
const LOGGER = require('@calzoneman/jsli')('database/accounts');
|
||||
|
||||
var registrationLock = {};
|
||||
var blackHole = function () { };
|
||||
|
|
|
@ -5,9 +5,8 @@ var path = require("path");
|
|||
var tables = require("./tables");
|
||||
var Flags = require("../flags");
|
||||
var util = require("../utilities");
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('database/channels');
|
||||
const LOGGER = require('@calzoneman/jsli')('database/channels');
|
||||
|
||||
var blackHole = function () { };
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
var db = require("../database");
|
||||
var Q = require("q");
|
||||
import Promise from 'bluebird';
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('database/update');
|
||||
const LOGGER = require('@calzoneman/jsli')('database/update');
|
||||
|
||||
const DB_VERSION = 11;
|
||||
var hasUpdates = [];
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
// @flow
|
||||
|
||||
import { Database } from '../database';
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
import net from 'net';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('AliasesDB');
|
||||
const LOGGER = require('@calzoneman/jsli')('AliasesDB');
|
||||
|
||||
class AliasesDB {
|
||||
db: Database;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
import util from '../utilities';
|
||||
import Promise from 'bluebird';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('GlobalBanDB');
|
||||
const LOGGER = require('@calzoneman/jsli')('GlobalBanDB');
|
||||
|
||||
class GlobalBanDB {
|
||||
constructor(db) {
|
||||
|
|
|
@ -6,9 +6,8 @@ var http = require("http");
|
|||
var urlparse = require("url");
|
||||
var path = require("path");
|
||||
require("status-message-polyfill");
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('ffmpeg');
|
||||
const LOGGER = require('@calzoneman/jsli')('ffmpeg');
|
||||
|
||||
var USE_JSON = true;
|
||||
var TIMEOUT = 30000;
|
||||
|
|
|
@ -13,9 +13,8 @@ var Streamable = require("cytube-mediaquery/lib/provider/streamable");
|
|||
var GoogleDrive = require("cytube-mediaquery/lib/provider/googledrive");
|
||||
var TwitchVOD = require("cytube-mediaquery/lib/provider/twitch-vod");
|
||||
var TwitchClip = require("cytube-mediaquery/lib/provider/twitch-clip");
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('get-info');
|
||||
const LOGGER = require('@calzoneman/jsli')('get-info');
|
||||
|
||||
var urlRetrieve = function (transport, options, callback) {
|
||||
var req = transport.request(options, function (res) {
|
||||
|
|
|
@ -5,8 +5,7 @@ var path = require('path');
|
|||
var querystring = require('querystring');
|
||||
var crypto = require('crypto');
|
||||
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
const LOGGER = LoggerFactory.getLogger('google2vtt');
|
||||
const LOGGER = require('@calzoneman/jsli')('google2vtt');
|
||||
|
||||
function md5(input) {
|
||||
var hash = crypto.createHash('md5');
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
import { getIPRange, getWideIPRange } from '../utilities';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('CachingGlobalBanlist');
|
||||
const LOGGER = require('@calzoneman/jsli')('CachingGlobalBanlist');
|
||||
|
||||
class CachingGlobalBanlist {
|
||||
constructor(globalBanDB) {
|
||||
|
|
|
@ -15,13 +15,12 @@ var session = require("../session");
|
|||
import counters from '../counters';
|
||||
import { verifyIPSessionCookie } from '../web/middleware/ipsessioncookie';
|
||||
import Promise from 'bluebird';
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
const verifySession = Promise.promisify(session.verifySession);
|
||||
const getAliases = Promise.promisify(db.getAliases);
|
||||
import { CachingGlobalBanlist } from './globalban';
|
||||
import proxyaddr from 'proxy-addr';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('ioserver');
|
||||
const LOGGER = require('@calzoneman/jsli')('ioserver');
|
||||
|
||||
var CONNECT_RATE = {
|
||||
burst: 5,
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
var fs = require("graceful-fs");
|
||||
var path = require("path");
|
||||
import { LoggerFactory, Logger as JsliLogger, LogLevel } from '@calzoneman/jsli';
|
||||
import { sprintf } from 'sprintf-js';
|
||||
import { Logger as JsliLogger, LogLevel } from '@calzoneman/jsli';
|
||||
import jsli from '@calzoneman/jsli';
|
||||
|
||||
function getTimeString() {
|
||||
var d = new Date();
|
||||
|
@ -65,25 +66,22 @@ exports.syslog = syslog;
|
|||
exports.eventlog = eventlog;
|
||||
|
||||
class LegacyLogger extends JsliLogger {
|
||||
constructor(level: LogLevel, loggerName: string) {
|
||||
super(level, loggerName);
|
||||
constructor(loggerName: string, level: LogLevel) {
|
||||
super(loggerName, level);
|
||||
}
|
||||
|
||||
log(level: LogLevel, ...args: any[]) {
|
||||
var message: string = "[" + level.name + "] " + this.loggerName + ": ";
|
||||
message += sprintf(String(args[0]), ...args.slice(1));
|
||||
emitMessage(level: LogLevel, message: string) {
|
||||
var output: string = `[${level.name}] ${this.loggerName}: ${message}`;
|
||||
if (level.shouldLogAtLevel(LogLevel.ERROR)) {
|
||||
errlog.log(message);
|
||||
errlog.log(output);
|
||||
} else {
|
||||
syslog.log(message);
|
||||
syslog.log(output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const level: LogLevel = !!process.env.DEBUG ? LogLevel.DEBUG : LogLevel.INFO;
|
||||
|
||||
LoggerFactory.setLoggerImplFactory({
|
||||
getLogger(loggerName: string): LegacyLogger {
|
||||
return new LegacyLogger(level, loggerName);
|
||||
}
|
||||
jsli.setLogBackend((loggerName) => {
|
||||
return new LegacyLogger(loggerName, level);
|
||||
});
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import uuid from 'uuid';
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('announcementrefresher');
|
||||
const LOGGER = require('@calzoneman/jsli')('announcementrefresher');
|
||||
|
||||
var SERVER;
|
||||
const SERVER_ANNOUNCEMENTS = 'serverAnnouncements';
|
||||
|
|
|
@ -2,9 +2,8 @@ import Promise from 'bluebird';
|
|||
import uuid from 'uuid';
|
||||
import { runLuaScript } from 'cytube-common/lib/redis/lualoader';
|
||||
import path from 'path';
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('partitionchannelindex');
|
||||
const LOGGER = require('@calzoneman/jsli')('partitionchannelindex');
|
||||
|
||||
var SERVER = null;
|
||||
const CHANNEL_INDEX = 'publicChannelList';
|
||||
|
|
|
@ -3,7 +3,6 @@ import { PartitionConfig } from './partitionconfig';
|
|||
import { PartitionDecider } from './partitiondecider';
|
||||
import { PartitionClusterClient } from '../io/cluster/partitionclusterclient';
|
||||
import RedisClientProvider from 'cytube-common/lib/redis/redisclientprovider';
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
import LegacyConfig from '../config';
|
||||
import path from 'path';
|
||||
import { AnnouncementRefresher } from './announcementrefresher';
|
||||
|
@ -11,7 +10,7 @@ import { RedisPartitionMapReloader } from './redispartitionmapreloader';
|
|||
|
||||
const PARTITION_CONFIG_PATH = path.resolve(__dirname, '..', '..', 'conf',
|
||||
'partitions.toml');
|
||||
const logger = LoggerFactory.getLogger('PartitionModule');
|
||||
const logger = require('@calzoneman/jsli')('PartitionModule');
|
||||
|
||||
class PartitionModule {
|
||||
constructor() {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { PartitionMap } from './partitionmap';
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
const logger = LoggerFactory.getLogger('RedisPartitionMapReloader');
|
||||
const logger = require('@calzoneman/jsli')('RedisPartitionMapReloader');
|
||||
|
||||
class RedisPartitionMapReloader extends EventEmitter {
|
||||
constructor(config, redisClient, subClient) {
|
||||
|
|
|
@ -4,9 +4,8 @@ var Config = require("./config");
|
|||
var Promise = require("bluebird");
|
||||
import * as ChannelStore from './channel-storage/channelstore';
|
||||
import { EventEmitter } from 'events';
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('server');
|
||||
const LOGGER = require('@calzoneman/jsli')('server');
|
||||
|
||||
module.exports = {
|
||||
init: function () {
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import https from 'https';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
import Promise from 'bluebird';
|
||||
|
||||
Promise.promisifyAll(fs);
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('torlist');
|
||||
const LOGGER = require('@calzoneman/jsli')('torlist');
|
||||
const TOR_EXIT_LIST_URL = 'https://check.torproject.org/exit-addresses';
|
||||
const TOR_EXIT_LIST_FILE = path.join(__dirname, '..', 'tor-exit-list.json');
|
||||
const ONE_DAY = 24 * 3600 * 1000;
|
||||
|
|
|
@ -6,10 +6,9 @@ var ACP = require("./acp");
|
|||
var Account = require("./account");
|
||||
var Flags = require("./flags");
|
||||
import { EventEmitter } from 'events';
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
import Logger from './logger';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('user');
|
||||
const LOGGER = require('@calzoneman/jsli')('user');
|
||||
|
||||
function User(socket) {
|
||||
var self = this;
|
||||
|
|
|
@ -14,9 +14,8 @@ var Server = require("../server");
|
|||
var session = require("../session");
|
||||
var csrf = require("./csrf");
|
||||
const url = require("url");
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('database/accounts');
|
||||
const LOGGER = require('@calzoneman/jsli')('database/accounts');
|
||||
|
||||
/**
|
||||
* Handles a GET request for /account/edit
|
||||
|
|
|
@ -15,9 +15,8 @@ var Config = require("../config");
|
|||
var url = require("url");
|
||||
var session = require("../session");
|
||||
var csrf = require("./csrf");
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('web/auth');
|
||||
const LOGGER = require('@calzoneman/jsli')('web/auth');
|
||||
|
||||
/**
|
||||
* Processes a login request. Sets a cookie upon successful authentication
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import CyTubeUtil from '../../utilities';
|
||||
import * as HTTPStatus from '../httpstatus';
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('web/routes/socketconfig');
|
||||
const LOGGER = require('@calzoneman/jsli')('web/routes/socketconfig');
|
||||
|
||||
export default function initialize(app, clusterClient) {
|
||||
app.get('/socketconfig/:channel.json', (req, res) => {
|
||||
|
|
|
@ -11,9 +11,8 @@ import csrf from './csrf';
|
|||
import * as HTTPStatus from './httpstatus';
|
||||
import { CSRFError, HTTPError } from '../errors';
|
||||
import counters from "../counters";
|
||||
import { LoggerFactory } from '@calzoneman/jsli';
|
||||
|
||||
const LOGGER = LoggerFactory.getLogger('webserver');
|
||||
const LOGGER = require('@calzoneman/jsli')('webserver');
|
||||
|
||||
function initializeLog(app) {
|
||||
const logFormat = ':real-address - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"';
|
||||
|
|
Loading…
Reference in a new issue