Compare commits

...

4 commits

Author SHA1 Message Date
James Feng Cao
6a726e893c add deno/bing.js 2023-04-07 21:38:56 +08:00
James Feng Cao
441db3a1f4 add workers for bingAI 2023-04-07 18:07:09 +08:00
James Feng Cao
95c5410f00 hosts to support both ip address and response headers 2023-04-07 15:32:34 +08:00
James Feng Cao
e8b5f412f0 bingAI: use https://mybing2.xn--xyza.top as default 2023-04-07 14:43:41 +08:00
13 changed files with 89 additions and 32 deletions

View file

@ -48,8 +48,8 @@ Long pressing the bookmark button in uweb browser will popup menus defined in fi
<guid>/en/adblock_domain/</guid> <guid>/en/adblock_domain/</guid>
<description>The enhanced hosts files &amp;quot;hosts&amp;quot; and &amp;quot;default.hosts&amp;quot; take effect when the setting option &amp;quot;using hosts&amp;quot; is checked. <description>The enhanced hosts files &amp;quot;hosts&amp;quot; and &amp;quot;default.hosts&amp;quot; take effect when the setting option &amp;quot;using hosts&amp;quot; is checked.
The enhanced file &amp;quot;hosts&amp;quot; defines IP addresses/attributes for domains. Each line has the following format: The enhanced file &amp;quot;hosts&amp;quot; defines IP addresses/attributes for domains. Each line has the following format:
[IP address/attributes][single space][domain name] [[IP address][attributes]][single space][domain name]
where &amp;quot;[IP address/attributes]&amp;quot; could be: where &amp;quot;[[IP address][attributes]]&amp;quot; could be:
ipv4 address such as: ipv4 address such as:
172.67.157.211 torapp.eu.org 172.67.157.211 torapp.eu.org
ipv6 address, Ex.: ipv6 address, Ex.:

View file

@ -51,8 +51,8 @@
</ul> </ul>
<p>The enhanced hosts files &quot;hosts&quot; and &quot;default.hosts&quot; take effect when the setting option &quot;using hosts&quot; is checked.</p> <p>The enhanced hosts files &quot;hosts&quot; and &quot;default.hosts&quot; take effect when the setting option &quot;using hosts&quot; is checked.</p>
<p>The <span style="color:red">enhanced</span> file <a href="file:///data/data/info.torapp.uweb/files/hosts">&quot;hosts&quot;</a> defines IP addresses/attributes for domains. Each line has the following format:<br> <p>The <span style="color:red">enhanced</span> file <a href="file:///data/data/info.torapp.uweb/files/hosts">&quot;hosts&quot;</a> defines IP addresses/attributes for domains. Each line has the following format:<br>
[IP address/attributes][single space][domain name]</p> [[IP address][attributes]][single space][domain name]</p>
<p>where &quot;[IP address/attributes]&quot; could be:</p> <p>where &quot;[[IP address][attributes]]&quot; could be:</p>
<ul> <ul>
<li> <li>
<p>ipv4 address such as:<br> <p>ipv4 address such as:<br>
@ -65,22 +65,26 @@
<li> <li>
<p>empty, that would lift all server-imposed limitations. Ex.:<br> <p>empty, that would lift all server-imposed limitations. Ex.:<br>
[single space]gitee.com</p> [single space]gitee.com</p>
<p>which will make all git repositories on the domain visitable as websites with raw file access url.</p>
</li>
<li>
<p>response headers, separeded by ';', Ex.:<br>
Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true mybing.xn--xyza.top</p>
<p>which makes &quot;mybing2.xn--xyza.top&quot; to accept CORS requests with cookies.</p>
</li>
<li>
<p>IP address and response headers, separeded by ';', Ex.:<br>
104.21.8.195;Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true uweb.torapp.eu.org</p>
</li> </li>
</ul> </ul>
<p>which will make all git repositories on the domain visitable as websites with raw file access url.</p>
<ul>
<li>response headers, separeded by ';', Ex.:<br>
Access-Control-Allow-Origin;*;Access-Control-Allow-Credentials;true mybing2.xn--xyza.top</li>
</ul>
<p>which makes &quot;mybing2.xn--xyza.top&quot; to accept CORS requests with cookies.</p>
<p><a href="file:///data/data/info.torapp.uweb/files/default.hosts">&quot;default.hosts&quot;</a> blocks whole domain trees including all descedant domains. The domains in the hosts file must be 2 or 3 segment domains, such as &quot;yahoo.com&quot; and &quot;finance.yahoo.com&quot;. If the length of the last 2 segments is less than 7, such as &quot;com.pl&quot;, then it is treated as one segment, so domains like &quot;xxx.xxx.com.pl&quot; are also valid in the hosts file.</p> <p><a href="file:///data/data/info.torapp.uweb/files/default.hosts">&quot;default.hosts&quot;</a> blocks whole domain trees including all descedant domains. The domains in the hosts file must be 2 or 3 segment domains, such as &quot;yahoo.com&quot; and &quot;finance.yahoo.com&quot;. If the length of the last 2 segments is less than 7, such as &quot;com.pl&quot;, then it is treated as one segment, so domains like &quot;xxx.xxx.com.pl&quot; are also valid in the hosts file.</p>
<p>Each line of the hosts file has the following format:<br> <p>Each line of the hosts file has the following format:<br>
[rootDomain][space][regex for domain prefix before rootDomain][space][regex for the whole url without &quot;http(s)://&quot;]<br> [rootDomain][space][regex for domain prefix before rootDomain][space][regex for the whole url without &quot;http(s)://&quot;]<br>
The first part [rootDomain] is required and the others are optional. regex is java-grammar regular expression. If the second regex is used, it is recommended to merge the first regex to the second one for performance.</p> The first part [rootDomain] is required and the others are optional. regex is java-grammar regular expression. If the second regex is used, it is recommended to merge the first regex to the second one for performance.</p>
</div> </div>
<p>Last Modified: 3 April 2023<br> <p>Last Modified: 7 April 2023<br>
bingAI to support cors with cookies<br> add bing.js for cf &amp; deno<br>
<pre></pre> <pre></pre>
</p> </p>

View file

@ -48,8 +48,8 @@ Long pressing the bookmark button in uweb browser will popup menus defined in fi
<guid>/en/adblock_domain/</guid> <guid>/en/adblock_domain/</guid>
<description>The enhanced hosts files &amp;quot;hosts&amp;quot; and &amp;quot;default.hosts&amp;quot; take effect when the setting option &amp;quot;using hosts&amp;quot; is checked. <description>The enhanced hosts files &amp;quot;hosts&amp;quot; and &amp;quot;default.hosts&amp;quot; take effect when the setting option &amp;quot;using hosts&amp;quot; is checked.
The enhanced file &amp;quot;hosts&amp;quot; defines IP addresses/attributes for domains. Each line has the following format: The enhanced file &amp;quot;hosts&amp;quot; defines IP addresses/attributes for domains. Each line has the following format:
[IP address/attributes][single space][domain name] [[IP address][attributes]][single space][domain name]
where &amp;quot;[IP address/attributes]&amp;quot; could be: where &amp;quot;[[IP address][attributes]]&amp;quot; could be:
ipv4 address such as: ipv4 address such as:
172.67.157.211 torapp.eu.org 172.67.157.211 torapp.eu.org
ipv6 address, Ex.: ipv6 address, Ex.:

View file

@ -77,7 +77,7 @@
async function getMagicUrl() { async function getMagicUrl() {
let v = localStorage.GoGoUrl; let v = localStorage.GoGoUrl;
if(v) return v; if(v) return v;
return "https://muweb.us.to/"; return "https://mybing2.xn--xyza.top/";
} }
</script> </script>
<script type="text/javascript" src="./js/GetSet.js"></script> <script type="text/javascript" src="./js/GetSet.js"></script>

View 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);
}

24
en/searchurl/deno/bing.js Normal file
View file

@ -0,0 +1,24 @@
import { serve } from "https://deno.land/std@0.140.0/http/server.ts";
async function handler(req: Request): Promise<Response> {
let url = req.url;
let iSlash = url.indexOf('/',11);
let nUrl = "https://www.bing.com/"+url.substring(iSlash+1);
let fp = {
method: req.method,
headers: {}
}
let reqHeaders = new Headers(req.headers);
let keepHeaders = ["cookie","user-agent","accept","accept-language"];
let he = reqHeaders.entries();
for (let h of he) {
let key = h[0],
value = h[1];
if (keepHeaders.includes(key)) {
fp.headers[key] = value;
}
}
return await fetch(nUrl, fp);
}
serve(handler);

View file

@ -3,7 +3,7 @@
xmlns:xhtml="http://www.w3.org/1999/xhtml"> xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url> <url>
<loc>/en/_posts/</loc> <loc>/en/_posts/</loc>
<lastmod>2023-04-03T17:48:42+08:00</lastmod> <lastmod>2023-04-07T18:05:06+08:00</lastmod>
<xhtml:link <xhtml:link
rel="alternate" rel="alternate"
hreflang="zh" hreflang="zh"
@ -29,7 +29,7 @@
/> />
</url><url> </url><url>
<loc>/en/</loc> <loc>/en/</loc>
<lastmod>2023-04-03T17:49:38+08:00</lastmod> <lastmod>2023-04-07T18:05:06+08:00</lastmod>
<xhtml:link <xhtml:link
rel="alternate" rel="alternate"
hreflang="zh" hreflang="zh"
@ -55,10 +55,10 @@
/> />
</url><url> </url><url>
<loc>/en/tags/adblock/</loc> <loc>/en/tags/adblock/</loc>
<lastmod>2023-04-03T17:48:42+08:00</lastmod> <lastmod>2023-04-07T18:05:06+08:00</lastmod>
</url><url> </url><url>
<loc>/en/adblock_domain/</loc> <loc>/en/adblock_domain/</loc>
<lastmod>2023-04-03T17:48:42+08:00</lastmod> <lastmod>2023-04-07T18:05:06+08:00</lastmod>
<xhtml:link <xhtml:link
rel="alternate" rel="alternate"
hreflang="zh" hreflang="zh"
@ -71,7 +71,7 @@
/> />
</url><url> </url><url>
<loc>/en/tags/</loc> <loc>/en/tags/</loc>
<lastmod>2023-04-03T17:48:42+08:00</lastmod> <lastmod>2023-04-07T18:05:06+08:00</lastmod>
<xhtml:link <xhtml:link
rel="alternate" rel="alternate"
hreflang="zh" hreflang="zh"

View file

@ -14,8 +14,8 @@
<guid>/en/adblock_domain/</guid> <guid>/en/adblock_domain/</guid>
<description>The enhanced hosts files &amp;quot;hosts&amp;quot; and &amp;quot;default.hosts&amp;quot; take effect when the setting option &amp;quot;using hosts&amp;quot; is checked. <description>The enhanced hosts files &amp;quot;hosts&amp;quot; and &amp;quot;default.hosts&amp;quot; take effect when the setting option &amp;quot;using hosts&amp;quot; is checked.
The enhanced file &amp;quot;hosts&amp;quot; defines IP addresses/attributes for domains. Each line has the following format: The enhanced file &amp;quot;hosts&amp;quot; defines IP addresses/attributes for domains. Each line has the following format:
[IP address/attributes][single space][domain name] [[IP address][attributes]][single space][domain name]
where &amp;quot;[IP address/attributes]&amp;quot; could be: where &amp;quot;[[IP address][attributes]]&amp;quot; could be:
ipv4 address such as: ipv4 address such as:
172.67.157.211 torapp.eu.org 172.67.157.211 torapp.eu.org
ipv6 address, Ex.: ipv6 address, Ex.:

View file

@ -4,14 +4,14 @@
<sitemap> <sitemap>
<loc>en/sitemap.xml</loc> <loc>en/sitemap.xml</loc>
<lastmod>2023-04-03T17:49:38+08:00</lastmod> <lastmod>2023-04-07T18:05:06+08:00</lastmod>
</sitemap> </sitemap>
<sitemap> <sitemap>
<loc>zh/sitemap.xml</loc> <loc>zh/sitemap.xml</loc>
<lastmod>2023-04-06T09:03:54+08:00</lastmod> <lastmod>2023-04-07T14:38:07+08:00</lastmod>
</sitemap> </sitemap>

View file

@ -19,7 +19,7 @@
复制bing.com cookies至魔法域名 复制bing.com cookies至魔法域名
勾选选项“使用离线缓存”, &amp;quot;使用hosts&amp;quot; 勾选选项“使用离线缓存”, &amp;quot;使用hosts&amp;quot;
hosts文件内添加一行允许发送cookie至魔法url: hosts文件内添加一行允许发送cookie至魔法url:
Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true muweb.us.to Click to append to &amp;quot;hosts&amp;quot;, edit the last part as magic url domain
点击界面入口 点击界面入口
可配置魔法url, 上述hosts文件作相应修改, 复制bing.com cookies至魔法域名。 详情 可配置魔法url, 上述hosts文件作相应修改, 复制bing.com cookies至魔法域名。 详情
方法2: 可以采用超级书签/直接界面+脚本+hosts。 方法2: 可以采用超级书签/直接界面+脚本+hosts。

