Browse Source

chore: Removed some commented code

Owen Diffey 3 years ago
parent
commit
5cf0c8ca2b
43 changed files with 2 additions and 1248 deletions
  1. 0 18
      backend/core.js
  2. 0 206
      backend/index.js
  3. 0 46
      backend/logic/actions/playlists.js
  4. 0 75
      backend/logic/actions/songs.js
  5. 0 48
      backend/logic/actions/stations.js
  6. 0 5
      backend/logic/actions/utils.js
  7. 0 136
      backend/logic/api.js
  8. 0 12
      backend/logic/cache/index.js
  9. 0 43
      backend/logic/db/index.js
  10. 0 1
      backend/logic/mail/index.js
  11. 0 2
      backend/logic/mail/schemas/passwordRequest.js
  12. 0 2
      backend/logic/mail/schemas/resetPasswordRequest.js
  13. 0 2
      backend/logic/migration/index.js
  14. 0 5
      backend/logic/migration/migrations/migration1.js
  15. 0 1
      backend/logic/migration/migrations/migration3.js
  16. 0 22
      backend/logic/migration/migrations/migration5.js
  17. 0 1
      backend/logic/migration/migrations/migration8.js
  18. 0 1
      backend/logic/migration/migrations/migration9.js
  19. 0 6
      backend/logic/notifications.js
  20. 0 87
      backend/logic/playlists.js
  21. 0 48
      backend/logic/songs.js
  22. 0 89
      backend/logic/stations.js
  23. 0 10
      backend/logic/tasks.js
  24. 0 10
      backend/logic/utils.js
  25. 0 2
      backend/logic/ws.js
  26. 0 4
      backend/logic/youtube.js
  27. 0 16
      frontend/src/App.vue
  28. 0 1
      frontend/src/components/modals/EditPlaylist/Tabs/Settings.vue
  29. 0 15
      frontend/src/components/modals/EditPlaylist/index.vue
  30. 1 264
      frontend/src/components/modals/EditSong/index.vue
  31. 0 8
      frontend/src/components/modals/ImportAlbum.vue
  32. 0 2
      frontend/src/components/modals/ViewReport.vue
  33. 0 1
      frontend/src/pages/Admin/tabs/HiddenSongs.vue
  34. 0 6
      frontend/src/pages/Admin/tabs/Playlists.vue
  35. 0 2
      frontend/src/pages/Admin/tabs/Punishments.vue
  36. 0 11
      frontend/src/pages/Admin/tabs/Reports.vue
  37. 0 1
      frontend/src/pages/Admin/tabs/Statistics.vue
  38. 0 1
      frontend/src/pages/Admin/tabs/UnverifiedSongs.vue
  39. 0 1
      frontend/src/pages/Admin/tabs/VerifiedSongs.vue
  40. 0 1
      frontend/src/pages/Home.vue
  41. 0 23
      frontend/src/pages/Station/index.vue
  42. 1 11
      frontend/src/store/modules/modals/importAlbum.js
  43. 0 2
      frontend/src/ws.js

+ 0 - 18
backend/core.js

