Skip to content

Commit 1e356c1

Browse files
Merge branch 'development' into vue3-test
2 parents 321ae9c + b51f473 commit 1e356c1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1194
-482
lines changed

package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@
8686
"@babel/preset-env": "^7.23.8",
8787
"@double-great/stylelint-a11y": "^3.0.0",
8888
"babel-loader": "^9.1.3",
89-
"copy-webpack-plugin": "^12.0.1",
90-
"css-loader": "^6.9.0",
91-
"css-minimizer-webpack-plugin": "^5.0.1",
92-
"electron": "^28.1.3",
89+
"copy-webpack-plugin": "^12.0.2",
90+
"css-loader": "^6.9.1",
91+
"css-minimizer-webpack-plugin": "^6.0.0",
92+
"electron": "^28.1.4",
9393
"electron-builder": "^24.9.1",
9494
"eslint": "^8.56.0",
9595
"eslint-config-prettier": "^9.1.0",
@@ -105,17 +105,17 @@
105105
"eslint-plugin-yml": "^1.11.0",
106106
"html-webpack-plugin": "^5.6.0",
107107
"js-yaml": "^4.1.0",
108-
"json-minimizer-webpack-plugin": "^4.0.0",
109-
"lefthook": "^1.5.6",
108+
"json-minimizer-webpack-plugin": "^5.0.0",
109+
"lefthook": "^1.6.0",
110110
"mini-css-extract-plugin": "^2.7.7",
111111
"npm-run-all": "^4.1.5",
112112
"postcss": "^8.4.33",
113113
"postcss-scss": "^4.0.9",
114114
"prettier": "^2.8.8",
115115
"rimraf": "^5.0.5",
116-
"sass": "^1.69.7",
117-
"sass-loader": "^13.3.3",
118-
"stylelint": "^16.1.0",
116+
"sass": "^1.70.0",
117+
"sass-loader": "^14.0.0",
118+
"stylelint": "^16.2.0",
119119
"stylelint-config-sass-guidelines": "^11.0.0",
120120
"stylelint-config-standard": "^36.0.0",
121121
"stylelint-high-performance-animation": "^1.10.0",
@@ -127,7 +127,7 @@
127127
"webpack": "^5.89.0",
128128
"webpack-cli": "^5.1.4",
129129
"webpack-dev-server": "^4.15.1",
130-
"webpack-watch-external-files-plugin": "^2.0.0",
130+
"webpack-watch-external-files-plugin": "^3.0.0",
131131
"yaml-eslint-parser": "^1.2.2"
132132
}
133133
}

src/main/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,8 @@ function runApp() {
720720
})
721721

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

