mirror of
https://github.com/torappinfo/uweb.git
synced 2024-08-14 23:54:59 +00:00
Compare commits
No commits in common. "093a4ef3ffc605d25bdf5d3e6cdb10aa2a65358f" and "5e3172ece0b676867b629cd37ab61477ee244eb0" have entirely different histories.
093a4ef3ff
...
5e3172ece0
4 changed files with 13 additions and 44 deletions
|
@ -56,7 +56,6 @@ You should have received a copy of the GNU General Public License along with thi
|
|||
}
|
||||
</style>
|
||||
<script>
|
||||
const { ipcRenderer } = require('electron');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const readline = require('readline');
|
||||
|
@ -353,7 +352,7 @@ You should have received a copy of the GNU General Public License along with thi
|
|||
return se.replace('%s',query);
|
||||
}
|
||||
function coloncommand(q){
|
||||
ipcRenderer.send("command",q);
|
||||
document.title = q;
|
||||
}
|
||||
function coloncommand_render(cmd){
|
||||
args = cmd.substring(1).split(/\s+/);
|
||||
|
@ -454,7 +453,6 @@ You should have received a copy of the GNU General Public License along with thi
|
|||
function handleQuery(q){
|
||||
if(q.length>1){
|
||||
let c0=q.charCodeAt(0);
|
||||
let c1=q.charCodeAt(1);
|
||||
switch(c0){
|
||||
case 33://"!"
|
||||
bangcommand(q);
|
||||
|
@ -464,6 +462,7 @@ You should have received a copy of the GNU General Public License along with thi
|
|||
tabs.children[iTab].findInPage(q.substring(1));
|
||||
return;
|
||||
case 58://':'
|
||||
let c1=q.charCodeAt(1);
|
||||
if(c1>98 && 112!=c1)
|
||||
coloncommand(q);
|
||||
else
|
||||
|
@ -471,18 +470,16 @@ You should have received a copy of the GNU General Public License along with thi
|
|||
recQueryHistory(q);
|
||||
return;
|
||||
}
|
||||
if(58===c1){
|
||||
console.log(q)
|
||||
internalLink(q);
|
||||
return;
|
||||
}
|
||||
}
|
||||
var url=q;
|
||||
NOREC: do{
|
||||
do {
|
||||
if(q.length>12){
|
||||
let c6 = q.charCodeAt(6);
|
||||
if(47===c6){// '/'
|
||||
if(58===q.charCodeAt(1)){
|
||||
internalLink(q);
|
||||
return;
|
||||
}else if(47===c6){// '/'
|
||||
let c5 = q.charCodeAt(5);
|
||||
if(47===c5 && 58===q.charCodeAt(4))//http/file urls
|
||||
break NOREC;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{"version":"1.0.53",
|
||||
{"version":"1.0.51",
|
||||
"name": "ebrowser",
|
||||
"description": "The keyboard-friendly minimal suckless web browser",
|
||||
"main": "webview.js",
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
"gt":"https://kkgithub.com/search?type=Repositories&q=%s",
|
||||
"360":"https://so.360.com/s?q=%s",
|
||||
"tg":"https://www.tiangong.cn/result?q=%s",
|
||||
"cg":"i:0/js/s2ta.js:https://chatglm.cn/main/detail?%s",
|
||||
"s100":"i:0/js/s2input.js:https://www.sou100.com/?%s",
|
||||
"csdn":"i:0/js/s2ta.js:https://chat.csdn.net?%s",
|
||||
"bdc":"i:0/js/s2editable.js:https://chat.baidu.com/?%s",
|
||||
"miku":"i:0/js/s2ta.js:https://www.hellomiku.com?%s",
|
||||
"cg":"i:0/js/hash2textarea.js:https://chatglm.cn/main/detail#%s",
|
||||
"s100":"i:0/js/hash2input.js:https://www.sou100.com/#%s",
|
||||
"csdn":"i:0/js/hash2textarea.js:https://chat.csdn.net#%s",
|
||||
"bdc":"i:0/js/hash2editable.js:https://chat.baidu.com/#%s",
|
||||
"miku":"i:0/js/hash2textarea.js:https://www.hellomiku.com#%s",
|
||||
"bd":"https://baidu.com/s?wd=%s"
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ You should have received a copy of the GNU General Public License along with thi
|
|||
*/
|
||||
const {
|
||||
app, BrowserWindow, Menu, shell, clipboard,
|
||||
session, protocol, net, dialog, ipcMain
|
||||
session, protocol, net, dialog
|
||||
} = require('electron')
|
||||
let win;
|
||||
|
||||
|
@ -184,10 +184,6 @@ app.on ('web-contents-created', (event, contents) => {
|
|||
}
|
||||
});
|
||||
|
||||
ipcMain.on('command', (event, cmd) => {
|
||||
addrCommand(cmd);
|
||||
});
|
||||
|
||||
function addrCommand(cmd){
|
||||
if(cmd.length<3) return;
|
||||
let c0 = cmd.charCodeAt(0);
|
||||
|
@ -681,27 +677,3 @@ function translate(str){
|
|||
if(translateRes && (result=translateRes[str])) return result;
|
||||
return str;
|
||||
}
|
||||
|
||||
async function jsonAppend(filePath, charcode, str){
|
||||
try{
|
||||
const fd = await fs.promises.open(filePath, 'r+');
|
||||
const stats = await fd.stat();
|
||||
const fileSize = stats.size;
|
||||
const buffer = Buffer.alloc(1);
|
||||
let position = fileSize-1;
|
||||
while (position >= 0) {
|
||||
await fd.read(buffer, 0, 1, position);
|
||||
if (buffer[0] === charcode) break;
|
||||
}
|
||||
let endS = String.fromCharCode(charcode);
|
||||
if(position<0){//re-write whole file
|
||||
str = String.fromCharCode(charcode-2)+str+endS;
|
||||
position = 0;
|
||||
}else
|
||||
str = ","+str+endS;
|
||||
await fd.truncate(position);
|
||||
const buf = Buffer.from(str);
|
||||
await fd.write(buf, 0, buf.length, position);
|
||||
await fd.close();
|
||||
}catch(e){console.log(e)}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue