From e3a9915b454b32e49d3871c94c839899f809520a Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Sun, 9 Feb 2020 16:50:37 -0800 Subject: [PATCH] Clean up a few things that no longer work/are no longer used --- src/channel/playlist.js | 19 +++++-------- src/main.js | 60 ----------------------------------------- src/switches.js | 1 - 3 files changed, 7 insertions(+), 73 deletions(-) diff --git a/src/channel/playlist.js b/src/channel/playlist.js index ca42964e..4c0477c0 100644 --- a/src/channel/playlist.js +++ b/src/channel/playlist.js @@ -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 }; } }; diff --git a/src/main.js b/src/main.js index b1b7522e..e1634697 100644 --- a/src/main.js +++ b/src/main.js @@ -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); - } } } diff --git a/src/switches.js b/src/switches.js index 5b76c10b..d77de051 100644 --- a/src/switches.js +++ b/src/switches.js @@ -1,5 +1,4 @@ const switches = { - plDirtyCheck: true, ytCache: true };