Relax error logs with google bot

pull/6562/head
Chocobozzz 2024-08-14 15:10:59 +02:00
parent 8fe17abb7c
commit af9f20d60c
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 13 additions and 2 deletions

View File

@ -298,7 +298,7 @@ export class Html5Hlsjs {
if (this.errorCounts[data.type]) this.errorCounts[data.type] += 1 if (this.errorCounts[data.type]) this.errorCounts[data.type] += 1
else this.errorCounts[data.type] = 1 else this.errorCounts[data.type] = 1
// Google Bot doesn't support our codecs, but we don't really care // Google Bot doesn't support our codecs, but it should not prevent indexing
if (!/googlebot/i.test(navigator.userAgent)) { if (!/googlebot/i.test(navigator.userAgent)) {
if (data.fatal) logger.error(error.message, { currentTime: this.player.currentTime(), data }) if (data.fatal) logger.error(error.message, { currentTime: this.player.currentTime(), data })
else logger.clientWarn(error.message) else logger.clientWarn(error.message)

View File

@ -202,7 +202,12 @@ class PeerTubePlugin extends Plugin {
this.player.addClass('vjs-error-display-enabled') this.player.addClass('vjs-error-display-enabled')
logger.error('Fatal error in player', this.player.error()) // Google Bot may throw codecs, but it should not prevent indexing
if (!/googlebot/i.test(navigator.userAgent)) {
console.error(this.player.error())
} else {
logger.error('Fatal error in player', this.player.error())
}
} }
hideFatalError () { hideFatalError () {

View File

@ -95,6 +95,12 @@
return return
} }
// Google Bot doesn't support our codecs, but it should not prevent indexing
if (!/googlebot/i.test(navigator.userAgent)) {
console.error(err)
return
}
// Video element is already created, don't crash the player // Video element is already created, don't crash the player
if (document.querySelector('.vjs-can-play')) { if (document.querySelector('.vjs-can-play')) {
if (window.logger && typeof window.logger.error === 'function') { if (window.logger && typeof window.logger.error === 'function') {