add udrop

This commit is contained in:
James Feng Cao 2023-05-26 15:48:51 +08:00
parent f536c6eb78
commit d43d3e3dfc
9 changed files with 80 additions and 37 deletions

View file

@ -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>

View file

@ -208,7 +208,7 @@ uweb, termux &amp;amp; history versions
github github
sourceforge sourceforge
powerfolder powerfolder
pcloud udrop
pagure pagure
Main features Change logs 1004: bookmarklet &amp;quot;Show as html&amp;quot; to support clipboard site &amp;quot;netcut.cn&amp;quot;. Main features Change logs 1004: bookmarklet &amp;quot;Show as html&amp;quot; to support clipboard site &amp;quot;netcut.cn&amp;quot;.
998: Bookmarklets to support CSP sites. 998: Bookmarklets to support CSP sites.

View file

@ -57,7 +57,7 @@
</ul> </ul>
<p>Click the following links to install menus for long pressing the button &quot;link&quot;:<br> <p>Click the following links to install menus for long pressing the button &quot;link&quot;:<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 &quot;xsel&quot; available to operate on copy/paste.</p> PCs need command &quot;xsel&quot; 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>

View file

@ -168,7 +168,7 @@ class Chat {
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)
let restsrstUrl = URLTrue(this.magicUrl.replace('http', 'ws'), "sydney/ChatHub"); let restsrstUrl = this.magicUrl.replace('http', 'ws')+"sydney/ChatHub";
let chatWebSocket = new WebSocket(restsrstUrl); let chatWebSocket = new WebSocket(restsrstUrl);
chatWebSocket.onopen = () => { chatWebSocket.onopen = () => {

View file

@ -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('&amp;','&'); ur = ur.replaceAll('&amp;','&');
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);
} }

View file

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

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-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"

View file

@ -63,7 +63,7 @@ uweb, termux &amp;amp; history versions
github github
sourceforge sourceforge
powerfolder powerfolder
pcloud udrop
pagure pagure
Main features Change logs 1004: bookmarklet &amp;quot;Show as html&amp;quot; to support clipboard site &amp;quot;netcut.cn&amp;quot;. Main features Change logs 1004: bookmarklet &amp;quot;Show as html&amp;quot; to support clipboard site &amp;quot;netcut.cn&amp;quot;.
998: Bookmarklets to support CSP sites. 998: Bookmarklets to support CSP sites.

View file

@ -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>