update AI engines

This commit is contained in:
James Feng Cao 2024-07-09 11:57:26 +08:00
parent 7792c764b2
commit b2e9cd1d31
20 changed files with 107 additions and 79 deletions

View file

@ -531,14 +531,16 @@ You should have received a copy of the GNU General Public License along with thi
function internalLink(url){
let cmd = url.charCodeAt(2);
let subcmd = url.charCodeAt(3);
let iColon = url.indexOf(':',5);
let name = decodeURIComponent(url.slice(4,iColon));
let rurl = url.substring(iColon+1);
switch(cmd){
case 48://'0' i:0
switch(subcmd){
case 47://'/' i:0/
if(106===url.charCodeAt(4) && 115===url.charCodeAt(5) && 47===url.charCodeAt(6)){
//i:0/js/xx:[url]
let iColon = url.indexOf(':',7);
let fname = url.slice(4,iColon);
let fname = name;
let pname = path.join(__dirname,fname);
if(fs.existsSync(pname)){
(async ()=>{
@ -546,7 +548,7 @@ You should have received a copy of the GNU General Public License along with thi
let js = await fs.promises.readFile(pname,'utf8');
let t=tabs.children[iTab];
t.dataset.jsonce=js;
t.src = url.substring(iColon+1);
t.src = rurl;
}catch(e){}
})();
}
@ -554,7 +556,6 @@ You should have received a copy of the GNU General Public License along with thi
return;
case 48: //i:00
{
let iColon = url.indexOf(':',5);
let endS;
let is = url.indexOf('%s',iColon+1);
if(is<0)
@ -562,11 +563,19 @@ You should have received a copy of the GNU General Public License along with thi
else
endS = '"\n';
let pname = path.join(__dirname,"search.json");
let str = '"'+url.slice(4,iColon)+'":"'+url.substring(iColon+1)+
let str = '"'+name+'":"'+rurl+
endS;
jsonAppend(pname,125,str);
}
return;
case 49: //i:01
{
let pname = path.join(__dirname,"menu.json");
let str = '"'+name+'",":bjs handleQuery(`'+
rurl+'${tabs.children[iTab].getURL()}`)"\n';
jsonAppend(pname,93,str);
}
return;
default:
}
}