From 863c1aff409617c04ee34b8b8a0f86ea2f4df291 Mon Sep 17 00:00:00 2001 From: exttex Date: Sun, 20 Sep 2020 19:17:28 +0200 Subject: [PATCH] Shuffle/Repeat fixes, Prebuilt frontend, Linux icon, Playback errors, Unsynced lyrics, Bug fixes --- .gitignore | 2 +- README.md | 5 ++ app/client/.gitignore | 2 - app/client/src/App.vue | 57 ++++++++++++++++++++-- app/client/src/components/ArtistTile.vue | 2 +- app/client/src/components/Lyrics.vue | 16 ++++-- app/client/src/main.js | 40 ++++++++++++--- app/client/src/views/FullscreenPlayer.vue | 2 +- app/package.json | 2 +- app/src/definitions.js | 5 +- app/src/server.js | 44 +++++------------ build/iconset/128x128.png | Bin 0 -> 9994 bytes build/iconset/256x256.png | Bin 0 -> 10721 bytes build/iconset/512x512.png | Bin 0 -> 14243 bytes package.json | 13 +++-- 15 files changed, 133 insertions(+), 57 deletions(-) create mode 100644 build/iconset/128x128.png create mode 100644 build/iconset/256x256.png create mode 100644 build/iconset/512x512.png diff --git a/.gitignore b/.gitignore index 93a9806..b711319 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ dist/ node_modules/ app/node_modules/ app/dist/ -app/client/dist/ +#app/client/dist/ app/client/node_modules/ electron_dist/ freezer-*.tgz diff --git a/README.md b/README.md index a977f5c..756f585 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,11 @@ Or manually: npm i cd app npm i +``` + +**1.0.5** - Prebuilt frontend is now included in the repo. The following steps are optional (but recommended): + +``` cd client npm i npm run build diff --git a/app/client/.gitignore b/app/client/.gitignore index 403adbc..7df6d18 100644 --- a/app/client/.gitignore +++ b/app/client/.gitignore @@ -1,7 +1,5 @@ .DS_Store node_modules -/dist - # local env files .env.local diff --git a/app/client/src/App.vue b/app/client/src/App.vue index 1d60d38..3f5b1bb 100644 --- a/app/client/src/App.vue +++ b/app/client/src/App.vue @@ -2,7 +2,7 @@ - + @@ -130,8 +130,10 @@ prepend-inner-icon="mdi-magnify" single-line solo + placeholder='Search or paste Deezer URL. Use "/" to quickly focus.' v-model="searchQuery" ref='searchBar' + :loading='searchLoading' @keyup='search'> @@ -191,7 +193,7 @@ mdi-play mdi-pause - + mdi-skip-next @@ -267,6 +269,7 @@ export default { showPlayer: false, position: '0.00', searchQuery: '', + searchLoading: false } }, methods: { @@ -283,10 +286,54 @@ export default { next() { this.$router.go(1); }, - search(event) { + async search(event) { //KeyUp event, enter if (event.keyCode !== 13) return; - this.$router.push({path: '/search', query: {q: this.searchQuery}}); + + //Check if url + if (this.searchQuery.startsWith('http')) { + this.searchLoading = true; + let url = new URL(this.searchQuery); + + //Normal link + if (url.hostname == 'www.deezer.com' || url.hostname == 'deezer.com' || url.hostname == 'deezer.page.link') { + + //Share link + if (url.hostname == 'deezer.page.link') { + let res = await this.$axios.get('/fullurl?url=' + encodeURIComponent(this.searchQuery)); + url = new URL(res.data.url); + } + + let supported = ['track', 'artist', 'album', 'playlist']; + + let path = url.pathname.substring(1).split('/'); + if (path.length == 3) path = path.slice(1); + let type = path[0]; + if (supported.includes(type)) { + + //Dirty lol + let res = await this.$axios('/' + path.join('/')); + if (res.data) { + //Add to queue + if (type == 'track') { + this.$root.queue.data.splice(this.$root.queue.index + 1, 0, res.data); + this.$root.skip(1); + } + //Show details page + if (type == 'artist' || type == 'album' || type == 'playlist') { + let query = {}; + query[type] = JSON.stringify(res.data); + this.$router.push({path: `/${type}`, query: query}); + } + } + } + } + + this.searchLoading = false; + } else { + //Normal search + this.$router.push({path: '/search', query: {q: this.searchQuery}}); + } }, seek(val) { this.$root.seek(Math.round((val / 100) * this.$root.duration())); @@ -314,7 +361,7 @@ export default { if (event.keyCode != 47) return; this.$refs.searchBar.focus(); setTimeout(() => { - this.searchQuery = this.searchQuery.replace(new RegExp('/', 'g'), ''); + if (this.searchQuery.startsWith('/')) this.searchQuery = this.searchQuery.substring(1); }, 40); }); diff --git a/app/client/src/components/ArtistTile.vue b/app/client/src/components/ArtistTile.vue index 54b2356..99eea55 100644 --- a/app/client/src/components/ArtistTile.vue +++ b/app/client/src/components/ArtistTile.vue @@ -1,7 +1,7 @@