Skip to content

Commit

Permalink
Merge branch 'development' into feature/history/remember-search-query
Browse files Browse the repository at this point in the history
* development: (49 commits)
  Translated using Weblate (Japanese)
  Translated using Weblate (French)
  Fix long comments overflowing and breaking the layout (FreeTubeApp#5774)
  Cleanup unused code in the store (FreeTubeApp#5776)
  Revert "Larger search/URL bar (FreeTubeApp#5348)" (FreeTubeApp#5773)
  Fix loading from search cache failing when no features are selected (FreeTubeApp#5775)
  Bump lefthook from 1.7.15 to 1.7.17 (FreeTubeApp#5768)
  Bump webpack from 5.94.0 to 5.95.0 (FreeTubeApp#5770)
  Bump sass from 1.79.3 to 1.79.4 (FreeTubeApp#5771)
  Translated using Weblate (Chinese (Traditional Han script))
  Change the Proxy Videos Through Invidious setting to only apply when using the Invidious API (FreeTubeApp#5758)
  Support copying post links from the context menu (FreeTubeApp#5760)
  Local API: Fix error when a community post has no likes (FreeTubeApp#5759)
  Translated using Weblate (English (United Kingdom))
  Translated using Weblate (Dutch)
  Translated using Weblate (Swedish)
  Do not overwrite cache entries when hitting RSS ratelimits (FreeTubeApp#5756)
  Translated using Weblate (Czech)
  Translated using Weblate (Hungarian)
  Translated using Weblate (Hungarian)
  ...
  • Loading branch information
PikachuEXE committed Oct 3, 2024
2 parents 54f4331 + d42cb9d commit 5d7cac4
Show file tree
Hide file tree
Showing 90 changed files with 816 additions and 557 deletions.
15 changes: 4 additions & 11 deletions _scripts/getRegions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ for (const language of youTubeLanguages) {
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') {
Expand All @@ -70,10 +63,10 @@ for (const language of youTubeLanguages) {
} 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')
foundLanguageNames.push('nb-NO', 'nn')
languagesToScrape.push({
youTube: 'no',
freeTube: 'nb_NO'
freeTube: 'nb-NO'
})
languagesToScrape.push({
youTube: 'no',
Expand All @@ -88,10 +81,10 @@ for (const language of youTubeLanguages) {
freeTube: 'he'
})
} else if (language === 'es-419') {
foundLanguageNames.push('es_AR', 'es-MX')
foundLanguageNames.push('es-AR', 'es-MX')
languagesToScrape.push({
youTube: 'es-419',
freeTube: 'es_AR'
freeTube: 'es-AR'
})
languagesToScrape.push({
youTube: 'es-419',
Expand Down
11 changes: 3 additions & 8 deletions _scripts/getShakaLocales.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,10 @@ function getMappings(shakaLocales, freeTubeLocales) {
locale,
locale
])
} else if (shakaLocales.has(locale.replace('_', '-'))) {
} else if (shakaLocales.has(locale.split('-')[0])) {
mappings.push([
locale,
locale.replace('_', '-')
])
} else if (shakaLocales.has(locale.split(/[-_]/)[0])) {
mappings.push([
locale,
locale.split(/[-_]/)[0]
locale.split('-')[0]
])
}
}
Expand All @@ -60,7 +55,7 @@ function getMappings(shakaLocales, freeTubeLocales) {
// according to https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
// "no" is the macro language for "nb" and "nn"
[
'nb_NO',
'nb-NO',
'no'
],
[
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"path-browserify": "^1.0.1",
"portal-vue": "^2.1.7",
"process": "^0.11.10",
"shaka-player": "^4.11.3",
"shaka-player": "^4.11.4",
"swiper": "^11.1.14",
"vue": "^2.7.16",
"vue-i18n": "^8.28.2",
Expand All @@ -83,18 +83,18 @@
"@babel/preset-env": "^7.25.4",
"@double-great/stylelint-a11y": "^3.0.2",
"@intlify/eslint-plugin-vue-i18n": "^3.0.0",
"babel-loader": "^9.1.3",
"babel-loader": "^9.2.1",
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^7.0.0",
"electron": "^32.1.0",
"electron": "^32.1.2",
"electron-builder": "^24.13.3",
"eslint": "^8.57.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-jsonc": "^2.16.0",
"eslint-plugin-n": "^17.10.2",
"eslint-plugin-n": "^17.10.3",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-promise": "^7.1.0",
"eslint-plugin-unicorn": "^55.0.0",
Expand All @@ -104,15 +104,15 @@
"html-webpack-plugin": "^5.6.0",
"js-yaml": "^4.1.0",
"json-minimizer-webpack-plugin": "^5.0.0",
"lefthook": "^1.7.15",
"lefthook": "^1.7.17",
"mini-css-extract-plugin": "^2.9.1",
"npm-run-all2": "^6.2.3",
"postcss": "^8.4.47",
"postcss-scss": "^4.0.9",
"prettier": "^2.8.8",
"rimraf": "^6.0.1",
"sass": "^1.78.0",
"sass-loader": "^16.0.1",
"sass": "^1.79.4",
"sass-loader": "^16.0.2",
"stylelint": "^16.9.0",
"stylelint-config-sass-guidelines": "^12.1.0",
"stylelint-config-standard": "^36.0.1",
Expand All @@ -122,7 +122,7 @@
"vue-devtools": "^5.1.4",
"vue-eslint-parser": "^9.4.3",
"vue-loader": "^15.10.0",
"webpack": "^5.94.0",
"webpack": "^5.95.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.1.0",
"yaml-eslint-parser": "^1.2.3"
Expand Down
10 changes: 9 additions & 1 deletion src/datastores/handlers/base.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import * as db from '../index'

class Settings {
static find() {
static async find() {
const currentLocale = await db.settings.findOneAsync({ _id: 'currentLocale' })

// In FreeTube 0.21.3 and earlier the locales 'en-GB', 'es-AR' and 'nb-NO' had underscores instead of a hyphens
// This is a one time migration for users that are using one of those locales
if (currentLocale?.value.includes('_')) {
await this.upsert('currentLocale', currentLocale.value.replace('_', '-'))
}

return db.settings.findAsync({ _id: { $ne: 'bounds' } })
}

Expand Down
17 changes: 16 additions & 1 deletion src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function runApp() {
const path = urlParts[1]

if (path) {
visible = ['/channel', '/watch', '/hashtag'].some(p => path.startsWith(p)) ||
visible = ['/channel', '/watch', '/hashtag', '/post'].some(p => path.startsWith(p)) ||
// Only show copy link entry for non user playlists
(path.startsWith('/playlist') && !/playlistType=user/.test(path))
}
Expand Down Expand Up @@ -157,6 +157,21 @@ function runApp() {

return url.toString()
}
case 'post': {
if (query) {
const authorId = new URLSearchParams(query).get('authorId')

if (authorId) {
if (toYouTube) {
return `${origin}/channel/${authorId}/community?lb=${id}`
} else {
return `${origin}/post/${id}?ucid=${authorId}`
}
}
}

return `${origin}/post/${id}`
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/renderer/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default defineComponent({
windowTitle: function () {
const routePath = this.$route.path
if (!routePath.startsWith('/channel/') && !routePath.startsWith('/watch/') && !routePath.startsWith('/hashtag/') && !routePath.startsWith('/playlist/')) {
let title = translateWindowTitle(this.$route.meta.title, this.$i18n)
let title = translateWindowTitle(this.$route.meta.title)
if (!title) {
title = packageDetails.productName
} else {
Expand Down Expand Up @@ -122,7 +122,7 @@ export default defineComponent({
},

locale: function() {
return this.$i18n.locale.replace('_', '-')
return this.$i18n.locale
},

systemTheme: function () {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/channel-about/channel-about.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default defineComponent({
},

currentLocale: function () {
return this.$i18n.locale.replace('_', '-')
return this.$i18n.locale
},

formattedJoined: function () {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/ft-list-video/ft-list-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ export default defineComponent({
},

currentLocale: function () {
return this.$i18n.locale.replace('_', '-')
return this.$i18n.locale
},

externalPlayer: function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default defineComponent({
return this.$store.getters.getNewPlaylistDefaultProperties
},
locale: function () {
return this.$i18n.locale.replace('_', '-')
return this.$i18n.locale
},
processedQuery: function() {
return this.query.trim().toLowerCase()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default defineComponent({
emits: ['click'],
computed: {
locale: function () {
return this.$i18n.locale.replace('_', '-')
return this.$i18n.locale
},
isMainProfile: function () {
return this.profileId === MAIN_PROFILE_ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default defineComponent({
]
},
locale: function () {
return this.$i18n.locale.replace('_', '-')
return this.$i18n.locale
},
},
watch: {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/ft-profile-edit/ft-profile-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default defineComponent({
},
computed: {
locale: function () {
return this.$i18n.locale.replace('_', '-')
return this.$i18n.locale
},
colorValues: function () {
return colors.map(color => color.value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default defineComponent({
return this.$t('Profile.{number} selected', { number: this.selectedLength })
},
locale: function () {
return this.$i18n.locale.replace('_', '-')
return this.$i18n.locale
}
},
watch: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default defineComponent({
},
computed: {
locale: function () {
return this.$i18n.locale.replace('_', '-')
return this.$i18n.locale
},
profileList: function () {
return this.$store.getters.getProfileList
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/ft-select/ft-select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
v-for="(name, index) in selectNames"
:key="index"
:value="selectValues[index]"
:lang="isLocaleSelector && selectValues[index] !== 'system' ? selectValues[index].replace('_', '-') : null"
:lang="isLocaleSelector && selectValues[index] !== 'system' ? selectValues[index] : null"
>
{{ name }}
</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default defineComponent({
},
computed: {
locale: function () {
return this.$i18n.locale.replace('_', '-')
return this.$i18n.locale
},
profileInitials: function () {
return this.profileDisplayList.map((profile) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default defineComponent({
return this.$router.getRoutes().filter((route) => includedPageNames.includes(route.name))
},
defaultPageNames: function () {
return this.defaultPages.map((route) => translateWindowTitle(route.meta.title, this.$i18n))
return this.defaultPages.map((route) => translateWindowTitle(route.meta.title))
},
defaultPageValues: function () {
// avoid Vue parsing issues by excluding '/' from path values
Expand Down
8 changes: 8 additions & 0 deletions src/renderer/components/player-settings/player-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ export default defineComponent({
return this.$store.getters.getBackendPreference
},

backendFallback: function () {
return this.$store.getters.getBackendFallback
},

autoplayVideos: function () {
return this.$store.getters.getAutoplayVideos
},
Expand All @@ -87,6 +91,10 @@ export default defineComponent({
return this.$store.getters.getProxyVideos
},

showProxyVideosAsDisabled: function () {
return this.backendPreference !== 'invidious' && !this.backendFallback
},

defaultSkipInterval: function () {
return parseInt(this.$store.getters.getDefaultSkipInterval)
},
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/components/player-settings/player-settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<ft-toggle-switch
:label="$t('Settings.Player Settings.Proxy Videos Through Invidious')"
:compact="true"
:default-value="proxyVideos"
:default-value="showProxyVideosAsDisabled ? false : proxyVideos"
:disabled="showProxyVideosAsDisabled"
:tooltip="$t('Tooltips.Player Settings.Proxy Videos Through Invidious')"
@change="updateProxyVideos"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/proxy-settings/proxy-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default defineComponent({
return `${this.proxyProtocol}://${this.proxyHostname}:${this.proxyPort}`
},
lang: function() {
return this.$i18n.locale.replace('_', '-')
return this.$i18n.locale
},
localeToUse: function() {
// locales found here: https://ipwhois.io/documentation
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/side-nav/side-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default defineComponent({
return this.$store.getters.getActiveProfile
},
locale: function () {
return this.$i18n.locale.replace('_', '-')
return this.$i18n.locale
},
activeSubscriptions: function () {
const subscriptions = deepCopy(this.activeProfile.subscriptions)
Expand Down
Loading

0 comments on commit 5d7cac4

Please sign in to comment.