@@ -141,7 +141,6 @@ class Queue {
 	_handleQueue() {
 		if (this.queue.length > 0) {
 			const task = this.queue.reduce((a, b) => (a.priority < b.priority ? a : b));
-			// console.log(`First task: `, task);
 			if (task) {
 				if ((!this.paused && this.runningTasks.length < this.concurrency) || task.priority === -1) {
 					this.queue.remove(task);
@@ -204,7 +203,6 @@ class Job {
 	 * @param {string} status - the new status
 	 */
 	setStatus(status) {
-		// console.log(`Job ${this.toString()} has changed status from ${this.status} to ${status}`);
 		this.status = status;
 	}
 
@@ -309,7 +307,6 @@ export default class CoreClass {
 	constructor(name, options) {
 		this.name = name;
 		this.status = "UNINITIALIZED";
-		// this.log("Core constructor");
 		this.concurrency = options && options.concurrency ? options.concurrency : 10;
 		this.jobQueue = new Queue((job, options) => this._runJob(job, options), this.concurrency);
 		this.jobQueue.pause();
@@ -491,11 +488,6 @@ export default class CoreClass {
 				);
 				_parentJob.setStatus("WAITING_ON_CHILD_JOB");
 				_parentJob.module.jobQueue.pauseRunningJob(_parentJob);
-				// console.log(111, _parentJob.module.jobQueue.length());
-				// console.log(
-				// 	222,
-				// 	_parentJob.module.jobQueue.workersList().map(data => data.data.job)
-				// );
 			} else {
 				this.log(
 					"INFO",
@@ -504,14 +496,8 @@ export default class CoreClass {
 			}
 		}
 
-		// console.log(this);
-
-		// console.log(321, _parentJob);
-
 		job.setStatus("QUEUED");
 
-		// if (options.bypassQueue) this._runJob(job, options, () => {});
-		// else {
 		let calculatedPriority = null;
 		if (_priority) calculatedPriority = _priority;
 		else if (this.priorities[name]) calculatedPriority = this.priorities[name];
@@ -529,8 +515,6 @@ export default class CoreClass {
 			this.moduleManager.debugJobs.all.push({ job, _priority });
 		}
 
-		// }
-
 		return deferredPromise.promise;
 	}
 
@@ -585,7 +569,6 @@ export default class CoreClass {
 								response
 							});
 						}
-						// job.onFinish.resolve(response);
 					})
 					.catch(error => {
 						this.log("INFO", `Running job ${job.name} (${job.toString()}) failed`);
@@ -605,7 +588,6 @@ export default class CoreClass {
 								error
 							});
 						}
-						// job.onFinish.reject(error);
 					})
 					.finally(() => {
 						const endTime = Date.now();

+ 0 - 206
backend/index.js

@@ -46,184 +46,6 @@ if (config.debug && config.debug.traceUnhandledPromises === true) {
 	import("trace-unhandled/register");
 }
 
-// class ModuleManager {
-// 	constructor() {
-// 		this.modules = {};
-// 		this.modulesInitialized = 0;
-// 		this.totalModules = 0;
-// 		this.modulesLeft = [];
-// 		this.i = 0;
-// 		this.lockdown = false;
-// 		this.fancyConsole = fancyConsole;
-// 	}
-
-// 	addModule(moduleName) {
-// 		console.log("add module", moduleName);
-// 		const moduleClass = new require(`./logic/${moduleName}`);
-// 		this.modules[moduleName] = new moduleClass(moduleName, this);
-// 		this.totalModules++;
-// 		this.modulesLeft.push(moduleName);
-// 	}
-
-// 	initialize() {
-// 		if (!this.modules["logger"]) return console.error("There is no logger module");
-// 		this.logger = this.modules["logger"];
-// 		if (this.fancyConsole) {
-// 			this.replaceConsoleWithLogger();
-// 			this.logger.reservedLines = Object.keys(this.modules).length + 5;
-// 		}
-
-// 		for (let moduleName in this.modules) {
-// 			let module = this.modules[moduleName];
-// 			if (this.lockdown) break;
-
-// 			module._onInitialize().then(() => {
-// 				this.moduleInitialized(moduleName);
-// 			});
-
-// 			let dependenciesInitializedPromises = [];
-
-// 			module.dependsOn.forEach(dependencyName => {
-// 				let dependency = this.modules[dependencyName];
-// 				dependenciesInitializedPromises.push(dependency._onInitialize());
-// 			});
-
-// 			module.lastTime = Date.now();
-
-// 			Promise.all(dependenciesInitializedPromises).then((res, res2) => {
-// 				if (this.lockdown) return;
-// 				this.logger.info("MODULE_MANAGER", `${moduleName} dependencies have been completed`);
-// 				module._initialize();
-// 			});
-// 		}
-// 	}
-
-// 	async printStatus() {
-// 		try { await Promise.race([this.logger._onInitialize(), this.logger._isInitialized()]); } catch { return; }
-// 		if (!this.fancyConsole) return;
-
-// 		let colors = this.logger.colors;
-
-// 		const rows = process.stdout.rows;
-
-// 		process.stdout.cursorTo(0, rows - this.logger.reservedLines);
-// 		process.stdout.clearScreenDown();
-
-// 		process.stdout.cursorTo(0, (rows - this.logger.reservedLines) + 2);
-
-// 		process.stdout.write(`${colors.FgYellow}Modules${colors.FgWhite}:\n`);
-
-// 		for (let moduleName in this.modules) {
-// 			let module = this.modules[moduleName];
-// 			let tabsAmount = Math.max(0, Math.ceil(2 - (moduleName.length / 8)));
-
-// 			let tabs = Array(tabsAmount).fill(`\t`).join("");
-
-// 			let timing = module.timeDifferences.map((timeDifference) => {
-// 				return `${colors.FgMagenta}${timeDifference}${colors.FgCyan}ms${colors.FgWhite}`;
-// 			}).join(", ");
-
-// 			let stateColor;
-// 			if (module.state === "NOT_INITIALIZED") stateColor = colors.FgWhite;
-// 			else if (module.state === "INITIALIZED") stateColor = colors.FgGreen;
-// 			else if (module.state === "LOCKDOWN" && !module.failed) stateColor = colors.FgRed;
-// 			else if (module.state === "LOCKDOWN" && module.failed) stateColor = colors.FgMagenta;
-// 			else stateColor = colors.FgYellow;
-
-// 			process.stdout.write(`${moduleName}${tabs}${stateColor}${module.state}\t${colors.FgYellow}Stage: ${colors.FgRed}${module.stage}${colors.FgWhite}. ${colors.FgYellow}Timing${colors.FgWhite}: [${timing}]${colors.FgWhite}${colors.FgWhite}. ${colors.FgYellow}Total time${colors.FgWhite}: ${colors.FgRed}${module.totalTimeInitialize}${colors.FgCyan}ms${colors.Reset}\n`);
-// 		}
-// 	}
-
-// 	moduleInitialized(moduleName) {
-// 		this.modulesInitialized++;
-// 		this.modulesLeft.splice(this.modulesLeft.indexOf(moduleName), 1);
-
-// 		this.logger.info("MODULE_MANAGER", `Initialized: ${this.modulesInitialized}/${this.totalModules}.`);
-
-// 		if (this.modulesLeft.length === 0) this.allModulesInitialized();
-// 	}
-
-// 	allModulesInitialized() {
-// 		this.logger.success("MODULE_MANAGER", "All modules have started!");
-// 	}
-
-// 	aModuleFailed(failedModule) {
-// 		this.logger.error("MODULE_MANAGER", `A module has failed, locking down. Module: ${failedModule.name}`);
-
-// 		this._lockdown();
-// 	}
-
-// 	replaceConsoleWithLogger() {
-// 		this.oldConsole = {
-// 			log: console.log,
-// 			debug: console.debug,
-// 			info: console.info,
-// 			warn: console.warn,
-// 			error: console.error
-// 		};
-// 		console.log = (...args) => this.logger.debug(args.map(arg => util.format(arg)));
-// 		console.debug = (...args) => this.logger.debug(args.map(arg => util.format(arg)));
-// 		console.info = (...args) => this.logger.debug(args.map(arg => util.format(arg)));
-// 		console.warn = (...args) => this.logger.debug(args.map(arg => util.format(arg)));
-// 		console.error = (...args) => this.logger.error("CONSOLE", args.map(arg => util.format(arg)));
-// 	}
-
-// 	replaceLoggerWithConsole() {
-// 		console.log = this.oldConsole.log;
-// 		console.debug = this.oldConsole.debug;
-// 		console.info = this.oldConsole.info;
-// 		console.warn = this.oldConsole.warn;
-// 		console.error = this.oldConsole.error;
-// 	}
-
-// 	_lockdown() {
-// 		this.lockdown = true;
-
-// 		for (let moduleName in this.modules) {
-// 			let module = this.modules[moduleName];
-// 			if (module.lockdownImmune) continue;
-// 			module._lockdown();
-// 		}
-// 	}
-// }
-
-// const moduleManager = new ModuleManager();
-
-// module.exports = moduleManager;
-
-// moduleManager.addModule("cache");
-// moduleManager.addModule("db");
-// moduleManager.addModule("mail");
-// moduleManager.addModule("api");
-// moduleManager.addModule("app");
-// moduleManager.addModule("ws");
-// moduleManager.addModule("logger");
-// moduleManager.addModule("notifications");
-// moduleManager.addModule("activities");
-// moduleManager.addModule("playlists");
-// moduleManager.addModule("punishments");
-// moduleManager.addModule("songs");
-// moduleManager.addModule("stations");
-// moduleManager.addModule("tasks");
-// moduleManager.addModule("utils");
-
-// moduleManager.initialize();
-
-// process.stdin.on("data", function (data) {
-//     if(data.toString() === "lockdown\r\n"){
-//         console.log("Locking down.");
-//        	moduleManager._lockdown();
-//     }
-// });
-
-// if (fancyConsole) {
-// 	const rows = process.stdout.rows;
-
-// 	for(let i = 0; i < rows; i++) {
-// 		process.stdout.write("\n");
-// 	}
-// }
-
 class JobManager {
 	// eslint-disable-next-line require-jsdoc
 	constructor() {
@@ -291,14 +113,6 @@ class ModuleManager {
 	 */
 	async addModule(moduleName) {
 		this.log("INFO", "Adding module", moduleName);
-		// import(`./logic/${moduleName}`).then(Module => {
-		// 	// eslint-disable-next-line new-cap
-
-		// 	const instantiatedModule = new Module.default();
-		// 	this.modules[moduleName] = instantiatedModule;
-		// 	this.modulesNotInitialized.push(instantiatedModule);
-		// 	if (moduleName === "cache") console.log(56, this.modules);
-		// });
 
 		this.modules[moduleName] = import(`./logic/${moduleName}`);
 	}
@@ -308,12 +122,7 @@ class ModuleManager {
 	 *
 	 */
 	async initialize() {
-		// if (!this.modules["logger"]) return console.error("There is no logger module");
-		// this.logger = this.modules["logger"];
-		// if (this.fancyConsole) {
-		// this.replaceConsoleWithLogger();
 		this.reservedLines = Object.keys(this.modules).length + 5;
-		// }
 
 		await Promise.all(Object.values(this.modules)).then(modules => {
 			for (let module = 0; module < modules.length; module += 1) {
@@ -331,20 +140,6 @@ class ModuleManager {
 
 			module._initialize();
 
-			// let dependenciesInitializedPromises = [];
-
-			// module.dependsOn.forEach(dependencyName => {
-			// 	let dependency = this.modules[dependencyName];
-			// 	dependenciesInitializedPromises.push(dependency._onInitialize());
-			// });
-
-			// module.lastTime = Date.now();
-
-			// Promise.all(dependenciesInitializedPromises).then((res, res2) => {
-			// 	if (this.lockdown) return;
-			// 	this.logger.info("MODULE_MANAGER", `${moduleName} dependencies have been completed`);
-			// 	module._initialize();
-			// });
 			return true;
 		});
 	}
@@ -500,7 +295,6 @@ process.stdin.on("data", data => {
 				}. Stage: ${module.getStage()}`
 			);
 		});
-		// moduleManager._lockdown();
 	}
 	if (command.startsWith("running")) {
 		const parts = command.split(" ");

+ 0 - 46
backend/logic/actions/playlists.js

@@ -1359,7 +1359,6 @@ export default {
 	 * @param {Function} cb - gets called with the result
 	 */
 	remove: isLoginRequired(async function remove(session, playlistId, cb) {
-		// const stationModel = await DBModule.runJob("GET_MODEL", { modelName: "station" }, this);
 		const userModel = await DBModule.runJob("GET_MODEL", { modelName: "user" }, this);
 
 		async.waterfall(
@@ -1388,51 +1387,6 @@ export default {
 						.then(() => next(null, playlist))
 						.catch(next);
 				}
-
-				// (playlist, next) => {
-				// 	stationModel.find({ privatePlaylist: playlistId }, (err, res) => {
-				// 		next(err, playlist, res);
-				// 	});
-				// },
-
-				// (playlist, stations, next) => {
-				// 	async.each(
-				// 		stations,
-				// 		(station, next) => {
-				// 			async.waterfall(
-				// 				[
-				// 					next => {
-				// 						stationModel.updateOne(
-				// 							{ _id: station._id },
-				// 							{ $set: { privatePlaylist: null } },
-				// 							{ runValidators: true },
-				// 							next
-				// 						);
-				// 					},
-
-				// 					(res, next) => {
-				// 						if (!station.partyMode) {
-				// 							moduleManager.modules.stations
-				// 								.runJob("UPDATE_STATION", { stationId: station._id }, this)
-				// 								.then(station => next(null, station))
-				// 								.catch(next);
-				// 							CacheModule.runJob("PUB", {
-				// 								channel: "privatePlaylist.selected",
-				// 								value: {
-				// 									playlistId: null,
-				// 									stationId: station._id
-				// 								}
-				// 							});
-				// 						} else next();
-				// 					}
-				// 				],
-
-				// 				() => next()
-				// 			);
-				// 		},
-				// 		() => next(null, playlist)
-				// 	);
-				// }
 			],
 			async (err, playlist) => {
 				if (err) {

+ 0 - 75
backend/logic/actions/songs.js

@@ -891,81 +891,6 @@ export default {
 		);
 	}),
 
-	// /**
-	//  * Adds a song
-	//  *
-	//  * @param session
-	//  * @param song - the song object
-	//  * @param cb
-	//  */
-	// add: isAdminRequired(async function add(session, song, cb) {
-	// 	const SongModel = await DBModule.runJob("GET_MODEL", { modelName: "song" }, this);
-	// 	async.waterfall(
-	// 		[
-	// 			next => {
-	// 				SongModel.findOne({ youtubeId: song.youtubeId }, next);
-	// 			},
-
-	// 			(existingSong, next) => {
-	// 				if (existingSong) return next("Song is already in rotation.");
-	// 				return next();
-	// 			},
-
-	// 			next => {
-	// 				const newSong = new SongModel(song);
-	// 				newSong.verifiedBy = session.userId;
-	// 				newSong.verifiedAt = Date.now();
-	// 				newSong.save(next);
-	// 			},
-
-	// 			(res, next) => {
-	// 				this.module
-	// 					.runJob(
-	// 						"RUN_ACTION2",
-	// 						{
-	// 							session,
-	// 							namespace: "queueSongs",
-	// 							action: "remove",
-	// 							args: [song._id]
-	// 						},
-	// 						this
-	// 					)
-	// 					.finally(() => {
-	// 						song.genres.forEach(genre => {
-	// 							PlaylistsModule.runJob("AUTOFILL_GENRE_PLAYLIST", { genre })
-	// 								.then(() => {})
-	// 								.catch(() => {});
-	// 						});
-
-	// 						next();
-	// 					});
-	// 			}
-	// 		],
-	// 		async err => {
-	// 			if (err) {
-	// 				err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
-
-	// 				this.log("ERROR", "SONGS_ADD", `User "${session.userId}" failed to add song. "${err}"`);
-
-	// 				return cb({ status: "error", message: err });
-	// 			}
-
-	// 			this.log("SUCCESS", "SONGS_ADD", `User "${session.userId}" successfully added song "${song.youtubeId}".`);
-
-	// 			CacheModule.runJob("PUB", {
-	// 				channel: "song.added",
-	// 				value: song.youtubeId
-	// 			});
-
-	// 			return cb({
-	// 				status: "success",
-	// 				message: "Song has been moved from the queue successfully."
-	// 			});
-	// 		}
-	// 	);
-	// 	// TODO Check if video is in queue and Add the song to the appropriate stations
-	// }),
-
 	/**
 	 * Likes a song
 	 *

+ 0 - 48
backend/logic/actions/stations.js

@@ -144,25 +144,6 @@ CacheModule.runJob("SUB", {
 	}
 });
 
-// CacheModule.runJob("SUB", {
-// 	channel: "privatePlaylist.selected",
-// 	cb: data => {
-// 		WSModule.runJob("EMIT_TO_ROOM", {
-// 			room: `station.${data.stationId}`,
-// 			args: ["event:privatePlaylist.selected", {data: {playlistId: data.playlistId}}]
-// 		});
-// 	}
-// });
-
-// CacheModule.runJob("SUB", {
-// 	channel: "privatePlaylist.deselected",
-// 	cb: data => {
-// 		WSModule.runJob("EMIT_TO_ROOM", {
-// 			room: `station.${data.stationId}`,
-// 			args: ["event:privatePlaylist.deselected"]
-// 		});
-// 	}
-// });
 
 CacheModule.runJob("SUB", {
 	channel: "station.includedPlaylist",
@@ -894,11 +875,8 @@ export default {
 						partyMode: station.partyMode,
 						playMode: station.playMode,
 						owner: station.owner,
-						// privatePlaylist: station.privatePlaylist,
 						includedPlaylists: station.includedPlaylists,
 						excludedPlaylists: station.excludedPlaylists,
-						// genres: station.genres,
-						// blacklistedGenres: station.blacklistedGenres,
 						theme: station.theme
 					};
 
@@ -1025,9 +1003,6 @@ export default {
 						partyMode: station.partyMode,
 						playMode: station.playMode,
 						owner: station.owner,
-						// privatePlaylist: station.privatePlaylist,
-						// genres: station.genres,
-						// blacklistedGenres: station.blacklistedGenres,
 						theme: station.theme,
 						paused: station.paused,
 						currentSong: station.currentSong
@@ -3113,14 +3088,6 @@ export default {
 						.then(station => next(null, station))
 						.catch(next);
 				}
-
-				// (res, next) => {
-				// 	StationsModule.runJob("UPDATE_STATION", { stationId }, this)
-				// 		.then(station => {
-				// 			next(null, station);
-				// 		})
-				// 		.catch(next);
-				// }
 			],
 			async err => {
 				if (err) {
@@ -3687,14 +3654,6 @@ export default {
 
 				PlaylistsModule.runJob("AUTOFILL_STATION_PLAYLIST", { stationId }).then().catch();
 
-				// CacheModule.runJob("PUB", {
-				// 	channel: "privatePlaylist.selected",
-				// 	value: {
-				// 		playlistId,
-				// 		stationId
-				// 	}
-				// });
-
 				return cb({
 					status: "success",
 					message: "Successfully selected playlist."
@@ -3761,13 +3720,6 @@ export default {
 
 				PlaylistsModule.runJob("AUTOFILL_STATION_PLAYLIST", { stationId }).then().catch();
 
-				// CacheModule.runJob("PUB", {
-				// 	channel: "privatePlaylist.deselected",
-				// 	value: {
-				// 		stationId
-				// 	}
-				// });
-
 				return cb({
 					status: "success",
 					message: "Successfully deselected playlist."

+ 0 - 5
backend/logic/actions/utils.js

@@ -16,7 +16,6 @@ export default {
 				},
 
 				(modules, next) => {
-					// this.log(modules, next);
 					next(
 						null,
 						Object.keys(modules).map(moduleName => {
@@ -59,7 +58,6 @@ export default {
 				}
 			],
 			async (err, module) => {
-				// this.log(module.runningJobs);
 				if (err && err !== true) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "GET_MODULE", `User ${session.userId} failed to get module. '${err}'`);
@@ -70,9 +68,6 @@ export default {
 						status: "success",
 						message: "Successfully got module info.",
 						data: {
-							// runningTasks: module.jobQueue.runningTasks,
-							// pausedTasks: module.jobQueue.pausedTasks,
-							// queuedTasks: module.jobQueue.queue,
 							jobStatistics: module.jobStatistics
 						}
 					});

+ 0 - 136
backend/logic/api.js

@@ -1,25 +1,19 @@
 import config from "config";
 
 import async from "async";
-// import crypto from "crypto";
 
 import CoreClass from "../core";
 
-// let APIModule;
 let AppModule;
-// let DBModule;
 let PlaylistsModule;
 let UtilsModule;
 let PunishmentsModule;
 let CacheModule;
-// let NotificationsModule;
 
 class _APIModule extends CoreClass {
 	// eslint-disable-next-line require-jsdoc
 	constructor() {
 		super("api");
-
-		// APIModule = this;
 	}
 
 	/**
@@ -30,12 +24,10 @@ class _APIModule extends CoreClass {
 	initialize() {
 		return new Promise((resolve, reject) => {
 			AppModule = this.moduleManager.modules.app;
-			// DBModule = this.moduleManager.modules.db;
 			PlaylistsModule = this.moduleManager.modules.playlists;
 			UtilsModule = this.moduleManager.modules.utils;
 			PunishmentsModule = this.moduleManager.modules.punishments;
 			CacheModule = this.moduleManager.modules.cache;
-			// NotificationsModule = this.moduleManager.modules.notifications;
 
 			const SIDname = config.get("cookie.SIDname");
 
@@ -140,134 +132,6 @@ class _APIModule extends CoreClass {
 							});
 					});
 
-					// response.app.get("/debug_station", async (req, res) => {
-					// 	const responseObject = {};
-
-					// 	const stationModel = await DBModule.runJob("GET_MODEL", {
-					// 		modelName: "station"
-					// 	});
-
-					// 	async.waterfall(
-					// 		[
-					// 			next => {
-					// 				stationModel.find({}, next);
-					// 			},
-
-					// 			(stations, next) => {
-					// 				responseObject.mongo = {
-					// 					stations
-					// 				};
-					// 				next();
-					// 			},
-
-					// 			next => {
-					// 				CacheModule.runJob("HGETALL", { table: "stations" })
-					// 					.then(stations => {
-					// 						next(null, stations);
-					// 					})
-					// 					.catch(err => {
-					// 						console.log(err);
-					// 						next(err);
-					// 					});
-					// 			},
-
-					// 			(stations, next) => {
-					// 				responseObject.redis = {
-					// 					stations
-					// 				};
-					// 				next();
-					// 			},
-
-					// 			next => {
-					// 				responseObject.cryptoExamples = {};
-					// 				responseObject.mongo.stations.forEach(station => {
-					// 					const payloadName = `stations.nextSong?id=${station._id}`;
-					// 					responseObject.cryptoExamples[station._id] = crypto
-					// 						.createHash("md5")
-					// 						.update(`_notification:${payloadName}_`)
-					// 						.digest("hex");
-					// 				});
-					// 				next();
-					// 			},
-
-					// 			next => {
-					// 				NotificationsModule.pub.keys("*", next);
-					// 			},
-
-					// 			(redisKeys, next) => {
-					// 				responseObject.redis = {
-					// 					...redisKeys,
-					// 					ttl: {}
-					// 				};
-					// 				async.eachLimit(
-					// 					redisKeys,
-					// 					1,
-					// 					(redisKey, next) => {
-					// 						NotificationsModule.pub.ttl(redisKey, (err, ttl) => {
-					// 							responseObject.redis.ttl[redisKey] = ttl;
-					// 							next(err);
-					// 						});
-					// 					},
-					// 					next
-					// 				);
-					// 			},
-
-					// 			next => {
-					// 				responseObject.debugLogs = this.moduleManager.debugLogs.stationIssue;
-					// 				next();
-					// 			},
-
-					// 			next => {
-					// 				responseObject.debugJobs = this.moduleManager.debugJobs;
-					// 				next();
-					// 			}
-					// 		],
-					// 		(err, response) => {
-					// 			if (err) {
-					// 				console.log(err);
-					// 				return res.json({
-					// 					error: err,
-					// 					objectSoFar: responseObject
-					// 				});
-					// 			}
-
-					// 			const responseJson = JSON.stringify(responseObject, (key, value) => {
-					// 				// console.log(key, value);
-					// 				if (
-					// 					key === "module" ||
-					// 					key === "task" ||
-					// 					key === "onFinish" ||
-					// 					key === "server" ||
-					// 					key === "nsp" ||
-					// 					key === "socket" ||
-					// 					key === "res" ||
-					// 					key === "client" ||
-					// 					key === "_idleNext" ||
-					// 					key === "_idlePrev"
-					// 				) {
-					// 					return undefined;
-					// 				}
-					// 				if (key === "parentJob" && value) return value.toString();
-					// 				return value;
-					// 			});
-
-					// 			res.end(responseJson);
-					// 		}
-					// 	);
-					// });
-
-					// Object.keys(actions).forEach(namespace => {
-					// 	Object.keys(actions[namespace]).forEach(action => {
-					// 		const name = `/${namespace}/${action}`;
-
-					// 		response.app.get(name, (req, res) => {
-					// 			actions[namespace][action](null, result => {
-					// 				if (typeof cb === "function") return res.json(result);
-					// 			});
-					// 		});
-					// 	});
-					// });
-
 					resolve();
 				})
 				.catch(err => {

+ 0 - 12
backend/logic/cache/index.js

@@ -59,9 +59,6 @@ class _CacheModule extends CoreClass {
 						this.log("ERROR", `Stopped trying to reconnect.`);
 
 						this.setStatus("FAILED");
-
-						// this.failed = true;
-						// this._lockdown();
 					}
 				}
 			});
@@ -164,9 +161,6 @@ class _CacheModule extends CoreClass {
 	 */
 	HDEL(payload) {
 		return new Promise((resolve, reject) => {
-			// if (!payload.key || !table || typeof key !== "string")
-			// return cb(null, null);
-
 			let { key } = payload;
 
 			if (!payload.table) return reject(new Error("Invalid table!"));
@@ -217,11 +211,6 @@ class _CacheModule extends CoreClass {
 	 */
 	PUB(payload) {
 		return new Promise((resolve, reject) => {
-			/* if (pubs[channel] === undefined) {
-            pubs[channel] = redis.createClient({ url: CacheModule.url });
-            pubs[channel].on('error', (err) => console.error);
-            } */
-
 			let { value } = payload;
 
 			if (!payload.channel) return reject(new Error("Invalid channel!"));
@@ -229,7 +218,6 @@ class _CacheModule extends CoreClass {
 
 			if (["object", "array"].includes(typeof value)) value = JSON.stringify(value);
 
-			// pubs[channel].publish(channel, value);
 			return CacheModule.client.publish(payload.channel, value, err => {
 				if (err) reject(err);
 				else resolve();

+ 0 - 43
backend/logic/db/index.js

@@ -119,8 +119,6 @@ class _DBModule extends CoreClass {
 
 					mongoose.connection.on("reconnectFailed", () => {
 						this.log("INFO", "Reconnect failed, stopping reconnecting.");
-						// this.failed = true;
-						// this._lockdown();
 						this.setStatus("FAILED");
 					});
 
@@ -138,10 +136,6 @@ class _DBModule extends CoreClass {
 						return regex.emailSimple.test(email) && regex.ascii.test(email);
 					}, "Invalid email.");
 
-					// this.schemas.user
-					// 	.path("name")
-					// 	.validate(name => isLength(name, 1, 64) && regex.name.test(name), "Invalid name.");
-
 					// Station
 					this.schemas.station
 						.path("name")
@@ -172,43 +166,6 @@ class _DBModule extends CoreClass {
 						message: "User already has 25 stations."
 					});
 
-					/*
-					this.schemas.station.path('queue').validate((queue, callback) => { //Callback no longer works, see station max count
-						let totalDuration = 0;
-						queue.forEach((song) => {
-							totalDuration += song.duration;
-						});
-						return callback(totalDuration <= 3600 * 3);
-					}, 'The max length of the queue is 3 hours.');
-		
-					this.schemas.station.path('queue').validate((queue, callback) => { //Callback no longer works, see station max count
-						if (queue.length === 0) return callback(true);
-						let totalDuration = 0;
-						const userId = queue[queue.length - 1].requestedBy;
-						queue.forEach((song) => {
-							if (userId === song.requestedBy) {
-								totalDuration += song.duration;
-							}
-						});
-						return callback(totalDuration <= 900);
-					}, 'The max length of songs per user is 15 minutes.');
-		
-					this.schemas.station.path('queue').validate((queue, callback) => { //Callback no longer works, see station max count
-						if (queue.length === 0) return callback(true);
-						let totalSongs = 0;
-						const userId = queue[queue.length - 1].requestedBy;
-						queue.forEach((song) => {
-							if (userId === song.requestedBy) {
-								totalSongs++;
-							}
-						});
-						if (totalSongs <= 2) return callback(true);
-						if (totalSongs > 3) return callback(false);
-						if (queue[queue.length - 2].requestedBy !== userId || queue[queue.length - 3] !== userId) return callback(true);
-						return callback(false);
-					}, 'The max amount of songs per user is 3, and only 2 in a row is allowed.');
-					*/
-
 					// Song
 					const songTitle = title => isLength(title, 1, 100);
 					this.schemas.song.path("title").validate(songTitle, "Invalid title.");

+ 0 - 1
backend/logic/mail/index.js

@@ -56,7 +56,6 @@ class _MailModule extends CoreClass {
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	SEND_MAIL(payload) {
-		// console.log(payload);
 		return new Promise((resolve, reject) => {
 			if (MailModule.enabled)
 				return MailModule.transporter

+ 0 - 2
backend/logic/mail/schemas/passwordRequest.js

@@ -1,5 +1,3 @@
-// const moduleManager = require('../../../index');
-
 import mail from "../index";
 
 /**

+ 0 - 2
backend/logic/mail/schemas/resetPasswordRequest.js

@@ -1,5 +1,3 @@
-// const moduleManager = require('../../../index');
-
 import mail from "../index";
 
 /**

+ 0 - 2
backend/logic/migration/index.js

@@ -56,8 +56,6 @@ class _MigrationModule extends CoreClass {
 
 					mongoose.connection.on("reconnectFailed", () => {
 						this.log("INFO", "Reconnect failed, stopping reconnecting.");
-						// this.failed = true;
-						// this._lockdown();
 						this.setStatus("FAILED");
 					});
 

+ 0 - 5
backend/logic/migration/migrations/migration1.js

@@ -29,11 +29,6 @@ export default async function migrate(MigrationModule) {
 						(err, res) => {
 							if (err) next(err);
 							else {
-								// { n: X, nModified: 1, ok: 1 }
-								// n = matched
-								// nModified = modified
-								// ok = successful
-
 								this.log(
 									"INFO",
 									`Migration 1 (activity). Matched: ${res.n}, modified: ${res.nModified}, ok: ${res.ok}.`

+ 0 - 1
backend/logic/migration/migrations/migration3.js

@@ -58,7 +58,6 @@ export default async function migrate(MigrationModule) {
 									}
 								}
 							);
-							// next();
 						},
 						next
 					);

+ 0 - 22
backend/logic/migration/migrations/migration5.js

@@ -63,13 +63,6 @@ export default async function migrate(MigrationModule) {
 								songs.map(song => song._doc),
 								1,
 								(song, next) => {
-									// this.log(
-									// 	"INFO",
-									// 	`Migration 5. Updating playlist songs and queue songs for song ${
-									// 		song.songId
-									// 	}/${song._id.toString()}.`
-									// );
-
 									const { _id, songId, title, artists, thumbnail, duration, status } = song;
 									const trimmedSong = {
 										_id,
@@ -117,21 +110,6 @@ export default async function migrate(MigrationModule) {
 							);
 						}
 					});
-					// songModel.updateMany(
-					// 	{ documentVersion: 2, verified: true },
-					// 	{ $set: { documentVersion: 3, status: "verified" }, $unset: { verified: "" } },
-					// 	(err, res) => {
-					// 		if (err) next(err);
-					// 		else {
-					// 			this.log(
-					// 				"INFO",
-					// 				`Migration 5 (verified songs). Matched: ${res.n}, modified: ${res.nModified}, ok: ${res.ok}.`
-					// 			);
-
-					// 			next();
-					// 		}
-					// 	}
-					// );
 				},
 
 				next => {

+ 0 - 1
backend/logic/migration/migrations/migration8.js

@@ -19,7 +19,6 @@ export default async function migrate(MigrationModule) {
 		async.waterfall(
 			[
 				next => {
-					// return next("BLOCKED");
 					this.log("INFO", `Migration 8. Finding activities with document version 1.`);
 					activityModel.find({ documentVersion: 1 }, (err, activities) => {
 						if (err) next(err);

+ 0 - 1
backend/logic/migration/migrations/migration9.js

@@ -15,7 +15,6 @@ export default async function migrate(MigrationModule) {
 		async.waterfall(
 			[
 				next => {
-					// return next("BLOCKED");
 					this.log("INFO", `Migration 9. Finding news with document version 1.`);
 					newsModel.find({ documentVersion: 1 }, (err, news) => {
 						if (err) next(err);

+ 0 - 6
backend/logic/notifications.js

@@ -43,9 +43,6 @@ class _NotificationsModule extends CoreClass {
 						this.log("ERROR", `Stopped trying to reconnect.`);
 
 						this.setStatus("FAILED");
-
-						// this.failed = true;
-						// this._lockdown();
 					}
 				}
 			});
@@ -62,9 +59,6 @@ class _NotificationsModule extends CoreClass {
 						this.log("ERROR", `Stopped trying to reconnect.`);
 
 						this.setStatus("FAILED");
-
-						// this.failed = true;
-						// this._lockdown();
 					}
 				}
 			});

+ 0 - 87
backend/logic/playlists.js

@@ -104,20 +104,6 @@ class _PlaylistsModule extends CoreClass {
 						reject(new Error(formattedErr));
 					} else {
 						resolve();
-
-						// PlaylistsModule.runJob("CREATE_MISSING_GENRE_PLAYLISTS", {})
-						// 	.then()
-						// 	.catch()
-						// 	.finally(() => {
-						// 		SongsModule.runJob("GET_ALL_GENRES", {})
-						// 			.then(response => {
-						// 				const { genres } = response;
-						// 				genres.forEach(genre => {
-						// 					PlaylistsModule.runJob("AUTOFILL_GENRE_PLAYLIST", { genre }).then().catch();
-						// 				});
-						// 			})
-						// 			.catch();
-						// 	});
 					}
 				}
 			)
@@ -152,29 +138,6 @@ class _PlaylistsModule extends CoreClass {
 		});
 	}
 
-	// /**
-	//  * Returns a list of playlists that include a specific song
-	//  *
-	//  * @param {object} payload - object that contains the payload
-	//  * @param {string} payload.songId - the song id
-	//  * @param {string} payload.includeSongs - include the songs
-	//  * @returns {Promise} - returns promise (reject, resolve)
-	//  */
-	// GET_PLAYLISTS_WITH_SONG(payload) {
-	// 	return new Promise((resolve, reject) => {
-	// 		async.waterfall([
-	// 			next => {
-	// 				const includeObject = payload.includeSongs ? null : { songs: false };
-	// 				PlaylistsModule.playlistModel.find({ "songs._id": payload.songId }, includeObject, next);
-	// 			},
-
-	// 			(playlists, next) => {
-	// 				console.log(playlists);
-	// 			}
-	// 		]);
-	// 	});
-	// }
-
 	/**
 	 * Creates a playlist that contains all songs of a specific genre
 	 *
@@ -503,56 +466,6 @@ class _PlaylistsModule extends CoreClass {
 							.catch(next);
 					},
 
-					// (data, next) => {
-					// 	data.songsToDelete = [];
-					// 	data.songsToAdd = [];
-
-					// 	data.playlist.songs.forEach(playlistSong => {
-					// 		const found = data.songs.find(song => playlistSong.youtubeId === song.youtubeId);
-					// 		if (!found) data.songsToDelete.push(playlistSong);
-					// 	});
-
-					// 	data.songs.forEach(song => {
-					// 		const found = data.playlist.songs.find(playlistSong => song.youtubeId === playlistSong.youtubeId);
-					// 		if (!found) data.songsToAdd.push(song);
-					// 	});
-
-					// 	next(null, data);
-					// },
-
-					// (data, next) => {
-					// 	const promises = [];
-					// 	data.songsToAdd.forEach(song => {
-					// 		promises.push(
-					// 			PlaylistsModule.runJob(
-					// 				"ADD_SONG_TO_PLAYLIST",
-					// 				{ playlistId: data.playlist._id, song },
-					// 				this
-					// 			)
-					// 		);
-					// 	});
-					// 	data.songsToDelete.forEach(song => {
-					// 		promises.push(
-					// 			PlaylistsModule.runJob(
-					// 				"DELETE_SONG_FROM_PLAYLIST_BY_YOUTUBE_ID",
-					// 				{
-					// 					playlistId: data.playlist._id,
-					// 					youtubeId: song.youtubeId
-					// 				},
-					// 				this
-					// 			)
-					// 		);
-					// 	});
-
-					// 	Promise.allSettled(promises)
-					// 		.then(() => {
-					// 			next(null, data.playlist._id);
-					// 		})
-					// 		.catch(err => {
-					// 			next(err);
-					// 		});
-					// },
-
 					(playlistId, next) => {
 						StationsModule.runJob("GET_STATIONS_THAT_INCLUDE_OR_EXCLUDE_PLAYLIST", { playlistId }, this)
 							.then(response => {

+ 0 - 48
backend/logic/songs.js

@@ -232,16 +232,6 @@ class _SongsModule extends CoreClass {
 								})
 								.catch(next);
 						}
-
-						// else if (song && song.duration <= 0) {
-						// 	YouTubeModule.runJob("GET_SONG", { youtubeId: payload.youtubeId }, this)
-						// 		.then(response => next(null, { ...response.song }, false))
-						// 		.catch(next);
-						// } else {
-						// 	YouTubeModule.runJob("GET_SONG", { youtubeId: payload.youtubeId }, this)
-						// 		.then(response => next(null, { ...response.song }, false))
-						// 		.catch(next);
-						// }
 					},
 
 					(song, youtubeSong, next) => {
@@ -388,11 +378,6 @@ class _SongsModule extends CoreClass {
 														}
 													);
 												}
-												// playlists.forEach(playlist => {
-												// 	PlaylistsModule.runJob("UPDATE_PLAYLIST", {
-												// 		playlistId: playlist._id
-												// 	});
-												// });
 											});
 									}
 								);
@@ -403,35 +388,7 @@ class _SongsModule extends CoreClass {
 					},
 
 					(song, next) => {
-						// next(null, song);
 						const { _id, youtubeId, title, artists, thumbnail, duration, status } = song;
-						// const trimmedSong = {
-						// 	_id,
-						// 	youtubeId,
-						// 	title,
-						// 	artists,
-						// 	thumbnail,
-						// 	duration,
-						// 	status
-						// };
-						// this.log("INFO", `Going to update playlists and stations now for song ${_id}`);
-						// DBModule.runJob("GET_MODEL", { modelName: "playlist" }).then(playlistModel => {
-						// 	playlistModel.updateMany(
-						// 		{ "songs._id": song._id },
-						// 		{ $set: { "songs.$": trimmedSong } },
-						// 		err => {
-						// 			if (err) this.log("ERROR", err);
-						// 			else
-						// 				playlistModel.find({ "songs._id": song._id }, (err, playlists) => {
-						// 					playlists.forEach(playlist => {
-						// 						PlaylistsModule.runJob("UPDATE_PLAYLIST", {
-						// 							playlistId: playlist._id
-						// 						});
-						// 					});
-						// 				});
-						// 		}
-						// 	);
-						// });
 						this.log("INFO", `Going to update stations now for song ${_id}`);
 						DBModule.runJob("GET_MODEL", { modelName: "station" }, this)
 							.then(stationModel => {
@@ -1141,11 +1098,6 @@ class _SongsModule extends CoreClass {
 											)
 												.then(() => next())
 												.catch(next);
-											// SongsModule.runJob("REQUEST_SONG", { youtubeId, userId: null }, this)
-											// 	.then(() => {
-											// 		next();
-											// 	})
-											// 	.catch(next);
 										},
 
 										next => {

+ 0 - 89
backend/logic/stations.js

@@ -1,5 +1,4 @@
 import async from "async";
-// import mongoose from "mongoose";
 
 import CoreClass from "../core";
 
@@ -34,17 +33,6 @@ class _StationsModule extends CoreClass {
 		PlaylistsModule = this.moduleManager.modules.playlists;
 		NotificationsModule = this.moduleManager.modules.notifications;
 
-		// this.defaultSong = {
-		// 	youtubeId: "60ItHLz5WEA",
-		// 	title: "Faded - Alan Walker",
-		// 	duration: 212,
-		// 	skipDuration: 0,
-		// 	likes: -1,
-		// 	dislikes: -1,
-		// 	requestedAt: Date.now(),
-		// 	status: "unverified"
-		// };
-
 		this.userList = {};
 		this.usersPerStation = {};
 		this.usersPerStationCount = {};
@@ -208,8 +196,6 @@ class _StationsModule extends CoreClass {
 	 */
 	INITIALIZE_STATION(payload) {
 		return new Promise((resolve, reject) => {
-			// if (typeof cb !== 'function') cb = ()=>{};
-
 			async.waterfall(
 				[
 					next => {
@@ -517,7 +503,6 @@ class _StationsModule extends CoreClass {
 						let lastSongAdded = null;
 
 						playlistSongs
-							// .map(song => song._doc)
 							.every(song => {
 								if (
 									songsToAdd.length < songsStillNeeded &&
@@ -784,21 +769,6 @@ class _StationsModule extends CoreClass {
 									if (err === "No songs available.") next(null, null, station);
 									else next(err);
 								});
-
-							// return StationsModule.stationModel.updateOne(
-							// 	{ _id: payload.stationId },
-							// 	{
-							// 		$pull: {
-							// 			queue: {
-							// 				_id: station.queue[0]._id
-							// 			}
-							// 		}
-							// 	},
-							// 	err => {
-							// 		if (err) return next(err);
-							// 		return next(null, station.queue[0], -12, station);
-							// 	}
-							// );
 						}
 
 						if (station.type === "community" && !station.partyMode) {
@@ -826,64 +796,6 @@ class _StationsModule extends CoreClass {
 								.catch(next);
 						}
 
-						// if (station.type === "community" && !station.partyMode) {
-						// 	return DBModule.runJob("GET_MODEL", { modelName: "playlist" }, this).then(playlistModel =>
-						// 		playlistModel.findOne({ _id: station.privatePlaylist }, (err, playlist) => {
-						// 			if (err) return next(err);
-
-						// 			if (!playlist) return next(null, null, -13, station);
-
-						// 			playlist = playlist.songs;
-
-						// 			if (playlist.length > 0) {
-						// 				let currentSongIndex;
-
-						// 				if (station.currentSongIndex < playlist.length - 1)
-						// 					currentSongIndex = station.currentSongIndex + 1;
-						// 				else currentSongIndex = 0;
-
-						// 				const callback = (err, song) => {
-						// 					if (err) return next(err);
-						// 					if (song) return next(null, song, currentSongIndex, station);
-
-						// 					const currentSong = {
-						// 						youtubeId: playlist[currentSongIndex].youtubeId,
-						// 						title: playlist[currentSongIndex].title,
-						// 						duration: playlist[currentSongIndex].duration,
-						// 						likes: -1,
-						// 						dislikes: -1,
-						// 						requestedAt: playlist[currentSongIndex].requestedAt
-						// 					};
-
-						// 					return next(null, currentSong, currentSongIndex, station);
-						// 				};
-
-						// 				if (mongoose.Types.ObjectId.isValid(playlist[currentSongIndex]._id))
-						// 					return SongsModule.runJob(
-						// 						"GET_SONG",
-						// 						{
-						// 							id: playlist[currentSongIndex]._id
-						// 						},
-						// 						this
-						// 					)
-						// 						.then(response => callback(null, response.song))
-						// 						.catch(callback);
-						// 				return SongsModule.runJob(
-						// 					"GET_SONG_FROM_YOUTUBE_ID",
-						// 					{
-						// 						youtubeId: playlist[currentSongIndex].youtubeId
-						// 					},
-						// 					this
-						// 				)
-						// 					.then(response => callback(null, response.song))
-						// 					.catch(callback);
-						// 			}
-
-						// 			return next(null, null, -14, station);
-						// 		})
-						// 	);
-						// }
-
 						if (station.type === "official") {
 							StationsModule.runJob(
 								"FILL_UP_STATION_QUEUE_FROM_STATION_PLAYLIST",
@@ -930,7 +842,6 @@ class _StationsModule extends CoreClass {
 							};
 						}
 
-						// if (currentSongIndex >= 0) $set.currentSongIndex = currentSongIndex;
 						$set.startedAt = Date.now();
 						$set.timePaused = 0;
 						if (station.paused) $set.pausedAt = Date.now();

+ 0 - 10
backend/logic/tasks.js

@@ -32,16 +32,12 @@ class _TasksModule extends CoreClass {
 	 */
 	initialize() {
 		return new Promise(resolve => {
-			// return reject(new Error("Not fully migrated yet."));
-
 			CacheModule = this.moduleManager.modules.cache;
 			StationsModule = this.moduleManager.modules.stations;
 			UtilsModule = this.moduleManager.modules.utils;
 			WSModule = this.moduleManager.modules.ws;
 			DBModule = this.moduleManager.modules.db;
 
-			// this.createTask("testTask", testTask, 5000, true);
-
 			TasksModule.runJob("CREATE_TASK", {
 				name: "stationSkipTask",
 				fn: TasksModule.checkStationSkipTask,
@@ -54,12 +50,6 @@ class _TasksModule extends CoreClass {
 				timeout: 1000 * 60 * 60 * 6
 			});
 
-			// TasksModule.runJob("CREATE_TASK", {
-			// 	name: "logFileSizeCheckTask",
-			// 	fn: TasksModule.logFileSizeCheckTask,
-			// 	timeout: 1000 * 60 * 60
-			// });
-
 			TasksModule.runJob("CREATE_TASK", {
 				name: "collectStationUsersTask",
 				fn: TasksModule.collectStationUsersTask,

+ 0 - 10
backend/logic/utils.js

@@ -45,16 +45,6 @@ class _UtilsModule extends CoreClass {
 		});
 	}
 
-	// COOKIES_TO_STRING() {//cookies
-	// 	return new Promise((resolve, reject) => {
-	//         let newCookie = [];
-	//         for (let prop in cookie) {
-	//             newCookie.push(prop + "=" + cookie[prop]);
-	//         }
-	//         return newCookie.join("; ");
-	//     });
-	// }
-
 	/**
 	 * Removes a cookie by name
 	 *

+ 0 - 2
backend/logic/ws.js

@@ -49,8 +49,6 @@ class _WSModule extends CoreClass {
 		// TODO: Check every 30s/, for all sockets, if they are still allowed to be in the rooms they are in, and on socket at all (permission changing/banning)
 		const server = await AppModule.runJob("SERVER");
 
-		// this._io.origins(config.get("cors.origin"));
-
 		this._io = new WebSocketServer({ server, path: "/ws" });
 
 		this.rooms = {};

+ 0 - 4
backend/logic/youtube.js

@@ -207,7 +207,6 @@ class _YouTubeModule extends CoreClass {
 						return resolve({ song });
 					})
 					.catch(err => {
-						// console.log(111, err, payload);
 						YouTubeModule.log("ERROR", "GET_SONG", `${err.message}`);
 						return reject(new Error("An error has occured. Please try again later."));
 					});
@@ -280,7 +279,6 @@ class _YouTubeModule extends CoreClass {
 					}
 				],
 				(err, response) => {
-					// console.log(222, err, payload);
 					if (err && err !== true) {
 						YouTubeModule.log("ERROR", "GET_PLAYLIST", "Some error has occurred.", err.message);
 						reject(new Error(err.message));
@@ -342,7 +340,6 @@ class _YouTubeModule extends CoreClass {
 						return resolve({ songs });
 					})
 					.catch(err => {
-						// console.log(333, err, payload);
 						YouTubeModule.log("ERROR", "GET_PLAYLIST_PAGE", `${err.message}`);
 						if (err.message === "Request failed with status code 404") {
 							return reject(new Error("Playlist not found. Is the playlist public/unlisted?"));
@@ -422,7 +419,6 @@ class _YouTubeModule extends CoreClass {
 							.catch(err => reject(err));
 					})
 					.catch(err => {
-						// console.log(444, err, payload);
 						YouTubeModule.log("ERROR", "FILTER_MUSIC_VIDEOS", `${err.message}`);
 						return reject(new Error("Failed to find playlist from YouTube"));
 					});

+ 0 - 16
frontend/src/App.vue

@@ -287,14 +287,9 @@ export default {
 
 .night-mode {
 	div {
-		// background-color: var(--black);
 		color: var(--light-grey-2);
 	}
 
-	// #toasts-container .toast {
-	// color: var(--dark-grey-2);
-	// background-color: var(--light-grey-3) !important;
-
 	.input,
 	.textarea,
 	.select select {
@@ -307,11 +302,6 @@ export default {
 		}
 	}
 
-	// &:last-of-type {
-	// 	background-color: var(--light-grey) !important;
-	// }
-	// }
-
 	h1,
 	h2,
 	h3,
@@ -351,11 +341,6 @@ body.night-mode {
 
 	.toast {
 		font-weight: 600;
-		// background-color: var(--dark-grey) !important;
-
-		// &:last-of-type {
-		// 	background-color: var(--dark-grey-2) !important;
-		// }
 	}
 }
 
@@ -1020,7 +1005,6 @@ h4.section-title {
 		i,
 		span {
 			cursor: pointer;
-			// color: var(--dark-grey);
 
 			&:not(:first-child) {
 				margin-left: 5px;

+ 0 - 1
frontend/src/components/modals/EditPlaylist/Tabs/Settings.vue

@@ -127,7 +127,6 @@ export default {
 				);
 			}
 		}
-		// 	...mapActions("modals/editSong", ["selectDiscogsInfo"])
 	}
 };
 </script>

+ 0 - 15
frontend/src/components/modals/EditPlaylist/index.vue

@@ -350,15 +350,6 @@ export default {
 				if (this.playlist._id === res.data.playlistId) {
 					// remove song from array of playlists
 					this.removeSong(res.data.youtubeId);
-
-					// // if this song is in search results, mark it available to add to the playlist again
-					// this.search.songs.results.forEach((searchItem, index) => {
-					// 	if (res.data.youtubeId === searchItem.id) {
-					// 		this.search.songs.results[
-					// 			index
-					// 		].isAddedToQueue = false;
-					// 	}
-					// });
 				}
 			},
 			{ modal: "editPlaylist" }
@@ -400,8 +391,6 @@ export default {
 			this.gettingSongs = true;
 			this.socket.dispatch("playlists.getPlaylist", this.editing, res => {
 				if (res.status === "success") {
-					// this.playlist = res.data.playlist;
-					// this.playlist.songs.sort((a, b) => a.position - b.position);
 					this.setPlaylist(res.data.playlist);
 				} else new Toast(res.message);
 				this.gettingSongs = false;
@@ -672,11 +661,8 @@ export default {
 }
 
 .tabs-container {
-	// padding: 16px;
-
 	.tab-selection {
 		display: flex;
-		// overflow-x: auto;
 		margin: 24px 10px 0 10px;
 		max-width: 100%;
 
@@ -703,7 +689,6 @@ export default {
 	}
 	.tab {
 		border: 1px solid var(--light-grey-3);
-		// padding: 15px;
 		border-radius: 0 0 5px 5px;
 	}
 }

+ 1 - 264
frontend/src/components/modals/EditSong/index.vue

@@ -554,7 +554,6 @@ export default {
 		youtubeId: { type: String, default: null },
 		songId: { type: String, default: null },
 		discogsAlbum: { type: Object, default: null },
-		// songType: { type: String, default: null },
 		sector: { type: String, default: "admin" }
 	},
 	data() {
@@ -646,13 +645,6 @@ export default {
 		/* eslint-enable */
 	},
 	async mounted() {
-		// if (this.modals.editSong = false) this.video.player.stopVideo();
-
-		// this.loadVideoById(
-		//   this.song.youtubeId,
-		//   this.song.skipDuration
-		// );
-
 		this.activityWatchVideoDataInterval = setInterval(() => {
 			this.sendActivityWatchVideoData();
 		}, 1000);
@@ -789,6 +781,7 @@ export default {
 			}
 		});
 
+		// TODO
 		keyboardShortcuts.registerShortcut("editSong.saveVerifyClose", {
 			keyCode: 86,
 			ctrl: true,
@@ -893,9 +886,6 @@ export default {
 				res => {
 					if (res.status === "success") {
 						const { song } = res.data;
-						// this.song = { ...song };
-						// if (this.song.discogs === undefined)
-						// 	this.song.discogs = null;
 						if (this.song.discogs)
 							this.editSong({
 								...song,
@@ -910,8 +900,6 @@ export default {
 							`edit-song.${this.song._id}`
 						);
 
-						// this.edit(res.data.song);
-
 						this.interval = setInterval(() => {
 							if (
 								this.song.duration !== -1 &&
@@ -1133,28 +1121,6 @@ export default {
 				return new Toast("Please fill in all fields");
 			}
 
-			// const thumbnailHeight = this.$refs.thumbnailElement.naturalHeight;
-			// const thumbnailWidth = this.$refs.thumbnailElement.naturalWidth;
-
-			// if (thumbnailHeight < 80 || thumbnailWidth < 80) {
-			// 	saveButtonRef.handleFailedSave();
-			// 	return new Toast(
-			// 		"Thumbnail width and height must be at least 80px."
-			// 	);
-			// }
-
-			// if (thumbnailHeight > 4000 || thumbnailWidth > 4000) {
-			// 	saveButtonRef.handleFailedSave();
-			// 	return new Toast(
-			// 		"Thumbnail width and height must be less than 4000px."
-			// 	);
-			// }
-
-			// if (thumbnailHeight - thumbnailWidth > 5) {
-			// 	saveButtonRef.handleFailedSave();
-			// 	return new Toast("Thumbnail cannot be taller than it is wide.");
-			// }
-
 			// Youtube Id
 			if (
 				this.youtubeError &&
@@ -1624,12 +1590,9 @@ export default {
 		.modal-card {
 			width: 1160px;
 			height: 100%;
-			// width: 1300px;
 
 			.modal-card-body {
 				display: flex;
-				// column-gap: 16px;
-				// row-gap: 16px;
 				padding: 16px;
 
 				@media screen and (max-width: 1000px) {
@@ -1638,7 +1601,6 @@ export default {
 
 				> div {
 					display: flex;
-					// flex-grow: 1;
 					height: 100%;
 					overflow: auto;
 				}
@@ -1655,44 +1617,13 @@ export default {
 	}
 }
 
-// #video-container {
-// 	position: relative;
-// 	padding-bottom: 56.25%; /* proportion value to aspect ratio 16:9 (9 / 16 = 0.5625 or 56.25%) */
-// 	height: 0;
-// 	overflow: hidden;
-
-// 	.player-cannot-autoplay {
-// 		position: relative;
-// 		width: 100%;
-// 		height: 100%;
-// 		bottom: calc(100% + 5px);
-// 		background-color: var(--primary-color);
-// 		display: flex;
-// 		align-items: center;
-// 		justify-content: center;
-
-// 		p {
-// 			color: var(--white);
-// 			font-size: 26px;
-// 			text-align: center;
-// 		}
-// 	}
-// }
-
 .left-section {
 	display: flex;
 	flex-direction: column;
 	margin-right: 16px;
-	// flex-grow: 0 !important;
-	// height: inherit !important;
-
-	// @media screen and (max-width: 1245px) {
-	// 	flex-grow: 1 !important;
-	// }
 
 	.top-section {
 		display: flex;
-		// flex-direction: column;
 
 		.player-section {
 			width: 530px;
@@ -1716,10 +1647,6 @@ export default {
 				}
 			}
 
-			// #durationCanvas {
-			// 	max-width: 100%;
-			// }
-
 			.player-footer {
 				border: 1px solid var(--light-grey-3);
 				border-radius: 0px 0px 3px 3px;
@@ -1728,11 +1655,6 @@ export default {
 				height: 54px;
 				padding-left: 10px;
 				padding-right: 10px;
-				// padding: 10px;
-				// width: 100%;
-				// background-color: var(--white);
-				// flex-direction: column;
-				// flex-flow: wrap;
 
 				> * {
 					width: 33.3%;
@@ -1951,26 +1873,6 @@ export default {
 
 		.album-art-container {
 			width: 100%;
-			// display: flex;
-			// flex-direction: column;
-
-			// div {
-			// 	display: flex;
-			// 	flex-direction: row;
-			// 	align-items: center;
-
-			// 	.thumbnail-preview {
-			// 		border: 1px solid var(--light-grey-3);
-
-			// 		width: 75px;
-			// 		height: 75px;
-			// 	}
-
-			// 	.control {
-			// 		margin-left: 20px;
-			// 		width: 100%;
-			// 	}
-			// }
 		}
 
 		.artists-container {
@@ -2091,23 +1993,13 @@ export default {
 .right-section {
 	display: flex;
 	flex-wrap: wrap;
-	// flex-basis: 450px;
-	// overflow-y: auto;
-
-	// @media screen and (max-width: 1245px) {
-	// 	height: inherit !important;
-	// }
 
 	#tabs-container {
 		width: 376px;
 		background-color: var(--light-grey);
 		border: 1px rgba(163, 224, 255, 0.75) solid;
 		border-radius: 5px;
-		// padding: 16px;
 		overflow: auto;
-		// display: flex;
-		// flex-direction: column;
-		// flex-grow: 1;
 
 		#tab-selection {
 			display: flex;
@@ -2140,161 +2032,6 @@ export default {
 			padding: 15px;
 		}
 	}
-
-	// .api-section {
-	// 	width: 376px;
-	// 	background-color: var(--light-grey);
-	// 	border: 1px rgba(163, 224, 255, 0.75) solid;
-	// 	border-radius: 5px;
-	// 	padding: 16px;
-	// 	overflow: auto;
-	// 	height: 100%;
-
-	// 	> label {
-	// 		margin-top: 12px;
-	// 	}
-
-	// 	.top-container {
-	// 		display: flex;
-
-	// 		img {
-	// 			height: 85px;
-	// 			width: 85px;
-	// 		}
-
-	// 		.right-container {
-	// 			padding: 8px;
-	// 			display: flex;
-	// 			flex-direction: column;
-	// 			flex: 1;
-
-	// 			.album-title {
-	// 				flex: 1;
-	// 				font-weight: 600;
-	// 			}
-
-	// 			.bottom-row {
-	// 				display: flex;
-	// 				flex-flow: row;
-	// 				line-height: 15px;
-
-	// 				img {
-	// 					height: 15px;
-	// 					align-self: end;
-	// 					flex: 1;
-	// 					user-select: none;
-	// 					-moz-user-select: none;
-	// 					-ms-user-select: none;
-	// 					-webkit-user-select: none;
-	// 					cursor: pointer;
-	// 				}
-
-	// 				p {
-	// 					text-align: right;
-	// 				}
-
-	// 				.type-year {
-	// 					font-size: 13px;
-	// 					align-self: end;
-	// 				}
-	// 			}
-	// 		}
-	// 	}
-
-	// 	.bottom-container {
-	// 		padding: 12px;
-
-	// 		.bottom-container-field {
-	// 			line-height: 16px;
-	// 			margin-bottom: 8px;
-	// 			font-weight: 600;
-
-	// 			span {
-	// 				font-weight: 400;
-	// 			}
-	// 		}
-
-	// 		.bottom-container-field:last-of-type {
-	// 			margin-bottom: 0;
-	// 		}
-	// 	}
-
-	// 	.selected-discogs-info {
-	// 		background-color: var(--white);
-	// 		border: 1px solid var(--purple);
-	// 		border-radius: 5px;
-	// 		margin-bottom: 16px;
-
-	// 		.selected-discogs-info-none {
-	// 			font-size: 18px;
-	// 			text-align: center;
-	// 		}
-
-	// 		.bottom-row > p {
-	// 			flex: 1;
-	// 		}
-	// 	}
-
-	// 	.api-result {
-	// 		background-color: var(--white);
-	// 		border: 0.5px solid var(--primary-color);
-	// 		border-radius: 5px;
-	// 		margin-bottom: 16px;
-	// 	}
-
-	// 	button {
-	// 		background-color: var(--primary-color) !important;
-
-	// 		&:focus,
-	// 		&:hover {
-	// 			filter: contrast(0.75);
-	// 		}
-	// 	}
-
-	// 	.tracks {
-	// 		margin-top: 12px;
-
-	// 		.track:first-child {
-	// 			margin-top: 0;
-	// 			border-radius: 3px 3px 0 0;
-	// 		}
-
-	// 		.track:last-child {
-	// 			border-radius: 0 0 3px 3px;
-	// 		}
-
-	// 		.track {
-	// 			border: 0.5px solid var(--black);
-	// 			margin-top: -1px;
-	// 			line-height: 16px;
-	// 			display: flex;
-	// 			cursor: pointer;
-
-	// 			span {
-	// 				font-weight: 600;
-	// 				display: inline-block;
-	// 				margin-top: 7px;
-	// 				margin-bottom: 7px;
-	// 				margin-left: 7px;
-	// 			}
-
-	// 			p {
-	// 				display: inline-block;
-	// 				margin: 7px;
-	// 				flex: 1;
-	// 			}
-	// 		}
-
-	// 		.track:hover,
-	// 		.track:focus {
-	// 			background-color: var(--light-grey);
-	// 		}
-	// 	}
-
-	// 	.discogs-load-more {
-	// 		margin-bottom: 8px;
-	// 	}
-	// }
 }
 
 .modal-card-foot .is-primary {

+ 0 - 8
frontend/src/components/modals/ImportAlbum.vue

@@ -280,7 +280,6 @@ import SongItem from "../SongItem.vue";
 export default {
 	components: { Modal, SongItem, draggable },
 	props: {
-		// songType: { type: String, default: null },
 		sector: { type: String, default: "admin" }
 	},
 	data() {
@@ -596,13 +595,6 @@ export default {
 		margin-left: 24px;
 	}
 
-	// .import-album-modal-body {
-	// 	display: flex;
-	// 	flex-direction: row;
-	// 	flex-wrap: wrap;
-	// 	justify-content: space-evenly;
-	// }
-
 	.modal-card {
 		width: 100%;
 		height: 100%;

+ 0 - 2
frontend/src/components/modals/ViewReport.vue

@@ -308,12 +308,10 @@ export default {
 				flex-direction: column;
 
 				.report-sub-item-title {
-					// font-size: 14px;
 					font-size: 16px;
 				}
 
 				.report-sub-item-description {
-					// font-size: 12px;
 					font-size: 14px;
 					line-height: 16px;
 				}

+ 0 - 1
frontend/src/pages/Admin/tabs/HiddenSongs.vue

@@ -312,7 +312,6 @@ export default {
 			this.socket.dispatch("apis.joinAdminRoom", "hiddenSongs");
 		},
 		...mapActions("admin/hiddenSongs", [
-			// "stopVideo",
 			"resetSongs",
 			"addSong",
 			"removeSong",

+ 0 - 6
frontend/src/pages/Admin/tabs/Playlists.vue

@@ -177,12 +177,6 @@ export default {
 			this.socket.dispatch("playlists.index", res => {
 				if (res.status === "success") {
 					this.setPlaylists(res.data.playlists);
-					// if (this.$route.query.userId) {
-					// 	const user = this.users.find(
-					// 		user => user._id === this.$route.query.userId
-					// 	);
-					// 	if (user) this.edit(user);
-					// }
 				}
 			});
 			this.socket.dispatch("apis.joinAdminRoom", "playlists", () => {});

+ 0 - 2
frontend/src/pages/Admin/tabs/Punishments.vue

@@ -136,7 +136,6 @@ export default {
 	},
 	computed: {
 		sortedPunishments() {
-			//   return _.orderBy(this.punishments, -1);
 			return this.punishments;
 		},
 		...mapState("modalVisibility", {
@@ -155,7 +154,6 @@ export default {
 	},
 	methods: {
 		view(punishment) {
-			// this.viewPunishment(punishment);
 			this.viewingPunishmentId = punishment._id;
 			this.openModal("viewPunishment");
 		},

+ 0 - 11
frontend/src/pages/Admin/tabs/Reports.vue

@@ -128,17 +128,6 @@ export default {
 		this.socket.on("event:admin.report.created", res =>
 			this.reports.unshift(res.data.report)
 		);
-
-		// if (this.$route.query.id) {
-		// 	this.socket.dispatch(
-		// 		"reports.findOne",
-		// 		this.$route.query.id,
-		// 		res => {
-		// 			if (res.status === "success") this.view(res.data.report);
-		// 			else new Toast("Report with that ID not found");
-		// 		}
-		// 	);
-		// }
 	},
 	methods: {
 		init() {

+ 0 - 1
frontend/src/pages/Admin/tabs/Statistics.vue

@@ -257,7 +257,6 @@ export default {
 };
 </script>
 
-//
 <style lang="scss" scoped>
 .night-mode {
 	.table {

+ 0 - 1
frontend/src/pages/Admin/tabs/UnverifiedSongs.vue

@@ -337,7 +337,6 @@ export default {
 			);
 		},
 		...mapActions("admin/unverifiedSongs", [
-			// "stopVideo",
 			"resetSongs",
 			"addSong",
 			"removeSong",

+ 0 - 1
frontend/src/pages/Admin/tabs/VerifiedSongs.vue

@@ -523,7 +523,6 @@ export default {
 			this.socket.dispatch("apis.joinAdminRoom", "songs", () => {});
 		},
 		...mapActions("admin/verifiedSongs", [
-			// "stopVideo",
 			"resetSongs",
 			"addSong",
 			"removeSong",

+ 0 - 1
frontend/src/pages/Home.vue

@@ -1113,7 +1113,6 @@ html {
 		display: flex;
 		align-items: center;
 		background: var(--primary-color);
-		// box-shadow: inset 0px 2px 4px rgba(100, 100, 100, 0.3);
 		width: 100%;
 		height: 30px;
 		line-height: 30px;

+ 0 - 23
frontend/src/pages/Station/index.vue

@@ -1205,11 +1205,6 @@ export default {
 			this.station.description = res.data.description;
 		});
 
-		// this.socket.on("event:newOfficialPlaylist", res => {
-		// 	if (this.station.type === "official")
-		// 		this.updateSongsList(res.data.playlist);
-		// });
-
 		this.socket.on("event:station.users.updated", res =>
 			this.updateUsers(res.data.users)
 		);
@@ -1699,13 +1694,10 @@ export default {
 						);
 					}
 				} else if (difference < -200) {
-					// console.log("Difference0.8");
 					playbackRate = 0.8;
 				} else if (difference < -50) {
-					// console.log("Difference0.9");
 					playbackRate = 0.9;
 				} else if (difference < -25) {
-					// console.log("Difference0.99");
 					playbackRate = 0.95;
 				} else if (difference > 2000) {
 					if (!this.seeking) {
@@ -1716,16 +1708,12 @@ export default {
 						);
 					}
 				} else if (difference > 200) {
-					// console.log("Difference1.2");
 					playbackRate = 1.2;
 				} else if (difference > 50) {
-					// console.log("Difference1.1");
 					playbackRate = 1.1;
 				} else if (difference > 25) {
-					// console.log("Difference1.01");
 					playbackRate = 1.05;
 				} else if (this.player.getPlaybackRate !== 1.0) {
-					// console.log("NDifference1.0");
 					this.player.setPlaybackRate(1.0);
 				}
 
@@ -1735,11 +1723,6 @@ export default {
 				}
 			}
 
-			/* if (this.currentTime !== undefined && this.paused) {
-				this.timePaused += Date.currently() - this.currentTime;
-				this.currentTime = undefined;
-			} */
-
 			let { timePaused } = this;
 			if (this.stationPaused)
 				timePaused += Date.currently() - this.pausedAt;
@@ -2430,7 +2413,6 @@ export default {
 
 	#station-inner-container {
 		width: 100%;
-		// height: fit-content;
 		min-height: calc(100vh - 428px);
 		display: flex;
 		flex-direction: row;
@@ -2508,7 +2490,6 @@ export default {
 		#current-next-row {
 			display: flex;
 			flex-direction: row;
-			// max-width: calc(100vw - 40px);
 
 			#currently-playing-container,
 			#next-up-container {
@@ -2842,7 +2823,6 @@ export default {
 	width: 40px;
 	height: 40px;
 	border-radius: 100px;
-	// background-color: rgba(255, 255, 255, 0.15);
 	background-color: var(--primary-color);
 	opacity: 0.15;
 	bottom: 0px;
@@ -2878,7 +2858,6 @@ export default {
 	height: 60px;
 	-webkit-animation-duration: 22s;
 	animation-duration: 22s;
-	// background-color: rgba(255, 255, 255, 0.25);
 	background-color: var(--primary-color);
 	opacity: 0.25;
 }
@@ -2893,7 +2872,6 @@ export default {
 	height: 120px;
 	-webkit-animation-delay: 3s;
 	animation-delay: 3s;
-	// background-color: rgba(255, 255, 255, 0.2);
 	background-color: var(--primary-color);
 	opacity: 0.2;
 }
@@ -2924,7 +2902,6 @@ export default {
 	animation-delay: 2s;
 	-webkit-animation-duration: 40s;
 	animation-duration: 40s;
-	// background-color: rgba(255, 255, 255, 0.3);
 	background-color: var(--primary-color);
 	opacity: 0.3;
 }

+ 1 - 11
frontend/src/store/modules/modals/importAlbum.js

@@ -1,19 +1,9 @@
 /* eslint no-param-reassign: 0 */
 
-// import Vue from "vue";
-// import admin from "@/api/admin/index";
-
 export default {
 	namespaced: true,
 	state: {
-		discogsAlbum: {
-			// album: {
-			// 	genres: [],
-			// 	artists: [],
-			// 	artistIds: []
-			// },
-			// tracks: []
-		},
+		discogsAlbum: {},
 		originalPlaylistSongs: [],
 		playlistSongs: [],
 		editingSongs: false

+ 0 - 2
frontend/src/ws.js

@@ -142,8 +142,6 @@ export default {
 
 		this.socket.onerror = err => {
 			console.log("WS: SOCKET ERROR", err);
-
-			// new Toast("Cannot perform this action at this time.");
 		};
 
 		this.socket.on("ready", () => {