Skip to content

Commit

Permalink
Merge branch 'feature/history-sensitive-search' into custom-builds/cu…
Browse files Browse the repository at this point in the history
…rrent

* feature/history-sensitive-search: (60 commits)
  * Implement case sensitive search in history
  $ Refactor a bit first
  Bump rimraf from 5.0.8 to 6.0.1 (FreeTubeApp#5412)
  Translated using Weblate (Indonesian)
  Bump the babel group across 1 directory with 3 updates (FreeTubeApp#5419)
  Bump sass from 1.77.6 to 1.77.8 (FreeTubeApp#5413)
  Bump webpack from 5.92.1 to 5.93.0 (FreeTubeApp#5414)
  Bump lefthook from 1.7.1 to 1.7.2 (FreeTubeApp#5415)
  Bump electron from 31.1.0 to 31.2.0 (FreeTubeApp#5416)
  Fix about page not reacting to locale changes (FreeTubeApp#5393)
  Delete .github/workflows/report.yml (FreeTubeApp#5395)
  Bump version number to v0.21.1
  Fix Invidious DASH manifest generation (FreeTubeApp#5387)
  ^ Update YouTube.js to 10.1.0 (FreeTubeApp#5384)
  Fix Invidious API error toasts saying undefined (FreeTubeApp#5380)
  Bump lefthook from 1.6.18 to 1.7.1 (FreeTubeApp#5376)
  Bump eslint-plugin-vue from 9.26.0 to 9.27.0 in the eslint group (FreeTubeApp#5371)
  Bump rimraf from 5.0.7 to 5.0.8 (FreeTubeApp#5373)
  Bump npm-run-all2 from 6.2.0 to 6.2.2 (FreeTubeApp#5374)
  Bump marked from 13.0.1 to 13.0.2 (FreeTubeApp#5375)
  ...
  • Loading branch information
PikachuEXE committed Jul 16, 2024
2 parents f294df5 + 15986c4 commit ec4ed68
Show file tree
Hide file tree
Showing 47 changed files with 800 additions and 604 deletions.
70 changes: 0 additions & 70 deletions .github/workflows/report.yml

This file was deleted.

3 changes: 2 additions & 1 deletion _scripts/webpack.renderer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ const config = {
resolve: {
alias: {
vue$: 'vue/dist/vue.runtime.esm.js',
'portal-vue$': 'portal-vue/dist/portal-vue.esm.js',

'DB_HANDLERS_ELECTRON_RENDERER_OR_WEB$': path.resolve(__dirname, '../src/datastores/handlers/electron.js'),
DB_HANDLERS_ELECTRON_RENDERER_OR_WEB$: path.resolve(__dirname, '../src/datastores/handlers/electron.js'),

'youtubei.js$': 'youtubei.js/web',

Expand Down
3 changes: 2 additions & 1 deletion _scripts/webpack.web.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ const config = {
resolve: {
alias: {
vue$: 'vue/dist/vue.runtime.esm.js',
'portal-vue$': 'portal-vue/dist/portal-vue.esm.js',

'DB_HANDLERS_ELECTRON_RENDERER_OR_WEB$': path.resolve(__dirname, '../src/datastores/handlers/web.js'),
DB_HANDLERS_ELECTRON_RENDERER_OR_WEB$: path.resolve(__dirname, '../src/datastores/handlers/web.js'),

// video.js's mpd-parser uses @xmldom/xmldom so that it can support both node and web browsers
// As FreeTube only runs in electron and web browsers, we can use the native DOMParser class, instead of the "polyfill"
Expand Down
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "freetube",
"productName": "FreeTube",
"description": "A private YouTube client",
"version": "0.21.0",
"version": "0.21.1",
"license": "AGPL-3.0-or-later",
"main": "./dist/main.js",
"private": true,
Expand Down Expand Up @@ -61,9 +61,9 @@
"@seald-io/nedb": "^4.0.4",
"@silvermine/videojs-quality-selector": "^1.3.1",
"autolinker": "^4.0.0",
"electron-context-menu": "^4.0.0",
"electron-context-menu": "^4.0.1",
"lodash.debounce": "^4.0.8",
"marked": "^13.0.0",
"marked": "^13.0.2",
"path-browserify": "^1.0.1",
"portal-vue": "^2.1.7",
"process": "^0.11.10",
Expand All @@ -79,20 +79,20 @@
"vue-observe-visibility": "^1.0.0",
"vue-router": "^3.6.5",
"vuex": "^3.6.2",
"youtubei.js": "^10.0.0"
"youtubei.js": "^10.1.0"
},
"devDependencies": {
"@babel/core": "^7.24.7",
"@babel/eslint-parser": "^7.24.7",
"@babel/core": "^7.24.9",
"@babel/eslint-parser": "^7.24.8",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.24.7",
"@babel/preset-env": "^7.24.8",
"@double-great/stylelint-a11y": "^3.0.2",
"@intlify/eslint-plugin-vue-i18n": "^3.0.0",
"babel-loader": "^9.1.3",
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^7.0.0",
"electron": "^31.0.1",
"electron": "^31.2.0",
"electron-builder": "^24.13.3",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -101,33 +101,33 @@
"eslint-plugin-jsonc": "^2.16.0",
"eslint-plugin-n": "^17.9.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.2.0",
"eslint-plugin-promise": "^6.4.0",
"eslint-plugin-unicorn": "^54.0.0",
"eslint-plugin-vue": "^9.26.0",
"eslint-plugin-vuejs-accessibility": "^2.3.0",
"eslint-plugin-vue": "^9.27.0",
"eslint-plugin-vuejs-accessibility": "^2.3.1",
"eslint-plugin-yml": "^1.14.0",
"html-webpack-plugin": "^5.6.0",
"js-yaml": "^4.1.0",
"json-minimizer-webpack-plugin": "^5.0.0",
"lefthook": "^1.6.16",
"lefthook": "^1.7.2",
"mini-css-extract-plugin": "^2.9.0",
"npm-run-all2": "^6.2.0",
"postcss": "^8.4.38",
"npm-run-all2": "^6.2.2",
"postcss": "^8.4.39",
"postcss-scss": "^4.0.9",
"prettier": "^2.8.8",
"rimraf": "^5.0.7",
"sass": "^1.77.5",
"rimraf": "^6.0.1",
"sass": "^1.77.8",
"sass-loader": "^14.2.1",
"stylelint": "^16.6.1",
"stylelint-config-sass-guidelines": "^11.1.0",
"stylelint-config-standard": "^36.0.0",
"stylelint-config-standard": "^36.0.1",
"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.4.3",
"vue-loader": "^15.10.0",
"webpack": "^5.92.0",
"webpack": "^5.93.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4",
"yaml-eslint-parser": "^1.2.3"
Expand Down
9 changes: 9 additions & 0 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,8 @@ function runApp() {

if (url.startsWith('https://www.youtube.com/youtubei/')) {
requestHeaders['Sec-Fetch-Site'] = 'same-origin'
requestHeaders['Sec-Fetch-Mode'] = 'same-origin'
requestHeaders['X-Youtube-Bootstrap-Logged-In'] = 'false'
} else {
// YouTube doesn't send the Content-Type header for the media requests, so we shouldn't either
delete requestHeaders['Content-Type']
Expand Down Expand Up @@ -974,6 +976,13 @@ function runApp() {

try {
const contents = await asyncFs.readFile(filePath)

// Probably a corrupted/broken cache entry, pretend it's absent
// A valid entry should be a few KB large
if (contents.byteLength < 500) {
return undefined
}

return contents.buffer
} catch (e) {
console.error(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</div>
<div class="switchColumn">
<ft-toggle-switch
:label="$t('Settings.Subscription Settings.Avoid Accidental Unsubscription')"
:label="$t('Settings.Subscription Settings.Confirm Before Unsubscribing')"
:default-value="unsubscriptionPopupStatus"
:compact="true"
@change="updateUnsubscriptionPopupStatus"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ export default defineComponent({
}).catch((err) => {
console.error(err)
const errorMessage = this.$t('Invidious API Error (Click to copy)')
showToast(`${errorMessage}: ${err.responseText}`, 10000, () => {
copyToClipboard(err.responseText)
showToast(`${errorMessage}: ${err}`, 10000, () => {
copyToClipboard(err)
})
switch (failedAttempts) {
case 0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ export default defineComponent({
}).catch((err) => {
console.error(err)
const errorMessage = this.$t('Invidious API Error (Click to copy)')
showToast(`${errorMessage}: ${err.responseText}`, 10000, () => {
copyToClipboard(err.responseText)
showToast(`${errorMessage}: ${err}`, 10000, () => {
copyToClipboard(err)
})
switch (failedAttempts) {
case 0:
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/components/top-nav/top-nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
inline-size: 100%;
z-index: 4;

@media only screen and (width >= 961px) {
@media only screen and (width >= 1122px) {
display: grid;
grid-template-columns: 1fr 440px 1fr;
grid-template-columns: 1fr 720px 1fr;
}

@include top-nav-is-colored {
Expand Down Expand Up @@ -190,7 +190,7 @@

.middle {
flex: 1;
max-inline-size: 440px;
max-inline-size: 720px;

.searchContainer {
align-items: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default defineComponent({
}
}
},
mounted: function () {
created: function () {
this.currentIndex = this.currentChapterIndex
},
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export default defineComponent({
return this.$store.getters.getActiveProfile.subscriptions
}
},
mounted: function () {
created: function () {
// region No comment detection
// For videos without any comment (comment disabled?)
// e.g. https://youtu.be/8NBSwDEf8a8
Expand Down Expand Up @@ -366,11 +366,11 @@ export default defineComponent({
}

this.isLoading = false
}).catch((xhr) => {
console.error(xhr)
}).catch((error) => {
console.error(error)
const errorMessage = this.$t('Invidious API Error (Click to copy)')
showToast(`${errorMessage}: ${xhr.responseText}`, 10000, () => {
copyToClipboard(xhr.responseText)
showToast(`${errorMessage}: ${error}`, 10000, () => {
copyToClipboard(error)
})
this.isLoading = false
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default defineComponent({
shownDescription: ''
}
},
mounted: function () {
created: function () {
if (this.descriptionHtml !== '') {
const parsed = this.parseDescriptionHtml(this.descriptionHtml)

Expand All @@ -50,26 +50,25 @@ export default defineComponent({
this.$emit('timestamp-event', timestamp)
},
parseDescriptionHtml: function (descriptionText) {
descriptionText = descriptionText.replaceAll('target="_blank"', '')
descriptionText = descriptionText.replaceAll(/\/redirect.+?(?=q=)/g, '')
descriptionText = descriptionText.replaceAll('q=', '')
descriptionText = descriptionText.replaceAll(/rel="nofollow\snoopener"/g, '')
descriptionText = descriptionText.replaceAll(/class=.+?(?=")./g, '')
descriptionText = descriptionText.replaceAll(/id=.+?(?=")./g, '')
descriptionText = descriptionText.replaceAll(/data-target-new-window=.+?(?=")./g, '')
descriptionText = descriptionText.replaceAll(/data-url=.+?(?=")./g, '')
descriptionText = descriptionText.replaceAll(/data-sessionlink=.+?(?=")./g, '')
descriptionText = descriptionText.replaceAll('&amp;', '&')
descriptionText = descriptionText.replaceAll('%3A', ':')
descriptionText = descriptionText.replaceAll('%2F', '/')
descriptionText = descriptionText.replaceAll(/&v.+?(?=")/g, '')
descriptionText = descriptionText.replaceAll(/&redirect-token.+?(?=")/g, '')
descriptionText = descriptionText.replaceAll(/&redir_token.+?(?=")/g, '')
descriptionText = descriptionText.replaceAll('href="/', 'href="https://www.youtube.com/')
descriptionText = descriptionText.replaceAll('href="/hashtag/', 'href="https://wwww.youtube.com/hashtag/')
descriptionText = descriptionText.replaceAll('yt.www.watch.player.seekTo', 'changeDuration')

return descriptionText
.replaceAll('target="_blank"', '')
.replaceAll(/\/redirect.+?(?=q=)/g, '')
.replaceAll('q=', '')
.replaceAll(/rel="nofollow\snoopener"/g, '')
.replaceAll(/class=.+?(?=")./g, '')
.replaceAll(/id=.+?(?=")./g, '')
.replaceAll(/data-target-new-window=.+?(?=")./g, '')
.replaceAll(/data-url=.+?(?=")./g, '')
.replaceAll(/data-sessionlink=.+?(?=")./g, '')
.replaceAll('&amp;', '&')
.replaceAll('%3A', ':')
.replaceAll('%2F', '/')
.replaceAll(/&v.+?(?=")/g, '')
.replaceAll(/&redirect-token.+?(?=")/g, '')
.replaceAll(/&redir_token.+?(?=")/g, '')
.replaceAll('href="/', 'href="https://www.youtube.com/')
.replaceAll('href="/hashtag/', 'href="https://wwww.youtube.com/hashtag/')
.replaceAll('yt.www.watch.player.seekTo', 'changeDuration')
}
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -306,18 +306,16 @@ export default defineComponent({
}
},

onScroll: function (event) {
onScroll: function (event, isScrollEnd = false) {
const liveChatComments = this.$refs.liveChatComments
if (event.wheelDelta >= 0 && this.stayAtBottom) {
this.stayAtBottom = false

if (liveChatComments.scrollHeight > liveChatComments.clientHeight) {
this.showScrollToBottom = true
}
} else if (event.wheelDelta < 0 && !this.stayAtBottom) {
if ((liveChatComments.scrollHeight - liveChatComments.scrollTop) === liveChatComments.clientHeight) {
this.scrollToBottom()
}
} else if ((isScrollEnd || event.wheelDelta < 0) && !this.stayAtBottom && (liveChatComments.scrollHeight - liveChatComments.scrollTop) === liveChatComments.clientHeight) {
this.scrollToBottom()
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
class="liveChatComments"
:style="{ blockSize: chatHeight }"
@mousewheel="e => onScroll(e)"
@scrollend="e => onScroll(e, true)"
>
<div
v-for="(comment, index) in comments"
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/helpers/api/invidious.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ export function convertInvidiousToLocalFormat(format) {
: {
fps: format.fps,
qualityLabel: format.qualityLabel,
colorInfo: format.colorInfo
colorInfo: format.colorInfo ?? {}
})
})

Expand Down
Loading

0 comments on commit ec4ed68

Please sign in to comment.