Skip to content

Commit

Permalink
Update console.html
Browse files Browse the repository at this point in the history
  • Loading branch information
gnh1201 committed Jun 25, 2024
1 parent 0c393a1 commit b8fa3e6
Showing 1 changed file with 33 additions and 8 deletions.
41 changes: 33 additions & 8 deletions console.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ <h1>Caterpillar Proxy Web Console</h1>
"method": "",
"filename": null
};
var set_default_env = function(_env) {
for (k in _env) {
if (!(k in env)) {
env[k] = _env[k];
}
}
};
var pretty_jsonify = function(data) {
return JSON.stringify(data, null, 4);
};
Expand Down Expand Up @@ -166,21 +173,25 @@ <h1>Caterpillar Proxy Web Console</h1>
if (k == "method") {
this.set_prompt('method([[b;red;black]' + env.method + '])> ');

// method(relay_sendmail)
if (env.method == "relay_sendmail") {
set_default_env({
"mail_to": "[email protected]",
"mail_from": "[email protected]",
"mail_subject": "Important Message from System Administrator"
});
}

// method(relay_mysql_query)
if (env.method == "relay_mysql_query") {
var _env = {
set_default_env({
"mysql_hostname": "localhost",
"mysql_username": "root",
"mysql_password": null,
"mysql_database": null,
"mysql_port": "3306",
"mysql_charset": "utf8"
};

for (k in _env) {
if (!(k in env)) {
env[k] = _env[k];
}
}
});
}
}
},
Expand Down Expand Up @@ -243,6 +254,20 @@ <h1>Caterpillar Proxy Web Console</h1>
return;
}

// method(relay_sendmail)
if (env.method == "relay_sendmail") {
this.echo("From: " + env.mail_from + "\r\nTo: " + env.mail_to + "\r\nSubject: " + env.mail_subject);
this.read("Enter your message:\r\n", function(message) {
jsonrpc2_request(this, env.method, {
"to": env.mail_to,
"from": env.mail_from,
"subject": env.mail_subject,
"message": message
});
});
return;
}

// method(relay_mysql_query)
if (env.method == "relay_mysql_query") {
var _this = this;
Expand Down

0 comments on commit b8fa3e6

Please sign in to comment.