726727
ipcMain.handle(IpcChannels.GET_USER_DATA_PATH, () => {

src/renderer/components/distraction-settings/distraction-settings.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,16 @@ export default defineComponent({
120120
return ch
121121
})
122122
},
123+
forbiddenTitles: function() {
124+
return JSON.parse(this.$store.getters.getForbiddenTitles)
125+
},
123126
hideSubscriptionsLiveTooltip: function () {
124127
return this.$t('Tooltips.Distraction Free Settings.Hide Subscriptions Live', {
125128
appWideSetting: this.$t('Settings.Distraction Free Settings.Hide Live Streams'),
126129
subsection: this.$t('Settings.Distraction Free Settings.Sections.General'),
127130
settingsSection: this.$t('Settings.Distraction Free Settings.Distraction Free Settings')
128131
})
129-
}
132+
},
130133
},
131134
mounted: function () {
132135
this.verifyChannelsHidden()
@@ -148,6 +151,9 @@ export default defineComponent({
148151
handleChannelsHidden: function (value) {
149152
this.updateChannelsHidden(JSON.stringify(value))
150153
},
154+
handleForbiddenTitles: function (value) {
155+
this.updateForbiddenTitles(JSON.stringify(value))
156+
},
151157
handleChannelsExists: function () {
152158
showToast(this.$t('Settings.Distraction Free Settings.Hide Channels Already Exists'))
153159
},
@@ -206,6 +212,7 @@ export default defineComponent({
206212
'updateHideSharingActions',
207213
'updateHideChapters',
208214
'updateChannelsHidden',
215+
'updateForbiddenTitles',
209216
'updateShowDistractionFreeTitles',
210217
'updateHideFeaturedChannels',
211218
'updateHideChannelShorts',

src/renderer/components/distraction-settings/distraction-settings.vue

+12
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,24 @@
239239
:tooltip="$t('Tooltips.Distraction Free Settings.Hide Channels')"
240240
:validate-tag-name="validateChannelId"
241241
:find-tag-info="findChannelTagInfo"
242+
:are-channel-tags="true"
242243
@invalid-name="handleInvalidChannel"
243244
@error-find-tag-info="handleChannelAPIError"
244245
@change="handleChannelsHidden"
245246
@already-exists="handleChannelsExists"
246247
/>
247248
</ft-flex-box>
249+
<ft-flex-box>
250+
<ft-input-tags
251+
:label="$t('Settings.Distraction Free Settings.Hide Videos and Playlists Containing Text')"
252+
:tag-name-placeholder="$t('Settings.Distraction Free Settings.Hide Videos and Playlists Containing Text Placeholder')"
253+
:show-action-button="true"
254+
:tag-list="forbiddenTitles"
255+
:min-input-length="3"
256+
:tooltip="$t('Tooltips.Distraction Free Settings.Hide Videos and Playlists Containing Text')"
257+
@change="handleForbiddenTitles"
258+
/>
259+
</ft-flex-box>
248260
</ft-settings-section>
249261
</template>
250262

src/renderer/components/ft-community-post/ft-community-post.js

+13
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ export default defineComponent({
2525
appearance: {
2626
type: String,
2727
required: true
28+
},
29+
hideForbiddenTitles: {
30+
type: Boolean,
31+
default: true
2832
}
2933
},
3034
data: function () {
@@ -44,6 +48,15 @@ export default defineComponent({
4448
computed: {
4549
listType: function () {
4650
return this.$store.getters.getListType
51+
},
52+
53+
forbiddenTitles() {
54+
if (!this.hideForbiddenTitles) { return [] }
55+
return JSON.parse(this.$store.getters.getForbiddenTitles)
56+
},
57+
58+
hideVideo() {
59+
return this.forbiddenTitles.some((text) => this.data.postContent.content.title?.toLowerCase().includes(text.toLowerCase()))
4760
}
4861
},
4962
created: function () {

src/renderer/components/ft-community-post/ft-community-post.scss

+6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
box-sizing: border-box;
1414
}
1515

16+
.hiddenVideo {
17+
font-style: italic;
18+
opacity: 0.85;
19+
text-align: center;
20+
}
21+
1622
.communityImage {
1723
block-size: 100%;
1824
inline-size: 100%;

src/renderer/components/ft-community-post/ft-community-post.vue

+7
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,16 @@
9090
v-if="type === 'video'"
9191
>
9292
<ft-list-video
93+
v-if="!hideVideo"
9394
:data="data.postContent.content"
9495
appearance=""
9596
/>
97+
<p
98+
v-else
99+
class="hiddenVideo"
100+
>
101+
{{ '[' + $t('Channel.Community.Video hidden by FreeTube') + ']' }}
102+
</p>
96103
</div>
97104
<div
98105
v-if="type === 'poll' || type === 'quiz'"

src/renderer/components/ft-element-list/ft-element-list.js

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export default defineComponent({
3030
type: Boolean,
3131
default: true,
3232
},
33+
hideForbiddenTitles: {
34+
type: Boolean,
35+
default: true
36+
}
3337
},
3438
computed: {
3539
listType: function () {

src/renderer/components/ft-element-list/ft-element-list.vue

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
:layout="displayValue"
1313
:show-video-with-last-viewed-playlist="showVideoWithLastViewedPlaylist"
1414
:use-channels-hidden-preference="useChannelsHiddenPreference"
15+
:hide-forbidden-titles="hideForbiddenTitles"
1516
/>
1617
</ft-auto-grid>
1718
</template>

src/renderer/components/ft-input-tags/ft-input-tags.js

+47
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import { defineComponent } from 'vue'
22
import FtInput from '../ft-input/ft-input.vue'
3+
import { showToast } from '../../helpers/utils'
34

45
export default defineComponent({
56
name: 'FtInputTags',
67
components: {
78
'ft-input': FtInput,
89
},
910
props: {
11+
areChannelTags: {
12+
type: Boolean,
13+
default: false
14+
},
1015
disabled: {
1116
type: Boolean,
1217
default: false
@@ -23,6 +28,10 @@ export default defineComponent({
2328
type: String,
2429
required: true
2530
},
31+
minInputLength: {
32+
type: Number,
33+
default: 1
34+
},
2635
showActionButton: {
2736
type: Boolean,
2837
default: true
@@ -47,6 +56,30 @@ export default defineComponent({
4756
emits: ['invalid-name', 'error-find-tag-info', 'change', 'already-exists'],
4857
methods: {
4958
updateTags: async function (text, _e) {
59+
if (this.areChannelTags) {
60+
await this.updateChannelTags(text, _e)
61+
return
62+
}
63+
// add tag and update tag list
64+
const trimmedText = text.trim()
65+
66+
if (this.minInputLength > trimmedText.length) {
67+
showToast(this.$tc('Trimmed input must be at least N characters long', this.minInputLength, { length: this.minInputLength }))
68+
return
69+
}
70+
71+
if (this.tagList.includes(trimmedText)) {
72+
showToast(this.$t('Tag already exists', { tagName: trimmedText }))
73+
return
74+
}
75+
76+
const newList = this.tagList.slice(0)
77+
newList.push(trimmedText)
78+
this.$emit('change', newList)
79+
// clear input box
80+
this.$refs.tagNameInput.handleClearTextClick()
81+
},
82+
updateChannelTags: async function (text, _e) {
5083
// get text without spaces after last '/' in url, if any
5184
const name = text.split('/').pop().trim()
5285

@@ -74,6 +107,20 @@ export default defineComponent({
74107
this.$refs.tagNameInput.handleClearTextClick()
75108
},
76109
removeTag: function (tag) {
110+
if (this.areChannelTags) {
111+
this.removeChannelTag(tag)
112+
return
113+
}
114+
// Remove tag from list
115+
const tagName = tag.trim()
116+
if (this.tagList.includes(tagName)) {
117+
const newList = this.tagList.slice(0)
118+
const index = newList.indexOf(tagName)
119+
newList.splice(index, 1)
120+
this.$emit('change', newList)
121+
}
122+
},
123+
removeChannelTag: function (tag) {
77124
// Remove tag from list
78125
if (this.tagList.some((tmpTag) => tmpTag.name === tag.name)) {
79126
const newList = this.tagList.filter((tmpTag) => tmpTag.name !== tag.name)

src/renderer/components/ft-input-tags/ft-input-tags.vue

+15-11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
:disabled="disabled"
1414
:placeholder="tagNamePlaceholder"
1515
:label="label"
16+
:min-input-length="minInputLength"
1617
:show-label="true"
1718
:tooltip="tooltip"
1819
:show-action-button="showActionButton"
@@ -26,18 +27,21 @@
2627
v-for="tag in tagList"
2728
:key="tag.id"
2829
>
29-
<router-link
30-
v-if="tag.icon"
31-
:to="tag.iconHref ?? ''"
32-
class="tag-icon-link"
33-
>
34-
<img
35-
:src="tag.icon"
36-
alt=""
37-
class="tag-icon"
30+
<template v-if="areChannelTags">
31+
<router-link
32+
v-if="tag.icon"
33+
:to="tag.iconHref ?? ''"
34+
class="tag-icon-link"
3835
>
39-
</router-link>
40-
<span>{{ (tag.preferredName) ? tag.preferredName : tag.name }}</span>
36+
<img
37+
:src="tag.icon"
38+
alt=""
39+
class="tag-icon"
40+
>
41+
</router-link>
42+
<span>{{ (tag.preferredName) ? tag.preferredName : tag.name }}</span>
43+
</template>
44+
<span v-else>{{ tag }}</span>
4145
<font-awesome-icon
4246
v-if="!disabled"
4347
:icon="['fas', 'fa-times']"

src/renderer/components/ft-input/ft-input.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { defineComponent } from 'vue'
2-
import FtTooltip from '../ft-tooltip/ft-tooltip.vue'
32
import { mapActions } from 'vuex'
3+
4+
import FtTooltip from '../ft-tooltip/ft-tooltip.vue'
45
import { isKeyboardEventKeyPrintableChar, isNullOrEmpty } from '../../helpers/strings'
56

67
export default defineComponent({
@@ -147,7 +148,9 @@ export default defineComponent({
147148
methods: {
148149
handleClick: function (e) {
149150
// No action if no input text
150-
if (!this.inputDataPresent) { return }
151+
if (!this.inputDataPresent) {
152+
return
153+
}
151154

152155
this.searchState.showOptions = false
153156
this.searchState.selectedOption = -1

src/renderer/components/ft-list-lazy-wrapper/ft-list-lazy-wrapper.js

+14
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ export default defineComponent({
4343
type: Boolean,
4444
default: true,
4545
},
46+
hideForbiddenTitles: {
47+
type: Boolean,
48+
default: true
49+
},
4650
},
4751
data: function () {
4852
return {
@@ -65,6 +69,10 @@ export default defineComponent({
6569
return ch
6670
})
6771
},
72+
forbiddenTitles: function() {
73+
if (!this.hideForbiddenTitles) { return [] }
74+
return JSON.parse(this.$store.getters.getForbiddenTitles)
75+
},
6876
hideUpcomingPremieres: function () {
6977
return this.$store.getters.getHideUpcomingPremieres
7078
},
@@ -102,6 +110,9 @@ export default defineComponent({
102110
// hide videos by author
103111
return false
104112
}
113+
if (this.forbiddenTitles.some((text) => this.data.title?.toLowerCase().includes(text.toLowerCase()))) {
114+
return false
115+
}
105116
} else if (dataType === 'channel') {
106117
const attrsToCheck = [
107118
// Local API
@@ -117,6 +128,9 @@ export default defineComponent({
117128
return false
118129
}
119130
} else if (dataType === 'playlist') {
131+
if (this.forbiddenTitles.some((text) => this.data.title?.toLowerCase().includes(text.toLowerCase()))) {
132+
return false
133+
}
120134
const attrsToCheck = [
121135
// Local API
122136
data.channelId,

src/renderer/components/ft-list-lazy-wrapper/ft-list-lazy-wrapper.vue

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
/>
3232
<ft-community-post
3333
v-else-if="finalDataType === 'community'"
34+
:hide-forbidden-titles="hideForbiddenTitles"
3435
:appearance="appearance"
3536
:data="data"
3637
/>

0 commit comments

Comments
 (0)