View file

@ -19,7 +19,7 @@
复制bing.com cookies至魔法域名 复制bing.com cookies至魔法域名
勾选选项“使用离线缓存”, &amp;quot;使用hosts&amp;quot; 勾选选项“使用离线缓存”, &amp;quot;使用hosts&amp;quot;
hosts文件内添加一行允许发送cookie至魔法url: hosts文件内添加一行允许发送cookie至魔法url:
Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true muweb.us.to Click to append to &amp;quot;hosts&amp;quot;, edit the last part as magic url domain
点击界面入口 点击界面入口
可配置魔法url, 上述hosts文件作相应修改, 复制bing.com cookies至魔法域名。 详情 可配置魔法url, 上述hosts文件作相应修改, 复制bing.com cookies至魔法域名。 详情
方法2: 可以采用超级书签/直接界面+脚本+hosts。 方法2: 可以采用超级书签/直接界面+脚本+hosts。

View file

@ -3,7 +3,7 @@
xmlns:xhtml="http://www.w3.org/1999/xhtml"> xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url> <url>
<loc>/zh/_posts/</loc> <loc>/zh/_posts/</loc>
<lastmod>2023-04-06T09:03:54+08:00</lastmod> <lastmod>2023-04-07T14:38:07+08:00</lastmod>
<xhtml:link <xhtml:link
rel="alternate" rel="alternate"
hreflang="en" hreflang="en"
@ -16,7 +16,7 @@
/> />
</url><url> </url><url>
<loc>/zh/</loc> <loc>/zh/</loc>
<lastmod>2023-04-06T09:03:54+08:00</lastmod> <lastmod>2023-04-07T14:38:07+08:00</lastmod>
<xhtml:link <xhtml:link
rel="alternate" rel="alternate"
hreflang="en" hreflang="en"
@ -29,7 +29,7 @@
/> />
</url><url> </url><url>
<loc>/zh/tips/</loc> <loc>/zh/tips/</loc>
<lastmod>2023-04-06T09:03:54+08:00</lastmod> <lastmod>2023-04-07T14:38:07+08:00</lastmod>
<xhtml:link <xhtml:link
rel="alternate" rel="alternate"
hreflang="en" hreflang="en"

View file

@ -56,7 +56,7 @@
复制bing.com cookies至魔法域名<br> 复制bing.com cookies至魔法域名<br>
勾选选项“使用离线缓存”, &quot;使用hosts&quot;</p> 勾选选项“使用离线缓存”, &quot;使用hosts&quot;</p>
<p>hosts文件内添加一行允许发送cookie至魔法url:<br> <p>hosts文件内添加一行允许发送cookie至魔法url:<br>
Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true muweb.us.to</p> <a href="i:0ghosts::Access-Control-Allow-Origin;https://www.bing.com;Access-Control-Allow-Credentials;true mybing2.xn--xyza.top%0A">Click to append to &quot;hosts&quot;, edit the last part as magic url domain</a></p>
<p>点击界面入口<br> <p>点击界面入口<br>
可配置魔法url, 上述hosts文件作相应修改, 复制bing.com cookies至魔法域名。 <a href="https://gitee.com/jja8/NewBingGoGo/blob/master/docs/%E5%88%9B%E5%BB%BA%E8%87%AA%E5%B7%B1%E7%9A%84%E9%AD%94%E6%B3%95%E9%93%BE%E6%8E%A5.md">详情</a></p> 可配置魔法url, 上述hosts文件作相应修改, 复制bing.com cookies至魔法域名。 <a href="https://gitee.com/jja8/NewBingGoGo/blob/master/docs/%E5%88%9B%E5%BB%BA%E8%87%AA%E5%B7%B1%E7%9A%84%E9%AD%94%E6%B3%95%E9%93%BE%E6%8E%A5.md">详情</a></p>
</li> </li>
@ -86,8 +86,8 @@ UA为非默认时点击PC按钮将恢复UA为默认同时触发不保存UA
<a href="../filenames">配置文件列表</a>中直接点击文件名即可编辑。</p> <a href="../filenames">配置文件列表</a>中直接点击文件名即可编辑。</p>
</div> </div>
<p>Last Modified: 6 April 2023<br> <p>Last Modified: 7 April 2023<br>
bingAI: complete<br> bingAI: minor optimization<br>
<pre></pre> <pre></pre>
</p> </p>