فهرست منبع

Merge pull request #3 from Musare/experimental

Updates from official repo
Owen Diffey 5 سال پیش
والد
کامیت
c597dced76

+ 26 - 6
frontend/components/Modals/EditSong.vue

@@ -96,7 +96,7 @@
 									<input
 										class="input"
 										type="text"
-										v-model="editing.song.duration"
+										v-model.number="editing.song.duration"
 									/>
 								</p>
 							</div>
@@ -106,7 +106,9 @@
 									<input
 										class="input"
 										type="text"
-										v-model="editing.song.skipDuration"
+										v-model.number="
+											editing.song.skipDuration
+										"
 									/>
 								</p>
 							</div>
@@ -618,6 +620,16 @@ export default {
 			modals: state => state.modals.admin
 		})
 	},
+	watch: {
+		/* eslint-disable */
+		"editing.song.duration": function() {
+			this.drawCanvas();
+		},
+		"editing.song.skipDuration": function() {
+			this.drawCanvas();
+		}
+		/* eslint-enable */
+	},
 	methods: {
 		save(songToCopy, close) {
 			const song = JSON.parse(JSON.stringify(songToCopy));
@@ -761,7 +773,7 @@ export default {
 					.then(data => {
 						apiResult.album.artists = [];
 						apiResult.album.artistIds = [];
-						const artistRegex = new RegExp(" \\([0-9]\\)$");
+						const artistRegex = new RegExp(" \\([0-9]+\\)$");
 
 						apiResult.dataQuality = data.data_quality;
 						data.artists.forEach(artist => {
@@ -796,12 +808,16 @@ export default {
 			if (type === "genres")
 				this.updateSongField({
 					field: "genres",
-					value: this.editing.song.discogs.album.genres
+					value: JSON.parse(
+						JSON.stringify(this.editing.song.discogs.album.genres)
+					)
 				});
 			if (type === "artists")
 				this.updateSongField({
 					field: "artists",
-					value: this.editing.song.discogs.album.artists
+					value: JSON.parse(
+						JSON.stringify(this.editing.song.discogs.album.artists)
+					)
 				});
 		},
 		searchDiscogsForPage(page) {
@@ -937,6 +953,7 @@ export default {
 					this.pauseVideo(false);
 					break;
 				case "skipToLast10Secs":
+					if (this.video.paused) this.pauseVideo(false);
 					this.video.player.seekTo(
 						this.editing.song.duration -
 							10 +
@@ -999,7 +1016,7 @@ export default {
 			const duration = Number(this.editing.song.duration);
 			const afterDuration = videoDuration - (skipDuration + duration);
 
-			const width = 560;
+			const width = 530;
 
 			const currentTime = this.video.player.getCurrentTime();
 
@@ -1153,6 +1170,7 @@ export default {
 			) {
 				this.video.paused = false;
 				this.video.player.stopVideo();
+				this.drawCanvas();
 			}
 			if (this.playerReady) {
 				this.youtubeVideoCurrentTime = this.video.player
@@ -1190,6 +1208,8 @@ export default {
 					this.drawCanvas();
 				},
 				onStateChange: event => {
+					this.drawCanvas();
+
 					if (event.data === 1) {
 						if (!this.video.autoPlayed) {
 							this.video.autoPlayed = true;

+ 31 - 29
frontend/components/Modals/Login.vue

@@ -26,37 +26,39 @@
 			</header>
 			<section class="modal-card-body">
 				<!-- validation to check if exists http://bulma.io/documentation/elements/form/ -->
-				<label class="label">Email</label>
-				<p class="control">
-					<input
-						v-model="email"
-						class="input"
-						type="text"
-						placeholder="Email..."
-					/>
-				</p>
-				<label class="label">Password</label>
-				<p class="control">
-					<input
-						v-model="password"
-						class="input"
-						type="password"
-						placeholder="Password..."
-						@keypress="$parent.submitOnEnter(submitModal, $event)"
-					/>
-				</p>
-				<p>
-					By logging in/registering you agree to our
-					<router-link to="/terms"> Terms of Service </router-link
-					>&nbsp;and
-					<router-link to="/privacy"> Privacy Policy </router-link>.
-				</p>
+				<form>
+					<label class="label">Email</label>
+					<p class="control">
+						<input
+							v-model="email"
+							class="input"
+							type="email"
+							placeholder="Email..."
+						/>
+					</p>
+					<label class="label">Password</label>
+					<p class="control">
+						<input
+							v-model="password"
+							class="input"
+							type="password"
+							placeholder="Password..."
+							@keypress="
+								$parent.submitOnEnter(submitModal, $event)
+							"
+						/>
+					</p>
+					<p>
+						By logging in/registering you agree to our
+						<router-link to="/terms"> Terms of Service </router-link
+						>&nbsp;and
+						<router-link to="/privacy"> Privacy Policy </router-link
+						>.
+					</p>
+				</form>
 			</section>
 			<footer class="modal-card-foot">
-				<a
-					class="button is-primary"
-					href="#"
-					@click="submitModal('login')"
+				<a class="button is-primary" href="#" @click="submitModal()"
 					>Submit</a
 				>
 				<a

+ 1 - 3
frontend/components/Modals/Register.vue

@@ -31,7 +31,7 @@
 					<input
 						v-model="email"
 						class="input"
-						type="text"
+						type="email"
 						placeholder="Email..."
 						autofocus
 					/>
@@ -127,8 +127,6 @@ export default {
 	},
 	methods: {
 		submitModal() {
-			console.log(this.recaptcha.token);
-
 			this.register({
 				username: this.username,
 				email: this.email,

+ 9 - 4
frontend/components/Station/Station.vue

@@ -1,8 +1,12 @@
 <template>
 	<div>
-		<metadata v-bind:title="`${station.displayName}`" />
+		<metadata
+			v-if="exists && !loading"
+			v-bind:title="`${station.displayName}`"
+		/>
+		<metadata v-else-if="!exists && !loading" v-bind:title="`Not found`" />
 
-		<station-header />
+		<station-header v-if="exists" />
 
 		<song-queue v-if="modals.addSongToQueue" />
 		<add-to-playlist v-if="modals.addSongToPlaylist" />
@@ -1010,6 +1014,9 @@ export default {
 						}
 						this.systemDifference = difference;
 					});
+				} else {
+					this.loading = false;
+					this.exists = false;
 				}
 			});
 		},
@@ -1044,8 +1051,6 @@ export default {
 				if (res.status === "failure") {
 					this.loading = false;
 					this.exists = false;
-				} else {
-					this.exists = true;
 				}
 			});
 			this.socket.on("event:songs.next", data => {

+ 2 - 4
frontend/main.js

@@ -155,9 +155,7 @@ router.beforeEach((to, from, next) => {
 				}
 			);
 		}
-	} else next();
-
-	if (to.name === "station") {
+	} else if (to.name === "station") {
 		io.getSocket(socket => {
 			socket.emit("stations.findByName", to.params.id, res => {
 				if (res.status === "success") {
@@ -165,7 +163,7 @@ router.beforeEach((to, from, next) => {
 				}
 			});
 		});
-	}
+	} else next();
 });
 
 // eslint-disable-next-line no-new