mirror of
https://github.com/torappinfo/uweb.git
synced 2024-08-14 23:54:59 +00:00
redirect bingai to cloudflare challenge if needed
This commit is contained in:
parent
63077ffe8f
commit
2c2f15bfa9
2 changed files with 10 additions and 1 deletions
|
@ -312,7 +312,7 @@ Bundle of internal urls, if it is an "i:0" url, then it should have th
|
|||
|
||||
</div>
|
||||
<p>Last Modified: 17 June 2023<br>
|
||||
add i:8d[url] to force downloading<br>
|
||||
finalize latest.html<br>
|
||||
<pre>i:56 urls support CTRL_A to CTRL-Z
|
||||
</pre>
|
||||
</p>
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue