forked from Medicean/AS_Redis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d5b1558
Showing
24 changed files
with
3,182 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.DS_* | ||
|
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
module.exports = { | ||
list: { | ||
title: 'Configurations', | ||
add: 'Add', | ||
edit: 'Edit', | ||
del: 'Del', | ||
}, | ||
keyview: { | ||
title: 'Results', | ||
rename: { | ||
prompt: 'Rename Key', | ||
success: 'Rename Key success', | ||
error: 'Rename Key fail', | ||
}, | ||
del: { | ||
title: 'Delete Key', | ||
confirm: (name)=> antSword.noxss(`Are you sure to delete ${name}?`), | ||
success: 'Delete Key success', | ||
error: 'Delete Key fail', | ||
}, | ||
setttl: { | ||
title: 'Set TTL', | ||
success: 'Set TTL success', | ||
error: 'Set TTL fail', | ||
} | ||
}, | ||
detail: { | ||
title: 'Detail', | ||
save: { | ||
error: `Save fail`, | ||
success: `Save success`, | ||
}, | ||
}, | ||
error: { | ||
auth: (err) => antSword.noxss(`Authentication failed, error msg:${err}`), | ||
database: (err) => antSword.noxss(`Getting the database list failed.\n${err}`), | ||
nodatabase: (err) => antSword.noxss(`The database does not exist,${err}`), | ||
delconf: (err)=> antSword.noxss(`Delete configuration failed,error msg: ${err}`), | ||
getkeys: (err) => antSword.noxss(`Getting Key failed,error msg: ${err}`), | ||
notimpl: (typevalue) => antSword.noxss(`Type ${typevalue} not support.`), | ||
}, | ||
add: { | ||
form: { | ||
title: 'Add configuration', | ||
host: 'Address', | ||
passwd: 'Password', | ||
warning: 'Please fill in the whole!', | ||
success: 'Successfully add configuration!', | ||
}, | ||
toolbar: { | ||
add: 'Add', | ||
clear: 'Clear', | ||
} | ||
}, | ||
edit: { | ||
form: { | ||
title: 'Edit configuration', | ||
host: 'Address', | ||
passwd: 'Password', | ||
warning: 'Please fill in the whole!', | ||
success: 'Successfully edit configuration!', | ||
}, | ||
toolbar: { | ||
edit: 'Edit', | ||
clear: 'Clear', | ||
} | ||
}, | ||
del: { | ||
form: { | ||
title: 'Delete configuration', | ||
confirm: 'Are you sure you want to delete this configuration?', | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
const languages = { | ||
'en': 'English', | ||
'zh': '简体中文' | ||
} | ||
|
||
// 获取本地设置语言(如若没有,则获取浏览器语言 | ||
let lang = antSword['storage']('language', | ||
false, | ||
navigator.language.substr(0,2) | ||
); | ||
|
||
// 判断本地设置语言是否符合语言模板 | ||
lang = languages[lang] ? lang : 'en'; | ||
|
||
// 返回语言模板 | ||
let langModule = require(`./${lang}`); | ||
langModule.__languages__ = languages; | ||
|
||
module.exports = langModule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
module.exports = { | ||
list: { | ||
title: '配置列表', | ||
add: '添加', | ||
edit: '编辑', | ||
del: '删除', | ||
}, | ||
keyview: { | ||
title: '结果信息', | ||
rename: { | ||
prompt: '重命名 Key', | ||
success: '重命名Key成功', | ||
error: '重命名Key失败', | ||
}, | ||
del: { | ||
title: '删除 Key', | ||
confirm: (name)=> antSword.noxss(`确定要删除 ${name} 吗?`), | ||
success: '删除 Key 成功', | ||
error: '删除 Key 失败', | ||
}, | ||
setttl: { | ||
title: '设置 TTL', | ||
success: '设置 TTL 成功', | ||
error: '设置 TTL 失败', | ||
} | ||
}, | ||
detail: { | ||
title: '详细信息', | ||
save: { | ||
error: `保存失败`, | ||
success: `保存成功`, | ||
}, | ||
}, | ||
error: { | ||
auth: (err) => antSword.noxss(`认证失败, 原因:${err}`), | ||
database: (err) => antSword.noxss(`获取数据库列表失败!\n${err}`), | ||
nodatabase: (err) => antSword.noxss(`该数据库不存在,${err}`), | ||
delconf: (err)=> antSword.noxss(`删除配置失败,原因: ${err}`), | ||
getkeys: (err) => antSword.noxss(`获取 Key 失败,原因: ${err}`), | ||
notimpl: (typevalue) => antSword.noxss(`暂不支持${typevalue}类型的Key`), | ||
}, | ||
add: { | ||
form: { | ||
title: '添加配置', | ||
host: '连接地址', | ||
passwd: '连接密码', | ||
warning: '请填写完整!', | ||
success: '成功添加配置!', | ||
}, | ||
toolbar: { | ||
add: '添加', | ||
clear: '重置', | ||
} | ||
}, | ||
edit: { | ||
form: { | ||
title: '编辑配置', | ||
host: '连接地址', | ||
passwd: '连接密码', | ||
warning: '请填写完整!', | ||
success: '成功编辑配置!', | ||
}, | ||
toolbar: { | ||
edit: '编辑', | ||
clear: '重置', | ||
} | ||
}, | ||
del: { | ||
form: { | ||
title: '删除配置', | ||
confirm: '确定要删除该配置吗?', | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
'use strict' | ||
|
||
class Core { | ||
constructor(opt={}) { | ||
this.host = opt['host']||"127.0.0.1:6379"; | ||
} | ||
|
||
setHost(host) { | ||
this.host = host; | ||
} | ||
|
||
// 将 buffer 转为 base64 string | ||
encode(buffer) { | ||
return new Buffer(buffer).toString('base64'); | ||
} | ||
|
||
decode(str) { | ||
return new Buffer(str, 'base64'); | ||
} | ||
|
||
get template() { | ||
return { | ||
'php': (cmdbuf) => `$cmd=base64_decode("${this.encode(cmdbuf)}"); | ||
$conn=@stream_socket_client("tcp:https://${this.host}", $errno, $errstr, $timeout=30); | ||
if(!$conn){ | ||
echo "LUVSUiBDb25uZWN0aW9uIFJlZnVzZWQ="; | ||
}else{ | ||
@fwrite($conn,$cmd,strlen($cmd)); | ||
$resp=@fread($conn, 8196); | ||
@stream_set_blocking($conn,0); | ||
while($buf=@fread($conn,8196)){$resp.=$buf;} | ||
stream_set_blocking($conn, 1); | ||
echo base64_encode($resp); | ||
@stream_socket_shutdown($conn,STREAM_SHUT_RDWR); | ||
@fclose($conn); | ||
}`, | ||
'asp': (cmdbuf) => ``, | ||
'aspx': (cmdbuf) => ``, | ||
} | ||
} | ||
} | ||
|
||
module.exports = Core; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const Parser = require("redis-parser"); | ||
// var commands = require('redis-commands'); | ||
|
||
class RedisUtil { | ||
constructor() { | ||
this.replyarr = Array(); | ||
this.errarr = Array(); | ||
this.parser = this.initParser(); | ||
} | ||
initParser() { | ||
let that = this; | ||
return new Parser({ | ||
returnReply: (reply) => { | ||
that.replyarr.push(reply); | ||
that.errarr.push(""); | ||
}, | ||
returnError: (err) => { | ||
that.replyarr.push(""); | ||
that.errarr.push(err); | ||
}, | ||
returnFatalError: (err) => { | ||
that.replyarr.push(""); | ||
that.errarr.push(err); | ||
}, | ||
returnBuffers: true, | ||
}); | ||
} | ||
|
||
parseResponse(buffer, callback) { | ||
this.clear(); | ||
this.parser.execute(buffer); | ||
callback(this.replyarr, this.errarr); | ||
} | ||
|
||
clear() { | ||
this.replyarr = Array(); | ||
this.errarr = Array(); | ||
} | ||
|
||
/** | ||
* 将指令转成协议 | ||
* makeCommand("info", "all"); | ||
* makeCommand("config", "get", "dir"); | ||
* */ | ||
makeCommand(...args) { | ||
let cmds = Array(); | ||
cmds.push(`*${args.length}\r\n`); | ||
args.forEach((arg)=> { | ||
cmds.push(`\$${new Buffer(arg).length}\r\n${arg}\r\n`); | ||
}) | ||
return cmds.join("") | ||
} | ||
} | ||
|
||
module.exports = RedisUtil; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.