Bladeren bron

chore: Removed more commented code and re-added some

Owen Diffey 3 jaren geleden
bovenliggende
commit
54930fb04d

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

@@ -144,7 +144,6 @@ CacheModule.runJob("SUB", {
 	}
 });
 
-
 CacheModule.runJob("SUB", {
 	channel: "station.includedPlaylist",
 	cb: data => {

+ 23 - 0
backend/logic/playlists.js

@@ -110,6 +110,29 @@ 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 is not generated or editable by a user e.g. liked songs playlist
 	 *

+ 11 - 12
backend/logic/stations.js

@@ -502,19 +502,18 @@ class _StationsModule extends CoreClass {
 						const songsToAdd = [];
 						let lastSongAdded = null;
 
-						playlistSongs
-							.every(song => {
-								if (
-									songsToAdd.length < songsStillNeeded &&
-									currentYoutubeIds.indexOf(song.youtubeId) === -1
-								) {
-									lastSongAdded = song;
-									songsToAdd.push(song);
-									return true;
-								}
-								if (songsToAdd.length >= songsStillNeeded) return false;
+						playlistSongs.every(song => {
+							if (
+								songsToAdd.length < songsStillNeeded &&
+								currentYoutubeIds.indexOf(song.youtubeId) === -1
+							) {
+								lastSongAdded = song;
+								songsToAdd.push(song);
 								return true;
-							});
+							}
+							if (songsToAdd.length >= songsStillNeeded) return false;
+							return true;
+						});
 
 						let { currentSongIndex } = station;
 

+ 6 - 0
backend/logic/tasks.js

@@ -50,6 +50,12 @@ 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,

+ 10 - 0
backend/logic/utils.js

@@ -45,6 +45,16 @@ 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 - 13
frontend/src/components/modals/EditPlaylist/index.vue

@@ -207,19 +207,6 @@
 						</aside>
 					</div>
 				</div>
-
-				<!--
-			
-			
-			<button
-				class="button is-info"
-				@click="shuffle()"
-				v-if="playlist.isUserModifiable"
-			>
-				Shuffle
-			</button>
-			<h5>Edit playlist details:</h5>
-			 -->
 			</div>
 		</template>
 		<template #footer>

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

@@ -66,7 +66,6 @@
 									</button>
 								</div>
 								<div class="player-footer-center">
-									<!-- <img src="/assets/social/youtube.svg" /> -->
 									<span>
 										<span>
 											{{ youtubeVideoCurrentTime }}
@@ -1121,6 +1120,28 @@ 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 &&

+ 0 - 6
frontend/src/components/modals/EditUser.vue

@@ -76,12 +76,6 @@
 				</div>
 			</template>
 			<template #footer>
-				<!--button class='button is-warning'>
-					<span>&nbsp;Send Verification Email</span>
-				</button>
-				<button class='button is-warning'>
-					<span>&nbsp;Send Password Reset Email</span>
-        </button-->
 				<button class="button is-warning" @click="removeSessions()">
 					<span>&nbsp;Remove all sessions</span>
 				</button>

+ 0 - 7
frontend/src/components/modals/ManageStation/Tabs/Playlists.vue

@@ -323,13 +323,6 @@
 								</template>
 
 								<template #actions>
-									<!-- <i
-									v-if="isExcluded(playlist._id)"
-									class="material-icons stop-icon"
-									content="This playlist is blacklisted in this station"
-									v-tippy="{ theme: 'info' }"
-									>play_disabled</i
-								> -->
 									<i
 										v-if="
 											isPartyMode() &&

+ 0 - 22
frontend/src/components/modals/ManageStation/index.vue

@@ -77,18 +77,6 @@
 									<span> Force Skip </span>
 								</button>
 
-								<!-- Station Settings Button -->
-								<!-- <button
-									class="button is-primary"
-									@click="openModal('manageStation')"
-								>
-									<i class="material-icons icon-with-button"
-										>settings</i
-									>
-									<span>
-										Manage Station
-									</span>
-								</button> -->
 								<router-link
 									v-if="sector !== 'station' && station.name"
 									:to="{
@@ -169,16 +157,6 @@
 			</div>
 		</template>
 		<template #footer>
-			<!-- <router-link
-				v-if="sector !== 'station' && station.name"
-				:to="{
-					name: 'station',
-					params: { id: station.name }
-				}"
-				class="button is-primary"
-			>
-				Go To Station
-			</router-link> -->
 			<button
 				class="button is-primary tab-actionable-button"
 				v-if="loggedIn && station.type === 'official'"

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

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

+ 0 - 4
frontend/src/pages/Admin/tabs/Users.vue

@@ -47,8 +47,6 @@
 						<td>Role</td>
 						<td>Email Address</td>
 						<td>Email Verified</td>
-						<!-- <td>Likes</td>
-						<td>Dislikes</td> -->
 						<td>Songs Requested</td>
 						<td>Options</td>
 					</tr>
@@ -76,8 +74,6 @@
 						<td>{{ user.role }}</td>
 						<td>{{ user.email.address }}</td>
 						<td>{{ user.email.verified }}</td>
-						<!-- <td>{{ user.liked.length }}</td>
-						<td>{{ user.disliked.length }}</td> -->
 						<td>{{ user.songsRequested }}</td>
 						<td>
 							<button

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

@@ -180,17 +180,6 @@
 						>
 						<hr />
 					</div>
-					<!-- <div>
-						<span class="biggest"><b>Songs page</b></span>
-						<span
-							><b>Arrow keys up/down</b> - Moves between
-							songs</span
-						>
-						<span><b>E</b> - Edit selected song</span>
-						<span><b>A</b> - Add selected song</span>
-						<span><b>X</b> - Delete selected song</span>
-						<hr />
-					</div> -->
 					<div>
 						<span class="biggest"><b>Edit song modal</b></span>
 						<span class="bigger"><b>Navigation</b></span>

+ 0 - 10
frontend/src/pages/Settings/Tabs/Account.vue

@@ -55,16 +55,6 @@
 
 		<save-button ref="saveButton" @clicked="saveChanges()" />
 
-		<!-- <div class="section-margin-bottom" />
-
-		<h4 class="section-title">Export my data</h4>
-
-		<p class="section-description">
-			Download a copy of all data we store on you in JSON format.
-		</p>
-
-		<hr class="section-horizontal-rule" /> -->
-
 		<div class="section-margin-bottom" />
 
 		<h4 class="section-title">Remove any data we hold on you</h4>

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

@@ -663,9 +663,6 @@
 									"
 									header="Currently Playing.."
 								/>
-								<!-- <p v-else class="nothing-here-text">
-								No song is currently playing
-							</p> -->
 							</div>
 							<div
 								v-if="nextSong"