mirror of
https://github.com/torappinfo/uweb.git
synced 2024-08-14 23:54:59 +00:00
Compare commits
No commits in common. "070d64e7e232caf5b85c7e530ea3a1d695ad7024" and "5f2116943f57f22ef8b2486b9593b42ec6734431" have entirely different histories.
070d64e7e2
...
5f2116943f
13 changed files with 33 additions and 167 deletions
|
@ -56,7 +56,6 @@ Later on, you can run "npm install electron" to update electron/chromium or "npm
|
||||||
- storage: clear site storage data.
|
- storage: clear site storage data.
|
||||||
- {[options](https://www.electronjs.org/docs/latest/api/session#sescleardataoptions)}
|
- {[options](https://www.electronjs.org/docs/latest/api/session#sescleardataoptions)}
|
||||||
- ext [extension path]: load unpacked Chrome extension.
|
- ext [extension path]: load unpacked Chrome extension.
|
||||||
- gr [gredirect index]: global redirection with corresponding index. Use the first global redirection url if no argument. Disable global redirection with any index out of the range.
|
|
||||||
- nc/uc : No Cookie forwarding/Use Cookie forwarding with global redirection.
|
- nc/uc : No Cookie forwarding/Use Cookie forwarding with global redirection.
|
||||||
- nh/uh for No/Use url history.
|
- nh/uh for No/Use url history.
|
||||||
- nj/uj for No/Use external Javascript files.
|
- nj/uj for No/Use external Javascript files.
|
||||||
|
@ -64,16 +63,15 @@ Later on, you can run "npm install electron" to update electron/chromium or "npm
|
||||||
- np : no proxy.
|
- np : no proxy.
|
||||||
- up [proxyName] : use proxy. privous proxy or the first proxy in proxy.json w/o [proxyName]. ":up" command also disables global and domain redirections, which are not restored by ":np".
|
- up [proxyName] : use proxy. privous proxy or the first proxy in proxy.json w/o [proxyName]. ":up" command also disables global and domain redirections, which are not restored by ":np".
|
||||||
- ua [useragentName] : set user agent for future tabs. default user agent w/o arguments.
|
- ua [useragentName] : set user agent for future tabs. default user agent w/o arguments.
|
||||||
- update [updateurl] : update the app. updateurl is optional.
|
|
||||||
- pdf [filename w/o extension] {[options](https://www.electronjs.org/docs/latest/api/web-contents#contentsprinttopdfoptions)} : print to PDF file. All arguments are optional; empty option "{}" to capture long screenshot as vector graphics.
|
- pdf [filename w/o extension] {[options](https://www.electronjs.org/docs/latest/api/web-contents#contentsprinttopdfoptions)} : print to PDF file. All arguments are optional; empty option "{}" to capture long screenshot as vector graphics.
|
||||||
- "!" address bar commands
|
- "!" address bar commands
|
||||||
"!xx ..." evaluates "xx.js" with the whole address bar text as arguments[0].
|
"!xx ..." evaluates "xx.js" with the whole address bar text as arguments[0].
|
||||||
|
|
||||||
#### Commands in no-focus mode (this mode is similar to vi Normal mode)
|
#### Commands in no-focus mode (this mode is similar to vi Normal mode)
|
||||||
Pressing "ESC" to enter no-focus mode if not sure.
|
Pressing "ESC" to enter no-focus mode if not sure.
|
||||||
- ":" for address bar commands
|
- ":" for address bar commands
|
||||||
- "/" for find-in-page with address bar
|
- "/" for find-in-page with address bar
|
||||||
- "!" for "!" address bar commands
|
- "!" for ":!" address bar commands
|
||||||
|
|
||||||
The other commands are defined in "mapkeys.json", which will map keys to address bar commands.
|
The other commands are defined in "mapkeys.json", which will map keys to address bar commands.
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,6 @@ npm install ebrowser
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>ext [extension path]: load unpacked Chrome extension.</li>
|
<li>ext [extension path]: load unpacked Chrome extension.</li>
|
||||||
<li>gr [gredirect index]: global redirection with corresponding index. Use the first global redirection url if no argument. Disable global redirection with any index out of the range.</li>
|
|
||||||
<li>nc/uc : No Cookie forwarding/Use Cookie forwarding with global redirection.</li>
|
<li>nc/uc : No Cookie forwarding/Use Cookie forwarding with global redirection.</li>
|
||||||
<li>nh/uh for No/Use url history.</li>
|
<li>nh/uh for No/Use url history.</li>
|
||||||
<li>nj/uj for No/Use external Javascript files.</li>
|
<li>nj/uj for No/Use external Javascript files.</li>
|
||||||
|
@ -110,7 +109,6 @@ npm install ebrowser
|
||||||
<li>np : no proxy.</li>
|
<li>np : no proxy.</li>
|
||||||
<li>up [proxyName] : use proxy. privous proxy or the first proxy in proxy.json w/o [proxyName]. ":up" command also disables global and domain redirections, which are not restored by ":np".</li>
|
<li>up [proxyName] : use proxy. privous proxy or the first proxy in proxy.json w/o [proxyName]. ":up" command also disables global and domain redirections, which are not restored by ":np".</li>
|
||||||
<li>ua [useragentName] : set user agent for future tabs. default user agent w/o arguments.</li>
|
<li>ua [useragentName] : set user agent for future tabs. default user agent w/o arguments.</li>
|
||||||
<li>update [updateurl] : update the app. updateurl is optional.</li>
|
|
||||||
<li>pdf [filename w/o extension] {<a href="https://www.electronjs.org/docs/latest/api/web-contents#contentsprinttopdfoptions">options</a>} : print to PDF file. All arguments are optional; empty option "{}" to capture long screenshot as vector graphics.</li>
|
<li>pdf [filename w/o extension] {<a href="https://www.electronjs.org/docs/latest/api/web-contents#contentsprinttopdfoptions">options</a>} : print to PDF file. All arguments are optional; empty option "{}" to capture long screenshot as vector graphics.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
@ -122,7 +120,7 @@ npm install ebrowser
|
||||||
<ul>
|
<ul>
|
||||||
<li>":" for address bar commands</li>
|
<li>":" for address bar commands</li>
|
||||||
<li>"/" for find-in-page with address bar</li>
|
<li>"/" for find-in-page with address bar</li>
|
||||||
<li>"!" for "!" address bar commands</li>
|
<li>"!" for ":!" address bar commands</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>The other commands are defined in "mapkeys.json", which will map keys to address bar commands.</p>
|
<p>The other commands are defined in "mapkeys.json", which will map keys to address bar commands.</p>
|
||||||
<h4 id="configuration-files">Configuration files</h4>
|
<h4 id="configuration-files">Configuration files</h4>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<description>Recent content on uweb browser: unlimited power</description>
|
<description>Recent content on uweb browser: unlimited power</description>
|
||||||
<generator>Hugo</generator>
|
<generator>Hugo</generator>
|
||||||
<language>en</language>
|
<language>en</language>
|
||||||
<lastBuildDate>Tue, 18 Jun 2024 23:24:23 +0800</lastBuildDate>
|
<lastBuildDate>Tue, 18 Jun 2024 11:13:22 +0800</lastBuildDate>
|
||||||
<atom:link href="/en/index.xml" rel="self" type="application/rss+xml" />
|
<atom:link href="/en/index.xml" rel="self" type="application/rss+xml" />
|
||||||
<item>
|
<item>
|
||||||
<title>Text selection/processing</title>
|
<title>Text selection/processing</title>
|
||||||
|
@ -223,7 +223,7 @@
|
||||||
<link>/en/mirrors/</link>
|
<link>/en/mirrors/</link>
|
||||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||||
<guid>/en/mirrors/</guid>
|
<guid>/en/mirrors/</guid>
|
||||||
<description>Mirrors (for version 1040+) gitee
gitcode
gitcode
gitea
notabug
launchpad
framagit
agit
froggi
disroot
gitdab
pagure
bitbucket
jsdelivr
dagshub
gitgud
gitly
gitnet
palemoon
tilde
dotclear
mimetest
chapril
cryto
antopie
bgithub
Mirrors (for all versions) 试验1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 gitly gitnet palemoon tilde dotclear minetest chapril cryto antopie Repositories gitlab
sourceforge
github
bitbucket
codeberg
gitee</description>
|
<description>Mirrors (for version 1040+) gitee
gitcode
gitcode
gitea
notabug
launchpad
framagit
agit
froggi
disroot
gitdab
pagure
bitbucket
jsdelivr
dagshub
gitgud
gitly
gitnet
palemoon
tilde
dotclear
mimetest
chapril
cryto
antopie
bgithub
nuaa
yzuu
Mirrors (for all versions) 试验1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 gitly gitnet palemoon tilde dotclear minetest chapril cryto antopie Repositories gitlab
sourceforge
github
bitbucket</description>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<title></title>
|
<title></title>
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
[cryto](https://git.cryto.net/jamesfengcao/uweb/raw/branch/master/redirect.html#)
|
[cryto](https://git.cryto.net/jamesfengcao/uweb/raw/branch/master/redirect.html#)
|
||||||
[antopie](https://code.antopie.org/jamesfengcao/uweb/raw/branch/master/redirect.html#)
|
[antopie](https://code.antopie.org/jamesfengcao/uweb/raw/branch/master/redirect.html#)
|
||||||
[bgithub](https://bgithub.xyz/torappinfo/uweb/raw/master/redirect.html#)
|
[bgithub](https://bgithub.xyz/torappinfo/uweb/raw/master/redirect.html#)
|
||||||
|
[nuaa](https://hub.nuaa.cf/torappinfo/uweb/raw/master/redirect.html#)
|
||||||
|
[yzuu](https://hub.yzuu.cf/torappinfo/uweb/raw/master/redirect.html#)
|
||||||
|
|
||||||
#### Mirrors (for all versions)
|
#### Mirrors (for all versions)
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -70,7 +70,9 @@
|
||||||
<a href="https://forge.chapril.org/jamesfengcao/uweb/raw/branch/master/redirect.html#">chapril</a><br>
|
<a href="https://forge.chapril.org/jamesfengcao/uweb/raw/branch/master/redirect.html#">chapril</a><br>
|
||||||
<a href="https://git.cryto.net/jamesfengcao/uweb/raw/branch/master/redirect.html#">cryto</a><br>
|
<a href="https://git.cryto.net/jamesfengcao/uweb/raw/branch/master/redirect.html#">cryto</a><br>
|
||||||
<a href="https://code.antopie.org/jamesfengcao/uweb/raw/branch/master/redirect.html#">antopie</a><br>
|
<a href="https://code.antopie.org/jamesfengcao/uweb/raw/branch/master/redirect.html#">antopie</a><br>
|
||||||
<a href="https://bgithub.xyz/torappinfo/uweb/raw/master/redirect.html#">bgithub</a></p>
|
<a href="https://bgithub.xyz/torappinfo/uweb/raw/master/redirect.html#">bgithub</a><br>
|
||||||
|
<a href="https://hub.nuaa.cf/torappinfo/uweb/raw/master/redirect.html#">nuaa</a><br>
|
||||||
|
<a href="https://hub.yzuu.cf/torappinfo/uweb/raw/master/redirect.html#">yzuu</a></p>
|
||||||
<h4 id="mirrors-for-all-versions">Mirrors (for all versions)</h4>
|
<h4 id="mirrors-for-all-versions">Mirrors (for all versions)</h4>
|
||||||
<p>
|
<p>
|
||||||
<a href="i:0mi:5h:https://gitee.com/jamesfengcao/uweb/raw/master/redirect.html">试验1</a>
|
<a href="i:0mi:5h:https://gitee.com/jamesfengcao/uweb/raw/master/redirect.html">试验1</a>
|
||||||
|
@ -133,8 +135,8 @@
|
||||||
<a href="https://code.antopie.org/jamesfengcao/uweb/src/master/README.md">antopie</a></p>
|
<a href="https://code.antopie.org/jamesfengcao/uweb/src/master/README.md">antopie</a></p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<p>Last Modified: 18 June 2024<br>
|
<p>Last Modified: 6 April 2024<br>
|
||||||
update mirrors<br>
|
more details on global redirection url<br>
|
||||||
<pre></pre>
|
<pre></pre>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<p>Last Modified: 18 June 2024<br>
|
<p>Last Modified: 18 June 2024<br>
|
||||||
update mirrors<br>
|
use adaptable ebrowser links<br>
|
||||||
<pre></pre>
|
<pre></pre>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<p>Last Modified: 18 June 2024<br>
|
<p>Last Modified: 18 June 2024<br>
|
||||||
update mirrors<br>
|
fix typos<br>
|
||||||
<pre></pre>
|
<pre></pre>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
/>
|
/>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>/en/</loc>
|
<loc>/en/</loc>
|
||||||
<lastmod>2024-06-18T23:24:23+08:00</lastmod>
|
<lastmod>2024-06-18T11:13:22+08:00</lastmod>
|
||||||
<xhtml:link
|
<xhtml:link
|
||||||
rel="alternate"
|
rel="alternate"
|
||||||
hreflang="zh"
|
hreflang="zh"
|
||||||
|
@ -508,10 +508,10 @@
|
||||||
/>
|
/>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>/en/ebrowserreadme/</loc>
|
<loc>/en/ebrowserreadme/</loc>
|
||||||
<lastmod>2024-06-18T23:24:23+08:00</lastmod>
|
<lastmod>2024-06-18T10:22:59+08:00</lastmod>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>/en/mirrors/</loc>
|
<loc>/en/mirrors/</loc>
|
||||||
<lastmod>2024-06-18T23:17:17+08:00</lastmod>
|
<lastmod>2024-04-06T10:20:49+08:00</lastmod>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>/en/readme/</loc>
|
<loc>/en/readme/</loc>
|
||||||
<lastmod>2024-06-18T11:13:22+08:00</lastmod>
|
<lastmod>2024-06-18T11:13:22+08:00</lastmod>
|
||||||
|
@ -539,7 +539,7 @@
|
||||||
/>
|
/>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>/en/unlist/</loc>
|
<loc>/en/unlist/</loc>
|
||||||
<lastmod>2024-06-18T23:24:23+08:00</lastmod>
|
<lastmod>2024-06-18T11:13:22+08:00</lastmod>
|
||||||
<xhtml:link
|
<xhtml:link
|
||||||
rel="alternate"
|
rel="alternate"
|
||||||
hreflang="zh"
|
hreflang="zh"
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<link>/en/mirrors/</link>
|
<link>/en/mirrors/</link>
|
||||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||||
<guid>/en/mirrors/</guid>
|
<guid>/en/mirrors/</guid>
|
||||||
<description>Mirrors (for version 1040+) gitee
gitcode
gitcode
gitea
notabug
launchpad
framagit
agit
froggi
disroot
gitdab
pagure
bitbucket
jsdelivr
dagshub
gitgud
gitly
gitnet
palemoon
tilde
dotclear
mimetest
chapril
cryto
antopie
bgithub
Mirrors (for all versions) 试验1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 gitly gitnet palemoon tilde dotclear minetest chapril cryto antopie Repositories gitlab
sourceforge
github
bitbucket
codeberg
gitee</description>
|
<description>Mirrors (for version 1040+) gitee
gitcode
gitcode
gitea
notabug
launchpad
framagit
agit
froggi
disroot
gitdab
pagure
bitbucket
jsdelivr
dagshub
gitgud
gitly
gitnet
palemoon
tilde
dotclear
mimetest
chapril
cryto
antopie
bgithub
nuaa
yzuu
Mirrors (for all versions) 试验1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 gitly gitnet palemoon tilde dotclear minetest chapril cryto antopie Repositories gitlab
sourceforge
github
bitbucket</description>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<title></title>
|
<title></title>
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
{"version":"1.0.21",
|
|
||||||
"name": "ebrowser",
|
|
||||||
"description": "The keyboard-friendly minimal suckless web browser",
|
|
||||||
"main": "webview.js",
|
|
||||||
"scripts": {
|
|
||||||
"release": "electron-builder"
|
|
||||||
},
|
|
||||||
"author": "Richard H. Cao",
|
|
||||||
"keywords": ["browser","minimal","suckless","command line","vim key map","user scripts"],
|
|
||||||
"license": "GPL-3.0",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/torappinfo/ebrowser.git"
|
|
||||||
},
|
|
||||||
"build": {
|
|
||||||
"appId": "torapp.eweb",
|
|
||||||
"publish": "github",
|
|
||||||
"asar": false,
|
|
||||||
"files": [
|
|
||||||
"webview.js",
|
|
||||||
"index.html",
|
|
||||||
"package.json",
|
|
||||||
"README.md"
|
|
||||||
],
|
|
||||||
"directories": {
|
|
||||||
"output": "release"
|
|
||||||
},
|
|
||||||
"dmg": {
|
|
||||||
"contents": [
|
|
||||||
{ "x": 110, "y": 150 },
|
|
||||||
{ "x": 240, "y": 150, "type": "link", "path": "/Applications" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"nsis": {
|
|
||||||
"createDesktopShortcut": "always"
|
|
||||||
},
|
|
||||||
"linux": {
|
|
||||||
"target": "AppImage"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"electron":"",
|
|
||||||
"electron-builder": ""
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -177,17 +177,6 @@ function addrCommand(cmd){
|
||||||
case "ext":
|
case "ext":
|
||||||
session.defaultSession.loadExtension(args[1]);
|
session.defaultSession.loadExtension(args[1]);
|
||||||
return;
|
return;
|
||||||
case "gr":
|
|
||||||
if(args.length<2) {
|
|
||||||
gredirect_enable(0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let i = parseInt(args[1]);
|
|
||||||
if(i>=0 && i<gredirects.length)
|
|
||||||
gredirect_enable(i);
|
|
||||||
else
|
|
||||||
gredirect_disable();
|
|
||||||
return;
|
|
||||||
case "nc":
|
case "nc":
|
||||||
bForwardCookie = false;
|
bForwardCookie = false;
|
||||||
msgbox_info("Cookie forwarding disabled");
|
msgbox_info("Cookie forwarding disabled");
|
||||||
|
@ -215,7 +204,11 @@ function addrCommand(cmd){
|
||||||
if(args.length>1)
|
if(args.length>1)
|
||||||
proxy = proxies[args[1]]; //retrieve proxy
|
proxy = proxies[args[1]]; //retrieve proxy
|
||||||
if(proxy){
|
if(proxy){
|
||||||
gredirect_disable();
|
if(gredirect){
|
||||||
|
gredirect=null;
|
||||||
|
unregisterHandler();
|
||||||
|
}
|
||||||
|
bRedirect = false;
|
||||||
session.defaultSession.setProxy(proxy);
|
session.defaultSession.setProxy(proxy);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -229,33 +222,10 @@ function addrCommand(cmd){
|
||||||
else
|
else
|
||||||
session.defaultSession.setUserAgent(defaultUA);
|
session.defaultSession.setUserAgent(defaultUA);
|
||||||
return;
|
return;
|
||||||
case "update":
|
|
||||||
let updateurl;
|
|
||||||
if(1==args.length)
|
|
||||||
updateurl = "https://gitlab.com/jamesfengcao/uweb/-/raw/master/misc/ebrowser/";
|
|
||||||
else {
|
|
||||||
updateurl = args[1];
|
|
||||||
if(!updateurl.endsWith("/")) updateurl = updateurl +"/";
|
|
||||||
}
|
|
||||||
updateApp(updateurl);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function gredirect_disable(){
|
|
||||||
if(gredirect){
|
|
||||||
gredirect=null;
|
|
||||||
unregisterHandler();
|
|
||||||
}
|
|
||||||
bRedirect = false;
|
|
||||||
}
|
|
||||||
function gredirect_enable(i){
|
|
||||||
if(i>=gredirects.length) return;
|
|
||||||
if(!gredirect) registerHandler();
|
|
||||||
gredirect=gredirects[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
function cbConsoleMsg(e, level, msg, line, sourceid){
|
function cbConsoleMsg(e, level, msg, line, sourceid){
|
||||||
console.log(line);
|
console.log(line);
|
||||||
console.log(sourceid);
|
console.log(sourceid);
|
||||||
|
@ -385,10 +355,15 @@ function topMenu(){
|
||||||
win.webContents.executeJavaScript(js,false);
|
win.webContents.executeJavaScript(js,false);
|
||||||
}},
|
}},
|
||||||
{ label: 'No redirect', accelerator: 'Ctrl+R', click: ()=>{
|
{ label: 'No redirect', accelerator: 'Ctrl+R', click: ()=>{
|
||||||
gredirect_disable();
|
if(gredirect){
|
||||||
|
gredirect=null;
|
||||||
|
unregisterHandler();
|
||||||
|
}
|
||||||
}},
|
}},
|
||||||
{ label: 'Redirect', accelerator: 'Ctrl+Shift+R', click: ()=>{
|
{ label: 'Redirect', accelerator: 'Ctrl+Shift+R', click: ()=>{
|
||||||
gredirect_enable(0);
|
if(0==gredirects.length) return;
|
||||||
|
if(!gredirect) registerHandler();
|
||||||
|
gredirect=gredirects[0];
|
||||||
}},
|
}},
|
||||||
{ label: 'Close', accelerator: 'Ctrl+W', click: ()=>{
|
{ label: 'Close', accelerator: 'Ctrl+W', click: ()=>{
|
||||||
win.webContents.executeJavaScript("tabClose()",false).then((r)=>{
|
win.webContents.executeJavaScript("tabClose()",false).then((r)=>{
|
||||||
|
@ -518,66 +493,4 @@ function msgbox_info(msg){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateApp(url){//url must ending with "/"
|
|
||||||
let msg;
|
|
||||||
do {
|
|
||||||
try {
|
|
||||||
let res = await fetch(url+"package.json");
|
|
||||||
let packageS = await res.text();
|
|
||||||
let nLatestVer;
|
|
||||||
//the last part of version string is the version number, must keep increasing
|
|
||||||
{
|
|
||||||
let head = packageS.slice(2,40);
|
|
||||||
let iV = head.indexOf("version");
|
|
||||||
if(iV<0) {
|
|
||||||
msg = "remote package.json corrupted"
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
iV = iV + 11;
|
|
||||||
let iE = head.indexOf('"',iV+4);
|
|
||||||
let iS = head.lastIndexOf('.',iE-1);
|
|
||||||
nLatestVer = parseInt(head.substring(iS+1,iE));
|
|
||||||
}
|
|
||||||
let nVer;
|
|
||||||
{
|
|
||||||
let ver = app.getVersion();
|
|
||||||
let iS = ver.lastIndexOf('.');
|
|
||||||
nVer = parseInt(ver.substring(iS+1));
|
|
||||||
}
|
|
||||||
if(nVer>=nLatestVer){
|
|
||||||
msg = "Already up to date";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
writeFile("package.json", packageS);
|
|
||||||
|
|
||||||
fetch2file(url,"webview.js");
|
|
||||||
fetch2file(url,"index.html");
|
|
||||||
|
|
||||||
msg = "Update completed";
|
|
||||||
}catch(e){
|
|
||||||
msg = "Fail to update"
|
|
||||||
}
|
|
||||||
}while(false);
|
|
||||||
dialog.showMessageBoxSync(null, {
|
|
||||||
type: 'info',
|
|
||||||
title: msg,
|
|
||||||
message: msg,
|
|
||||||
buttons: ['OK']
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function fetch2file(urlFolder, filename){
|
|
||||||
let res = await fetch(urlFolder+filename);
|
|
||||||
let str = await res.text();
|
|
||||||
writeFile(filename, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function writeFile(filename, str){
|
|
||||||
let pathname=path.join(__dirname,filename+".new");
|
|
||||||
fs.writeFile(pathname, str, (err) => {
|
|
||||||
if(err) throw "Fail to write";
|
|
||||||
fs.rename(pathname,path.join(__dirname,filename),(e1)=>{
|
|
||||||
if(e1) throw "Fail to rename";
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<sitemap>
|
<sitemap>
|
||||||
<loc>/en/sitemap.xml</loc>
|
<loc>/en/sitemap.xml</loc>
|
||||||
|
|
||||||
<lastmod>2024-06-18T23:24:23+08:00</lastmod>
|
<lastmod>2024-06-18T11:13:22+08:00</lastmod>
|
||||||
|
|
||||||
</sitemap>
|
</sitemap>
|
||||||
|
|
||||||
|
|
|
@ -326,7 +326,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<p>Last Modified: 18 June 2024<br>
|
<p>Last Modified: 18 June 2024<br>
|
||||||
update mirrors<br>
|
add more AI search engines<br>
|
||||||
<pre>24.02.26 添加网盘搜索引擎
|
<pre>24.02.26 添加网盘搜索引擎
|
||||||
</pre>
|
</pre>
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Reference in a new issue