Skip to content

Commit

Permalink
V3.9 右键添加了清除重复节点功能!完善了二维码生成器代码!
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMRLL authored Oct 3, 2021
1 parent 72a80c5 commit aea0d27
Show file tree
Hide file tree
Showing 11 changed files with 125 additions and 66 deletions.
6 changes: 3 additions & 3 deletions default.aproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<project ver="10" name="WinXray" libEmbed="true" icon="\forms\ico\app.ico" ui="win" output="WinXray.exe" CompanyName="WinXray" FileDescription="网络代理通用客户端" LegalCopyright="Copyright (C) WinXray" ProductName="WinXray" InternalName="WinXray" FileVersion="3.8" ProductVersion="3.8" publishDir="\WinXray" dstrip="false" local="false" ignored="false">
<project ver="10" name="WinXray" libEmbed="true" icon="\forms\ico\app.ico" ui="win" output="WinXray.exe" CompanyName="WinXray" FileDescription="网络代理通用客户端" LegalCopyright="Copyright (C) WinXray" ProductName="WinXray" InternalName="WinXray" FileVersion="3.9" ProductVersion="3.9" publishDir="\WinXray" dstrip="false" local="false" ignored="false">
<file name="main" path="main.aardio"/>
<folder name="窗体" path="forms" comment="" embed="true" local="false" ignored="false">
<folder name="ico" path="forms\ico" comment="forms\ico">
<file name="app-direct.ico" path="forms\ico\app-direct.ico" comment="forms\ico\app-direct.ico"/>
<file name="app-pac.ico" path="forms\ico\app-pac.ico" comment="forms\ico\app-pac.ico"/>
<file name="app.ico" path="forms\ico\app.ico" comment="forms\ico\app.ico"/>
</folder>
<folder name="main" path="forms\main" comment="forms\main">
<folder name="main" path="forms\main" comment="forms\main" local="false" embed="false" ignored="false">
<file name="outbound.aardio" path="forms\main\outbound.aardio" comment="forms\main\outbound.aardio"/>
<file name="pac.aardio" path="forms\main\pac.aardio" comment="forms\main\pac.aardio"/>
<file name="xray.aardio" path="forms\main\xray.aardio" comment="forms\main\xray.aardio"/>
Expand All @@ -20,7 +20,7 @@
<file name="xray.rules.json" path="forms\main\config\coreConfigs\xray.rules.json" comment="forms\main\config\coreConfigs\xray.rules.json"/>
</folder>
</folder>
<folder name="tools" path="forms\main\tools" comment="forms\main\tools">
<folder name="tools" path="forms\main\tools" comment="forms\main\tools" local="false" embed="false" ignored="false">
<file name="github.aardio" path="forms\main\tools\github.aardio" comment="forms\main\tools\github.aardio"/>
<file name="qr.aardio" path="forms\main\tools\qr.aardio" comment="forms\main\tools\qr.aardio"/>
<file name="tools.aardio" path="forms\main\tools\tools.aardio" comment="forms\main\tools\tools.aardio"/>
Expand Down
86 changes: 35 additions & 51 deletions forms/main/tools/qr.aardio
Original file line number Diff line number Diff line change
@@ -1,71 +1,55 @@
//二维码生成工具

import win.ui;
import win.ui.atom;
import fonts.fontAwesome;
/*DSG{{*/
var winform = win.form(text="WinXray - 二维码生成工具";right=730;bottom=678;bgcolor=16777215;border="none";exmode="none";mode="popup")
var winform = win.form(text="二维码生成工具";right=851;bottom=775)
winform.add(
bk={cls="bk";left=-6;top=-2;right=734;bottom=27;bgcolor=12632256;z=10};
btnQrEnode={cls="plus";text="生成二维码";left=562;top=565;right=694;bottom=595;align="left";bgcolor=14935259;db=1;dr=1;font=LOGFONT(h=-13);iconStyle={align="left";font=LOGFONT(h=-13;name='FontAwesome');padding={left=22}};iconText='\uF1C4';notify=1;textPadding={left=40};z=9};
editUrl={cls="plus";left=44;top=569;right=537;bottom=594;align="right";bgcolor=16777215;border={bottom=1;color=-8355712};db=1;dl=1;dr=1;editable="edit";font=LOGFONT(h=-16);textPadding={bottom=1};z=8};
lbErrLevel={cls="static";text=" 0:L 可纠错7%数据码字";left=104;top=656;right=272;bottom=679;db=1;dl=1;transparent=1;z=6};
lbVersion={cls="static";text="自动选择版本";left=466;top=656;right=672;bottom=679;db=1;dr=1;transparent=1;z=7};
plus={cls="plus";left=28;top=49;right=708;bottom=522;bgcolor=16777215;db=1;dl=1;dr=1;dt=1;repeat="scale";z=1};
static={cls="static";text="纠错级别:";left=13;top=624;right=97;bottom=651;align="right";db=1;dl=1;transparent=1;z=3};
static2={cls="static";text="版本(大小):";left=353;top=624;right=437;bottom=651;align="right";db=1;dl=1;dr=1;transparent=1;z=5};
static3={cls="static";text="WinXray - 二维码生成工具";left=17;top=4;right=230;bottom=24;color=3947580;transparent=1;z=11};
tbErrLevel={cls="trackbar";left=96;top=611;right=290;bottom=641;bgcolor=16777215;db=1;dl=1;max=3;min=0;z=2};
tbVersion={cls="trackbar";left=439;top=611;right=703;bottom=641;bgcolor=16777215;db=1;dr=1;max=40;min=0;z=4}
btnQrEnode={cls="button";text="生成二维码";left=655;top=630;right=797;bottom=672;db=1;dr=1;z=2};
edit={cls="edit";text="https://www.winxray.com";left=69;top=633;right=622;bottom=670;db=1;dl=1;dr=1;edge=1;multiline=1;z=9};
lbErrLevel={cls="static";text=" 0:L 可纠错7%数据码字";left=129;top=735;right=297;bottom=758;db=1;dl=1;transparent=1;z=7};
lbVersion={cls="static";text="自动选择版本";left=491;top=735;right=697;bottom=758;db=1;dl=1;dr=1;transparent=1;z=8};
plus={cls="plus";left=71;top=50;right=786;bottom=588;db=1;dl=1;dr=1;dt=1;repeat="scale";z=1};
static={cls="static";text="纠错级别:";left=38;top=703;right=122;bottom=730;align="right";db=1;dl=1;transparent=1;z=4};
static2={cls="static";text="版本(大小):";left=378;top=703;right=462;bottom=730;align="right";db=1;dl=1;transparent=1;z=6};
tbErrLevel={cls="trackbar";left=121;top=690;right=315;bottom=720;db=1;dl=1;max=3;min=0;z=3};
tbVersion={cls="trackbar";left=464;top=690;right=728;bottom=720;db=1;dl=1;dr=1;max=40;min=0;z=5}
)
/*}}*/

import style;
winform.btnQrEnode.skin(style.primaryButton);

winform.tbErrLevel.oncommand = function(id,event,pos){
if( event == 0x8/*_TB_ENDTRACK*/ ){
pos = winform.tbErrLevel.pos;
var v = {[0]="L 可纠错7%数据码字";[1]="M 可纠错15%的数据码字";[2]="Q 可纠错25%的数据码字";[3]="H 可纠错30%的数据码字";}
winform.lbErrLevel.text = pos +":"+ v[pos];
}
if( event == 0x8/*_TB_ENDTRACK*/ ){
pos = winform.tbErrLevel.pos;
var v = {[0]="L 可纠错7%数据码字";[1]="M 可纠错15%的数据码字";[2]="Q 可纠错25%的数据码字";[3]="H 可纠错30%的数据码字";}
winform.lbErrLevel.text = pos +":"+ v[pos];
}
}
winform.tbVersion.oncommand = function(id,event,pos){
if( event == 0x8/*_TB_ENDTRACK*/ ){
pos = winform.tbVersion.pos;
if(!pos)winform.lbVersion.text = "自动选择版本";
else {
var width = ((pos-1)*4)+21;
winform.lbVersion.text = string.format("版本:%d 二维码数据大小:%d x %d",pos,width,width );
}
}
if( event == 0x8/*_TB_ENDTRACK*/ ){
pos = winform.tbVersion.pos;
if(!pos)winform.lbVersion.text = "自动选择版本";
else {
var width = ((pos-1)*4)+21;
winform.lbVersion.text = string.format("版本:%d 二维码数据大小:%d x %d",pos,width,width );
}
}
}

import win.dlg.message;
import qrencode.bitmap;
winform.btnQrEnode.oncommand = function(id,event){
if(!#winform.editUrl.text){
return winform.msgErr("请先输入内容")
}

winform.plus.hide = true;
var qrBmp = qrencode.bitmap(winform.editUrl.text,winform.tbVersion.pos,winform.tbErrLevel.pos );
if(!qrBmp){
return winform.msgErr("请先输入内容")
}
winform.plus.setBackground(qrBmp.copyBitmap(winform.plus.width));

winform.plus.hide = false;
winform.plus.redraw()
winform.btnQrEnode.oncommand = function(id,event){
winform.plus.hide = true;
var qrBmp = qrencode.bitmap(winform.edit.text,winform.tbVersion.pos,winform.tbErrLevel.pos );
winform.plus.setBackground(qrBmp.copyBitmap(winform.plus.width));

winform.plus.hide = false;
winform.plus.redraw()
}

winform.createQrCode = function(url){
winform.editUrl.text = url;
winform.edit.text = url;
winform.btnQrEnode.oncommand();
}

import win.ui.simpleWindow2;
win.ui.simpleWindow2(winform);

winform.show()
win.loopMessage();
67 changes: 65 additions & 2 deletions forms/main/xray.aardio
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,59 @@ var removeOutbounds = function(selectedItems){
if(!xray.core.lastDownloadingCoreFailed) frmXray.btnTcping.oncommand();
}
}
//移除重复节点
frmXray.removeRepeat=function(){
//跳过检测异常
frmXray.listChanging = true;
//避免后台线程改变activeIndex
frmXray.onTcpingReturn = function(outboundIndex,address,succeeded,speedText){};
frmXray.btnTcping.disabledText = null;
frmXray.autoTesting = false;
//标记活动节点
var activeIndex = frmXray.listview.activeOutboundIndex;
var outbounds = config.proxy.outbounds;
for(i=#outbounds;1;-1){
var ob = outbounds[i];
if(activeIndex==i){
ob.active = true;
}
}
//标记重复节点
for(i=1;#outbounds;1){
for(j=1;#outbounds;1){
if( j<=i ){ continue }
if( outbounds[j].address==outbounds[i].address
&& outbounds[j].port==outbounds[i].port ){
outbounds[j].repeat=true;
}
}
}
//删除重复节点
var removecount=0;
for(i=#outbounds;1;-1){
if(outbounds[i].repeat){
table.remove(outbounds,i);
removecount++;
}
}

//保存配置文件
config.proxy.outbounds = outbounds;
config.proxy.save();
frmXray.listview.setTable(outbounds);
//如果把活动节点删了,重新连接
if(activeIndex && (!frmXray.listview.activeOutboundIndex) ){
if( config.settings.autoStartTest) frmXray.btnAutoConnect.oncommand();
}
elseif(frmXray.listview.activeOutboundIndex){
frmXray.listview.setItemText(activeText,activeIndex,frmXray.StatusX);
}
//继续检测异常
frmXray.listChanging = false;

return removecount;
}


import xray.outbounds;
frmXray.listview.onnotify = function(id,code,ptr){
Expand Down Expand Up @@ -552,10 +605,15 @@ frmXray.listview.onnotify = function(id,code,ptr){
publish("outbounds.updateConfigJson");
});

popmenu.add('清除「不可用」服务器',function(id){
popmenu.add('清除「不可用」节点',function(id){
removeOutbounds();
});

popmenu.add('清除「重复」节点',function(id){
var removecount = frmXray.removeRepeat();
if(removecount){ frmXray.edit.print("删除了"+removecount+"个节点") }
});

popmenu.add("重置为默认服务器列表",
function(id){
..config.__loadDefaultOutbounds();
Expand Down Expand Up @@ -674,10 +732,15 @@ frmXray.listview.onnotify = function(id,code,ptr){
}
});

popmenu.add('清除「不可用」服务器',function(id){
popmenu.add('清除「不可用」节点',function(id){
removeOutbounds();
});

popmenu.add('清除「重复」节点',function(id){
var removecount = frmXray.removeRepeat();
if(removecount){ frmXray.edit.print("删除了"+removecount+"个节点") }
});

popmenu.add("重置为默认服务器列表",
function(id){
..config.__loadDefaultOutbounds();
Expand Down
26 changes: 19 additions & 7 deletions lib/xray/outbounds.aardio
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exportSharedLinks = function(outbounds){
var outString = {};
for i,outbound in ..table.eachIndex(outbounds){
if(outbound.protocol == "vmess"){
var json = ..web.json.stringify({
var info = {
v = 2;
add = outbound.address;
aid = outbound.alterId;
Expand All @@ -23,8 +23,20 @@ exportSharedLinks = function(outbounds){
host = outbound.host;
tls = outbound.tls;
ps = outbound.ps;
})
}

if(outbound.network=="quic"){
info.host = outbound.quicSecutity;
info.path = outbound.key;
}
elseif(outbound.network=="kcp"){
info.path = outbound.seed;
}
elseif(outbound.network=="grpc"){
info.path = outbound.grpcSni;
}

var json = ..web.json.stringify(info);
var vmess = "vmess://" + ..crypt.encodeBin(json);
..table.push(outString,vmess);
}
Expand Down Expand Up @@ -60,7 +72,7 @@ exportSharedLinks = function(outbounds){

if(#outbound.ps)info.remarks = ..crypt.bin.encodeUrlBase64(outbound.ps);
if(#outbound.obfsParam)info.obfsparam = ..crypt.bin.encodeUrlBase64(outbound.obfsParam);
if(#outbound.networkParam)info.protoparam = ..crypt.bin.encodeUrlBase64(outbound.networkParam);
if(#outbound.networkParam)info.protoparam = ..crypt.bin.encodeUrlBase64(outbound.networkParam);

if(#outbound.path)info.ot_path = ..crypt.bin.encodeUrlBase64(outbound.path);
if(#outbound.sni)info.ot_domain = ..crypt.bin.encodeUrlBase64(outbound.sni);
Expand Down Expand Up @@ -152,14 +164,14 @@ exportSharedLinks = function(outbounds){
var urlInfo = {
host = outbound.address;
port = outbound.port;
scheme = "proxy";
scheme = outbound.protocol;//"proxy"
location = outbound.ps;
}

if(outbound.protocol == "http"){
urlInfo.extraInfo ={
/*urlInfo.extraInfo ={
["tls"] = "none"
}
}*/
}
elseif(outbound.allowInsecure){
urlInfo.extraInfo ={
Expand Down
2 changes: 1 addition & 1 deletion main.aardio
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ import win.ui;
mainForm = win.form(text="WinXray";right=1019;bottom=679;bgcolor=15793151;border="none")
mainForm.add(
Promote={cls="plus";text="推荐";left=0;top=300;right=85;bottom=380;bkBottom=3;bkLeft=7;bkRight=8;bkTop=2;border={color=-65536};color=16777215;dl=1;dt=1;font=LOGFONT(h=-13);iconStyle={font=LOGFONT(h=-37;name='FontAwesome');padding={bottom=20}};iconText='\uF233';notify=1;textPadding={bottom=10};valign="bottom";x=0.5;y=0.2;z=8};
caption={cls="bkplus";text="WinXray.COM V3.8";left=25;top=9;right=685;bottom=27;align="left";color=6052956;dl=1;dt=1;font=LOGFONT(h=-14);z=6};
caption={cls="bkplus";text="WinXray.COM V3.9";left=25;top=9;right=685;bottom=27;align="left";color=6052956;dl=1;dt=1;font=LOGFONT(h=-14);z=6};
custom={cls="custom";left=83;top=40;right=1022;bottom=679;bgcolor=16777215;db=1;dl=1;dr=1;dt=1;z=3};
navBar={cls="bkplus";left=0;top=37;right=83;bottom=681;bgcolor=3442175;db=1;dl=1;dt=1;z=1};
navJsonConfig={cls="plus";text="配置";left=0;top=132;right=85;bottom=212;bkBottom=3;bkLeft=7;bkRight=8;bkTop=2;border={color=-65536};color=16777215;dl=1;dt=1;font=LOGFONT(h=-13);iconStyle={font=LOGFONT(h=-37;name='FontAwesome');padding={bottom=20}};iconText='\uF0F6';notify=1;textPadding={bottom=10};valign="bottom";x=0.5;y=0.2;z=5};
Expand Down
Binary file modified release/WinXray.7z
Binary file not shown.
Binary file modified release/WinXray32.7z
Binary file not shown.
Binary file modified release/update/checksum.lzma
Binary file not shown.
Binary file modified release/update/files/WinXray.exe.lzma
Binary file not shown.
4 changes: 2 additions & 2 deletions release/update/version.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"description":"在最小化图标右键栏添加扫一扫导入节点功能,以及完善了一下导入SS节点规则!",
"description":"右键添加了清除重复节点功能!完善了二维码生成器代码!",
"format":".lzma",
"main":"\\WinXray.exe",
"updater":"\\WinXray.exe",
"url":"https://raw.githubusercontent.com/TheMRLL/winxray/main/release/update/",
"version":"3.8"
"version":"3.9"
}
Binary file modified winXray/WinXray.exe
Binary file not shown.

0 comments on commit aea0d27

Please sign in to comment.