From 2c2f15bfa962d3a59f0cebfaadcfeb407620cd95 Mon Sep 17 00:00:00 2001 From: James Feng Cao Date: Mon, 19 Jun 2023 20:55:00 +0800 Subject: [PATCH] redirect bingai to cloudflare challenge if needed --- en/links/index.html | 2 +- en/searchurl/bingAI/js/bingChatHub.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/en/links/index.html b/en/links/index.html index baa782b..0ed14da 100644 --- a/en/links/index.html +++ b/en/links/index.html @@ -312,7 +312,7 @@ Bundle of internal urls, if it is an "i:0" url, then it should have th

Last Modified: 17 June 2023
-add i:8d[url] to force downloading
+finalize latest.html

i:56 urls support CTRL_A to CTRL-Z 
 

diff --git a/en/searchurl/bingAI/js/bingChatHub.js b/en/searchurl/bingAI/js/bingChatHub.js index e981ca7..94ca39a 100644 --- a/en/searchurl/bingAI/js/bingChatHub.js +++ b/en/searchurl/bingAI/js/bingChatHub.js @@ -235,6 +235,15 @@ async function createChat(theChatType) { try { let url = URLTrue(magicUrl,'turing/conversation/create'); let res = await fetch(url); + if(!res.ok){ + if(res.headers.has('cf-mitigated')){ + let challengeUrl = `${magicUrl}/challenge?`+location.href; + location.href=challengeUrl; + return; + } + mes = `Error code: ${res.status} ${res.statusText}`; + break; + } let resjson = await res.json(); if (!resjson.result || resjson.result.value != 'Success') { mes = resjson;