mirror of https://github.com/FreeTubeApp/FreeTube
Fix local API search erroring, because the default parameter values were not getting applied (#4704)
This commit is contained in:
parent
a6cb20be40
commit
414003336d
|
@ -35,23 +35,23 @@ const TRACKING_PARAM_NAMES = [
|
||||||
* @param {boolean} options.generateSessionLocally generate the session locally or let YouTube generate it (local is faster, remote is more accurate)
|
* @param {boolean} options.generateSessionLocally generate the session locally or let YouTube generate it (local is faster, remote is more accurate)
|
||||||
* @returns the Innertube instance
|
* @returns the Innertube instance
|
||||||
*/
|
*/
|
||||||
async function createInnertube(options = { withPlayer: false, location: undefined, safetyMode: false, clientType: undefined, generateSessionLocally: true }) {
|
async function createInnertube({ withPlayer = false, location = undefined, safetyMode = false, clientType = undefined, generateSessionLocally = true } = {}) {
|
||||||
let cache
|
let cache
|
||||||
if (options.withPlayer) {
|
if (withPlayer) {
|
||||||
const userData = await getUserDataPath()
|
const userData = await getUserDataPath()
|
||||||
cache = new PlayerCache(join(userData, 'player_cache'))
|
cache = new PlayerCache(join(userData, 'player_cache'))
|
||||||
}
|
}
|
||||||
|
|
||||||
return await Innertube.create({
|
return await Innertube.create({
|
||||||
retrieve_player: !!options.withPlayer,
|
retrieve_player: !!withPlayer,
|
||||||
location: options.location,
|
location: location,
|
||||||
enable_safety_mode: !!options.safetyMode,
|
enable_safety_mode: !!safetyMode,
|
||||||
client_type: options.clientType,
|
client_type: clientType,
|
||||||
|
|
||||||
// use browser fetch
|
// use browser fetch
|
||||||
fetch: (input, init) => fetch(input, init),
|
fetch: (input, init) => fetch(input, init),
|
||||||
cache,
|
cache,
|
||||||
generate_session_locally: !!options.generateSessionLocally
|
generate_session_locally: !!generateSessionLocally
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue