diff --git a/src/linker.share.win/default.aproj b/src/linker.share.win/default.aproj deleted file mode 100644 index d0eb0d9a..00000000 --- a/src/linker.share.win/default.aproj +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/src/linker.share.win/lib/config.aardio b/src/linker.share.win/lib/config.aardio deleted file mode 100644 index 5da06a0a..00000000 --- a/src/linker.share.win/lib/config.aardio +++ /dev/null @@ -1,17 +0,0 @@ -//config 配置文件 -import fsys.config; -config = fsys.config("/config/"); -//config = fsys.config( io.appData("/软件作者/应用程序名/") ); - -//不需要序列化的配置名字前请添加下划线 -namespace config { - __appName = "应用程序名"; - __website = "http://www.aardio.com/"; -} - -/**intellisense(config) -__appName = 应用程序名 -__website = 官方网站 -saveAll() = 写入所有配置到文件 -? = 获取值时指定不以下划线开始的配置表名称,\n返回一个可自动序列化到同名配置文件的表对象。\n如果此对象名以下划线开始,则可以正常读写值不会序列化为配置文件。\n否则不能对此对象直接赋值,只能对配置表对象的成员赋值。\n\n配置表可自动自文件加载,退出线程前自动序列化并存入文件。\n仅序列化以字符串、数值为键的元素,\n仅序列化值为字符串、数值、buffer 以及定义了 _serialize 元方法的成员。\n循环引用的值转换为 null,序列化时忽略成员函数\n!fsys_table. -end intellisense**/ \ No newline at end of file diff --git a/src/linker.share.win/main.aardio b/src/linker.share.win/main.aardio deleted file mode 100644 index af76e32a..00000000 --- a/src/linker.share.win/main.aardio +++ /dev/null @@ -1,22 +0,0 @@ -//RUNAS// -import win.ui; -/*DSG{{*/ -mainForm = win.form(text="linker局域网共享";right=352;bottom=312;border="thin";max=false;topmost=1) -mainForm.add( -mainTab={cls="tab";left=8;top=1;right=346;bottom=306;z=1} -) -/*}}*/ - -import win.ui.atom; -import win.ui.atom -var atom,hwndConflict = mainForm.atom("CC31CBD7-B5B5-4709-A6B2-6126B611B8C2"); -if(!atom){ - win.quitMessage(); return; -}; - -mainForm.mainTab.loadForm("\res\connect.aardio"); -mainForm.mainTab.loadForm("\res\share.aardio"); -mainForm.mainTab.loadForm("\res\info.aardio"); - -mainForm.show(); -return win.loopMessage(); \ No newline at end of file diff --git a/src/linker.share.win/res/connect.aardio b/src/linker.share.win/res/connect.aardio deleted file mode 100644 index faff9968..00000000 --- a/src/linker.share.win/res/connect.aardio +++ /dev/null @@ -1,18 +0,0 @@ -import win.ui; -/*DSG{{*/ -var winform = win.form(text="连接共享";right=330;bottom=276) -winform.add( -button={cls="button";text="删除";left=223;top=10;right=269;bottom=31;z=3}; -button2={cls="button";text="新增";left=275;top=10;right=321;bottom=31;z=4}; -button3={cls="button";text="开启连接";left=120;top=234;right=208;bottom=269;z=8}; -checkbox={cls="checkbox";text="自动开启连接";left=10;top=242;right=105;bottom=261;z=7}; -combobox={cls="combobox";left=67;top=11;right=217;bottom=32;edge=1;items={};mode="dropdown";z=2}; -groupbox={cls="groupbox";text="在线的";left=10;top=37;right=321;bottom=228;edge=1;z=5}; -listview2={cls="listview";left=17;top=56;right=314;bottom=221;edge=1;z=6}; -static={cls="static";text="选择共享";left=10;top=12;right=67;bottom=29;transparent=1;z=1} -) -/*}}*/ - -winform.show(); -win.loopMessage(); -return winform; diff --git a/src/linker.share.win/res/favicon.ico b/src/linker.share.win/res/favicon.ico deleted file mode 100644 index 2a0e4e36..00000000 Binary files a/src/linker.share.win/res/favicon.ico and /dev/null differ diff --git a/src/linker.share.win/res/favicon1.ico b/src/linker.share.win/res/favicon1.ico deleted file mode 100644 index b0ed7927..00000000 Binary files a/src/linker.share.win/res/favicon1.ico and /dev/null differ diff --git a/src/linker.share.win/res/share.aardio b/src/linker.share.win/res/share.aardio deleted file mode 100644 index 16e17453..00000000 --- a/src/linker.share.win/res/share.aardio +++ /dev/null @@ -1,286 +0,0 @@ -import win.ui; -/*DSG{{*/ -var winform = win.form(text="发出共享";right=330;bottom=283) -winform.add( -btnCopy={cls="button";text="复制共享密钥";left=229;top=240;right=321;bottom=267;z=16}; -btnNewSecretkey={cls="button";text="新ID";left=276;top=41;right=321;bottom=64;z=14}; -btnSave={cls="button";text="保存";left=276;top=12;right=321;bottom=35;z=19}; -btnStart={cls="button";text="开启共享";left=122;top=237;right=210;bottom=272;z=15}; -cbLan={cls="combobox";left=80;top=102;right=205;bottom=123;edge=1;items={};mode="dropdown";z=4}; -cbLanPrefixlength={cls="combobox";left=248;top=102;right=314;bottom=123;edge=1;items={};mode="dropdown";z=7}; -cbRoutePrefixlength={cls="combobox";left=248;top=131;right=314;bottom=152;edge=1;items={};mode="dropdown";z=9}; -ckAuto={cls="checkbox";text="自动开启共享";left=11;top=246;right=115;bottom=265;z=17}; -groupbox={cls="groupbox";text="共享网段";left=11;top=75;right=321;bottom=228;edge=1;z=3}; -static={cls="static";text="服务器";left=11;top=16;right=54;bottom=33;transparent=1;z=2}; -static3={cls="static";text="内网网段";left=19;top=105;right=72;bottom=122;transparent=1;z=5}; -static4={cls="static";text="掩码";left=216;top=105;right=247;bottom=119;transparent=1;z=6}; -static5={cls="static";text="掩码";left=216;top=135;right=247;bottom=152;transparent=1;z=8}; -static6={cls="static";text="映射路由";left=19;top=134;right=72;bottom=154;transparent=1;z=11}; -static9={cls="static";text="唯一ID";left=11;top=46;right=52;bottom=63;transparent=1;z=13}; -textMsg={cls="edit";left=19;top=163;right=314;bottom=219;autohscroll=false;edge=1;multiline=1;readonly=1;z=18}; -textRoute={cls="ipaddress";left=80;top=132;right=205;bottom=153;edge=1;z=10}; -textSecretkey={cls="edit";left=58;top=42;right=273;bottom=63;edge=1;z=12}; -textServer={cls="edit";left=58;top=13;right=273;bottom=34;edge=1;z=1} -) -/*}}*/ - -import dotNet; -compiler = dotNet.createCompiler("C#"); -compiler.Source = /****** -using System; -namespace LinkerLibsSpace -{ - public class LinkerLibs - { - public string GetGuid() - { - return Guid.NewGuid().ToString(); - } - } -} -******/ -assembly = compiler.CompileOrFail(); -assembly.import("LinkerLibsSpace"); -winform.linkerLibs = LinkerLibsSpace.LinkerLibs(); - - -if(mainForm != null) -{ - winform.mainForm = mainForm; - winform.mainForm.shareForm =winform; -} - -import crypt.aes; -import crypt.bin; -import web.json; -winform.aes = crypt.aes(); -winform.aes.setPassword("BC7F0C7C-6A1E-4792-A17F-0008D300C076"); -winform.shareSettingTab = { - "server"="", - "secretkey" = winform.linkerLibs.GetGuid(), - "lan"="", - "lanPrefixlength"="24", - "route"="192.168.188.0", - "routePrefixlength"="24", - "auto"=false -} -winform.loadShareSetting = function() -{ - configStr = string.load("~/configs/share.json"); - if(configStr) - { - json = web.json.parse(winform.aes.decrypt(configStr)); - winform.shareSettingTab.server = json.server; - winform.shareSettingTab.secretkey = json.secretkey; - winform.shareSettingTab.lan = json.lan; - winform.shareSettingTab.lanPrefixlength = json.lanPrefixlength; - winform.shareSettingTab.route = json.route; - winform.shareSettingTab.routePrefixlength = json.routePrefixlength; - winform.shareSettingTab.auto = json.auto; - } - winform.btnSave.oncommand = function() - { - winform.saveShareSetting(); - } -} -winform.saveShareSetting = function() -{ - import console; - winform.shareSettingTab.server = winform.textServer.text; - winform.shareSettingTab.secretkey = winform.textSecretkey.text; - winform.shareSettingTab.lan = winform.cbLan.selText; - winform.shareSettingTab.lanPrefixlength = winform.cbLanPrefixlength.selText; - winform.shareSettingTab.route = winform.textRoute.text; - winform.shareSettingTab.routePrefixlength = winform.cbRoutePrefixlength.selText; - winform.shareSettingTab.auto = winform.ckAuto.checked; - config = winform.aes.encrypt(web.json.stringify(winform.shareSettingTab)); - import fsys; - try{fsys.delete("~/configs/share.json");}catch(e){} - string.save("~/configs/share.json",config ,true); - win.msgbox("已保存配置",,0x01); -} - - -winform.initLans = function() -{ - import com.wmi; - - winform.prefixlengthDefault = "24"; - winform.prefixlengthTab = {32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16}; - winform.cbLanPrefixlength.items = winform.prefixlengthTab; - winform.cbLanPrefixlength.selText = winform.shareSettingTab.lanPrefixlength; - winform.cbLanPrefixlength.onEditChange = function(){ - winform.cbLanPrefixlength.selText = winform.prefixlengthDefault; - } - winform.cbRoutePrefixlength.items = winform.prefixlengthTab; - winform.cbRoutePrefixlength.selText = winform.shareSettingTab.routePrefixlength; - winform.cbRoutePrefixlength.onEditChange = function(){ - winform.cbRoutePrefixlength.selText = winform.prefixlengthDefault; - } - - lansTab = {}; - for item in com.wmi.eachProperties("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=true") { - table.push(lansTab,item.IPAddress[1]); - } - winform.cbLan.items = lansTab; - - if(#winform.shareSettingTab.lan)winform.cbLan.selText = winform.shareSettingTab.lan - else winform.cbLan.selText = lansTab[1]; - winform.cbLan.onEditChange = function(){ - winform.cbLan.selText = lansTab[1]; - } - winform.textRoute.text = winform.shareSettingTab.route; - - function setText() - { - winform.textMsg.text = "对方使用【"+winform.textRoute.text+"/"+winform.cbRoutePrefixlength.selText+"】访问你的【"+winform.cbLan.selText+"/"+winform.cbLanPrefixlength.selText+"】,这能有效的解决网段冲突,和隐藏你的真实内网网段"; - } - winform.cbLan.onListChange = function(){ - setText(); - } - winform.cbLanPrefixlength.onListChange = function(){ - setText(); - } - winform.cbRoutePrefixlength.onListChange = function(){ - setText(); - } - winform.textRoute.onChange = function(){ - if(owner.onModified)owner.onModified(true); - setText(); - } - setText(); -} - -winform.initSecretkey = function() -{ - winform.textSecretkey.text = winform.shareSettingTab.secretkey; - winform.btnNewSecretkey.oncommand = function(){ - result = win.msgbox("旧的共享密钥将不可用,确认使用一个新ID吗",,0x01/*MB_YESNOCANCEL*/ ); - if(result == 1) - { - winform.textSecretkey.text = winform.linkerLibs.GetGuid(); - } - } -} - -winform.initAuto = function() -{ - winform.ckAuto.checked = winform.shareSettingTab.auto; -} -winform.initServer = function() -{ - winform.textServer.text = winform.shareSettingTab.server; -} - -winform.getShareKey = function() -{ - json = { - "Client"={ - CApi = {ApiPort:18003,ApiPassword="snltty",WebPort:0}, - Servers={{Name="linker",Host=winform.textServer.text}}, - Groups={{Name="Linker",Id="Linker",Password=winform.textSecretkey.text}} - }, - "Common"= { Modes={"client"},Install=true }, - "Tuntap" = { - Running=true, - Lans={ - { - IP= winform.cbLan.selText, - PrefixLength = winform.cbLanPrefixlength.selText, - MapIP = winform.textRoute.text, - MapPrefixLength = winform.cbRoutePrefixlength.selText - } - }, - Lease={ - IP="10.18.0.0", - PrefixLength=16, - Name="linkers" - } - } - } - if(!#json.Client.Servers[1].Host) - { - winform.textServer.showErrorTip("必填","请填写服务器") - return null; - } - if(!#json.Client.Groups[1].Password) - { - winform.textSecretkey.showErrorTip("必选","请填写唯一id") - return null; - } - if(!#json.Tuntap.Lans[1].IP) - { - winform.cbLan.showErrorTip("必选","请选择一个局域网IP") - return null; - } - return json; -} -winform.initSHareKey = function() -{ - winform.btnCopy.oncommand = function() - { - import win.clip; - json = winform.getShareKey(); - if(json) - { - encodeText = winform.aes.encrypt(web.json.stringify(json)); - base64Text = crypt.bin.encodeBase64(encodeText); - win.clip.write(base64Text); - win.msgbox("已复制到剪贴板",,0x01); - } - } -} - -winform.startProc = null; -winform.runStart = function() -{ - import process.popen; - import console; - - winform.btnStart.text = "操作中.."; - if(winform.startProc) - { - winform.startProc.terminate(); - winform.startProc = null; - } - else - { - json = winform.getShareKey(); - if(json) - { - params = { - "--config-client", - crypt.bin.encodeBase64(web.json.stringify(json.Client)) - "--config-common", - crypt.bin.encodeBase64(web.json.stringify(json.Common)) - "--config-tuntap", - crypt.bin.encodeBase64(web.json.stringify(json.Tuntap)) - } - winform.startProc = process.popen("~/linker.exe",process.joinArguments(params)); - } - } - winform.btnStart.text = winform.startProc ? "关闭共享" : "开启共享"; -} -winform.initStart = function() -{ - if(winform.ckAuto.checked) - { - winform.runStart(); - } - winform.btnStart.oncommand = function() - { - winform.runStart(); - } -} - -winform.loadShareSetting(); -winform.initLans(); -winform.initSecretkey(); -winform.initAuto(); -winform.initServer(); -winform.initSHareKey(); -winform.initStart(); - -winform.show(); -win.loopMessage(); -return winform;