Remove flow (not being used)
This commit is contained in:
parent
0bd11c3bba
commit
c90d9c0ddc
4 changed files with 12 additions and 24 deletions
|
|
@ -1,17 +1,15 @@
|
|||
// @flow
|
||||
import crypto from 'crypto';
|
||||
import * as urlparse from 'url';
|
||||
import { CamoConfig } from './configuration/camoconfig';
|
||||
|
||||
const LOGGER = require('@calzoneman/jsli')('camo');
|
||||
|
||||
function isWhitelisted(camoConfig: CamoConfig, url: string): boolean {
|
||||
function isWhitelisted(camoConfig, url) {
|
||||
const whitelistedDomains = camoConfig.getWhitelistedDomainsRegexp();
|
||||
const parsed = urlparse.parse(url);
|
||||
return whitelistedDomains.test('.' + parsed.hostname);
|
||||
}
|
||||
|
||||
export function camoify(camoConfig: CamoConfig, url: string): string {
|
||||
export function camoify(camoConfig, url) {
|
||||
if (typeof url !== 'string') {
|
||||
throw new TypeError(`camoify expected a string, not [${url}]`);
|
||||
}
|
||||
|
|
@ -33,7 +31,7 @@ export function camoify(camoConfig: CamoConfig, url: string): string {
|
|||
}
|
||||
}
|
||||
|
||||
export function transformImgTags(camoConfig: CamoConfig, tagName: string, attribs: Object) {
|
||||
export function transformImgTags(camoConfig, tagName, attribs) {
|
||||
if (typeof attribs.src === 'string') {
|
||||
try {
|
||||
const oldSrc = attribs.src;
|
||||
|
|
|
|||
|
|
@ -1,18 +1,13 @@
|
|||
// @flow
|
||||
|
||||
import { Database } from '../database';
|
||||
import net from 'net';
|
||||
|
||||
const LOGGER = require('@calzoneman/jsli')('AliasesDB');
|
||||
|
||||
class AliasesDB {
|
||||
db: Database;
|
||||
|
||||
constructor(db: Database) {
|
||||
constructor(db) {
|
||||
this.db = db;
|
||||
}
|
||||
|
||||
async addAlias(ip: string, name: string) {
|
||||
async addAlias(ip, name) {
|
||||
return this.db.runTransaction(async tx => {
|
||||
try {
|
||||
await tx.table('aliases')
|
||||
|
|
@ -27,7 +22,7 @@ class AliasesDB {
|
|||
});
|
||||
}
|
||||
|
||||
async getAliasesByIP(ip: string): Promise<Array<string>> {
|
||||
async getAliasesByIP(ip) {
|
||||
return this.db.runTransaction(async tx => {
|
||||
const query = tx.table('aliases');
|
||||
if (net.isIP(ip)) {
|
||||
|
|
@ -45,7 +40,7 @@ class AliasesDB {
|
|||
});
|
||||
}
|
||||
|
||||
async getIPsByName(name: string): Promise<Array<string>> {
|
||||
async getIPsByName(name) {
|
||||
return this.db.runTransaction(async tx => {
|
||||
const rows = await tx.table('aliases')
|
||||
.select('ip')
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
// @flow
|
||||
|
||||
var fs = require("graceful-fs");
|
||||
var path = require("path");
|
||||
import { Logger as JsliLogger, LogLevel } from '@calzoneman/jsli';
|
||||
|
|
@ -66,12 +64,12 @@ exports.syslog = syslog;
|
|||
exports.eventlog = eventlog;
|
||||
|
||||
class LegacyLogger extends JsliLogger {
|
||||
constructor(loggerName: string, level: LogLevel) {
|
||||
constructor(loggerName, level) {
|
||||
super(loggerName, level);
|
||||
}
|
||||
|
||||
emitMessage(level: LogLevel, message: string) {
|
||||
var output: string = `[${level.name}] ${this.loggerName}: ${message}`;
|
||||
emitMessage(level, message) {
|
||||
var output = `[${level.name}] ${this.loggerName}: ${message}`;
|
||||
if (level.shouldLogAtLevel(LogLevel.ERROR)) {
|
||||
errlog.log(output);
|
||||
} else {
|
||||
|
|
@ -81,7 +79,7 @@ class LegacyLogger extends JsliLogger {
|
|||
}
|
||||
|
||||
// TODO: allow reconfiguration of log level at runtime
|
||||
const level: LogLevel = process.env.DEBUG ? LogLevel.DEBUG : LogLevel.INFO;
|
||||
const level = process.env.DEBUG ? LogLevel.DEBUG : LogLevel.INFO;
|
||||
|
||||
jsli.setLogBackend((loggerName) => {
|
||||
return new LegacyLogger(loggerName, level);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue