mirror of
https://github.com/torappinfo/uweb.git
synced 2025-01-15 08:31:00 +01:00
add workers for bingAI
This commit is contained in:
parent
95c5410f00
commit
441db3a1f4
|
@ -69,12 +69,12 @@
|
|||
</li>
|
||||
<li>
|
||||
<p>response headers, separeded by ';', Ex.:<br>
|
||||
Access-Control-Allow-Origin;*;Access-Control-Allow-Credentials;true mybing2.xn--xyza.top</p>
|
||||
Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true mybing.xn--xyza.top</p>
|
||||
<p>which makes "mybing2.xn--xyza.top" to accept CORS requests with cookies.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>IP address and response headers, separeded by ';', Ex.:<br>
|
||||
172.64.80.1;Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true wild-cake-ff77.jamesfengcao.workers.dev</p>
|
||||
104.21.8.195;Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true uweb.torapp.eu.org</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p><a href="file:///data/data/info.torapp.uweb/files/default.hosts">"default.hosts"</a> blocks whole domain trees including all descedant domains. The domains in the hosts file must be 2 or 3 segment domains, such as "yahoo.com" and "finance.yahoo.com". If the length of the last 2 segments is less than 7, such as "com.pl", then it is treated as one segment, so domains like "xxx.xxx.com.pl" are also valid in the hosts file.</p>
|
||||
|
@ -84,7 +84,7 @@ The first part [rootDomain] is required and the others are optional. regex is ja
|
|||
|
||||
</div>
|
||||
<p>Last Modified: 7 April 2023<br>
|
||||
hosts to support both ip address and response headers<br>
|
||||
add cloudflare/bing.js<br>
|
||||
<pre></pre>
|
||||
</p>
|
||||
|
||||
|
|
29
en/searchurl/cloudflare/bing.js
Normal file
29
en/searchurl/cloudflare/bing.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
export default {
|
||||
async fetch(req, _env) {
|
||||
let url = req.url;
|
||||
let iSlash = url.indexOf('/',11);
|
||||
let nUrl = "https://www.bing.com/"+url.substring(iSlash+1);
|
||||
return goUrl(req, nUrl);
|
||||
}
|
||||
}
|
||||
|
||||
function goUrl(request, url) {
|
||||
//构建 fetch 参数
|
||||
let fp = {
|
||||
method: request.method,
|
||||
headers: {}
|
||||
}
|
||||
//保留头部信息
|
||||
let reqHeaders = new Headers(request.headers);
|
||||
let dropHeaders = ["cookie","user-agent","accept","accept-language"];
|
||||
let he = reqHeaders.entries();
|
||||
for (let h of he) {
|
||||
let key = h[0],
|
||||
value = h[1];
|
||||
if (dropHeaders.includes(key)) {
|
||||
fp.headers[key] = value;
|
||||
}
|
||||
}
|
||||
return fetch(url, fp);
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||
<url>
|
||||
<loc>/en/_posts/</loc>
|
||||
<lastmod>2023-04-07T15:29:47+08:00</lastmod>
|
||||
<lastmod>2023-04-07T18:05:06+08:00</lastmod>
|
||||
<xhtml:link
|
||||
rel="alternate"
|
||||
hreflang="zh"
|
||||
|
@ -29,7 +29,7 @@
|
|||
/>
|
||||
</url><url>
|
||||
<loc>/en/</loc>
|
||||
<lastmod>2023-04-07T15:29:47+08:00</lastmod>
|
||||
<lastmod>2023-04-07T18:05:06+08:00</lastmod>
|
||||
<xhtml:link
|
||||
rel="alternate"
|
||||
hreflang="zh"
|
||||
|
@ -55,10 +55,10 @@
|
|||
/>
|
||||
</url><url>
|
||||
<loc>/en/tags/adblock/</loc>
|
||||
<lastmod>2023-04-07T15:29:47+08:00</lastmod>
|
||||
<lastmod>2023-04-07T18:05:06+08:00</lastmod>
|
||||
</url><url>
|
||||
<loc>/en/adblock_domain/</loc>
|
||||
<lastmod>2023-04-07T15:29:47+08:00</lastmod>
|
||||
<lastmod>2023-04-07T18:05:06+08:00</lastmod>
|
||||
<xhtml:link
|
||||
rel="alternate"
|
||||
hreflang="zh"
|
||||
|
@ -71,7 +71,7 @@
|
|||
/>
|
||||
</url><url>
|
||||
<loc>/en/tags/</loc>
|
||||
<lastmod>2023-04-07T15:29:47+08:00</lastmod>
|
||||
<lastmod>2023-04-07T18:05:06+08:00</lastmod>
|
||||
<xhtml:link
|
||||
rel="alternate"
|
||||
hreflang="zh"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<sitemap>
|
||||
<loc>en/sitemap.xml</loc>
|
||||
|
||||
<lastmod>2023-04-07T15:29:47+08:00</lastmod>
|
||||
<lastmod>2023-04-07T18:05:06+08:00</lastmod>
|
||||
|
||||
</sitemap>
|
||||
|
||||
|
|
Loading…
Reference in a new issue