From c90d9c0ddc5dcda12f5a271e7b40fa8cfb28b074 Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Mon, 27 Aug 2018 21:48:13 -0700 Subject: [PATCH] Remove flow (not being used) --- package.json | 5 +---- src/camo.js | 8 +++----- src/db/aliases.js | 13 ++++--------- src/logger.js | 10 ++++------ 4 files changed, 12 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index b0d73b02..363cdf6f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.57.1", + "version": "3.57.2", "repository": { "url": "http://github.com/calzoneman/sync" }, @@ -62,11 +62,9 @@ "babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-transform-async-to-generator": "^6.24.1", "babel-plugin-transform-decorators-legacy": "^1.3.4", - "babel-plugin-transform-flow-strip-types": "^6.22.0", "babel-preset-env": "^1.5.2", "coffeescript": "^1.9.2", "eslint": "^4.19.1", - "flow-bin": "^0.43.0", "mocha": "^5.2.0", "sinon": "^2.3.2" }, @@ -84,7 +82,6 @@ "plugins": [ "transform-async-to-generator", "add-module-exports", - "transform-flow-strip-types", "transform-decorators-legacy" ] } diff --git a/src/camo.js b/src/camo.js index 61a8bb1e..37c7f956 100644 --- a/src/camo.js +++ b/src/camo.js @@ -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; diff --git a/src/db/aliases.js b/src/db/aliases.js index d2149567..2e3ddc64 100644 --- a/src/db/aliases.js +++ b/src/db/aliases.js @@ -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> { + 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> { + async getIPsByName(name) { return this.db.runTransaction(async tx => { const rows = await tx.table('aliases') .select('ip') diff --git a/src/logger.js b/src/logger.js index 2c68f4f9..fc8caca0 100644 --- a/src/logger.js +++ b/src/logger.js @@ -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);