mirror of https://github.com/calzoneman/sync.git
Remove flow (not being used)
This commit is contained in:
parent
0bd11c3bba
commit
c90d9c0ddc
|
@ -2,7 +2,7 @@
|
||||||
"author": "Calvin Montgomery",
|
"author": "Calvin Montgomery",
|
||||||
"name": "CyTube",
|
"name": "CyTube",
|
||||||
"description": "Online media synchronizer and chat",
|
"description": "Online media synchronizer and chat",
|
||||||
"version": "3.57.1",
|
"version": "3.57.2",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "http://github.com/calzoneman/sync"
|
"url": "http://github.com/calzoneman/sync"
|
||||||
},
|
},
|
||||||
|
@ -62,11 +62,9 @@
|
||||||
"babel-plugin-add-module-exports": "^0.2.1",
|
"babel-plugin-add-module-exports": "^0.2.1",
|
||||||
"babel-plugin-transform-async-to-generator": "^6.24.1",
|
"babel-plugin-transform-async-to-generator": "^6.24.1",
|
||||||
"babel-plugin-transform-decorators-legacy": "^1.3.4",
|
"babel-plugin-transform-decorators-legacy": "^1.3.4",
|
||||||
"babel-plugin-transform-flow-strip-types": "^6.22.0",
|
|
||||||
"babel-preset-env": "^1.5.2",
|
"babel-preset-env": "^1.5.2",
|
||||||
"coffeescript": "^1.9.2",
|
"coffeescript": "^1.9.2",
|
||||||
"eslint": "^4.19.1",
|
"eslint": "^4.19.1",
|
||||||
"flow-bin": "^0.43.0",
|
|
||||||
"mocha": "^5.2.0",
|
"mocha": "^5.2.0",
|
||||||
"sinon": "^2.3.2"
|
"sinon": "^2.3.2"
|
||||||
},
|
},
|
||||||
|
@ -84,7 +82,6 @@
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"transform-async-to-generator",
|
"transform-async-to-generator",
|
||||||
"add-module-exports",
|
"add-module-exports",
|
||||||
"transform-flow-strip-types",
|
|
||||||
"transform-decorators-legacy"
|
"transform-decorators-legacy"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
// @flow
|
|
||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
import * as urlparse from 'url';
|
import * as urlparse from 'url';
|
||||||
import { CamoConfig } from './configuration/camoconfig';
|
|
||||||
|
|
||||||
const LOGGER = require('@calzoneman/jsli')('camo');
|
const LOGGER = require('@calzoneman/jsli')('camo');
|
||||||
|
|
||||||
function isWhitelisted(camoConfig: CamoConfig, url: string): boolean {
|
function isWhitelisted(camoConfig, url) {
|
||||||
const whitelistedDomains = camoConfig.getWhitelistedDomainsRegexp();
|
const whitelistedDomains = camoConfig.getWhitelistedDomainsRegexp();
|
||||||
const parsed = urlparse.parse(url);
|
const parsed = urlparse.parse(url);
|
||||||
return whitelistedDomains.test('.' + parsed.hostname);
|
return whitelistedDomains.test('.' + parsed.hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function camoify(camoConfig: CamoConfig, url: string): string {
|
export function camoify(camoConfig, url) {
|
||||||
if (typeof url !== 'string') {
|
if (typeof url !== 'string') {
|
||||||
throw new TypeError(`camoify expected a string, not [${url}]`);
|
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') {
|
if (typeof attribs.src === 'string') {
|
||||||
try {
|
try {
|
||||||
const oldSrc = attribs.src;
|
const oldSrc = attribs.src;
|
||||||
|
|
|
@ -1,18 +1,13 @@
|
||||||
// @flow
|
|
||||||
|
|
||||||
import { Database } from '../database';
|
|
||||||
import net from 'net';
|
import net from 'net';
|
||||||
|
|
||||||
const LOGGER = require('@calzoneman/jsli')('AliasesDB');
|
const LOGGER = require('@calzoneman/jsli')('AliasesDB');
|
||||||
|
|
||||||
class AliasesDB {
|
class AliasesDB {
|
||||||
db: Database;
|
constructor(db) {
|
||||||
|
|
||||||
constructor(db: Database) {
|
|
||||||
this.db = db;
|
this.db = db;
|
||||||
}
|
}
|
||||||
|
|
||||||
async addAlias(ip: string, name: string) {
|
async addAlias(ip, name) {
|
||||||
return this.db.runTransaction(async tx => {
|
return this.db.runTransaction(async tx => {
|
||||||
try {
|
try {
|
||||||
await tx.table('aliases')
|
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 => {
|
return this.db.runTransaction(async tx => {
|
||||||
const query = tx.table('aliases');
|
const query = tx.table('aliases');
|
||||||
if (net.isIP(ip)) {
|
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 => {
|
return this.db.runTransaction(async tx => {
|
||||||
const rows = await tx.table('aliases')
|
const rows = await tx.table('aliases')
|
||||||
.select('ip')
|
.select('ip')
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
// @flow
|
|
||||||
|
|
||||||
var fs = require("graceful-fs");
|
var fs = require("graceful-fs");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
import { Logger as JsliLogger, LogLevel } from '@calzoneman/jsli';
|
import { Logger as JsliLogger, LogLevel } from '@calzoneman/jsli';
|
||||||
|
@ -66,12 +64,12 @@ exports.syslog = syslog;
|
||||||
exports.eventlog = eventlog;
|
exports.eventlog = eventlog;
|
||||||
|
|
||||||
class LegacyLogger extends JsliLogger {
|
class LegacyLogger extends JsliLogger {
|
||||||
constructor(loggerName: string, level: LogLevel) {
|
constructor(loggerName, level) {
|
||||||
super(loggerName, level);
|
super(loggerName, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
emitMessage(level: LogLevel, message: string) {
|
emitMessage(level, message) {
|
||||||
var output: string = `[${level.name}] ${this.loggerName}: ${message}`;
|
var output = `[${level.name}] ${this.loggerName}: ${message}`;
|
||||||
if (level.shouldLogAtLevel(LogLevel.ERROR)) {
|
if (level.shouldLogAtLevel(LogLevel.ERROR)) {
|
||||||
errlog.log(output);
|
errlog.log(output);
|
||||||
} else {
|
} else {
|
||||||
|
@ -81,7 +79,7 @@ class LegacyLogger extends JsliLogger {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: allow reconfiguration of log level at runtime
|
// 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) => {
|
jsli.setLogBackend((loggerName) => {
|
||||||
return new LegacyLogger(loggerName, level);
|
return new LegacyLogger(loggerName, level);
|
||||||
|
|
Loading…
Reference in New Issue