From 96835dd7037a5770bb6dc5be634d44d9dcfb364c Mon Sep 17 00:00:00 2001 From: RikThePixel <63408969+Rikthepixel@users.noreply.github.com> Date: Sun, 25 Jun 2023 16:40:03 +0200 Subject: [PATCH 01/92] Fix Hide Channel Subscribers setting still displaying subscribers if changed from a secondary window (#3504) (#3692) * Fix Hide Channel Subscribers setting still displaying subscribers if changed from a secondary window (#3504) * Revert naming change subscriptionCountText to channelSubCountText * Use `!=` instead of `!==` for `subscriberCount` in ft-list-channel * Set subscriberCount to null if `data.subscribers` is null in ft-list-channel.js Co-authored-by: absidue <48293849+absidue@users.noreply.github.com> --------- Co-authored-by: absidue <48293849+absidue@users.noreply.github.com> --- .../ft-list-channel/ft-list-channel.js | 13 +++--------- .../ft-list-channel/ft-list-channel.vue | 2 +- .../ft-subscribe-button.js | 6 +++++- src/renderer/views/Channel/Channel.js | 8 ++----- src/renderer/views/Channel/Channel.vue | 2 +- src/renderer/views/Watch/Watch.js | 21 +++++-------------- 6 files changed, 17 insertions(+), 35 deletions(-) diff --git a/src/renderer/components/ft-list-channel/ft-list-channel.js b/src/renderer/components/ft-list-channel/ft-list-channel.js index bd5409241cc47..db21d867c1bd8 100644 --- a/src/renderer/components/ft-list-channel/ft-list-channel.js +++ b/src/renderer/components/ft-list-channel/ft-list-channel.js @@ -53,11 +53,8 @@ export default defineComponent({ this.channelName = this.data.name this.id = this.data.id - if (this.hideChannelSubscriptions || this.data.subscribers == null) { - this.subscriberCount = null - } else { - this.subscriberCount = this.data.subscribers.replace(/ subscriber(s)?/, '') - } + this.subscriberCount = this.data.subscribers != null ? this.data.subscribers.replace(/ subscriber(s)?/, '') : null + if (this.data.videos === null) { this.videoCount = 0 } else { @@ -79,11 +76,7 @@ export default defineComponent({ this.channelName = this.data.author this.id = this.data.authorId - if (this.hideChannelSubscriptions) { - this.subscriberCount = null - } else { - this.subscriberCount = formatNumber(this.data.subCount) - } + this.subscriberCount = formatNumber(this.data.subCount) this.videoCount = formatNumber(this.data.videoCount) this.description = this.data.description } diff --git a/src/renderer/components/ft-list-channel/ft-list-channel.vue b/src/renderer/components/ft-list-channel/ft-list-channel.vue index 6ac9f8ed835dd..cfc85205005e1 100644 --- a/src/renderer/components/ft-list-channel/ft-list-channel.vue +++ b/src/renderer/components/ft-list-channel/ft-list-channel.vue @@ -26,7 +26,7 @@
{{ subscriberCount }} subscribers - diff --git a/src/renderer/components/ft-subscribe-button/ft-subscribe-button.js b/src/renderer/components/ft-subscribe-button/ft-subscribe-button.js index 15a6147c94087..270715369b708 100644 --- a/src/renderer/components/ft-subscribe-button/ft-subscribe-button.js +++ b/src/renderer/components/ft-subscribe-button/ft-subscribe-button.js @@ -50,9 +50,13 @@ export default defineComponent({ return this.subscriptionInfo !== null }, + hideChannelSubscriptions: function () { + return this.$store.getters.getHideChannelSubscriptions + }, + subscribedText: function () { let subscribedValue = (this.isSubscribed ? this.$t('Channel.Unsubscribe') : this.$t('Channel.Subscribe')).toUpperCase() - if (this.subscriptionCountText !== '') { + if (this.subscriptionCountText !== '' && !this.hideChannelSubscriptions) { subscribedValue += ' ' + this.subscriptionCountText } return subscribedValue diff --git a/src/renderer/views/Channel/Channel.js b/src/renderer/views/Channel/Channel.js index 27e2d97200880..1f7462f8812bd 100644 --- a/src/renderer/views/Channel/Channel.js +++ b/src/renderer/views/Channel/Channel.js @@ -559,7 +559,7 @@ export default defineComponent({ document.title = `${channelName} - ${packageDetails.productName}` - if (!this.hideChannelSubscriptions && subscriberText) { + if (subscriberText) { const subCount = parseLocalSubscriberCount(subscriberText) if (isNaN(subCount)) { @@ -864,11 +864,7 @@ export default defineComponent({ document.title = `${this.channelName} - ${packageDetails.productName}` this.id = channelId this.isFamilyFriendly = response.isFamilyFriendly - if (this.hideChannelSubscriptions) { - this.subCount = null - } else { - this.subCount = response.subCount - } + this.subCount = response.subCount const thumbnail = response.authorThumbnails[3].url this.thumbnailUrl = youtubeImageUrlToInvidious(thumbnail, this.currentInvidiousInstance) this.updateSubscriptionDetails({ channelThumbnailUrl: thumbnail, channelName: channelName, channelId: channelId }) diff --git a/src/renderer/views/Channel/Channel.vue b/src/renderer/views/Channel/Channel.vue index 23b8b3a81d8f8..395dbba1c4550 100644 --- a/src/renderer/views/Channel/Channel.vue +++ b/src/renderer/views/Channel/Channel.vue @@ -49,7 +49,7 @@

{{ formattedSubCount }} diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index 70481b1054855..3e79d34f865e7 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -357,18 +357,10 @@ export default defineComponent({ this.isUpcoming = !!result.basic_info.is_upcoming this.isLiveContent = !!result.basic_info.is_live_content - if (!this.hideChannelSubscriptions) { - const subCount = parseLocalSubscriberCount(result.secondary_info.owner.subscriber_count.text) + const subCount = parseLocalSubscriberCount(result.secondary_info.owner.subscriber_count.text) - if (!isNaN(subCount)) { - if (subCount >= 10000) { - this.channelSubscriptionCountText = formatNumber(subCount, { notation: 'compact' }) - } else { - this.channelSubscriptionCountText = formatNumber(subCount) - } - } else { - this.channelSubscriptionCountText = '' - } + if (!isNaN(subCount)) { + this.channelSubscriptionCountText = formatNumber(subCount, subCount >= 10000 ? { notation: 'compact' } : undefined) } else { this.channelSubscriptionCountText = '' } @@ -720,6 +712,7 @@ export default defineComponent({ this.videoTitle = result.title this.videoViewCount = result.viewCount + this.channelSubscriptionCountText = result.subCountText || 'FT-0' if (this.hideVideoLikesAndDislikes) { this.videoLikeCount = null this.videoDislikeCount = null @@ -727,11 +720,7 @@ export default defineComponent({ this.videoLikeCount = result.likeCount this.videoDislikeCount = result.dislikeCount } - if (this.hideChannelSubscriptions) { - this.channelSubscriptionCountText = '' - } else { - this.channelSubscriptionCountText = result.subCountText || 'FT-0' - } + this.channelId = result.authorId this.channelName = result.author const channelThumb = result.authorThumbnails[1] From 427ec794c4724855274661eacb0ad8d5474df6db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 19:32:00 +0200 Subject: [PATCH 02/92] Bump lefthook from 1.4.2 to 1.4.3 (#3707) Bumps [lefthook](https://github.com/evilmartians/lefthook) from 1.4.2 to 1.4.3. - [Release notes](https://github.com/evilmartians/lefthook/releases) - [Changelog](https://github.com/evilmartians/lefthook/blob/master/CHANGELOG.md) - [Commits](https://github.com/evilmartians/lefthook/compare/v1.4.2...v1.4.3) --- updated-dependencies: - dependency-name: lefthook dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 88 ++++++++++++++++++++++++++-------------------------- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/package.json b/package.json index 7337a059d261b..eafb9d57dd32e 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,7 @@ "html-webpack-plugin": "^5.5.3", "js-yaml": "^4.1.0", "json-minimizer-webpack-plugin": "^4.0.0", - "lefthook": "^1.4.2", + "lefthook": "^1.4.3", "mini-css-extract-plugin": "^2.7.6", "npm-run-all": "^4.1.5", "postcss": "^8.4.24", diff --git a/yarn.lock b/yarn.lock index d4c8a0b56d45f..63a0be23f8a43 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5343,59 +5343,59 @@ lazy-val@^1.0.4, lazy-val@^1.0.5: resolved "https://registry.yarnpkg.com/lazy-val/-/lazy-val-1.0.5.tgz#6cf3b9f5bc31cee7ee3e369c0832b7583dcd923d" integrity sha512-0/BnGCCfyUMkBpeDgWihanIAF9JmZhHBgUhEqzvf+adhNGLoP6TaiI5oF8oyb3I45P+PcnrqihSf01M0l0G5+Q== -lefthook-darwin-arm64@1.4.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/lefthook-darwin-arm64/-/lefthook-darwin-arm64-1.4.2.tgz#aa2fc610491c651e77c95d346bf41f589ef2fc7b" - integrity sha512-1tyNoHbjIuGa3xWWoMwaX5cF3EjRYCZSomMDPiHnIom1dxa/p3nSaF0thJSnQRlXNddsisH+t6vWOmccgukCWA== +lefthook-darwin-arm64@1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/lefthook-darwin-arm64/-/lefthook-darwin-arm64-1.4.3.tgz#b253fbc20041815010da66e8588faf4bbd75c0aa" + integrity sha512-ZFsgIzN+Z0c4RpMMHU/M4J43XFyXYGZI8r0GG4jqVMX+prDBIb/6vpgMdZxK5IozRUmnfLGQPXcVokE9WBHSOg== -lefthook-darwin-x64@1.4.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/lefthook-darwin-x64/-/lefthook-darwin-x64-1.4.2.tgz#fc8a3900def1839cac180bd3c418e4a2acdc5cd7" - integrity sha512-+CcLTMvNTOdP2E7qHnAiSn1xtNeMLbhykyJOe/7Dd5beAv4BZ94ZnuoH74RIgyBALeZxpUeOdwJNI3Nc8Pg6+A== +lefthook-darwin-x64@1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/lefthook-darwin-x64/-/lefthook-darwin-x64-1.4.3.tgz#5afa63f7a18cf89495895fc1321cdd749825bf9c" + integrity sha512-O6ZesdJ9MStI38gNfJh0ShExIf0KyHG1lR32F9FUFklFwhcquRM+uIDyDqVCxU3UWqmKwcbTk9AJWMjQZGPLxQ== -lefthook-freebsd-arm64@1.4.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/lefthook-freebsd-arm64/-/lefthook-freebsd-arm64-1.4.2.tgz#58fa1714f5c2972e7e4ff8ced9658654de654fae" - integrity sha512-uT0PR66ZEMzaFco+eTn/3jYzf47vt0UQM6u5eWPdYoUQTbYavvpsecyGw6YyhIaIYVOwbK8Gaf2YVJMvZFEyLA== +lefthook-freebsd-arm64@1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/lefthook-freebsd-arm64/-/lefthook-freebsd-arm64-1.4.3.tgz#070141ccc981658bd7545f40b14814b410f2930e" + integrity sha512-6swb+98Qs6P9V9Rcd2lHWH2LunFEk+kfIPpf6oiPrOHnw3OkfFhQLmawX425Ari7Y9qy9gfDoNe/0/IR7YGmGw== -lefthook-freebsd-x64@1.4.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/lefthook-freebsd-x64/-/lefthook-freebsd-x64-1.4.2.tgz#118d01566e308704a4c8d351b19187cd403ed68f" - integrity sha512-4FaBXxenytECD1R3qM/VTVSqp7E3mlKBtm5dDVGXNMBIsTXiEP/qkuk3nteIUnhgjQv0Ma23V0v7KTmNlo1oXA== +lefthook-freebsd-x64@1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/lefthook-freebsd-x64/-/lefthook-freebsd-x64-1.4.3.tgz#47b4e7cf4c0459b1152e605c047541ec3eec5f0b" + integrity sha512-+58NARATypmIj0kDutd29ozywr6IeA0lVBxsVzq7C5ycYrd31iNak3lnaEvNJvdj5fGVNEL9X7XRojylthZlAg== -lefthook-linux-arm64@1.4.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/lefthook-linux-arm64/-/lefthook-linux-arm64-1.4.2.tgz#30a879fcb460cd3e1341853cbe8cbdd1a46db9a5" - integrity sha512-RzI1j6LPW1y4dqrVSBv/B/Sipa9Bp9LP0TB9BRB0CmxIqerFe90x9wVp3vAAkodGHv/B7Xa5f1OAibwkSbtTkw== +lefthook-linux-arm64@1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/lefthook-linux-arm64/-/lefthook-linux-arm64-1.4.3.tgz#b3caae33a20cc2665ec047a098e7b4e4498d63d1" + integrity sha512-gAWJQEhgheOfPu579fhlcNNm3KoJbNkT11AATKHlFu+esyiCxI8xZVpGwDQVMphO7s43FKbkQJSvIM4tElb6FQ== -lefthook-linux-x64@1.4.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/lefthook-linux-x64/-/lefthook-linux-x64-1.4.2.tgz#972270c7e9284fb8d13531fef1a315c7d26ccdae" - integrity sha512-huBfLsIPVfdU0jPnGCvJ4e39JdkXKsbb0Dr+fzAhLNhcg6Touo6y/pwDbW5zfeN2hu0EdhzT0p0a28FGsV9dEQ== +lefthook-linux-x64@1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/lefthook-linux-x64/-/lefthook-linux-x64-1.4.3.tgz#ac2990e23a4c39bf774e4094f33c0fbaef79129c" + integrity sha512-mVv/amRqX81nQcizhRRx/X6KKNIkMUG4HdDItWkDazwLAviZ2zv8TRcSaEYBOpriP/dBZm8gt6EhzPpfoWtcJw== -lefthook-windows-arm64@1.4.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/lefthook-windows-arm64/-/lefthook-windows-arm64-1.4.2.tgz#47d509e769ab64e0b49ad732b2e123ae017c077d" - integrity sha512-vzx6jbyLkAncE7UB3IB9HJqoFFZpGaxnp6zVimvDDOUSAOLKgbF+jJHgXlX8j6kzs/rZAoYmA0oR48dpUcUNQw== +lefthook-windows-arm64@1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/lefthook-windows-arm64/-/lefthook-windows-arm64-1.4.3.tgz#dc0dcfea32badab031183bdc8cd91bda929cee9b" + integrity sha512-ccClPTC7AvhcbyT6pLzdV8K8e/P0T7p/THGRtcyjkKIU0IS89k95VazDlt22QPzUTc8UMNCQyZ1XY4UDx295jw== -lefthook-windows-x64@1.4.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/lefthook-windows-x64/-/lefthook-windows-x64-1.4.2.tgz#d59db53a464137b6f3af615fa7911a8706861837" - integrity sha512-sXTlvUITYzBIpNwlQO6Oa8nIB9GV4cUPmf6wdyPn1dv/1qa1+0ROgeROJzLYj2v+NtiJ2aIHTjaOXiBeoZCISA== +lefthook-windows-x64@1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/lefthook-windows-x64/-/lefthook-windows-x64-1.4.3.tgz#795b1215969c7d0d4007f89bfe660cfc2736075c" + integrity sha512-q1K5kycfqTYLm5/pOCiAFa+hoSFt/29QjHVZAWRmk/nKDIf8MvTWX0tdaEx7/VJuG3cgQT1jM+xiTwSmNUXTKg== -lefthook@^1.4.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/lefthook/-/lefthook-1.4.2.tgz#83f9aaa84d847026f13058406560f9a12eac84c2" - integrity sha512-T7fvI7WXEZGUcaeuLckAzL5EURi6x5fkoBYjeiJ1u2ix2/A4Xjlca/lGQzgrqVWyCaHKeW5QkhR2tXwiubuLlw== +lefthook@^1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/lefthook/-/lefthook-1.4.3.tgz#cedfd13f13c87a974ea5e055853c7fae0c6df11e" + integrity sha512-zvhAJ9wDQW7F27XYWRfx72L6LuPLu49be+sRUF+DKku1IGT+x3eHjQ9k70pt65lnEq1X8Xl/Xygm3Kwi/piOYg== optionalDependencies: - lefthook-darwin-arm64 "1.4.2" - lefthook-darwin-x64 "1.4.2" - lefthook-freebsd-arm64 "1.4.2" - lefthook-freebsd-x64 "1.4.2" - lefthook-linux-arm64 "1.4.2" - lefthook-linux-x64 "1.4.2" - lefthook-windows-arm64 "1.4.2" - lefthook-windows-x64 "1.4.2" + lefthook-darwin-arm64 "1.4.3" + lefthook-darwin-x64 "1.4.3" + lefthook-freebsd-arm64 "1.4.3" + lefthook-freebsd-x64 "1.4.3" + lefthook-linux-arm64 "1.4.3" + lefthook-linux-x64 "1.4.3" + lefthook-windows-arm64 "1.4.3" + lefthook-windows-x64 "1.4.3" levn@^0.4.1: version "0.4.1" From 2f1f7c3d2c6da8b3096bd4bc10b5acd0288b3dd0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 19:32:17 +0200 Subject: [PATCH 03/92] Bump webpack from 5.87.0 to 5.88.0 (#3706) Bumps [webpack](https://github.com/webpack/webpack) from 5.87.0 to 5.88.0. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](https://github.com/webpack/webpack/compare/v5.87.0...v5.88.0) --- updated-dependencies: - dependency-name: webpack dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index eafb9d57dd32e..471d99e9f6038 100644 --- a/package.json +++ b/package.json @@ -123,7 +123,7 @@ "vue-devtools": "^5.1.4", "vue-eslint-parser": "^9.3.1", "vue-loader": "^15.10.0", - "webpack": "^5.87.0", + "webpack": "^5.88.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^4.15.1", "yaml-eslint-parser": "^1.2.2" diff --git a/yarn.lock b/yarn.lock index 63a0be23f8a43..cbdc8cf690b35 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8346,10 +8346,10 @@ webpack-sources@^3.2.3: resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== -webpack@^5.87.0: - version "5.87.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.87.0.tgz#df8a9c094c6037f45e0d77598f9e59d33ca3a98c" - integrity sha512-GOu1tNbQ7p1bDEoFRs2YPcfyGs8xq52yyPBZ3m2VGnXGtV9MxjrkABHm4V9Ia280OefsSLzvbVoXcfLxjKY/Iw== +webpack@^5.88.0: + version "5.88.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.88.0.tgz#a07aa2f8e7a64a8f1cec0c6c2e180e3cb34440c8" + integrity sha512-O3jDhG5e44qIBSi/P6KpcCcH7HD+nYIHVBhdWFxcLOcIGN8zGo5nqF3BjyNCxIh4p1vFdNnreZv2h2KkoAw3lw== dependencies: "@types/eslint-scope" "^3.7.3" "@types/estree" "^1.0.0" From 3d61fd71251c207bb6f430ba460d438cb986ccb9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 19:32:45 +0200 Subject: [PATCH 04/92] Bump electron from 22.3.13 to 22.3.14 (#3705) Bumps [electron](https://github.com/electron/electron) from 22.3.13 to 22.3.14. - [Release notes](https://github.com/electron/electron/releases) - [Changelog](https://github.com/electron/electron/blob/main/docs/breaking-changes.md) - [Commits](https://github.com/electron/electron/compare/v22.3.13...v22.3.14) --- updated-dependencies: - dependency-name: electron dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 471d99e9f6038..859724b7ffa18 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "copy-webpack-plugin": "^11.0.0", "css-loader": "^6.8.1", "css-minimizer-webpack-plugin": "^5.0.1", - "electron": "^22.3.13", + "electron": "^22.3.14", "electron-builder": "^23.6.0", "eslint": "^8.43.0", "eslint-config-prettier": "^8.8.0", diff --git a/yarn.lock b/yarn.lock index cbdc8cf690b35..41e1974314f2e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3344,10 +3344,10 @@ electron-to-chromium@^1.4.411: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.411.tgz#8cb7787f0442fcb4209590e9951bdb482caa93b2" integrity sha512-5VXLW4Qw89vM2WTICHua/y8v7fKGDRVa2VPOtBB9IpLvW316B+xd8yD1wTmLPY2ot/00P/qt87xdolj4aG/Lzg== -electron@^22.3.13: - version "22.3.13" - resolved "https://registry.yarnpkg.com/electron/-/electron-22.3.13.tgz#ce1de257a3f17dc44c8954789ada0ac31dec1120" - integrity sha512-SDqQM3zSNiiiHIaxhx9yshWwgkqhyYMEH7XfWQhnvtI3N+5bnC6Po7Uz7p2jVqHWaBYTatdbBwB0flhvlDtBuQ== +electron@^22.3.14: + version "22.3.14" + resolved "https://registry.yarnpkg.com/electron/-/electron-22.3.14.tgz#539fc7d7b6df37483aaa351856a28e43092d550e" + integrity sha512-WxVcLnC4DrkBLN1/BwpxNkGvVq8iq1hM7lae5nvjnSYg/bwVbuo1Cwc80Keft4MIWKlYCXNiKKqs3qCXV4Aiaw== dependencies: "@electron/get" "^2.0.0" "@types/node" "^16.11.26" From 76c0361f998db0f0fae90671941cdb81560b163c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 19:33:37 +0200 Subject: [PATCH 05/92] Bump eslint-plugin-n from 16.0.0 to 16.0.1 (#3704) Bumps [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) from 16.0.0 to 16.0.1. - [Release notes](https://github.com/eslint-community/eslint-plugin-n/releases) - [Commits](https://github.com/eslint-community/eslint-plugin-n/compare/16.0.0...16.0.1) --- updated-dependencies: - dependency-name: eslint-plugin-n dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 36 ++++++++++++++++++------------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 859724b7ffa18..3f5daa1cfe1c1 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "eslint-config-standard": "^17.1.0", "eslint-plugin-import": "^2.27.5", "eslint-plugin-jsonc": "^2.9.0", - "eslint-plugin-n": "^16.0.0", + "eslint-plugin-n": "^16.0.1", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-promise": "^6.1.1", "eslint-plugin-unicorn": "^47.0.0", diff --git a/yarn.lock b/yarn.lock index 41e1974314f2e..6c681f34ab848 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3618,10 +3618,10 @@ eslint-module-utils@^2.7.4: dependencies: debug "^3.2.7" -eslint-plugin-es-x@^6.1.0: - version "6.2.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-es-x/-/eslint-plugin-es-x-6.2.1.tgz#34c9abc22483d7d49ff9ca8b5db29d54442d2e6b" - integrity sha512-uR34zUhZ9EBoiSD2DdV5kHLpydVEvwWqjteUr9sXRgJknwbKZJZhdJ7uFnaTtd+Nr/2G3ceJHnHXrFhJ67n3Tw== +eslint-plugin-es-x@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-es-x/-/eslint-plugin-es-x-7.1.0.tgz#f0d5421e658cca95c1cfb2355831851bdc83322d" + integrity sha512-AhiaF31syh4CCQ+C5ccJA0VG6+kJK8+5mXKKE7Qs1xcPRg02CDPOj3mWlQxuWS/AYtg7kxrDNgW9YW3vc0Q+Mw== dependencies: "@eslint-community/eslint-utils" "^4.1.2" "@eslint-community/regexpp" "^4.5.0" @@ -3656,19 +3656,19 @@ eslint-plugin-jsonc@^2.9.0: jsonc-eslint-parser "^2.0.4" natural-compare "^1.4.0" -eslint-plugin-n@^16.0.0: - version "16.0.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-16.0.0.tgz#de39e4dd6cf04fd78fd6f49cb39ecb20ea0167ff" - integrity sha512-akkZTE3hsHBrq6CwmGuYCzQREbVUrA855kzcHqe6i0FLBkeY7Y/6tThCVkjUnjhvRBAlc+8lILcSe5QvvDpeZQ== +eslint-plugin-n@^16.0.1: + version "16.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-16.0.1.tgz#baa62bb3af52940a53ba15386348ad9b0b425ada" + integrity sha512-CDmHegJN0OF3L5cz5tATH84RPQm9kG+Yx39wIqIwPR2C0uhBGMWfbbOtetR83PQjjidA5aXMu+LEFw1jaSwvTA== dependencies: "@eslint-community/eslint-utils" "^4.4.0" builtins "^5.0.1" - eslint-plugin-es-x "^6.1.0" - ignore "^5.1.1" - is-core-module "^2.12.0" + eslint-plugin-es-x "^7.1.0" + ignore "^5.2.4" + is-core-module "^2.12.1" minimatch "^3.1.2" resolve "^1.22.2" - semver "^7.5.0" + semver "^7.5.3" eslint-plugin-prettier@^4.2.1: version "4.2.1" @@ -4722,7 +4722,7 @@ ieee754@^1.1.13: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== -ignore@^5.1.1, ignore@^5.2.0, ignore@^5.2.1: +ignore@^5.2.0, ignore@^5.2.1, ignore@^5.2.4: version "5.2.4" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== @@ -4897,7 +4897,7 @@ is-ci@^3.0.0: dependencies: ci-info "^3.2.0" -is-core-module@^2.11.0, is-core-module@^2.12.0, is-core-module@^2.5.0: +is-core-module@^2.11.0, is-core-module@^2.12.1, is-core-module@^2.5.0: version "2.12.1" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.12.1.tgz#0c0b6885b6f80011c71541ce15c8d66cf5a4f9fd" integrity sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg== @@ -7117,10 +7117,10 @@ semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== -semver@^7.0.0, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.6, semver@^7.3.7, semver@^7.3.8, semver@^7.5.0: - version "7.5.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.1.tgz#c90c4d631cf74720e46b21c1d37ea07edfab91ec" - integrity sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw== +semver@^7.0.0, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.6, semver@^7.3.7, semver@^7.3.8, semver@^7.5.3: + version "7.5.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.3.tgz#161ce8c2c6b4b3bdca6caadc9fa3317a4c4fe88e" + integrity sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ== dependencies: lru-cache "^6.0.0" From 97c4d8fe28f1b41680f9b90485d384ceeb05aa4d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 19:34:04 +0200 Subject: [PATCH 06/92] Bump sass from 1.63.4 to 1.63.6 (#3702) Bumps [sass](https://github.com/sass/dart-sass) from 1.63.4 to 1.63.6. - [Release notes](https://github.com/sass/dart-sass/releases) - [Changelog](https://github.com/sass/dart-sass/blob/main/CHANGELOG.md) - [Commits](https://github.com/sass/dart-sass/compare/1.63.4...1.63.6) --- updated-dependencies: - dependency-name: sass dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 3f5daa1cfe1c1..71b868b1343d2 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,7 @@ "postcss-scss": "^4.0.6", "prettier": "^2.8.8", "rimraf": "^5.0.1", - "sass": "^1.63.4", + "sass": "^1.63.6", "sass-loader": "^13.3.2", "stylelint": "^14.16.1", "stylelint-config-sass-guidelines": "^9.0.1", diff --git a/yarn.lock b/yarn.lock index 6c681f34ab848..3dbde73e72850 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7057,10 +7057,10 @@ sass-loader@^13.3.2: dependencies: neo-async "^2.6.2" -sass@^1.63.4: - version "1.63.4" - resolved "https://registry.yarnpkg.com/sass/-/sass-1.63.4.tgz#caf60643321044c61f6a0fe638a07abbd31cfb5d" - integrity sha512-Sx/+weUmK+oiIlI+9sdD0wZHsqpbgQg8wSwSnGBjwb5GwqFhYNwwnI+UWZtLjKvKyFlKkatRK235qQ3mokyPoQ== +sass@^1.63.6: + version "1.63.6" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.63.6.tgz#481610e612902e0c31c46b46cf2dad66943283ea" + integrity sha512-MJuxGMHzaOW7ipp+1KdELtqKbfAWbH7OLIdoSMnVe3EXPMTmxTmlaZDCTsgIpPCs3w99lLo9/zDKkOrJuT5byw== dependencies: chokidar ">=3.0.0 <4.0.0" immutable "^4.0.0" From 17e94c7fd79b8765e29737356543285251a021ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 19:34:18 +0200 Subject: [PATCH 07/92] Bump eslint-plugin-vue from 9.15.0 to 9.15.1 (#3703) Bumps [eslint-plugin-vue](https://github.com/vuejs/eslint-plugin-vue) from 9.15.0 to 9.15.1. - [Release notes](https://github.com/vuejs/eslint-plugin-vue/releases) - [Commits](https://github.com/vuejs/eslint-plugin-vue/compare/v9.15.0...v9.15.1) --- updated-dependencies: - dependency-name: eslint-plugin-vue dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 71b868b1343d2..27908e5c9528b 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-promise": "^6.1.1", "eslint-plugin-unicorn": "^47.0.0", - "eslint-plugin-vue": "^9.15.0", + "eslint-plugin-vue": "^9.15.1", "eslint-plugin-vuejs-accessibility": "^2.1.0", "eslint-plugin-yml": "^1.8.0", "html-webpack-plugin": "^5.5.3", diff --git a/yarn.lock b/yarn.lock index 3dbde73e72850..d0fc5dc5f25d1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3704,10 +3704,10 @@ eslint-plugin-unicorn@^47.0.0: semver "^7.3.8" strip-indent "^3.0.0" -eslint-plugin-vue@^9.15.0: - version "9.15.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-9.15.0.tgz#2bffe2b8a628ee438f983672a73cd89df455c461" - integrity sha512-XYzpK6e2REli100+6iCeBA69v6Sm0D/yK2FZP+fCeNt0yH/m82qZQq+ztseyV0JsKdhFysuSEzeE1yCmSC92BA== +eslint-plugin-vue@^9.15.1: + version "9.15.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-9.15.1.tgz#3c09e0edab444b5d4d9239a12a645a0e2e2ea5be" + integrity sha512-CJE/oZOslvmAR9hf8SClTdQ9JLweghT6JCBQNrT2Iel1uVw0W0OLJxzvPd6CxmABKCvLrtyDnqGV37O7KQv6+A== dependencies: "@eslint-community/eslint-utils" "^4.3.0" natural-compare "^1.4.0" From 23d8af59f637fae4f3fb948d30f4b1be4cdc4252 Mon Sep 17 00:00:00 2001 From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> Date: Mon, 26 Jun 2023 11:13:32 -0700 Subject: [PATCH 08/92] Fix some web build errors (#3687) --- .../player-settings/player-settings.js | 38 ++++++++++++------- .../player-settings/player-settings.vue | 13 +++++-- src/renderer/store/modules/invidious.js | 6 ++- src/renderer/store/modules/settings.js | 6 +-- static/pwabuilder-sw.js | 4 -- 5 files changed, 41 insertions(+), 26 deletions(-) diff --git a/src/renderer/components/player-settings/player-settings.js b/src/renderer/components/player-settings/player-settings.js index 54611a59f16f1..36a4dae7eb3a5 100644 --- a/src/renderer/components/player-settings/player-settings.js +++ b/src/renderer/components/player-settings/player-settings.js @@ -8,7 +8,6 @@ import FtFlexBox from '../ft-flex-box/ft-flex-box.vue' import FtButton from '../ft-button/ft-button.vue' import FtInput from '../ft-input/ft-input.vue' import FtTooltip from '../ft-tooltip/ft-tooltip.vue' -import { ipcRenderer } from 'electron' import { IpcChannels } from '../../../constants' import path from 'path' import { getPicturesPath } from '../../helpers/utils' @@ -61,6 +60,10 @@ export default defineComponent({ } }, computed: { + usingElectron: function () { + return process.env.IS_ELECTRON + }, + backendPreference: function () { return this.$store.getters.getBackendPreference }, @@ -226,7 +229,11 @@ export default defineComponent({ }, getScreenshotEmptyFolderPlaceholder: async function() { - return path.join(await getPicturesPath(), 'Freetube') + if (process.env.IS_ELECTRON) { + return path.join(await getPicturesPath(), 'Freetube') + } else { + return '' + } }, getScreenshotFolderPlaceholder: function() { @@ -234,21 +241,26 @@ export default defineComponent({ this.screenshotFolderPlaceholder = this.screenshotFolder return } - this.getScreenshotEmptyFolderPlaceholder().then((res) => { - this.screenshotFolderPlaceholder = res - }) + if (process.env.IS_ELECTRON) { + this.getScreenshotEmptyFolderPlaceholder().then((res) => { + this.screenshotFolderPlaceholder = res + }) + } }, chooseScreenshotFolder: async function() { // only use with electron - const folder = await ipcRenderer.invoke( - IpcChannels.SHOW_OPEN_DIALOG, - { properties: ['openDirectory'] } - ) - - if (!folder.canceled) { - await this.updateScreenshotFolderPath(folder.filePaths[0]) - this.getScreenshotFolderPlaceholder() + if (process.env.IS_ELECTRON) { + const { ipcRenderer } = require('electron') + const folder = await ipcRenderer.invoke( + IpcChannels.SHOW_OPEN_DIALOG, + { properties: ['openDirectory'] } + ) + + if (!folder.canceled) { + await this.updateScreenshotFolderPath(folder.filePaths[0]) + this.getScreenshotFolderPlaceholder() + } } }, diff --git a/src/renderer/components/player-settings/player-settings.vue b/src/renderer/components/player-settings/player-settings.vue index 11e40690d5fd5..5e1a614ad8c73 100644 --- a/src/renderer/components/player-settings/player-settings.vue +++ b/src/renderer/components/player-settings/player-settings.vue @@ -169,14 +169,16 @@ />
- + -

+

@@ -223,7 +225,10 @@ @click="chooseScreenshotFolder" /> - +

{{ $t('Settings.Player Settings.Screenshot.File Name Label') }} { return process.env.IS_ELECTRON || e.cors }).map(e => { diff --git a/src/renderer/store/modules/settings.js b/src/renderer/store/modules/settings.js index 5fcb15dde0a77..c156eaddd6ac9 100644 --- a/src/renderer/store/modules/settings.js +++ b/src/renderer/store/modules/settings.js @@ -163,8 +163,8 @@ const defaultSideEffectsTriggerId = settingId => const state = { autoplayPlaylists: true, autoplayVideos: true, - backendFallback: true, - backendPreference: 'local', + backendFallback: process.env.IS_ELECTRON, + backendPreference: !process.env.IS_ELECTRON ? 'invidious' : 'local', barColor: false, checkForBlogPosts: true, checkForUpdates: true, @@ -225,7 +225,7 @@ const state = { proxyHostname: '127.0.0.1', proxyPort: '9050', proxyProtocol: 'socks5', - proxyVideos: false, + proxyVideos: !process.env.IS_ELECTRON, region: 'US', rememberHistory: true, removeVideoMetaFiles: true, diff --git a/static/pwabuilder-sw.js b/static/pwabuilder-sw.js index bc108b31dbfca..f9dc1fdbb18a4 100644 --- a/static/pwabuilder-sw.js +++ b/static/pwabuilder-sw.js @@ -53,10 +53,6 @@ self.addEventListener('install', function (event) { console.log('[PWA Builder] Caching pages during install') return cache.addAll(precacheFiles).then(function () { - if (offlineFallbackPage === 'ToDo-replace-this-name.html') { - return cache.add(new Response('TODO: Update the value of the offlineFallbackPage constant in the serviceworker.')) - } - return cache.add(offlineFallbackPage) }) }) From 0a471f8a172214925724acb367696086d3afe5e1 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Mon, 26 Jun 2023 20:58:31 +0200 Subject: [PATCH 09/92] Fix channel tabs accessibility (#3689) --- src/renderer/views/Channel/Channel.js | 8 -------- src/renderer/views/Channel/Channel.vue | 24 ++++++++++++------------ 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/renderer/views/Channel/Channel.js b/src/renderer/views/Channel/Channel.js index 1f7462f8812bd..4804dd9a45881 100644 --- a/src/renderer/views/Channel/Channel.js +++ b/src/renderer/views/Channel/Channel.js @@ -1395,21 +1395,13 @@ export default defineComponent({ : this.tabInfoValues[(index + 1) % this.tabInfoValues.length] const tabNode = document.getElementById(`${tab}Tab`) - event.target.setAttribute('tabindex', '-1') - tabNode.setAttribute('tabindex', 0) tabNode.focus({ focusVisible: true }) return } } - // `currentTabNode` can be `null` on 2nd+ search - const currentTabNode = document.querySelector('.tabs > .tab[aria-selected="true"]') // `newTabNode` can be `null` when `tab` === "search" const newTabNode = document.getElementById(`${tab}Tab`) - document.querySelector('.tabs > .tab[tabindex="0"]')?.setAttribute('tabindex', '-1') - newTabNode?.setAttribute('tabindex', '0') - currentTabNode?.setAttribute('aria-selected', 'false') - newTabNode?.setAttribute('aria-selected', 'true') this.currentTab = tab newTabNode?.focus({ focusVisible: true }) }, diff --git a/src/renderer/views/Channel/Channel.vue b/src/renderer/views/Channel/Channel.vue index 395dbba1c4550..306bb6c78766d 100644 --- a/src/renderer/views/Channel/Channel.vue +++ b/src/renderer/views/Channel/Channel.vue @@ -90,9 +90,9 @@ class="tab" :class="(currentTab==='videos')?'selectedTab':''" role="tab" - aria-selected="true" + :aria-selected="String(currentTab === 'videos')" aria-controls="videoPanel" - tabindex="0" + :tabindex="(currentTab === 'videos' || currentTab === 'search') ? 0 : -1" @click="changeTab('videos')" @keydown.left.right.enter.space="changeTab('videos', $event)" > @@ -104,9 +104,9 @@ class="tab" :class="(currentTab==='shorts')?'selectedTab':''" role="tab" - aria-selected="true" + :aria-selected="String(currentTab === 'shorts')" aria-controls="shortPanel" - tabindex="0" + :tabindex="currentTab === 'shorts' ? 0 : -1" @click="changeTab('shorts')" @keydown.left.right.enter.space="changeTab('shorts', $event)" > @@ -118,9 +118,9 @@ class="tab" :class="(currentTab==='live')?'selectedTab':''" role="tab" - aria-selected="true" + :aria-selected="String(currentTab === 'live')" aria-controls="livePanel" - tabindex="0" + :tabindex="currentTab === 'live' ? 0 : -1" @click="changeTab('live')" @keydown.left.right.enter.space="changeTab('live', $event)" > @@ -131,9 +131,9 @@ id="playlistsTab" class="tab" role="tab" - aria-selected="false" + :aria-selected="String(currentTab === 'playlists')" aria-controls="playlistPanel" - tabindex="-1" + :tabindex="currentTab === 'playlists' ? 0 : -1" :class="(currentTab==='playlists')?'selectedTab':''" @click="changeTab('playlists')" @keydown.left.right.enter.space="changeTab('playlists', $event)" @@ -145,9 +145,9 @@ id="communityTab" class="tab" role="tab" - aria-selected="false" + :aria-selected="String(currentTab === 'community')" aria-controls="communityPanel" - tabindex="-1" + :tabindex="currentTab === 'community' ? 0 : -1" :class="(currentTab==='community')?'selectedTab':''" @click="changeTab('community')" @keydown.left.right.enter.space="changeTab('community', $event)" @@ -158,9 +158,9 @@ id="aboutTab" class="tab" role="tab" - aria-selected="false" + :aria-selected="String(currentTab === 'about')" aria-controls="aboutPanel" - tabindex="-1" + :tabindex="currentTab === 'about' ? 0 : -1" :class="(currentTab==='about')?'selectedTab':''" @click="changeTab('about')" @keydown.left.right.enter.space="changeTab('about', $event)" From c102996b526aadac0407dceb7dac7ae93cf8e201 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Mon, 26 Jun 2023 22:15:42 +0200 Subject: [PATCH 10/92] Fix search bar keyboard shortcuts after hide search bar is disabled (#3699) * Fix search bar keyboard shortcuts after hide search bar is disabled * Fix copy paste issue --- src/renderer/components/ft-input/ft-input.js | 4 ++++ src/renderer/components/top-nav/top-nav.js | 8 ++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/renderer/components/ft-input/ft-input.js b/src/renderer/components/ft-input/ft-input.js index 763d72d807bd3..9df01584949f0 100644 --- a/src/renderer/components/ft-input/ft-input.js +++ b/src/renderer/components/ft-input/ft-input.js @@ -285,6 +285,10 @@ export default defineComponent({ this.$refs.input.focus() }, + blur() { + this.$refs.input.blur() + }, + ...mapActions([ 'getYoutubeUrlInfo' ]) diff --git a/src/renderer/components/top-nav/top-nav.js b/src/renderer/components/top-nav/top-nav.js index 6a0270b8be9f9..347d02ab6fc37 100644 --- a/src/renderer/components/top-nav/top-nav.js +++ b/src/renderer/components/top-nav/top-nav.js @@ -42,10 +42,6 @@ export default defineComponent({ return this.$store.getters.getEnableSearchSuggestions }, - searchInput: function () { - return this.$refs.searchInput.$refs.input - }, - searchSettings: function () { return this.$store.getters.getSearchSettings }, @@ -114,7 +110,7 @@ export default defineComponent({ this.$refs.searchContainer.blur() this.showSearchContainer = false } else { - this.searchInput.blur() + this.$refs.searchInput.blur() } clearLocalSearchSuggestionsSession() @@ -209,7 +205,7 @@ export default defineComponent({ focusSearch: function () { if (!this.hideSearchBar) { - this.searchInput.focus() + this.$refs.searchInput.focus() } }, From 30db1bbd47e3cb7a0543d4c43cf12240d2c6d326 Mon Sep 17 00:00:00 2001 From: Ihor Hordiichuk Date: Mon, 26 Jun 2023 21:00:14 +0000 Subject: [PATCH 11/92] Translated using Weblate (Ukrainian) Currently translated at 100.0% (687 of 687 strings) Translation: FreeTube/Translations Translate-URL: https://hosted.weblate.org/projects/free-tube/translations/uk/ --- static/locales/uk.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/static/locales/uk.yaml b/static/locales/uk.yaml index 3db6ac0375733..ae3aa28a63c0e 100644 --- a/static/locales/uk.yaml +++ b/static/locales/uk.yaml @@ -8,7 +8,7 @@ FreeTube: 'FreeTube' # Webkit Menu Bar File: 'Файл' Quit: 'Вийти' -Edit: 'Редагувати' +Edit: 'Змінити' Undo: 'Повернути' Redo: 'Повторити' Cut: 'Вирізати' @@ -18,13 +18,13 @@ Delete: 'Видалити' Select all: 'Вибрати все' Reload: 'Перезавантажити' Force Reload: 'Примусове перезавантаження' -Toggle Developer Tools: 'Переключити інструменти розробника' +Toggle Developer Tools: 'Перемкнути інструменти розробника' Actual size: 'Фактичний розмір' Zoom in: 'Збільшити' Zoom out: 'Зменшити' -Toggle fullscreen: 'Переключити повноекранний режим' +Toggle fullscreen: 'Перемкнути повноекранний режим' Window: 'Вікно' -Minimize: 'Мінімізувати' +Minimize: 'Згорнути' Close: 'Закрити' Back: 'Назад' Forward: 'Вперед' @@ -41,10 +41,10 @@ Search / Go to URL: 'Пошук / Перейти по URL' Search Filters: Search Filters: 'Фільтри пошуку' Sort By: - Sort By: 'Сортувати за' - Most Relevant: 'Найбільш релевантні' + Sort By: 'Впорядковувати за' + Most Relevant: 'Найвідповідніші' Rating: 'Рейтинг' - Upload Date: 'Дата публікації' + Upload Date: 'Дата вивантаження' View Count: 'Кількість переглядів' Time: Time: 'Час' @@ -531,7 +531,7 @@ Channel: Added channel to your subscriptions: 'Додано канал до підписок' Search Channel: 'Шукати на каналі' Your search results have returned 0 results: 'Пошук дав 0 результатів' - Sort By: 'Сортувати за' + Sort By: 'Впорядковувати за' Videos: Videos: 'Відео' This channel does not currently have any videos: 'Наразі на цьому каналі немає @@ -773,7 +773,7 @@ Comments: There are no more comments for this video: 'Більше немає коментарів до цього відео' Show Comments: 'Показати коментарі' Hide Comments: 'Сховати коментарі' - Sort by: 'Сортувати за' + Sort by: 'Впорядковувати за' Top comments: 'Найпопулярніші коментарі' Newest first: 'Спочатку новіші' # Context: View 10 Replies, View 1 Reply From 164597025498ace0e6525600c48ce8ee8b4c022d Mon Sep 17 00:00:00 2001 From: Kyotaro Iijima Date: Mon, 26 Jun 2023 23:53:58 +0000 Subject: [PATCH 12/92] Translated using Weblate (Japanese) Currently translated at 100.0% (687 of 687 strings) Translation: FreeTube/Translations Translate-URL: https://hosted.weblate.org/projects/free-tube/translations/ja/ --- static/locales/ja.yaml | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/static/locales/ja.yaml b/static/locales/ja.yaml index 8735f304a533e..97d56666bb779 100644 --- a/static/locales/ja.yaml +++ b/static/locales/ja.yaml @@ -91,7 +91,8 @@ Playlists: '再生リスト' User Playlists: Your Playlists: 'あなたの再生リスト' Your saved videos are empty. Click on the save button on the corner of a video to have it listed here: 保存した動画はありません。一覧に表示させるには、ビデオの角にある保存ボタンをクリックします - Playlist Message: このページは、完全に動作する動画リストではありません。保存またはお気に入りと設定した動画のみが表示されます。操作が完了すると、現在ここにあるすべての動画は「お気に入り」の動画リストに移動します。 + Playlist Message: + このページは、完全に動作する動画リストではありません。保存またはお気に入りと設定した動画のみが表示されます。操作が完了すると、現在ここにあるすべての動画は「お気に入り」の動画リストに移動します。 Search bar placeholder: 動画リスト内の検索 Empty Search Message: この再生リストに、検索に一致する動画はありません History: @@ -253,6 +254,8 @@ Settings: Enter Fullscreen on Display Rotate: 横画面時にフルスクリーンにする Skip by Scrolling Over Video Player: 動画プレーヤーでスクロールしてスキップ可能にする Allow DASH AV1 formats: DASH AV1形式を許可する + Comment Auto Load: + Comment Auto Load: コメント自動読み込み Subscription Settings: Subscription Settings: '登録チャンネルの設定' Hide Videos on Watch: '視聴済み動画の非表示' @@ -364,6 +367,15 @@ Settings: Hide Channels: チャンネルから動画を非表示 Hide Channels Placeholder: チャネル名または ID Display Titles Without Excessive Capitalisation: 英語の大文字化を控えたタイトル表示 + Hide Channel Playlists: チャンネル再生リストの非表示 + Hide Channel Community: チャンネル コミュニティの非表示 + Sections: + Side Bar: サイドバー + Channel Page: チャンネル ページ + Watch Page: ウォッチリスト + General: 一般 + Hide Featured Channels: おすすめチャンネルの非表示 + Hide Channel Shorts: ショート動画チャンネルの非表示 The app needs to restart for changes to take effect. Restart and apply change?: 変更の反映には、アプリの再起動が必要です。再起動して変更を適用しますか? Proxy Settings: Error getting network information. Is your proxy configured properly?: ネットワーク情報の取得中にエラーが発生しました。プロキシーを正しく設定してますか? @@ -525,6 +537,9 @@ Channel: Live: This channel does not currently have any live streams: このチャンネルは現在、ライブ配信を行っていません Live: ライブ配信 + Shorts: + Shorts: ショート動画 + This channel does not currently have any shorts: このチャンネルには現在ショート動画がありません Video: Open in YouTube: 'YouTube で表示' Copy YouTube Link: 'YouTube リンクのコピー' @@ -817,8 +832,8 @@ Tooltips: Fallback to Non-Preferred Backend on Failure: 有効にすると、選択した API で取得できなければ、FreeTube は自動的に他の API での取得を試みます。 Region for Trending: 急上昇の地域設定では、急上昇動画を表示する国を選択できます。YouTube は、すべての国に対応していません。 - External Link Handling: "FreeTube で開けないリンクをクリックしたときのデフォルトの動作を選択します。\nデフォルトでは、FreeTube\ - \ はクリックしたリンクをデフォルトのブラウザで開きます。\n" + External Link Handling: "FreeTube で開けないリンクをクリックしたときのデフォルトの動作を選択します。\nデフォルトでは、FreeTube + はクリックしたリンクをデフォルトのブラウザで開きます。\n" Privacy Settings: Remove Video Meta Files: 有効にすると、FreeTube は動画再生中に作成したメタファイルを、再生ページを閉じるときに自動的に削除します。 External Player Settings: @@ -833,7 +848,8 @@ Tooltips: Replace HTTP Cache: Electron のディスクに基づく HTTP キャッシュを無効化し、メモリ内で独自の画像キャッシュを使用します。このことにより RAM の使用率は増加します。 Distraction Free Settings: - Hide Channels: チャンネル名またはチャンネル ID を入力すると、すべてのビデオ、再生リスト、およびチャンネル自体が検索や人気に表示されなくなります。入力するチャンネル名は完全に一致することが必要で、大文字と小文字を区別します。 + Hide Channels: チャンネル名またはチャンネル ID + を入力すると、すべてのビデオ、再生リスト、およびチャンネル自体が検索や人気に表示されなくなります。入力するチャンネル名は完全に一致することが必要で、大文字と小文字を区別します。 Playing Next Video Interval: すぐに次の動画を再生します。クリックするとキャンセル。|次の動画を {nextVideoInterval} 秒で再生します。クリックするとキャンセル。|次の動画を {nextVideoInterval} 秒で再生します。クリックするとキャンセル。 More: もっと見る @@ -878,3 +894,6 @@ Chapters: {chapterName}' Preferences: 環境設定 Ok: OK +Hashtag: + Hashtag: ハッシュタグ + This hashtag does not currently have any videos: このハッシュタグには現在動画がありません From 87a389cce0219dcc86467743622cbb472bc674b5 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Tue, 27 Jun 2023 13:52:39 +0200 Subject: [PATCH 13/92] Fix focus related race conditions (#3700) --- src/renderer/components/ft-icon-button/ft-icon-button.js | 4 ++-- .../components/ft-profile-selector/ft-profile-selector.js | 2 +- src/renderer/views/Trending/Trending.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/renderer/components/ft-icon-button/ft-icon-button.js b/src/renderer/components/ft-icon-button/ft-icon-button.js index eb08a55d8ac99..93c4db4df1421 100644 --- a/src/renderer/components/ft-icon-button/ft-icon-button.js +++ b/src/renderer/components/ft-icon-button/ft-icon-button.js @@ -94,8 +94,8 @@ export default defineComponent({ // wait until the dropdown is visible // then focus it so we can hide it automatically when it loses focus setTimeout(() => { - this.$refs.dropdown.focus() - }, 0) + this.$refs.dropdown?.focus() + }) } } else { this.$emit('click') diff --git a/src/renderer/components/ft-profile-selector/ft-profile-selector.js b/src/renderer/components/ft-profile-selector/ft-profile-selector.js index b14e222562c5f..24faf0fed6881 100644 --- a/src/renderer/components/ft-profile-selector/ft-profile-selector.js +++ b/src/renderer/components/ft-profile-selector/ft-profile-selector.js @@ -42,7 +42,7 @@ export default defineComponent({ // wait until the profile list is visible // then focus it so we can hide it automatically when it loses focus setTimeout(() => { - this.$refs.profileList.$el.focus() + this.$refs.profileList?.$el?.focus() }) } }, diff --git a/src/renderer/views/Trending/Trending.js b/src/renderer/views/Trending/Trending.js index 72492775af044..7f4ff414d4d1f 100644 --- a/src/renderer/views/Trending/Trending.js +++ b/src/renderer/views/Trending/Trending.js @@ -103,7 +103,7 @@ export default defineComponent({ this.$store.commit('setTrendingCache', { value: results, page: this.currentTab }) setTimeout(() => { - this.$refs[this.currentTab].focus() + this.$refs[this.currentTab]?.focus() }) } catch (err) { console.error(err) @@ -149,7 +149,7 @@ export default defineComponent({ this.isLoading = false this.$store.commit('setTrendingCache', { value: returnData, page: this.currentTab }) setTimeout(() => { - this.$refs[this.currentTab].focus() + this.$refs[this.currentTab]?.focus() }) }).catch((err) => { console.error(err) From 2c759b8ba165a359a3f4396051f70889536631fc Mon Sep 17 00:00:00 2001 From: PikachuEXE Date: Wed, 28 Jun 2023 01:04:48 +0800 Subject: [PATCH 14/92] * Update view to ignore keyboard events caused by user holding keys (#3709) No point keep refreshing info on key hold --- src/renderer/views/Popular/Popular.js | 9 ++++++++- src/renderer/views/Subscriptions/Subscriptions.js | 9 ++++++++- src/renderer/views/Trending/Trending.js | 9 ++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/renderer/views/Popular/Popular.js b/src/renderer/views/Popular/Popular.js index ea6d32253e752..6af366eb2cd7a 100644 --- a/src/renderer/views/Popular/Popular.js +++ b/src/renderer/views/Popular/Popular.js @@ -62,11 +62,18 @@ export default defineComponent({ this.$store.commit('setPopularCache', this.shownResults) }, - // This function should always be at the bottom of this file + /** + * This function `keyboardShortcutHandler` should always be at the bottom of this file + * @param {KeyboardEvent} event the keyboard event + */ keyboardShortcutHandler: function (event) { if (event.ctrlKey || document.activeElement.classList.contains('ft-input')) { return } + // Avoid handling events due to user holding a key (not released) + // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat + if (event.repeat) { return } + switch (event.key) { case 'r': case 'R': diff --git a/src/renderer/views/Subscriptions/Subscriptions.js b/src/renderer/views/Subscriptions/Subscriptions.js index c952fa66f0053..5a441948d1139 100644 --- a/src/renderer/views/Subscriptions/Subscriptions.js +++ b/src/renderer/views/Subscriptions/Subscriptions.js @@ -467,11 +467,18 @@ export default defineComponent({ sessionStorage.setItem('subscriptionLimit', this.dataLimit) }, - // This function should always be at the bottom of this file + /** + * This function `keyboardShortcutHandler` should always be at the bottom of this file + * @param {KeyboardEvent} event the keyboard event + */ keyboardShortcutHandler: function (event) { if (event.ctrlKey || document.activeElement.classList.contains('ft-input')) { return } + // Avoid handling events due to user holding a key (not released) + // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat + if (event.repeat) { return } + switch (event.key) { case 'r': case 'R': diff --git a/src/renderer/views/Trending/Trending.js b/src/renderer/views/Trending/Trending.js index 7f4ff414d4d1f..27f3865f5d247 100644 --- a/src/renderer/views/Trending/Trending.js +++ b/src/renderer/views/Trending/Trending.js @@ -167,11 +167,18 @@ export default defineComponent({ }) }, - // This function should always be at the bottom of this file + /** + * This function `keyboardShortcutHandler` should always be at the bottom of this file + * @param {KeyboardEvent} event the keyboard event + */ keyboardShortcutHandler: function (event) { if (event.ctrlKey || document.activeElement.classList.contains('ft-input')) { return } + // Avoid handling events due to user holding a key (not released) + // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat + if (event.repeat) { return } + switch (event.key) { case 'r': case 'R': From 6e0395d58e20629038aa7bb00b8571ab19732c1d Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Tue, 27 Jun 2023 19:13:48 +0200 Subject: [PATCH 15/92] Support YouTube's new layout for shorts only playlists (#3708) --- .../components/ft-list-video/ft-list-video.js | 56 ++++++++++--------- .../ft-list-video/ft-list-video.vue | 3 +- src/renderer/helpers/api/local.js | 39 +++++++++---- 3 files changed, 61 insertions(+), 37 deletions(-) diff --git a/src/renderer/components/ft-list-video/ft-list-video.js b/src/renderer/components/ft-list-video/ft-list-video.js index df374042a5dba..b7bc0afd1ab0a 100644 --- a/src/renderer/components/ft-list-video/ft-list-video.js +++ b/src/renderer/components/ft-list-video/ft-list-video.js @@ -58,8 +58,8 @@ export default defineComponent({ return { id: '', title: '', - channelName: '', - channelId: '', + channelName: null, + channelId: null, viewCount: 0, parsedViewCount: '', uploadedTime: '', @@ -190,30 +190,34 @@ export default defineComponent({ { label: this.$t('Video.Open in Invidious'), value: 'openInvidious' - }, - { - type: 'divider' - }, - { - label: this.$t('Video.Copy YouTube Channel Link'), - value: 'copyYoutubeChannel' - }, - { - label: this.$t('Video.Copy Invidious Channel Link'), - value: 'copyInvidiousChannel' - }, - { - type: 'divider' - }, - { - label: this.$t('Video.Open Channel in YouTube'), - value: 'openYoutubeChannel' - }, - { - label: this.$t('Video.Open Channel in Invidious'), - value: 'openInvidiousChannel' } ) + if (this.channelId !== null) { + options.push( + { + type: 'divider' + }, + { + label: this.$t('Video.Copy YouTube Channel Link'), + value: 'copyYoutubeChannel' + }, + { + label: this.$t('Video.Copy Invidious Channel Link'), + value: 'copyInvidiousChannel' + }, + { + type: 'divider' + }, + { + label: this.$t('Video.Open Channel in YouTube'), + value: 'openYoutubeChannel' + }, + { + label: this.$t('Video.Open Channel in Invidious'), + value: 'openInvidiousChannel' + } + ) + } } return options @@ -402,8 +406,8 @@ export default defineComponent({ this.title = this.data.title // this.thumbnail = this.data.videoThumbnails[4].url - this.channelName = this.data.author - this.channelId = this.data.authorId + this.channelName = this.data.author ?? null + this.channelId = this.data.authorId ?? null this.duration = formatDurationAsTimestamp(this.data.lengthSeconds) this.description = this.data.description this.isLive = this.data.liveNow || this.data.lengthSeconds === 'undefined' diff --git a/src/renderer/components/ft-list-video/ft-list-video.vue b/src/renderer/components/ft-list-video/ft-list-video.vue index 2e5967b383190..a6a039d2ae8dd 100644 --- a/src/renderer/components/ft-list-video/ft-list-video.vue +++ b/src/renderer/components/ft-list-video/ft-list-video.vue @@ -78,13 +78,14 @@

{{ channelName }} diff --git a/src/renderer/helpers/api/local.js b/src/renderer/helpers/api/local.js index 0c5ea3e6601b7..552dece380dd7 100644 --- a/src/renderer/helpers/api/local.js +++ b/src/renderer/helpers/api/local.js @@ -406,18 +406,37 @@ function handleSearchResponse(response) { } /** - * @param {import('youtubei.js').YTNodes.PlaylistVideo} video + * @param {import('youtubei.js').YTNodes.PlaylistVideo|import('youtubei.js').YTNodes.ReelItem} video */ export function parseLocalPlaylistVideo(video) { - return { - videoId: video.id, - title: video.title.text, - author: video.author.name, - authorId: video.author.id, - lengthSeconds: isNaN(video.duration.seconds) ? '' : video.duration.seconds, - liveNow: video.is_live, - isUpcoming: video.is_upcoming, - premiereDate: video.upcoming + if (video.type === 'ReelItem') { + /** @type {import('youtubei.js').YTNodes.ReelItem} */ + const short = video + + // unfortunately the only place with the duration is the accesibility string + const duration = parseShortDuration(video.accessibility_label, short.id) + + return { + type: 'video', + videoId: short.id, + title: short.title.text, + viewCount: parseLocalSubscriberCount(short.views.text), + lengthSeconds: isNaN(duration) ? '' : duration + } + } else { + /** @type {import('youtubei.js').YTNodes.PlaylistVideo} */ + const video_ = video + + return { + videoId: video_.id, + title: video_.title.text, + author: video_.author.name, + authorId: video_.author.id, + lengthSeconds: isNaN(video_.duration.seconds) ? '' : video_.duration.seconds, + liveNow: video_.is_live, + isUpcoming: video_.is_upcoming, + premiereDate: video_.upcoming + } } } From 7c7e0e5d7d1954dd746a764cc59831d94b1e38f5 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Tue, 27 Jun 2023 19:30:36 +0200 Subject: [PATCH 16/92] Add back sort by oldest (#3698) --- src/renderer/views/Channel/Channel.js | 23 ++++++++++++++++++----- src/renderer/views/Channel/Channel.vue | 18 +++++++++--------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/renderer/views/Channel/Channel.js b/src/renderer/views/Channel/Channel.js index 4804dd9a45881..504b1c4c354c1 100644 --- a/src/renderer/views/Channel/Channel.js +++ b/src/renderer/views/Channel/Channel.js @@ -92,7 +92,12 @@ export default defineComponent({ errorMessage: '', showSearchBar: true, showShareMenu: true, - videoShortLiveSelectValues: [ + videoLiveSelectValues: [ + 'newest', + 'popular', + 'oldest' + ], + shortSelectValues: [ 'newest', 'popular' ], @@ -137,7 +142,15 @@ export default defineComponent({ return this.subscriptionInfo !== null }, - videoShortLiveSelectNames: function () { + videoLiveSelectNames: function () { + return [ + this.$t('Channel.Videos.Sort Types.Newest'), + this.$t('Channel.Videos.Sort Types.Most Popular'), + this.$t('Channel.Videos.Sort Types.Oldest') + ] + }, + + shortSelectNames: function () { return [ this.$t('Channel.Videos.Sort Types.Newest'), this.$t('Channel.Videos.Sort Types.Most Popular') @@ -687,7 +700,7 @@ export default defineComponent({ this.showVideoSortBy = videosTab.filters.length > 1 if (this.showVideoSortBy && this.videoSortBy !== 'newest') { - const index = this.videoShortLiveSelectValues.indexOf(this.videoSortBy) + const index = this.videoLiveSelectValues.indexOf(this.videoSortBy) videosTab = await videosTab.applyFilter(videosTab.filters[index]) } @@ -745,7 +758,7 @@ export default defineComponent({ this.showShortSortBy = shortsTab.filters.length > 1 if (this.showShortSortBy && this.shortSortBy !== 'newest') { - const index = this.videoShortLiveSelectValues.indexOf(this.shortSortBy) + const index = this.shortSelectValues.indexOf(this.shortSortBy) shortsTab = await shortsTab.applyFilter(shortsTab.filters[index]) } @@ -803,7 +816,7 @@ export default defineComponent({ this.showLiveSortBy = liveTab.filters.length > 1 if (this.showLiveSortBy && this.liveSortBy !== 'newest') { - const index = this.videoShortLiveSelectValues.indexOf(this.liveSortBy) + const index = this.videoLiveSelectValues.indexOf(this.liveSortBy) liveTab = await liveTab.applyFilter(liveTab.filters[index]) } diff --git a/src/renderer/views/Channel/Channel.vue b/src/renderer/views/Channel/Channel.vue index 306bb6c78766d..4042bea116ea7 100644 --- a/src/renderer/views/Channel/Channel.vue +++ b/src/renderer/views/Channel/Channel.vue @@ -197,9 +197,9 @@ v-if="showVideoSortBy" v-show="currentTab === 'videos' && latestVideos.length > 0" class="sortSelect" - :value="videoShortLiveSelectValues[0]" - :select-names="videoShortLiveSelectNames" - :select-values="videoShortLiveSelectValues" + :value="videoLiveSelectValues[0]" + :select-names="videoLiveSelectNames" + :select-values="videoLiveSelectValues" :placeholder="$t('Search Filters.Sort By.Sort By')" @change="videoSortBy = $event" /> @@ -207,9 +207,9 @@ v-if="!hideChannelShorts && showShortSortBy" v-show="currentTab === 'shorts' && latestShorts.length > 0" class="sortSelect" - :value="videoShortLiveSelectValues[0]" - :select-names="videoShortLiveSelectNames" - :select-values="videoShortLiveSelectValues" + :value="shortSelectValues[0]" + :select-names="shortSelectNames" + :select-values="shortSelectValues" :placeholder="$t('Search Filters.Sort By.Sort By')" @change="shortSortBy = $event" /> @@ -217,9 +217,9 @@ v-if="!hideLiveStreams && showLiveSortBy" v-show="currentTab === 'live' && latestLive.length > 0" class="sortSelect" - :value="videoShortLiveSelectValues[0]" - :select-names="videoShortLiveSelectNames" - :select-values="videoShortLiveSelectValues" + :value="videoLiveSelectValues[0]" + :select-names="videoLiveSelectNames" + :select-values="videoLiveSelectValues" :placeholder="$t('Search Filters.Sort By.Sort By')" @change="liveSortBy = $event" /> From 518d019a8e7aa7d434ae7bf72c0c7dd6907b6b49 Mon Sep 17 00:00:00 2001 From: Mahdi Bagheri Date: Tue, 27 Jun 2023 21:44:29 +0000 Subject: [PATCH 17/92] Translated using Weblate (Persian) Currently translated at 35.8% (246 of 687 strings) Translation: FreeTube/Translations Translate-URL: https://hosted.weblate.org/projects/free-tube/translations/fa/ --- static/locales/fa.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/static/locales/fa.yaml b/static/locales/fa.yaml index 520a4cf4f0857..9db036c043ebf 100644 --- a/static/locales/fa.yaml +++ b/static/locales/fa.yaml @@ -55,12 +55,14 @@ Search Filters: Videos: 'ویدیو ها' Channels: 'کانال ها' #& Playlists + Movies: فیلم‌ها Duration: Duration: 'طول مدت' All Durations: 'طول مدت همه' Short (< 4 minutes): 'کوتاه(>۴ دقیقه)' Long (> 20 minutes): 'طولانی(<۲۰ دقیقه)' # On Search Page + Medium (4 - 20 minutes): متوسط (۴-۲۰ دقیقه) Search Results: 'نتایج جست و جو' Fetching results. Please wait: 'دریافت نتایج.لطفا صبر کنید' Fetch more results: 'دریافت نتایج بیشتر' @@ -78,6 +80,7 @@ Subscriptions: 'Getting Subscriptions. Please wait.': 'درحال گرفتن دنبال کرده ها.لطفا صبر کنید.' Refresh Subscriptions: 'تازه سازی دنبال کرده ها' Load More Videos: 'بارگیری ویدیو های بیشتر' + Error Channels: کانالهای خطادار More: 'بیشتر' Trending: Trending: 'پربازدید ها' @@ -325,3 +328,9 @@ Are you sure you want to open this link?: آیا مطمئن هستید که می باز کنید؟ About: Email: پست الکترونیکی +New Window: پنجره جدید +Preferences: ترجیحات +Version {versionNumber} is now available! Click for more details: نسخه {versionNumber} + موجود است! برای جزئیات بیشتر کلیک کنید +A new blog is now available, {blogTitle}. Click to view more: یک بلاگ جدید در دسترس + است، {blogTitle}. برای مشاهده بیشتر کلیک کنید From d989af2326bed3bfcef8169ae255f962101be1d5 Mon Sep 17 00:00:00 2001 From: Wesley Appler <83597346+lamemakes@users.noreply.github.com> Date: Tue, 27 Jun 2023 20:44:49 -0400 Subject: [PATCH 18/92] Fixed incorrect invidious linking (#3711) --- src/renderer/helpers/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/helpers/utils.js b/src/renderer/helpers/utils.js index d420a6914c709..82ac772a64995 100644 --- a/src/renderer/helpers/utils.js +++ b/src/renderer/helpers/utils.js @@ -406,7 +406,7 @@ export function createWebURL(path) { // strip html tags but keep
, , , , , export function stripHTML(value) { - return value.replaceAll(/(<(?!br|\/?[bis]|img>)([^>]+)>)/gi, '') + return value.replaceAll(/(<(?!br|\/?[abis]|img>)([^>]+)>)/gi, '') } /** From afffbf69fc67270f06df2083d9720587946258d0 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Wed, 28 Jun 2023 08:15:44 +0200 Subject: [PATCH 19/92] Fix reading instances from the Invidious fallback file (#3712) --- src/renderer/store/modules/invidious.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/store/modules/invidious.js b/src/renderer/store/modules/invidious.js index 0f88ab53a9930..fd6fc272588a1 100644 --- a/src/renderer/store/modules/invidious.js +++ b/src/renderer/store/modules/invidious.js @@ -45,7 +45,7 @@ const actions = { const filePath = `${fileLocation}${fileName}` if (!process.env.IS_ELECTRON || await pathExists(filePath)) { console.warn('reading static file for invidious instances') - const fileData = process.env.IS_ELECTRON ? JSON.parse(await fs.readFile(filePath)) : await (await fetch(createWebURL(filePath))).text() + const fileData = process.env.IS_ELECTRON ? await fs.readFile(filePath, 'utf8') : await (await fetch(createWebURL(filePath))).text() instances = JSON.parse(fileData).filter(e => { return process.env.IS_ELECTRON || e.cors }).map(e => { From fc7c252722169a382ac82ddac67e861b9095dd24 Mon Sep 17 00:00:00 2001 From: Jaden <97551221+jadenet@users.noreply.github.com> Date: Fri, 30 Jun 2023 12:18:43 -0400 Subject: [PATCH 20/92] Use playlist thumbnail provided by YT (#3710) * Use playlist thumbnail provided by YT from Local API * Use correct thumbnails for playlist page * Fix playlistThumbnail not giving correct value * Update youtubei.js * Update package.json Co-authored-by: PikachuEXE * Update yarn.lock to align with package.json --------- Co-authored-by: PikachuEXE --- package.json | 2 +- src/renderer/components/playlist-info/playlist-info.js | 3 ++- src/renderer/helpers/api/local.js | 4 +++- src/renderer/views/Playlist/Playlist.js | 1 + yarn.lock | 8 ++++---- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 27908e5c9528b..a30c927818c38 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "vue-router": "^3.6.5", "vue-tiny-slider": "^0.1.39", "vuex": "^3.6.2", - "youtubei.js": "^5.1.0" + "youtubei.js": "^5.2.0" }, "devDependencies": { "@babel/core": "^7.22.5", diff --git a/src/renderer/components/playlist-info/playlist-info.js b/src/renderer/components/playlist-info/playlist-info.js index 907417ba58431..9a2fe326edd25 100644 --- a/src/renderer/components/playlist-info/playlist-info.js +++ b/src/renderer/components/playlist-info/playlist-info.js @@ -17,6 +17,7 @@ export default defineComponent({ return { id: '', firstVideoId: '', + playlistThumbnail: '', title: '', channelThumbnail: '', channelName: '', @@ -54,7 +55,7 @@ export default defineComponent({ if (this.backendPreference === 'invidious') { baseUrl = this.currentInvidiousInstance } else { - baseUrl = 'https://i.ytimg.com' + return this.data.playlistThumbnail } switch (this.thumbnailPreference) { diff --git a/src/renderer/helpers/api/local.js b/src/renderer/helpers/api/local.js index 552dece380dd7..1de58c46dd623 100644 --- a/src/renderer/helpers/api/local.js +++ b/src/renderer/helpers/api/local.js @@ -353,6 +353,8 @@ function parseShortDuration(accessibilityLabel, videoId) { export function parseLocalListPlaylist(playlist, author = undefined) { let channelName let channelId = null + /** @type {import('youtubei.js').YTNodes.PlaylistVideoThumbnail} */ + const thumbnailRenderer = playlist.thumbnail_renderer if (playlist.author) { if (playlist.author instanceof Misc.Text) { @@ -374,7 +376,7 @@ export function parseLocalListPlaylist(playlist, author = undefined) { type: 'playlist', dataSource: 'local', title: playlist.title.text, - thumbnail: playlist.thumbnails[0].url, + thumbnail: thumbnailRenderer ? thumbnailRenderer.thumbnail[0].url : playlist.thumbnails[0].url, channelName, channelId, playlistId: playlist.id, diff --git a/src/renderer/views/Playlist/Playlist.js b/src/renderer/views/Playlist/Playlist.js index 8551c4f27289f..09bdc58b934a9 100644 --- a/src/renderer/views/Playlist/Playlist.js +++ b/src/renderer/views/Playlist/Playlist.js @@ -88,6 +88,7 @@ export default defineComponent({ title: result.info.title, description: result.info.description ?? '', firstVideoId: result.items[0].id, + playlistThumbnail: result.info.thumbnails[0].url, viewCount: extractNumberFromString(result.info.views), videoCount: extractNumberFromString(result.info.total_items), lastUpdated: result.info.last_updated ?? '', diff --git a/yarn.lock b/yarn.lock index d0fc5dc5f25d1..fc23d15f9cd6b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8585,10 +8585,10 @@ yocto-queue@^0.1.0: resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== -youtubei.js@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/youtubei.js/-/youtubei.js-5.1.0.tgz#a71474f23fbf8679c1f517f3f8a33064e898683e" - integrity sha512-Rbe71rqqSVGj2kBv7FeIDbod+AEcd84F/7inSLWjt6jv8tmTGLjXr8cjlqzY5WhpNKMJuSUVKLFgCb3V0SHTUA== +youtubei.js@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/youtubei.js/-/youtubei.js-5.2.0.tgz#97e66de34072c40e04e7cf5172c0cf3a1eeccbf7" + integrity sha512-UXbkHnLp+YUSbA6ye58knH11RRx52BWpO/k6wSKQTm6eC/MSUBQO4KdYrO1INptlbOWWn7DjW5LwLMZ6e4qdMw== dependencies: jintr "^1.0.0" linkedom "^0.14.12" From 939352347db1fad7fb709ae44b57b9715fd3dc06 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Sat, 1 Jul 2023 16:08:09 +0200 Subject: [PATCH 21/92] Add a script to update the region/geolocation files (#3701) * Add a script to update the region/geolocation files * Update tooltip now that we only list supported geolocations * Add language sensitive sorting --- _scripts/getRegions.mjs | 148 +++++++++++++ _scripts/webpack.web.config.js | 2 +- package.json | 1 + .../components/ft-select/ft-select.js | 14 +- .../components/ft-select/ft-select.vue | 1 + src/renderer/store/modules/utils.js | 9 +- static/geolocations/ar.json | 1 + static/geolocations/ar/countries.json | 195 ----------------- static/geolocations/bg.json | 1 + static/geolocations/bg/countries.json | 195 ----------------- static/geolocations/ca.json | 1 + static/geolocations/cs.json | 1 + static/geolocations/cs/countries.json | 196 ------------------ static/geolocations/da.json | 1 + static/geolocations/da/countries.json | 196 ------------------ static/geolocations/de-DE.json | 1 + static/geolocations/de-DE/countries.json | 196 ------------------ static/geolocations/ee/countries.json | 196 ------------------ static/geolocations/el.json | 1 + static/geolocations/el/countries.json | 196 ------------------ static/geolocations/en-GB/countries.json | 195 ----------------- static/geolocations/en-US.json | 1 + static/geolocations/en-US/countries.json | 195 ----------------- static/geolocations/en_GB.json | 1 + static/geolocations/es-AR/countries.json | 196 ------------------ static/geolocations/es-MX/countries.json | 196 ------------------ static/geolocations/es.json | 1 + static/geolocations/es/countries.json | 196 ------------------ static/geolocations/et.json | 1 + static/geolocations/eu.json | 1 + static/geolocations/eu/countries.json | 196 ------------------ static/geolocations/fi.json | 1 + static/geolocations/fi/countries.json | 196 ------------------ static/geolocations/fr-FR.json | 1 + static/geolocations/fr-FR/countries.json | 196 ------------------ static/geolocations/gl.json | 1 + static/geolocations/hr.json | 1 + static/geolocations/hr/countries.json | 194 ----------------- static/geolocations/hu.json | 1 + static/geolocations/hu/countries.json | 196 ------------------ static/geolocations/id.json | 1 + static/geolocations/is.json | 1 + static/geolocations/is/countries.json | 195 ----------------- static/geolocations/it.json | 1 + static/geolocations/it/countries.json | 196 ------------------ static/geolocations/ja.json | 1 + static/geolocations/ja/countries.json | 196 ------------------ static/geolocations/ko.json | 1 + static/geolocations/ko/countries.json | 196 ------------------ static/geolocations/lt.json | 1 + static/geolocations/lt/countries.json | 196 ------------------ static/geolocations/nb-NO/countries.json | 196 ------------------ static/geolocations/nb_NO.json | 1 + static/geolocations/nl.json | 1 + static/geolocations/nl/countries.json | 196 ------------------ static/geolocations/nn.json | 1 + static/geolocations/pl.json | 1 + static/geolocations/pl/countries.json | 196 ------------------ static/geolocations/pt-BR/countries.json | 196 ------------------ static/geolocations/pt-PT.json | 1 + static/geolocations/pt-PT/countries.json | 196 ------------------ static/geolocations/pt.json | 1 + static/geolocations/pt/countries.json | 196 ------------------ static/geolocations/ro.json | 1 + static/geolocations/ro/countries.json | 196 ------------------ static/geolocations/ru.json | 1 + static/geolocations/ru/countries.json | 196 ------------------ static/geolocations/sk.json | 1 + static/geolocations/sk/countries.json | 196 ------------------ static/geolocations/sl.json | 1 + static/geolocations/sr.json | 1 + static/geolocations/sv.json | 1 + static/geolocations/sv/countries.json | 196 ------------------ static/geolocations/th/countries.json | 196 ------------------ static/geolocations/tr.json | 1 + static/geolocations/uk.json | 1 + static/geolocations/uk/countries.json | 194 ----------------- static/geolocations/vi.json | 1 + static/geolocations/zh-CN.json | 1 + static/geolocations/zh-TW.json | 1 + static/geolocations/zh-tw/countries.json | 196 ------------------ static/geolocations/zh/countries.json | 196 ------------------ static/locales/ar.yaml | 2 - static/locales/bg.yaml | 3 +- static/locales/cs.yaml | 3 +- static/locales/da.yaml | 3 +- static/locales/de-DE.yaml | 3 +- static/locales/el.yaml | 3 +- static/locales/en-US.yaml | 3 +- static/locales/en_GB.yaml | 3 +- static/locales/es-MX.yaml | 3 +- static/locales/es.yaml | 2 +- static/locales/et.yaml | 2 +- static/locales/eu.yaml | 3 +- static/locales/fi.yaml | 3 +- static/locales/fr-FR.yaml | 3 +- static/locales/gl.yaml | 3 +- static/locales/he.yaml | 2 - static/locales/hr.yaml | 2 +- static/locales/hu.yaml | 3 +- static/locales/id.yaml | 3 +- static/locales/is.yaml | 3 +- static/locales/it.yaml | 3 +- static/locales/ja.yaml | 6 +- static/locales/ko.yaml | 3 +- static/locales/lt.yaml | 3 +- static/locales/nb_NO.yaml | 2 +- static/locales/nl.yaml | 3 +- static/locales/nn.yaml | 2 +- static/locales/pl.yaml | 3 +- static/locales/pt-BR.yaml | 3 +- static/locales/pt-PT.yaml | 3 +- static/locales/pt.yaml | 3 +- static/locales/ro.yaml | 3 +- static/locales/ru.yaml | 2 +- static/locales/sk.yaml | 3 +- static/locales/sv.yaml | 2 +- static/locales/tr.yaml | 3 +- static/locales/uk.yaml | 3 +- static/locales/ur.yaml | 3 - static/locales/vi.yaml | 3 +- static/locales/zh-CN.yaml | 2 +- static/locales/zh-TW.yaml | 2 +- 123 files changed, 247 insertions(+), 7130 deletions(-) create mode 100644 _scripts/getRegions.mjs create mode 100644 static/geolocations/ar.json delete mode 100644 static/geolocations/ar/countries.json create mode 100644 static/geolocations/bg.json delete mode 100644 static/geolocations/bg/countries.json create mode 100644 static/geolocations/ca.json create mode 100644 static/geolocations/cs.json delete mode 100644 static/geolocations/cs/countries.json create mode 100644 static/geolocations/da.json delete mode 100644 static/geolocations/da/countries.json create mode 100644 static/geolocations/de-DE.json delete mode 100644 static/geolocations/de-DE/countries.json delete mode 100644 static/geolocations/ee/countries.json create mode 100644 static/geolocations/el.json delete mode 100644 static/geolocations/el/countries.json delete mode 100644 static/geolocations/en-GB/countries.json create mode 100644 static/geolocations/en-US.json delete mode 100644 static/geolocations/en-US/countries.json create mode 100644 static/geolocations/en_GB.json delete mode 100644 static/geolocations/es-AR/countries.json delete mode 100644 static/geolocations/es-MX/countries.json create mode 100644 static/geolocations/es.json delete mode 100644 static/geolocations/es/countries.json create mode 100644 static/geolocations/et.json create mode 100644 static/geolocations/eu.json delete mode 100644 static/geolocations/eu/countries.json create mode 100644 static/geolocations/fi.json delete mode 100644 static/geolocations/fi/countries.json create mode 100644 static/geolocations/fr-FR.json delete mode 100644 static/geolocations/fr-FR/countries.json create mode 100644 static/geolocations/gl.json create mode 100644 static/geolocations/hr.json delete mode 100644 static/geolocations/hr/countries.json create mode 100644 static/geolocations/hu.json delete mode 100644 static/geolocations/hu/countries.json create mode 100644 static/geolocations/id.json create mode 100644 static/geolocations/is.json delete mode 100644 static/geolocations/is/countries.json create mode 100644 static/geolocations/it.json delete mode 100644 static/geolocations/it/countries.json create mode 100644 static/geolocations/ja.json delete mode 100644 static/geolocations/ja/countries.json create mode 100644 static/geolocations/ko.json delete mode 100644 static/geolocations/ko/countries.json create mode 100644 static/geolocations/lt.json delete mode 100644 static/geolocations/lt/countries.json delete mode 100644 static/geolocations/nb-NO/countries.json create mode 100644 static/geolocations/nb_NO.json create mode 100644 static/geolocations/nl.json delete mode 100644 static/geolocations/nl/countries.json create mode 100644 static/geolocations/nn.json create mode 100644 static/geolocations/pl.json delete mode 100644 static/geolocations/pl/countries.json delete mode 100644 static/geolocations/pt-BR/countries.json create mode 100644 static/geolocations/pt-PT.json delete mode 100644 static/geolocations/pt-PT/countries.json create mode 100644 static/geolocations/pt.json delete mode 100644 static/geolocations/pt/countries.json create mode 100644 static/geolocations/ro.json delete mode 100644 static/geolocations/ro/countries.json create mode 100644 static/geolocations/ru.json delete mode 100644 static/geolocations/ru/countries.json create mode 100644 static/geolocations/sk.json delete mode 100644 static/geolocations/sk/countries.json create mode 100644 static/geolocations/sl.json create mode 100644 static/geolocations/sr.json create mode 100644 static/geolocations/sv.json delete mode 100644 static/geolocations/sv/countries.json delete mode 100644 static/geolocations/th/countries.json create mode 100644 static/geolocations/tr.json create mode 100644 static/geolocations/uk.json delete mode 100644 static/geolocations/uk/countries.json create mode 100644 static/geolocations/vi.json create mode 100644 static/geolocations/zh-CN.json create mode 100644 static/geolocations/zh-TW.json delete mode 100644 static/geolocations/zh-tw/countries.json delete mode 100644 static/geolocations/zh/countries.json diff --git a/_scripts/getRegions.mjs b/_scripts/getRegions.mjs new file mode 100644 index 0000000000000..90adce4d0dfd0 --- /dev/null +++ b/_scripts/getRegions.mjs @@ -0,0 +1,148 @@ +/** + * This script updates the files in static/geolocations with the available locations on YouTube. + * + * It tries to map every active FreeTube language (static/locales/activelocales.json) + * to it's equivalent on YouTube. + * + * It then uses those language mappings, + * to scrape the location selection menu on the YouTube website, in every mapped language. + * + * All languages it couldn't find on YouTube, that don't have manually added mapping, + * get logged to the console, as well as all unmapped YouTube languages. + */ + +import { mkdirSync, readFileSync, rmSync, writeFileSync } from 'fs' +import { dirname } from 'path' +import { fileURLToPath } from 'url' +import { Innertube, Misc } from 'youtubei.js' + +const STATIC_DIRECTORY = `${dirname(fileURLToPath(import.meta.url))}/../static` + +const activeLanguagesPath = `${STATIC_DIRECTORY}/locales/activeLocales.json` +/** @type {string[]} */ +const activeLanguages = JSON.parse(readFileSync(activeLanguagesPath, { encoding: 'utf8' })) + +// en-US is en on YouTube +const initialResponse = await scrapeLanguage('en') + +// Scrape language menu in en-US + +/** @type {string[]} */ +const youTubeLanguages = initialResponse.data.actions[0].openPopupAction.popup.multiPageMenuRenderer.sections[1].multiPageMenuSectionRenderer.items[1].compactLinkRenderer.serviceEndpoint.signalServiceEndpoint.actions[0].getMultiPageMenuAction.menu.multiPageMenuRenderer.sections[0].multiPageMenuSectionRenderer.items + .map(({ compactLinkRenderer }) => { + return compactLinkRenderer.serviceEndpoint.signalServiceEndpoint.actions[0].selectLanguageCommand.hl + }) + +// map FreeTube languages to their YouTube equivalents + +const foundLanguageNames = ['en-US'] +const unusedYouTubeLanguageNames = [] +const languagesToScrape = [] + +for (const language of youTubeLanguages) { + if (activeLanguages.includes(language)) { + foundLanguageNames.push(language) + languagesToScrape.push({ + youTube: language, + freeTube: language + }) + } else if (activeLanguages.includes(language.replace('-', '_'))) { + const withUnderScore = language.replace('-', '_') + foundLanguageNames.push(withUnderScore) + languagesToScrape.push({ + youTube: language, + freeTube: withUnderScore + }) + } + // special cases + else if (language === 'de') { + foundLanguageNames.push('de-DE') + languagesToScrape.push({ + youTube: 'de', + freeTube: 'de-DE' + }) + } else if (language === 'fr') { + foundLanguageNames.push('fr-FR') + languagesToScrape.push({ + youTube: 'fr', + freeTube: 'fr-FR' + }) + } else if (language === 'no') { + // according to https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes + // "no" is the macro language for "nb" and "nn" + foundLanguageNames.push('nb_NO', 'nn') + languagesToScrape.push({ + youTube: 'no', + freeTube: 'nb_NO' + }) + languagesToScrape.push({ + youTube: 'no', + freeTube: 'nn' + }) + } else if (language !== 'en') { + unusedYouTubeLanguageNames.push(language) + } +} + +console.log("Active FreeTube languages that aren't available on YouTube:") +console.log(activeLanguages.filter(lang => !foundLanguageNames.includes(lang)).sort()) + +console.log("YouTube languages that don't have an equivalent active FreeTube language:") +console.log(unusedYouTubeLanguageNames.sort()) + +// Scrape the location menu in various languages and write files to the file system + +rmSync(`${STATIC_DIRECTORY}/geolocations`, { recursive: true }) +mkdirSync(`${STATIC_DIRECTORY}/geolocations`) + +processGeolocations('en-US', 'en', initialResponse) + +for (const { youTube, freeTube } of languagesToScrape) { + const response = await scrapeLanguage(youTube) + + processGeolocations(freeTube, youTube, response) +} + + + +async function scrapeLanguage(youTubeLanguageCode) { + const session = await Innertube.create({ + retrieve_player: false, + generate_session_locally: true, + lang: youTubeLanguageCode + }) + + return await session.actions.execute('/account/account_menu') +} + +function processGeolocations(freeTubeLanguage, youTubeLanguage, response) { + const geolocations = response.data.actions[0].openPopupAction.popup.multiPageMenuRenderer.sections[1].multiPageMenuSectionRenderer.items[3].compactLinkRenderer.serviceEndpoint.signalServiceEndpoint.actions[0].getMultiPageMenuAction.menu.multiPageMenuRenderer.sections[0].multiPageMenuSectionRenderer.items + .map(({ compactLinkRenderer }) => { + return { + name: new Misc.Text(compactLinkRenderer.title).toString().trim(), + code: compactLinkRenderer.serviceEndpoint.signalServiceEndpoint.actions[0].selectCountryCommand.gl + } + }) + + const normalisedFreeTubeLanguage = freeTubeLanguage.replace('_', '-') + + // give Intl.Collator 4 locales, in the hopes that it supports one of them + // deduplicate the list so it doesn't have to do duplicate work + const localeSet = new Set() + localeSet.add(normalisedFreeTubeLanguage) + localeSet.add(youTubeLanguage) + localeSet.add(normalisedFreeTubeLanguage.split('-')[0]) + localeSet.add(youTubeLanguage.split('-')[0]) + + const locales = Array.from(localeSet) + + // only sort if node supports sorting the language, otherwise hope that YouTube's sorting was correct + // node 20.3.1 doesn't support sorting `eu` + if (Intl.Collator.supportedLocalesOf(locales).length > 0) { + const collator = new Intl.Collator(locales) + + geolocations.sort((a, b) => collator.compare(a.name, b.name)) + } + + writeFileSync(`${STATIC_DIRECTORY}/geolocations/${freeTubeLanguage}.json`, JSON.stringify(geolocations)) +} diff --git a/_scripts/webpack.web.config.js b/_scripts/webpack.web.config.js index 896a0d80c4e54..420d350482ea4 100644 --- a/_scripts/webpack.web.config.js +++ b/_scripts/webpack.web.config.js @@ -170,7 +170,7 @@ config.plugins.push( processLocalesPlugin, new webpack.DefinePlugin({ 'process.env.LOCALE_NAMES': JSON.stringify(processLocalesPlugin.localeNames), - 'process.env.GEOLOCATION_NAMES': JSON.stringify(fs.readdirSync(path.join(__dirname, '..', 'static', 'geolocations'))) + 'process.env.GEOLOCATION_NAMES': JSON.stringify(fs.readdirSync(path.join(__dirname, '..', 'static', 'geolocations')).map(filename => filename.replace('.json', ''))) }), new CopyWebpackPlugin({ patterns: [ diff --git a/package.json b/package.json index a30c927818c38..d0a6cace4251d 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "dev:web": "node _scripts/dev-runner.js --web", "dev-runner": "node _scripts/dev-runner.js", "get-instances": "node _scripts/getInstances.js", + "get-regions": "node _scripts/getRegions.mjs", "lint-all": "run-p lint lint-json lint-style", "lint-fix": "eslint --fix --ext .js,.vue ./", "lint": "eslint --ext .js,.vue ./", diff --git a/src/renderer/components/ft-select/ft-select.js b/src/renderer/components/ft-select/ft-select.js index e6050edadff1a..83ab2f523ac79 100644 --- a/src/renderer/components/ft-select/ft-select.js +++ b/src/renderer/components/ft-select/ft-select.js @@ -1,4 +1,4 @@ -import { defineComponent } from 'vue' +import { defineComponent, nextTick } from 'vue' import FtTooltip from '../ft-tooltip/ft-tooltip.vue' import { sanitizeForHtmlId } from '../../helpers/accessibility' @@ -45,5 +45,17 @@ export default defineComponent({ sanitizedPlaceholder: function() { return sanitizeForHtmlId(this.placeholder) } + }, + watch: { + // update the selected value in the menu when the list of values changes + + // e.g. when you change the display language, the locations list gets updated + // as the locations list is sorted alphabetically for the language, the ordering can be different + // so we need to ensure that the correct location is selected after a language change + selectValues: function () { + nextTick(() => { + this.$refs.select.value = this.value + }) + } } }) diff --git a/src/renderer/components/ft-select/ft-select.vue b/src/renderer/components/ft-select/ft-select.vue index b935405f2f7ad..fb73a3b543238 100644 --- a/src/renderer/components/ft-select/ft-select.vue +++ b/src/renderer/components/ft-select/ft-select.vue @@ -2,6 +2,7 @@