Skip to content

Commit

Permalink
Merge branch 'development' into feature/auto-load-next-page
Browse files Browse the repository at this point in the history
* development: (92 commits)
  Make video info section more concise (FreeTubeApp#4338)
  Playlist performance improvements (FreeTubeApp#4597)
  ! Fix playlist type not passed when playing next/prev item in a user playlist (FreeTubeApp#4623)
  Properly localize playlist view and video counts (FreeTubeApp#4620)
  Translated using Weblate (Croatian)
  Translated using Weblate (German)
  Translated using Weblate (Croatian)
  Fix search bar handling of Invidious channel URLs (FreeTubeApp#4568)
  Local API: List related games in featured channels section (FreeTubeApp#4562)
  Workaround community post slider dependency incorrectly calculating its size (FreeTubeApp#4598)
  Add support for viewing movie trailers with local api (FreeTubeApp#4391)
  Bump the eslint group with 2 updates (FreeTubeApp#4616)
  Translated using Weblate (French)
  Translated using Weblate (Finnish)
  Bump electron from 28.1.4 to 28.2.0 (FreeTubeApp#4611)
  Translated using Weblate (French)
  Bump the eslint group with 4 updates (FreeTubeApp#4581)
  Bump lefthook from 1.6.0 to 1.6.1 (FreeTubeApp#4608)
  Bump marked from 11.1.1 to 11.2.0 (FreeTubeApp#4612)
  Bump webpack from 5.89.0 to 5.90.0 (FreeTubeApp#4610)
  ...
  • Loading branch information
PikachuEXE committed Feb 3, 2024
2 parents adfc9f7 + ad9cabd commit 9861ad2
Show file tree
Hide file tree
Showing 65 changed files with 2,032 additions and 954 deletions.
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"autolinker": "^4.0.0",
"electron-context-menu": "^3.6.1",
"lodash.debounce": "^4.0.8",
"marked": "^11.1.1",
"marked": "^11.2.0",
"path-browserify": "^1.0.1",
"process": "^0.11.10",
"swiper": "^11.0.5",
Expand All @@ -80,54 +80,54 @@
"youtubei.js": "^8.2.0"
},
"devDependencies": {
"@babel/core": "^7.23.7",
"@babel/eslint-parser": "^7.23.3",
"@babel/core": "^7.23.9",
"@babel/eslint-parser": "^7.23.9",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.23.8",
"@babel/preset-env": "^7.23.9",
"@double-great/stylelint-a11y": "^3.0.0",
"babel-loader": "^9.1.3",
"copy-webpack-plugin": "^12.0.1",
"css-loader": "^6.9.0",
"css-minimizer-webpack-plugin": "^5.0.1",
"electron": "^28.1.3",
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^6.9.1",
"css-minimizer-webpack-plugin": "^6.0.0",
"electron": "^28.2.0",
"electron-builder": "^24.9.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsonc": "^2.11.2",
"eslint-plugin-jsonc": "^2.13.0",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-unicorn": "^50.0.1",
"eslint-plugin-vue": "^9.20.1",
"eslint-plugin-vuejs-accessibility": "^2.2.0",
"eslint-plugin-yml": "^1.11.0",
"eslint-plugin-vuejs-accessibility": "^2.2.1",
"eslint-plugin-yml": "^1.12.2",
"html-webpack-plugin": "^5.6.0",
"js-yaml": "^4.1.0",
"json-minimizer-webpack-plugin": "^4.0.0",
"lefthook": "^1.5.6",
"json-minimizer-webpack-plugin": "^5.0.0",
"lefthook": "^1.6.1",
"mini-css-extract-plugin": "^2.7.7",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.33",
"postcss-scss": "^4.0.9",
"prettier": "^2.8.8",
"rimraf": "^5.0.5",
"sass": "^1.69.7",
"sass-loader": "^13.3.3",
"stylelint": "^16.1.0",
"sass": "^1.70.0",
"sass-loader": "^14.0.0",
"stylelint": "^16.2.0",
"stylelint-config-sass-guidelines": "^11.0.0",
"stylelint-config-standard": "^36.0.0",
"stylelint-high-performance-animation": "^1.10.0",
"stylelint-use-logical-spec": "^5.0.1",
"tree-kill": "1.2.2",
"vue-devtools": "^5.1.4",
"vue-eslint-parser": "^9.3.2",
"vue-eslint-parser": "^9.4.2",
"vue-loader": "^15.10.0",
"webpack": "^5.89.0",
"webpack": "^5.90.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1",
"webpack-watch-external-files-plugin": "^2.0.0",
"webpack-watch-external-files-plugin": "^3.0.0",
"yaml-eslint-parser": "^1.2.2"
}
}
3 changes: 2 additions & 1 deletion src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,8 @@ function runApp() {
})

ipcMain.handle(IpcChannels.GET_SYSTEM_LOCALE, () => {
return app.getLocale()
// we should switch to getPreferredSystemLanguages at some point and iterate through until we find a supported locale
return app.getSystemLocale()
})

ipcMain.handle(IpcChannels.GET_USER_DATA_PATH, () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,16 @@ export default defineComponent({
return ch
})
},
forbiddenTitles: function() {
return JSON.parse(this.$store.getters.getForbiddenTitles)
},
hideSubscriptionsLiveTooltip: function () {
return this.$t('Tooltips.Distraction Free Settings.Hide Subscriptions Live', {
appWideSetting: this.$t('Settings.Distraction Free Settings.Hide Live Streams'),
subsection: this.$t('Settings.Distraction Free Settings.Sections.General'),
settingsSection: this.$t('Settings.Distraction Free Settings.Distraction Free Settings')
})
}
},
},
mounted: function () {
this.verifyChannelsHidden()
Expand All @@ -148,6 +151,9 @@ export default defineComponent({
handleChannelsHidden: function (value) {
this.updateChannelsHidden(JSON.stringify(value))
},
handleForbiddenTitles: function (value) {
this.updateForbiddenTitles(JSON.stringify(value))
},
handleChannelsExists: function () {
showToast(this.$t('Settings.Distraction Free Settings.Hide Channels Already Exists'))
},
Expand Down Expand Up @@ -206,6 +212,7 @@ export default defineComponent({
'updateHideSharingActions',
'updateHideChapters',
'updateChannelsHidden',
'updateForbiddenTitles',
'updateShowDistractionFreeTitles',
'updateHideFeaturedChannels',
'updateHideChannelShorts',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,24 @@
:tooltip="$t('Tooltips.Distraction Free Settings.Hide Channels')"
:validate-tag-name="validateChannelId"
:find-tag-info="findChannelTagInfo"
:are-channel-tags="true"
@invalid-name="handleInvalidChannel"
@error-find-tag-info="handleChannelAPIError"
@change="handleChannelsHidden"
@already-exists="handleChannelsExists"
/>
</ft-flex-box>
<ft-flex-box>
<ft-input-tags
:label="$t('Settings.Distraction Free Settings.Hide Videos and Playlists Containing Text')"
:tag-name-placeholder="$t('Settings.Distraction Free Settings.Hide Videos and Playlists Containing Text Placeholder')"
:show-action-button="true"
:tag-list="forbiddenTitles"
:min-input-length="3"
:tooltip="$t('Tooltips.Distraction Free Settings.Hide Videos and Playlists Containing Text')"
@change="handleForbiddenTitles"
/>
</ft-flex-box>
</ft-settings-section>
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
block-size: 50px;
border-radius: 100%;
-webkit-border-radius: 100%;
object-fit: cover;
}

.selected {
Expand Down
13 changes: 13 additions & 0 deletions src/renderer/components/ft-community-post/ft-community-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export default defineComponent({
appearance: {
type: String,
required: true
},
hideForbiddenTitles: {
type: Boolean,
default: true
}
},
data: function () {
Expand All @@ -44,6 +48,15 @@ export default defineComponent({
computed: {
listType: function () {
return this.$store.getters.getListType
},

forbiddenTitles() {
if (!this.hideForbiddenTitles) { return [] }
return JSON.parse(this.$store.getters.getForbiddenTitles)
},

hideVideo() {
return this.forbiddenTitles.some((text) => this.data.postContent.content.title?.toLowerCase().includes(text.toLowerCase()))
}
},
created: function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
box-sizing: border-box;
}

.hiddenVideo {
font-style: italic;
opacity: 0.85;
text-align: center;
}

.communityImage {
block-size: 100%;
inline-size: 100%;
Expand Down Expand Up @@ -138,5 +144,5 @@
}

.sliderContainer {
display: block;
display: grid;
}
43 changes: 24 additions & 19 deletions src/renderer/components/ft-community-post/ft-community-post.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,25 @@
class="postText"
v-html="postText"
/>
<div class="sliderContainer">
<swiper-container
v-if="type === 'multiImage' && postContent.content.length > 0"
ref="swiperContainer"
init="false"
class="slider"
<swiper-container
v-if="type === 'multiImage' && postContent.content.length > 0"
ref="swiperContainer"
init="false"
class="sliderContainer"
>
<swiper-slide
v-for="(img, index) in postContent.content"
:key="index"
lazy="true"
>
<swiper-slide
v-for="(img, index) in postContent.content"
:key="index"
lazy="true"
<img
:src="getBestQualityImage(img)"
class="communityImage"
alt=""
loading="lazy"
>
<img
:src="getBestQualityImage(img)"
class="communityImage"
alt=""
loading="lazy"
>
</swiper-slide>
</swiper-container>
</div>
</swiper-slide>
</swiper-container>
<div
v-if="type === 'image' && postContent.content.length > 0"
>
Expand All @@ -90,9 +88,16 @@
v-if="type === 'video'"
>
<ft-list-video
v-if="!hideVideo"
:data="data.postContent.content"
appearance=""
/>
<p
v-else
class="hiddenVideo"
>
{{ '[' + $t('Channel.Community.Video hidden by FreeTube') + ']' }}
</p>
</div>
<div
v-if="type === 'poll' || type === 'quiz'"
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/components/ft-element-list/ft-element-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export default defineComponent({
type: Boolean,
default: true,
},
hideForbiddenTitles: {
type: Boolean,
default: true
}
},
computed: {
listType: function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
:layout="displayValue"
:show-video-with-last-viewed-playlist="showVideoWithLastViewedPlaylist"
:use-channels-hidden-preference="useChannelsHiddenPreference"
:hide-forbidden-titles="hideForbiddenTitles"
/>
</ft-auto-grid>
</template>
Expand Down
47 changes: 47 additions & 0 deletions src/renderer/components/ft-input-tags/ft-input-tags.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { defineComponent } from 'vue'
import FtInput from '../ft-input/ft-input.vue'
import { showToast } from '../../helpers/utils'

export default defineComponent({
name: 'FtInputTags',
components: {
'ft-input': FtInput,
},
props: {
areChannelTags: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
Expand All @@ -23,6 +28,10 @@ export default defineComponent({
type: String,
required: true
},
minInputLength: {
type: Number,
default: 1
},
showActionButton: {
type: Boolean,
default: true
Expand All @@ -46,6 +55,30 @@ export default defineComponent({
},
methods: {
updateTags: async function (text, _e) {
if (this.areChannelTags) {
await this.updateChannelTags(text, _e)
return
}
// add tag and update tag list
const trimmedText = text.trim()

if (this.minInputLength > trimmedText.length) {
showToast(this.$tc('Trimmed input must be at least N characters long', this.minInputLength, { length: this.minInputLength }))
return
}

if (this.tagList.includes(trimmedText)) {
showToast(this.$t('Tag already exists', { tagName: trimmedText }))
return
}

const newList = this.tagList.slice(0)
newList.push(trimmedText)
this.$emit('change', newList)
// clear input box
this.$refs.tagNameInput.handleClearTextClick()
},
updateChannelTags: async function (text, _e) {
// get text without spaces after last '/' in url, if any
const name = text.split('/').pop().trim()

Expand Down Expand Up @@ -73,6 +106,20 @@ export default defineComponent({
this.$refs.tagNameInput.handleClearTextClick()
},
removeTag: function (tag) {
if (this.areChannelTags) {
this.removeChannelTag(tag)
return
}
// Remove tag from list
const tagName = tag.trim()
if (this.tagList.includes(tagName)) {
const newList = this.tagList.slice(0)
const index = newList.indexOf(tagName)
newList.splice(index, 1)
this.$emit('change', newList)
}
},
removeChannelTag: function (tag) {
// Remove tag from list
if (this.tagList.some((tmpTag) => tmpTag.name === tag.name)) {
const newList = this.tagList.filter((tmpTag) => tmpTag.name !== tag.name)
Expand Down
Loading

0 comments on commit 9861ad2

Please sign in to comment.