Update catproxy.js

This commit is contained in:
Namhyeon Go 2024-07-01 01:29:24 +09:00 committed by GitHub
parent 2f974727d6
commit c0e2b7731a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,7 @@
// catproxy.js
// Integration with [Caterpillar Proxy](https://github.com/gnh1201/caterpillar) project
// https://github.com/gnh1201/welsonjs
// Caterpillar Proxy Integration for WelsonJS framework
// https://github.com/gnh1201/welsonjs
// https://github.com/gnh1201/caterpillar
var JSONRPC2 = require("lib/jsonrpc2");
function CatProxyClient(url) {
@ -32,12 +33,13 @@ function CatProxyClient(url) {
}
}
this.exec = function() {
var args = arguments;
var args = Array.from(arguments);
var rpc = JSONRPC2.create(env.target);
var result;
if (env.method == "relay_mysql_query") {
var query = arguments.join(' ');
rpc.invoke(env.method, {
var query = args.join(' ');
result = rpc.invoke(env.method, {
"hostname": env.mysql_hostname,
"username": env.mysql_username,
"password": env.mysql_password,
@ -46,10 +48,11 @@ function CatProxyClient(url) {
"charset": env.mysql_charset,
"query": query
}, null);
return;
} else {
result = rpc.invoke(env.method, {}, null);
}
rpc.invoke(env.method, {}, null);
return result;
}
}
@ -60,7 +63,7 @@ function create(url) {
exports.create = create;
exports.CatProxyClient = CatProxyClient;
exports.VERSIONINFO = "Caterpillar Proxy Integration (caterpillar.js) version 0.1.2";
exports.VERSIONINFO = "Caterpillar Proxy Integration (caterpillar.js) version 0.1.3";
exports.AUTHOR = "abuse@catswords.net";
exports.global = global;
exports.require = global.require;