This commit is contained in:
Namhyeon Go 2020-07-31 10:29:13 +09:00
commit 67fc0cff0e
6 changed files with 73 additions and 13 deletions

View File

@ -33,6 +33,10 @@ WelsonJS - Build a Windows desktop apps with JavaScript, HTML, and CSS based on
- lib/cloudflare ([Cloudflare Argo Tunnel](https://catswords.re.kr/go/argotunnel) interface)
- lib/shadowsocks ([Shadowsocks](https://catswords.re.kr/go/shadowsocks) interface)
- lib/excel (Microsoft Excel interface)
- lib/vbscript (VBScript interface)
- lib/wintap (Windows-TAP interface)
- lib/tun2socks (TUN2SOCKS interface)
- lib/hosts (Hosts file interface)
## Make your own `sayhello` example

View File

@ -9,5 +9,61 @@ exports.config = {
},
webapp: {
baseURL: "http://158.247.196.146/"
},
shadow: {
"IPRules": {
"Mode": true,
"IPCIDR": [
"44.44.0.0/16",
"1.1.1.1",
"1.0.0.1",
"8.8.8.8",
"8.8.4.4",
"2001:4860:4860::8888",
"2001:4860:4860::8844",
"2001:4860:4860::/64",
"91.108.4.0/22",
"91.108.8.0/22",
"91.108.12.0/22",
"91.108.20.0/22",
"91.108.36.0/23",
"91.108.38.0/23",
"91.108.56.0/22",
"149.154.160.0/20",
"149.154.164.0/22",
"149.154.172.0/22"
]
},
"AppRules": {
"Mode": true,
"Programs":[
"git.exe",
"chrome.exe",
"msedge.exe",
"iexplore.exe",
"firefox.exe",
"opera.exe"
]
},
"DomainRules": {
"Proxy": [
"**.google.com",
"**.google.*",
"**.google.*.*",
"**.youtube.com",
"*.twitter.com",
"www.facebook.com",
"bing.com",
"**.amazon.*"
],
"Direct": [
"**.baidu.*",
"**.youku.*",
"**.*"
],
"Blocked": [
"ad.blocked.com"
]
}
}
};

View File

@ -7,7 +7,7 @@ var FILE = require("lib/file");
exports.getHosts = function() {
var hosts = [];
var filePath = SYS.getEnvString("windir") + "\\System32\\\drivers\\etc\\hosts";
var fileContent = FILE.readFile(filePath, "utf-8");

View File

@ -11,9 +11,9 @@ exports.require = global.require;
var arch = SYS.getArch();
if(arch.indexOf("64") > -1) {
exports.binPath = "bin/shadowsocks-lib-mingw-x86_64/ss-local.exe";
exports.binPath = "bin/shadowsocks-libev-mingw-x86_64/ss-local.exe";
} else {
exports.binPath = "bin/shadowsocks-lib-mingw-x86/ss-local.exe";
exports.binPath = "bin/shadowsocks-libev-mingw-x86/ss-local.exe";
}
exports.getRandomInt = function(min, max) {
@ -22,9 +22,7 @@ exports.getRandomInt = function(min, max) {
};
exports.connect = function() {
return;
var port = exports.getRandomInt(49152, 65535);
var listenPort = exports.getRandomInt(49152, 65535);
SHELL.run([
exports.binPath,
@ -33,12 +31,12 @@ exports.connect = function() {
"-p",
__config.shadowsocks.port,
"-l",
port,
listenPort,
"-k",
__config.shadowsocks.password,
"-m",
__config.shadowsocks.cipher
], true);
return port;
return listenPort;
};

View File

@ -8,8 +8,8 @@ exports.VERSIONINFO = "Shell Lib (shell.js) version 0.1";
exports.global = global;
exports.require = global.require;
exports.addslashes = function(string) {
return string.replace(/\\/g, '\\\\').
exports.addslashes = function(s) {
return s.toString().replace(/\\/g, '\\\\').
replace(/\u0008/g, '\\b').
replace(/\t/g, '\\t').
replace(/\n/g, '\\n').
@ -39,6 +39,7 @@ exports.exec = function(cmd, stdOutPath) {
var c = "%comspec% /c (" + exports.makeCmdLine(cmd) + ") 1> " + stdOutPath;
c += " 2>&1";
WSH.Run(c, 0, true);
console.info("exec() -> " + c);
data = FILE.readFile(stdOutPath, "utf-8");
if (FILE.fileExists(stdOutPath)) {
@ -51,6 +52,7 @@ exports.exec = function(cmd, stdOutPath) {
exports.run = function(cmd, fork) {
var WSH = CreateObject("WScript.Shell");
var fork = (typeof(fork) !== "undefined") ? fork : true;
var c = "%comspec% /q /c " + exports.makeCmdLine(cmd);
var c = "%comspec% /q /c (" + exports.makeCmdLine(cmd) + ")";
console.info("run() -> " + c);
WSH.Run(c, 0, !fork);
};

View File

@ -9,8 +9,8 @@ var HOSTS = require("lib/hosts");
exports.main = function() {
console.log("Connecting to shadowsocks...");
var proxyport = SS.connect();
console.log(proxyport);
var listenPort = SS.connect();
console.log("Local listening port: " + listenPort);
console.log("Gethering network interfaces...");
var inets = SYS.getNetworkInterfaces();