Skip to content

Commit

Permalink
! Fix URL copied via right click menu
Browse files Browse the repository at this point in the history
- Invalid URL when copying IV video
- URL with user playlist ID
  • Loading branch information
PikachuEXE committed Feb 21, 2024
1 parent 822544f commit d935574
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,17 @@ function runApp() {
let url

if (toYouTube) {
url = `https://youtu.be/${id}`
url = new URL(`https://youtu.be/${id}`)
} else {
url = `https://redirect.invidious.io/watch?v=${id}`
url = new URL(`https://redirect.invidious.io/watch?v=${id}`)
}

if (query) {
const params = new URLSearchParams(query)
const newParams = new URLSearchParams()
const newParams = new URLSearchParams(url.search)
let hasParams = false

if (params.has('playlistId')) {
if (params.has('playlistId') && params.get('playlistType') !== 'user') {
newParams.set('list', params.get('playlistId'))
hasParams = true
}
Expand All @@ -124,11 +124,11 @@ function runApp() {
}

if (hasParams) {
url += '?' + newParams.toString()
url.search = newParams.toString()
}
}

return url
return url.toString()
}
}
}
Expand Down

0 comments on commit d935574

Please sign in to comment.