File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 777777 return readRequest ;
778778 }
779779
780+ async function hasConsumable ( ) {
781+ try {
782+ // Récupérer les valeurs stockées avec GM.getValue (équivalent de chrome.storage.local)
783+ const requestType = await GM . getValue ( "ophirofox_request_type" ) ;
784+ const keywords = await GM . getValue ( "ophirofox_keywords" ) ;
785+
786+ // Vérifier si l'une des deux clés existe et contient une valeur
787+ const hasRequestType = requestType !== undefined ;
788+ const hasKeywords = keywords !== undefined ;
789+
790+ // Retourner true si au moins une des clés existe avec une valeur
791+ return hasRequestType || hasKeywords ;
792+ } catch ( error ) {
793+ console . error ( "Erreur lors de la vérification des consommables:" , error ) ;
794+ return false ;
795+ }
796+ }
797+
780798 async function onLoad ( ) {
781799 ophirofoxRealoadOnExpired ( ) ;
782800 const path = window . location . pathname ;
789807 path . startsWith ( "/Search/Result" )
790808 ) ) return ;
791809
810+ /* Fix une issue avec le proxy BNF qui redirige vers /Pdf */
811+ if ( path === '/Pdf' && await hasConsumable ( ) ) {
812+ window . location . pathname = '/Search/Reading' ;
813+ return ;
814+ }
815+
792816 const readRequest = await consumeReadRequest ( ) ;
793817 const search_terms = readRequest . keywords ;
794818 const published_time = readRequest . published_time ;
You can’t perform that action at this time.
0 commit comments