mirror of https://github.com/FreeTubeApp/FreeTube
Merge c4e32bce9c
into a94910df27
This commit is contained in:
commit
a43ed6778f
|
@ -1,6 +1,7 @@
|
|||
import { ClientType, Endpoints, Innertube, Misc, UniversalCache, Utils, YT } from 'youtubei.js'
|
||||
import Autolinker from 'autolinker'
|
||||
import { join } from 'path'
|
||||
import store from '../../store/index'
|
||||
|
||||
import { PlayerCache } from './PlayerCache'
|
||||
import {
|
||||
|
@ -63,6 +64,14 @@ async function createInnertube({ withPlayer = false, location = undefined, safet
|
|||
let searchSuggestionsSession = null
|
||||
|
||||
export async function getLocalSearchSuggestions(query) {
|
||||
const searchCharLimit = store.getters.getSearchCharacterLimit
|
||||
|
||||
if (query.length > searchCharLimit) {
|
||||
// There's an event handler on the search input so avoid displaying an exception
|
||||
console.error(`Query is over ${searchCharLimit} characters`)
|
||||
return
|
||||
}
|
||||
|
||||
// reuse innertube instance to keep the search suggestions snappy
|
||||
if (searchSuggestionsSession === null) {
|
||||
searchSuggestionsSession = await createInnertube()
|
||||
|
|
|
@ -242,6 +242,7 @@ const state = {
|
|||
rememberHistory: true,
|
||||
saveWatchedProgress: true,
|
||||
saveVideoHistoryWithLastViewedPlaylist: true,
|
||||
searchCharacterLimit: 100,
|
||||
showFamilyFriendlyOnly: false,
|
||||
sponsorBlockShowSkippedToast: true,
|
||||
sponsorBlockUrl: 'https://sponsor.ajay.app',
|
||||
|
|
|
@ -92,6 +92,14 @@ export default defineComponent({
|
|||
},
|
||||
methods: {
|
||||
checkSearchCache: function (payload) {
|
||||
const searchCharLimit = this.$store.getters.getSearchCharacterLimit
|
||||
|
||||
if (payload.query.length > searchCharLimit) {
|
||||
console.warn(`Search character limit is: ${searchCharLimit}`)
|
||||
showToast(this.$t('Search character limit', { searchCharacterLimit: searchCharLimit }))
|
||||
return
|
||||
}
|
||||
|
||||
const sameSearch = this.sessionSearchHistory.filter((search) => {
|
||||
return search.query === payload.query && searchFiltersMatch(payload.searchSettings, search.searchSettings)
|
||||
})
|
||||
|
|
|
@ -60,6 +60,7 @@ Global:
|
|||
Search / Go to URL: Search / Go to URL
|
||||
Search Bar:
|
||||
Clear Input: Clear Input
|
||||
Search character limit: Search query is over the {searchCharacterLimit} character limit
|
||||
# In Filter Button
|
||||
Search Filters:
|
||||
Search Filters: Search Filters
|
||||
|
|
Loading…
Reference in New Issue