好友
阅读权限20
听众
最后登录1970-1-1
|
楼主|
善良的果仁
发表于 2023-9-1 09:59
main.aardio
[JavaScript] 纯文本查看 复制代码 import win.ui;
import inet.http;
import inet.httpFile;
import web.rest.client;
import web.json;
import fsys.ini
import thread.event;
import process;
import win.ui.simpleWindow;
import thread.command;
var UpdatePackageUrl = '';
var UpdateDescriptionUrl = '';
var filename = '';
var wjnum = 0;
var $ini = fsys.ini("/updata.ini")
var version = $ini.read("version","num");
var mainpath = $ini.read("set","mainpath");
var url = $ini.read("lanzouyun","url");
var pwd = $ini.read("lanzouyun","pwd");
var logopath = $ini.read("set","logopath");
if(version==null or mainpath==null or url==null or pwd==null ){
if( ! win.loadForm("\dlg\ck.aardio").doModal() ){
return;
}
}
/*DSG{{*/
mainForm = win.form(text="更新";right=499;bottom=339;border="none")
mainForm.add(
bk={cls="bk";left=-5;top=0;right=505;bottom=29;dl=1;dr=1;dt=1;z=2};
button={cls="button";text="更新";left=20;top=267;right=140;bottom=302;db=1;dr=1;z=1};
button2={cls="button";text="取消";left=362;top=267;right=482;bottom=302;db=1;dr=1;z=3};
button3={cls="button";text="暂不更新";left=188;top=268;right=308;bottom=303;db=1;dr=1;z=8};
edit={cls="edit";left=20;top=58;right=482;bottom=215;autohscroll=false;edge=1;font=LOGFONT(h=-18);multiline=1;readonly=1;vscroll=1;z=5};
plus={cls="plus";left=0;top=0;right=24;bottom=24;z=7};
progress={cls="progress";left=20;top=229;right=482;bottom=247;color=65280;edge=1;max=100;min=0;z=6};
static={cls="static";left=13;top=33;right=276;bottom=50;notify=1;transparent=1;z=4}
)
/*}}*/
mainForm.onMouseDown = function(wParam,lParam){
mainForm.hitCaption()
}
win.ui.simpleWindow(mainForm);
var $ini = fsys.ini("/updata.ini")
var version = $ini.read("version","num");
var mainpath = $ini.read("set","mainpath");
var url = $ini.read("lanzouyun","url");
var pwd = $ini.read("lanzouyun","pwd");
var logopath = $ini.read("set","logopath");
mainForm.plus.background = logopath;
var Host= string.split(string.split(tostring(url),"<//>")[2],"</>")[1];//ybmzlqzj.lanzoue.com
var Origin = "https://"+Host
var listener = thread.command();
mainForm.edit.print("获取更新中...")
listener.getgxnr = function(data1,data2,data3,data4){
wjnum = data1;
UpdatePackageUrl = data2;
UpdateDescriptionUrl = data3;
filename = data4;if(wjnum ==1 ){
/*
var pyMain = py3.import("pyMain");
var pyStr = pyMain.fetch_direct_link(UpdateDescriptionUrl);
*/
var http = web.rest.client("Mozilla/5.0 (Linux; Android 7.1.2; PCT-AL10 Build/N2G47H; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/81.0.4044.117 Mobile Safari/537.36");
var data = http.get(UpdateDescriptionUrl);
mainForm.edit.text=data
mainForm.button.disabled = false;
}elseif(wjnum == 2){
mainForm.edit.text="暂未上传更新包!"
var http = web.rest.client("Mozilla/5.0 (Linux; Android 7.1.2; PCT-AL10 Build/N2G47H; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/81.0.4044.117 Mobile Safari/537.36");
var data = http.get(UpdateDescriptionUrl);
mainForm.edit.print(data)
mainForm.button.disabled = true;
}
else {
mainForm.button.disabled = true;
mainForm.close()
var prcs = process(mainpath);
}
}
mainForm.button.disabled = true;
mainForm.show();
//多线程
thread.invoke(
function(mainForm){
import win.ui;
import inet.http;
import inet.httpFile;
import web.rest.client;
import web.json;
import fsys.ini
import thread.command;
var $ini = fsys.ini("/updata.ini")
var version = $ini.read("version","num");
var filename = "";
var wjnum = 0;
var UpdatePackageUrl = ""
var UpdateDescriptionUrl = ""
var mainpath = $ini.read("set","mainpath");
var url = $ini.read("lanzouyun","url");
var pwd = $ini.read("lanzouyun","pwd");
var Host= string.split(string.split(tostring(url),"<//>")[2],"</>")[1];//ybmzlqzj.lanzoue.com
var Origin = "https://"+Host
function IntoPageDir(url) {
var http = web.rest.client();
var data = http.get(url);
var t,k,s,uid,fid;
try{
t = string.split(string.split(string.split(tostring(data),"<var pgs;>")[2],"<= '>")[2],"<';>")[1];
k = string.split(string.split(string.split(tostring(data),"<var pgs;>")[2],"<= '>")[3],"<';>")[1];
fid = tonumber(string.split(string.split(tostring(data),"<'fid':>")[2],"<,>")[1]);
uid = string.split(string.split(tostring(data),"<'uid':'>")[2],"<',>")[1];
s = {"error":0,"t":t,"k":k,"fid":fid,"uid":uid};
}
catch(e){
s = {"error":1,"t":"0","k":"0","fid":0,"uid":0};
$ini.write("error",tostring(e),"error");
}
http.close();
return s;
};
function IntoPage2(url,pwd,data1) {
var t = data1.t;
var k = data1.k;
var fid = data1.fid;
var uid = data1.uid;
var Host= string.split(string.split(tostring(url),"<//>")[2],"</>")[1];
var Origin = "https://"+Host;
var url2 = Origin +"/filemoreajax.php";
var http = web.rest.client();
var data = http.post(url2,{
'lx'=tonumber(2);
'fid'= fid;
'uid'= uid;
'pg'= tonumber(1);
'rep'= '0';
't'= t;
'k'= k;
'up'= tonumber(1);
'ls'=tonumber(1);
'pwd'=pwd;
});
var responsedata = web.json.parse(data).text;
http.close();
return responsedata;
};
//解析下载地址
function IntoPage3(url,data){
var list = data;
var Host= string.split(string.split(tostring(url),"<//>")[2],"</>")[1];
var Origin = "https://"+Host;
var url2 = Origin+"/tp/"+data.id;
var http = web.rest.client("Mozilla/5.0 (Linux; Android 7.1.2; PCT-AL10 Build/N2G47H; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/81.0.4044.117 Mobile Safari/537.36");
var data = http.get(url2);
var wjnum =0;
data = string.split(tostring(data),'<javascript">')[2]
data = string.split(tostring(data),'<var>')
var urlsplit1 ;
var urlsplit2;
for(i=1;#data;1){
if(string.indexOf(data[i],"lanzou") != null){
urlsplit1 = data[i]
urlsplit1 = string.split(tostring(urlsplit1),"<'>")[2]
}elseif(string.indexOf(data[i]," = '?")!= null){
urlsplit2 = string.split(tostring(data[i]),"<'>")[2]
}
}
newurl = urlsplit1 + urlsplit2
return newurl
};
IP_ADDRESSES = {
"218", "218", "66", "66", "218", "218", "60", "60", "202", "204", "66", "66", "66", "59", "61", "60", "222", "221", "66", "59",
"60", "60", "66", "218", "218", "62", "63", "64", "66", "66", "122", "211"
}
URL_DOMAINS = {
"wwa.lanzoux.com",
"wwa.lanzoup.com",
"wwa.lanzouw.com",
"wwa.lanzouy.com"
}
function get_random_ip(){
var ip1 = IP_ADDRESSES[math.random(1,#IP_ADDRESSES)];
var ip2 = tostring(math.random(60, 255));
var ip3 = tostring(math.random(60, 255));
var ip4 = tostring(math.random(60, 255));
return ip1+'.'+ip2+'.'+ip3+'.'+ip4
};
var random_ip = get_random_ip();
var referer_url = URL_DOMAINS[math.random(1,#URL_DOMAINS)];
try{
var Page1 = IntoPageDir(url);
var Page2 = IntoPage2(url,pwd,Page1);//得到 {"icon":"dll","t":0,"id":"iReFr0svzqsj","name_all":"v1.0.1.dll","size":"81.0 B","time":"2023-04-13","duan":"i0svzqs","p_ico":0},{"icon":"zip","t":0,"id":"iXT3a0slnxkb","name_all":"\u5c0f\u767d\u70b9.zip","size":"39.4 M","time":"2023-04-10","duan":"i0slnxk","p_ico":0}]
var updatatext = {}; //Page2中 name_all 包含 V. 的数据分别排在第几位 例如{1,3}表示第1、3个文件都包含V. 最新文件就是updatatext[1]
//Page2中 name_all 包含 V. 的数据分别排在第几位
for(i=1;#Page2;1){
if(string.indexOf(Page2[i].name_all,"V.") != null){
table.push(updatatext,i)
}
}
//var jsj = IntoPage3(url,Page2[1]);
//mainForm.edit.print(jsj)
//判断存在是否包含 V.的文件
if(#updatatext != 0){
var newvupdata = Page2[updatatext[1]].name_all//文件名 V.1.0.1.dll
var bbh =string.replace(newvupdata,'V.','')//得到 1.0.1.dll
var hzm = '.'+string.split(newvupdata,'.')[#string.split(newvupdata,'.')]// 得到后缀名 dll
bbh =string.replace(bbh,hzm,'')//得到 1.0.1
//检查 最新版本号与data.ini的version[num]是否相同,如果不相同
if(bbh!=version){
for(i=1;#Page2;1){
//检查Page2中是否存在 U.+getversion 字符串的文件名,如果存在,返回文件id
if(string.indexOf(Page2[i].name_all,"U."+bbh) != null){ //判断是否存在文件名包含 U.1.0.1 的文件
wjnum = 1
//updataid = Page2[i].id;//U.1.0.1.zip 的id
//upversionid = Page2[updatatext[1]].id;//V.1.0.1.dll 的id
var resques3 = IntoPage3(url,Page2[updatatext[1]]);
var http = inet.http();
UpdateDescriptionUrl = http.location(resques3,'GET',,
{'User-Agent': 'Mozilla/5.0 (Linux; Android 7.1.2; PCT-AL10 Build/N2G47H; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/81.0.4044.117 Mobile Safari/537.36',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Encoding': 'deflate, sdch, br',
'Accept-Language': 'zh-CN,zh;q=0.8',
'Cache-Control': 'max-age=0',
'Connection': 'keep-alive',
'Upgrade-Insecure-Requests': '1',
'X-Forwarded-For': random_ip,
'Referer': referer_url}
);//更新说明文件直链
var resques3 = IntoPage3(url,Page2[i]);
var http = inet.http();
UpdatePackageUrl = http.location(resques3,'GET',,
{'User-Agent': 'Mozilla/5.0 (Linux; Android 7.1.2; PCT-AL10 Build/N2G47H; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/81.0.4044.117 Mobile Safari/537.36',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Encoding': 'deflate, sdch, br',
'Accept-Language': 'zh-CN,zh;q=0.8',
'Cache-Control': 'max-age=0',
'Connection': 'keep-alive',
'Upgrade-Insecure-Requests': '1',
'X-Forwarded-For': random_ip,
'Referer': referer_url}
);//更新压缩包直链
filename = Page2[i].name_all;
}
}
if(wjnum!=1){
wjnum=2
}
}
}
thread.command.getgxnr(wjnum,UpdatePackageUrl,UpdateDescriptionUrl,filename)
}
catch(e){
mainForm.edit.print("更新异常")
mainForm.button.disabled = true;
}
},mainForm)
mainForm.button.oncommand = function(id,event){
thread.invoke(
function(mainForm,filename,UpdatePackageUrl){
import win.ui;
import inet.http;
import inet.httpFile;
import web.rest.client;
import web.json;
import fsys.ini
import process;
import thread.command;
var $ini = fsys.ini("/updata.ini")
var mainpath = $ini.read("set","mainpath");
var url = $ini.read("lanzouyun","url");
mainForm.button.disabled = true;
mainForm.progress.setRange(0,100)
var onReceiveFileSize = 0
var remoteFile = inet.httpFile(UpdatePackageUrl ,"/")
var ok,err,errCode = remoteFile.test()
if( ok ){
mainForm.edit.print("文件已下载完成、服务器未更新,无需重新下载");
}
elseif( ok === null ){
mainForm.edit.print("下载错误,HTTP错误代码",remoteFile.statusCode,err);
}
remoteFile.onReceiveBegin = function(statusCode,contentLength,fileSize){
if( statusCode == 206/*断点续传*/ ){
mainForm.edit.print("正在断点续传")
mainForm.progress.pos=(fileSize/contentLength)*100
}
elseif(fileSize){
mainForm.edit.print("正在重新下载")
mainForm.progress.pos=(fileSize/contentLength)*100
}
}
remoteFile.onReceive = function(str,downSize,contentLength){
onReceiveFileSize+=downSize
mainForm.edit.text = "正在下载 文件大小:" + math.size64(onReceiveFileSize).format()+'/'+math.size64(contentLength).format()
mainForm.progress.pos=tonumber(string.format("%.0f",(onReceiveFileSize/contentLength)*100))
}
//下载文件
var ok,err,fileSize = remoteFile.download()
//解压
import zlib.unzip
var unzipsize=0 ;
var ok,err = zlib.unzip.extract( "/"+filename,"/",
function(fileName,extractPath,fileInfo,size,unitSize,unitName){
if( size !== null ){
unzipsize += fileInfo.compressed_size
mainForm.edit.print( "正在解压文件:",fileName,size++ unitName )
mainForm.progress.pos=tonumber(string.format("%.0f",(unzipsize/onReceiveFileSize)*100))}
else {
mainForm.edit.print( "正在解压目录:",fileName );
}
return true;
})
mainForm.edit.text="解压完成!"
mainForm.edit.print("重新启动中,请稍等...")
fsys.delete("/"+filename)
var getversion = string.replace(filename,'U.','');
var hzm = '.'+string.split(getversion,'.')[#string.split(getversion,'.')];
getversion = string.replace(filename,hzm,'');
getversion = string.replace(getversion,'U.','');
$ini.write("version","num",getversion)
var prcs = process(mainpath);
mainForm.close()
},mainForm,filename,UpdatePackageUrl)
}
mainForm.button2.oncommand = function(id,event){
mainForm.close();
}
mainForm.button3.oncommand = function(id,event){
mainForm.close();
var prcs = process(mainpath);
}
mainForm.onClose = function(hwnd,message,wParam,lParam){
mainForm.text = "正在等待关闭"; }
mainForm.static.oncommand = function(id,event){
}
win.loopMessage();
ck.aardio
[JavaScript] 纯文本查看 复制代码 import win.ui;
import win.ui.simpleWindow;
import fsys.ini
/*DSG{{*/
var winform = win.form(text="热更新设置";right=499;bottom=299;border="none")
winform.add(
bk={cls="bk";left=-5;top=0;right=505;bottom=29;dl=1;dr=1;dt=1;z=2};
button={cls="button";text="保存设置";left=132;top=247;right=332;bottom=282;z=11};
edit={cls="edit";left=52;top=80;right=465;bottom=102;edge=1;z=1};
edit2={cls="edit";left=52;top=129;right=146;bottom=151;edge=1;z=4};
edit3={cls="edit";left=318;top=128;right=464;bottom=150;edge=1;z=6};
edit4={cls="edit";left=130;top=207;right=465;bottom=229;edge=1;z=8};
edit5={cls="edit";left=131;top=169;right=466;bottom=191;edge=1;z=12};
plus={cls="plus";left=0;top=0;right=24;bottom=24;z=9};
static={cls="static";text="网址:";left=9;top=83;right=49;bottom=105;align="center";transparent=1;z=3};
static2={cls="static";text="密码:";left=9;top=132;right=49;bottom=154;align="center";transparent=1;z=5};
static3={cls="static";text="软件现行版本号:";left=212;top=131;right=317;bottom=153;align="center";transparent=1;z=7};
static4={cls="static";text="软件启动程序路径:";left=7;top=209;right=131;bottom=231;align="center";transparent=1;z=10};
static5={cls="static";text="更新程序logo路径:";left=8;top=172;right=132;bottom=193;align="center";transparent=1;z=13};
static6={cls="static";text="初始化设置";left=82;top=35;right=409;bottom=59;align="center";font=LOGFONT(h=-22;name='楷体';weight=700);transparent=1;z=14}
)
/*}}*/
winform.onMouseDown = function(wParam,lParam){
winform.hitCaption()
}
win.ui.simpleWindow(winform);
var $ini = fsys.ini("/updata.ini")
var version = $ini.read("version","num");
var mainpath = $ini.read("set","mainpath");
var url = $ini.read("lanzouyun","url");
var pwd = $ini.read("lanzouyun","pwd");
var logopath = $ini.read("set","logopath");
winform.plus.background = logopath;
if(version==null or mainpath==null or url==null or pwd==null){
winform.edit.text="https://guoren.lanzouo.com/b00wvmvli"
winform.edit2.text="0000"
winform.edit3.text="1.0.0"
winform.edit4.text="/小白点/小白点A股助手.exe"
winform.edit5.text="/小白点/xbd.png"
}
else {
winform.edit.text=url
winform.edit2.text=pwd
winform.edit3.text=version
winform.edit4.text=mainpath
winform.edit5.text=logopath
}
winform.button.oncommand = function(id,event){
$ini.write("lanzouyun","url",winform.edit.text);
$ini.write("lanzouyun","pwd",winform.edit2.text);
$ini.write("version","num",winform.edit3.text);
$ini.write("set","logopath",winform.edit5.text);
$ini.write("set","mainpath",winform.edit4.text);
winform.endModal("已设置")
}
winform.show();
win.loopMessage();
return winform;
|
免费评分
-
查看全部评分
|