Clean up a few things that no longer work/are no longer used

This commit is contained in:
Calvin Montgomery 2020-02-09 16:50:37 -08:00
parent b80a532f9e
commit e3a9915b45
3 changed files with 7 additions and 73 deletions

View file

@ -10,7 +10,6 @@ var CustomEmbedFilter = require("../customembed").filter;
var XSS = require("../xss");
import counters from '../counters';
import { Counter } from 'prom-client';
import * as Switches from '../switches';
const LOGGER = require('@calzoneman/jsli')('playlist');
@ -118,7 +117,7 @@ PlaylistModule.prototype = Object.create(ChannelModule.prototype);
Object.defineProperty(PlaylistModule.prototype, "dirty", {
get() {
return this._positionDirty || this._listDirty || !Switches.isActive("plDirtyCheck");
return this._positionDirty || this._listDirty;
},
set(val) {
@ -214,17 +213,13 @@ PlaylistModule.prototype.save = function (data) {
time = this.current.media.currentTime;
}
if (Switches.isActive("plDirtyCheck")) {
data.playlistPosition = {
index: pos,
time
};
data.playlistPosition = {
index: pos,
time
};
if (this._listDirty) {
data.playlist = { pl: arr, pos, time, externalPosition: true };
}
} else {
data.playlist = { pl: arr, pos, time };
if (this._listDirty) {
data.playlist = { pl: arr, pos, time, externalPosition: true };
}
};

View file

@ -1,6 +1,5 @@
import Config from './config';
import * as Switches from './switches';
import { isIP as validIP } from 'net';
import { eventlog } from './logger';
require('source-map-support').install();
@ -21,8 +20,6 @@ if (!Config.get('debug')) {
});
}
let profileName = null;
// TODO: this can probably just be part of servsock.js
// servsock should also be refactored to send replies instead of
// relying solely on tailing logs
@ -44,29 +41,6 @@ function handleLine(line) {
}
} else if (line.indexOf('/reload-partitions') === 0) {
sv.reloadPartitionMap();
} else if (line.indexOf('/globalban') === 0) {
const args = line.split(/\s+/); args.shift();
if (args.length >= 2 && validIP(args[0]) !== 0) {
const ip = args.shift();
const comment = args.join(' ');
// TODO: this is broken by the knex refactoring
require('./database').globalBanIP(ip, comment, function (err, _res) {
if (!err) {
eventlog.log('[acp] ' + 'SYSTEM' + ' global banned ' + ip);
}
});
}
} else if (line.indexOf('/unglobalban') === 0) {
var args = line.split(/\s+/); args.shift();
if (args.length >= 1 && validIP(args[0]) !== 0) {
var ip = args.shift();
// TODO: this is broken by the knex refactoring
require('./database').globalUnbanIP(ip, function (err, _res) {
if (!err) {
eventlog.log('[acp] ' + 'SYSTEM' + ' un-global banned ' + ip);
}
});
}
} else if (line.indexOf('/save') === 0) {
sv.forceSave();
} else if (line.indexOf('/unloadchan') === 0) {
@ -83,40 +57,6 @@ function handleLine(line) {
}
} else if (line.indexOf('/reloadcert') === 0) {
sv.reloadCertificateData();
} else if (line.indexOf('/profile') === 0) {
try {
const fs = require('fs');
const path = require('path');
const profiler = require('v8-profiler');
if (profileName !== null) {
const filename = path.resolve(
__dirname,
'..',
`${profileName}.cpuprofile`
);
const profile = profiler.stopProfiling(profileName);
profileName = null;
const stream = profile.export();
stream.on('error', error => {
LOGGER.error('Error exporting profile: %s', error);
profile.delete();
});
stream.on('finish', () => {
LOGGER.info('Exported profile to %s', filename);
profile.delete();
});
stream.pipe(fs.createWriteStream(filename));
} else {
profileName = `prof_${Date.now()}`;
profiler.startProfiling(profileName, true);
LOGGER.info('Started CPU profile');
}
} catch (error) {
LOGGER.error('Unable to record CPU profile: %s', error);
}
}
}

View file

@ -1,5 +1,4 @@
const switches = {
plDirtyCheck: true,
ytCache: true
};