mirror of
https://github.com/torappinfo/uweb.git
synced 2024-08-14 23:54:59 +00:00
Compare commits
4 commits
087b9df6b6
...
d43d3e3dfc
Author | SHA1 | Date | |
---|---|---|---|
|
d43d3e3dfc | ||
|
f536c6eb78 | ||
|
a1f7adb7f0 | ||
|
594fcf767d |
10 changed files with 104 additions and 66 deletions
|
@ -47,7 +47,7 @@
|
||||||
<p><a href="https://github.com/torappinfo/uweb/releases/tag/v1">github</a></p>
|
<p><a href="https://github.com/torappinfo/uweb/releases/tag/v1">github</a></p>
|
||||||
<p><a href="https://sourceforge.net/projects/uwebbrowser/files/v1/">sourceforge</a></p>
|
<p><a href="https://sourceforge.net/projects/uwebbrowser/files/v1/">sourceforge</a></p>
|
||||||
<p><a href="https://my.powerfolder.com/getlink/fi61cC6VHjK72tfufmnLAz/">powerfolder</a></p>
|
<p><a href="https://my.powerfolder.com/getlink/fi61cC6VHjK72tfufmnLAz/">powerfolder</a></p>
|
||||||
<p><a href="https://u.pcloud.link/publink/show?code=kZXFGdVZ4tBRn1r2yn8yjJUGmT0ecQlRu4e7">pcloud</a></p>
|
<p><a href="https://www.udrop.com/folder/08ba413230f465ca0901bef68e857c0b/uweb">udrop</a></p>
|
||||||
<p><a href="https://releases.pagure.org/uweb/">pagure</a></p>
|
<p><a href="https://releases.pagure.org/uweb/">pagure</a></p>
|
||||||
<h4 id="main-featuresreadmeindexhtml"><a href="../readme/index.html">Main features</a></h4>
|
<h4 id="main-featuresreadmeindexhtml"><a href="../readme/index.html">Main features</a></h4>
|
||||||
<h4 id="change-logs">Change logs</h4>
|
<h4 id="change-logs">Change logs</h4>
|
||||||
|
@ -79,8 +79,8 @@
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<p>Last Modified: 23 May 2023<br>
|
<p>Last Modified: 26 May 2023<br>
|
||||||
enhance default.select with clipboard output<br>
|
add udrop<br>
|
||||||
<pre></pre>
|
<pre></pre>
|
||||||
</p>
|
</p>
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -208,7 +208,7 @@ uweb, termux &amp; history versions
|
||||||
github
|
github
|
||||||
sourceforge
|
sourceforge
|
||||||
powerfolder
|
powerfolder
|
||||||
pcloud
|
udrop
|
||||||
pagure
|
pagure
|
||||||
Main features Change logs 1004: bookmarklet &quot;Show as html&quot; to support clipboard site &quot;netcut.cn&quot;.
|
Main features Change logs 1004: bookmarklet &quot;Show as html&quot; to support clipboard site &quot;netcut.cn&quot;.
|
||||||
998: Bookmarklets to support CSP sites.
|
998: Bookmarklets to support CSP sites.
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<p>Click the following links to install menus for long pressing the button "link":<br>
|
<p>Click the following links to install menus for long pressing the button "link":<br>
|
||||||
<a href="i:0gdefault.select::html2clip:html/clip:cat%0A">Copy selected text with html format to clipboard</a></p>
|
<a href="i:0gdefault.select::copyHtml:html/clip:%0A">Copy selected text with html format to clipboard</a></p>
|
||||||
<p><a href="i:0gdefault.select::Home:/uweb:printf file://data/data/info.torapp.uweb/files/home5.search%5C location.href=%5C%22i:15;cat;printf %5C%22%0A">Search with home screen</a></p>
|
<p><a href="i:0gdefault.select::Home:/uweb:printf file://data/data/info.torapp.uweb/files/home5.search%5C location.href=%5C%22i:15;cat;printf %5C%22%0A">Search with home screen</a></p>
|
||||||
<p><a href="i:0gdefault.select::google Translate:/uweb:printf 'https://translate.google.com/?sl=auto&tl=en&op=translate&text=';cat|tr ' ' '%2B'%0A">google Translate</a></p>
|
<p><a href="i:0gdefault.select::google Translate:/uweb:printf 'https://translate.google.com/?sl=auto&tl=en&op=translate&text=';cat|tr ' ' '%2B'%0A">google Translate</a></p>
|
||||||
<p><a href="i:0gdefault.select::bing Translate:/uweb:printf 'https://cn.bing.com/translator/?from=&to=en&text=';cat|tr ' ' '%2B'%0A">bing translate</a></p>
|
<p><a href="i:0gdefault.select::bing Translate:/uweb:printf 'https://cn.bing.com/translator/?from=&to=en&text=';cat|tr ' ' '%2B'%0A">bing translate</a></p>
|
||||||
|
@ -91,8 +91,8 @@ To use ssh or scp, users need to install uweb compatible Termux provided on the
|
||||||
PCs need command "xsel" available to operate on copy/paste.</p>
|
PCs need command "xsel" available to operate on copy/paste.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<p>Last Modified: 23 May 2023<br>
|
<p>Last Modified: 25 May 2023<br>
|
||||||
enhance default.select with clipboard output<br>
|
rework cf/redirect.js<br>
|
||||||
<pre></pre>
|
<pre></pre>
|
||||||
</p>
|
</p>
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -103,11 +103,6 @@ function reSetStartChatMessage(type) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
if(t>1){
|
|
||||||
restartNewChat.classList.remove('onShow');
|
|
||||||
}else{
|
|
||||||
restartNewChat.classList.add('onShow');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,31 +164,31 @@ class Chat {
|
||||||
* 参数 消息string,当收到消息的函数,当关闭时函数
|
* 参数 消息string,当收到消息的函数,当关闭时函数
|
||||||
*/
|
*/
|
||||||
//(string,function:可以不传)
|
//(string,function:可以不传)
|
||||||
sendMessage(message, onMessage) {
|
sendMessage(message, onMessage) {
|
||||||
try {
|
try {
|
||||||
let restsrstUrl = 'wss://sydney.bing.com/sydney/ChatHub';
|
//let restsrstUrl = 'wss://sydney.bing.com/sydney/ChatHub';
|
||||||
if (this.chatWithMagic==true) {
|
//if (this.chatWithMagic==true)
|
||||||
restsrstUrl = URLTrue(this.magicUrl.replace('http', 'ws'), "ChatHub");
|
let restsrstUrl = this.magicUrl.replace('http', 'ws')+"sydney/ChatHub";
|
||||||
}
|
|
||||||
let chatWebSocket = new WebSocket(restsrstUrl);
|
let chatWebSocket = new WebSocket(restsrstUrl);
|
||||||
chatWebSocket.onopen = () => {
|
chatWebSocket.onopen = () => {
|
||||||
this.sendMessageManager.sendShakeHandsJson(chatWebSocket);
|
this.sendMessageManager.sendShakeHandsJson(chatWebSocket);
|
||||||
this.sendMessageManager.sendChatMessage(chatWebSocket, message);
|
this.sendMessageManager.sendChatMessage(chatWebSocket, message);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
ok: true,
|
ok: true,
|
||||||
message: 'ok',
|
message: 'ok',
|
||||||
obj: new ReturnMessage(chatWebSocket, onMessage),
|
obj: new ReturnMessage(chatWebSocket, onMessage),
|
||||||
chatWithMagic: this.chatWithMagic==true?true:false
|
chatWithMagic: this.chatWithMagic==true?true:false
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn(e)
|
console.warn(e)
|
||||||
return {
|
return {
|
||||||
ok: false,
|
ok: false,
|
||||||
message: "发生错误,可能是网络连接错误:" + e.message
|
message: "发生错误,可能是网络连接错误:" + e.message
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function URLTrue(url, thiePath) {
|
function URLTrue(url, thiePath) {
|
||||||
|
|
|
@ -16,7 +16,9 @@ async function generateImages(text,requestId,countF){
|
||||||
theUrls.append('q', text);
|
theUrls.append('q', text);
|
||||||
theUrls.append('iframeid', requestId);
|
theUrls.append('iframeid', requestId);
|
||||||
let theUrl = magicUrl+`images/create?${theUrls.toString()}`;
|
let theUrl = magicUrl+`images/create?${theUrls.toString()}`;
|
||||||
let response = await fetch(theUrl);
|
let response = await fetch(theUrl,
|
||||||
|
{"sec-fetch-site": "same-origin",
|
||||||
|
"referer": "https://www.bing.com/search?q=bingAI"});
|
||||||
let html = (await response.text());
|
let html = (await response.text());
|
||||||
//let cookieID = response.headers.get('cookieID');
|
//let cookieID = response.headers.get('cookieID');
|
||||||
|
|
||||||
|
@ -40,6 +42,7 @@ async function generateImages(text,requestId,countF){
|
||||||
let ur = urr[1];
|
let ur = urr[1];
|
||||||
ur = ur.replaceAll('&','&');
|
ur = ur.replaceAll('&','&');
|
||||||
let imgPageHtmlUrl = magicUrl + `${ur}`;
|
let imgPageHtmlUrl = magicUrl + `${ur}`;
|
||||||
|
let options = {"sec-fetch-site":"same-origin", "referer":"https://www.bing.com/images/create?partner=sydney&showselective=1&sude=1&kseed=7000"};
|
||||||
for(let count = 1;count<=20;count++){
|
for(let count = 1;count<=20;count++){
|
||||||
if((!!countF)&&(typeof countF =='function')){
|
if((!!countF)&&(typeof countF =='function')){
|
||||||
countF(count);
|
countF(count);
|
||||||
|
@ -47,7 +50,7 @@ async function generateImages(text,requestId,countF){
|
||||||
await sleep(3000);
|
await sleep(3000);
|
||||||
let imgPageHtml;
|
let imgPageHtml;
|
||||||
try{
|
try{
|
||||||
imgPageHtml = (await (await fetch(imgPageHtmlUrl)).text());
|
imgPageHtml = (await (await fetch(imgPageHtmlUrl,options)).text());
|
||||||
}catch(e){
|
}catch(e){
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,25 +3,65 @@ export default {
|
||||||
let url = req.url;
|
let url = req.url;
|
||||||
let iSlash = url.indexOf('/',11);
|
let iSlash = url.indexOf('/',11);
|
||||||
let nUrl = url.substring(iSlash+1);
|
let nUrl = url.substring(iSlash+1);
|
||||||
return goUrl(req, nUrl);
|
if(nUrl.startsWith("ws"))
|
||||||
|
return await websocketHandler(req, nUrl);
|
||||||
|
return await goUrl(req, nUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function goUrl(request, url) {
|
async function goUrl(request, url) {
|
||||||
let fp = {
|
let fp = {
|
||||||
method: request.method,
|
method: request.method,
|
||||||
headers: {}
|
};
|
||||||
|
fp.headers = new Headers(request.headers);
|
||||||
|
for(var i = 2; i < arguments.length-1; i=i+2){
|
||||||
|
fp.headers[arguments[i]] = arguments[i+1];
|
||||||
}
|
}
|
||||||
let reqHeaders = new Headers(request.headers);
|
return await fetch(url, fp);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function handleSession(req, serverWebSocket, url) {
|
||||||
|
let isAccept = false;
|
||||||
|
//let ws = new WebSocket(url);
|
||||||
|
let resp = await goUrl(req, url);
|
||||||
|
let ws = resp.webSocket;
|
||||||
|
if (!ws) {
|
||||||
|
throw new Error("server didn't accept WebSocket");
|
||||||
|
}
|
||||||
|
ws.accept();
|
||||||
|
|
||||||
|
serverWebSocket.addEventListener("message", event => {
|
||||||
|
ws.send(event.data);
|
||||||
|
});
|
||||||
|
ws.addEventListener("message", event => {
|
||||||
|
serverWebSocket.send(event.data)
|
||||||
|
});
|
||||||
|
ws.addEventListener("open", event => {
|
||||||
|
isAccept = true;
|
||||||
|
serverWebSocket.accept();
|
||||||
|
})
|
||||||
|
ws.addEventListener("close", event => {
|
||||||
|
serverWebSocket.close(event.code, event.reason);
|
||||||
|
})
|
||||||
|
ws.addEventListener("error", event => {
|
||||||
|
if(!isAccept){
|
||||||
|
serverWebSocket.accept();
|
||||||
|
}
|
||||||
|
serverWebSocket.close();
|
||||||
|
});
|
||||||
|
serverWebSocket.addEventListener("error", event => {
|
||||||
|
serverWebSocket.close();
|
||||||
|
})
|
||||||
|
serverWebSocket.addEventListener("close",event => {
|
||||||
|
ws.close(event.code, event.reason);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function websocketHandler(req, url){
|
||||||
|
const [client, server] = Object.values(new WebSocketPair())
|
||||||
|
await handleSession(req, server, url);
|
||||||
|
return new Response(null, {
|
||||||
|
status: 101,
|
||||||
|
webSocket: client
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -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-05-23T16:42:12+08:00</lastmod>
|
<lastmod>2023-05-25T14:58:48+08:00</lastmod>
|
||||||
<xhtml:link
|
<xhtml:link
|
||||||
rel="alternate"
|
rel="alternate"
|
||||||
hreflang="zh"
|
hreflang="zh"
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
/>
|
/>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>/en/tags/</loc>
|
<loc>/en/tags/</loc>
|
||||||
<lastmod>2023-05-23T16:42:12+08:00</lastmod>
|
<lastmod>2023-05-25T14:58:48+08:00</lastmod>
|
||||||
<xhtml:link
|
<xhtml:link
|
||||||
rel="alternate"
|
rel="alternate"
|
||||||
hreflang="zh"
|
hreflang="zh"
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
/>
|
/>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>/en/</loc>
|
<loc>/en/</loc>
|
||||||
<lastmod>2023-05-23T16:42:12+08:00</lastmod>
|
<lastmod>2023-05-26T15:47:44+08:00</lastmod>
|
||||||
<xhtml:link
|
<xhtml:link
|
||||||
rel="alternate"
|
rel="alternate"
|
||||||
hreflang="zh"
|
hreflang="zh"
|
||||||
|
@ -113,7 +113,7 @@
|
||||||
/>
|
/>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>/en/topposts/</loc>
|
<loc>/en/topposts/</loc>
|
||||||
<lastmod>2023-05-23T16:21:17+08:00</lastmod>
|
<lastmod>2023-05-26T15:47:44+08:00</lastmod>
|
||||||
<xhtml:link
|
<xhtml:link
|
||||||
rel="alternate"
|
rel="alternate"
|
||||||
hreflang="zh"
|
hreflang="zh"
|
||||||
|
@ -210,7 +210,7 @@
|
||||||
/>
|
/>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>/en/changelog/</loc>
|
<loc>/en/changelog/</loc>
|
||||||
<lastmod>2023-05-23T16:21:17+08:00</lastmod>
|
<lastmod>2023-05-26T15:47:44+08:00</lastmod>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>/en/sitemap/</loc>
|
<loc>/en/sitemap/</loc>
|
||||||
<lastmod>2023-02-01T09:52:11+08:00</lastmod>
|
<lastmod>2023-02-01T09:52:11+08:00</lastmod>
|
||||||
|
@ -304,10 +304,10 @@
|
||||||
/>
|
/>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>/en/tags/clipboard/</loc>
|
<loc>/en/tags/clipboard/</loc>
|
||||||
<lastmod>2023-05-23T16:42:12+08:00</lastmod>
|
<lastmod>2023-05-25T14:58:48+08:00</lastmod>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>/en/tags/pc/</loc>
|
<loc>/en/tags/pc/</loc>
|
||||||
<lastmod>2023-05-23T16:42:12+08:00</lastmod>
|
<lastmod>2023-05-25T14:58:48+08:00</lastmod>
|
||||||
<xhtml:link
|
<xhtml:link
|
||||||
rel="alternate"
|
rel="alternate"
|
||||||
hreflang="zh"
|
hreflang="zh"
|
||||||
|
@ -320,7 +320,7 @@
|
||||||
/>
|
/>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>/en/tags/ssh/</loc>
|
<loc>/en/tags/ssh/</loc>
|
||||||
<lastmod>2023-05-23T16:42:12+08:00</lastmod>
|
<lastmod>2023-05-25T14:58:48+08:00</lastmod>
|
||||||
<xhtml:link
|
<xhtml:link
|
||||||
rel="alternate"
|
rel="alternate"
|
||||||
hreflang="zh"
|
hreflang="zh"
|
||||||
|
@ -333,7 +333,7 @@
|
||||||
/>
|
/>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>/en/tags/termux/</loc>
|
<loc>/en/tags/termux/</loc>
|
||||||
<lastmod>2023-05-23T16:42:12+08:00</lastmod>
|
<lastmod>2023-05-25T14:58:48+08:00</lastmod>
|
||||||
<xhtml:link
|
<xhtml:link
|
||||||
rel="alternate"
|
rel="alternate"
|
||||||
hreflang="zh"
|
hreflang="zh"
|
||||||
|
@ -346,7 +346,7 @@
|
||||||
/>
|
/>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>/en/pccopy/</loc>
|
<loc>/en/pccopy/</loc>
|
||||||
<lastmod>2023-05-23T16:42:12+08:00</lastmod>
|
<lastmod>2023-05-25T14:58:48+08:00</lastmod>
|
||||||
<xhtml:link
|
<xhtml:link
|
||||||
rel="alternate"
|
rel="alternate"
|
||||||
hreflang="zh"
|
hreflang="zh"
|
||||||
|
@ -359,7 +359,7 @@
|
||||||
/>
|
/>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>/en/tags/windows/</loc>
|
<loc>/en/tags/windows/</loc>
|
||||||
<lastmod>2023-05-23T16:42:12+08:00</lastmod>
|
<lastmod>2023-05-25T14:58:48+08:00</lastmod>
|
||||||
<xhtml:link
|
<xhtml:link
|
||||||
rel="alternate"
|
rel="alternate"
|
||||||
hreflang="zh"
|
hreflang="zh"
|
||||||
|
|
|
@ -63,7 +63,7 @@ uweb, termux &amp; history versions
|
||||||
github
|
github
|
||||||
sourceforge
|
sourceforge
|
||||||
powerfolder
|
powerfolder
|
||||||
pcloud
|
udrop
|
||||||
pagure
|
pagure
|
||||||
Main features Change logs 1004: bookmarklet &quot;Show as html&quot; to support clipboard site &quot;netcut.cn&quot;.
|
Main features Change logs 1004: bookmarklet &quot;Show as html&quot; to support clipboard site &quot;netcut.cn&quot;.
|
||||||
998: Bookmarklets to support CSP sites.
|
998: Bookmarklets to support CSP sites.
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<sitemap>
|
<sitemap>
|
||||||
<loc>en/sitemap.xml</loc>
|
<loc>en/sitemap.xml</loc>
|
||||||
|
|
||||||
<lastmod>2023-05-23T16:42:12+08:00</lastmod>
|
<lastmod>2023-05-26T15:47:44+08:00</lastmod>
|
||||||
|
|
||||||
</sitemap>
|
</sitemap>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue