1
This commit is contained in:
parent
af6c48e47b
commit
f86fdac6fe
8
server/bin/web3test/gm
Executable file
8
server/bin/web3test/gm
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
while true
|
||||
do
|
||||
read -p '> ' cmd
|
||||
curl "http://127.0.0.1:8331/webapp/index.php?c=GM&a=execCmd&cmd=${cmd}" |jq .
|
||||
echo ""
|
||||
done
|
@ -7,11 +7,7 @@ function add(name) {
|
||||
|
||||
function init() {
|
||||
add('proxy');
|
||||
}
|
||||
|
||||
function create(name) {
|
||||
|
||||
add('gm');
|
||||
}
|
||||
|
||||
exports.init = init;
|
||||
exports.create = create;
|
||||
|
19
server/web3test/controllers/gm.js
Normal file
19
server/web3test/controllers/gm.js
Normal file
@ -0,0 +1,19 @@
|
||||
const app = require('j7/app');
|
||||
const cmdHash = {};
|
||||
|
||||
async function execCmd(session) {
|
||||
const cmdLine = session.request('cmd').split('.');
|
||||
const cmd = cmdLine[0];
|
||||
const params = cmdLine.length > 1 ? [] : cmdLine.slice(1);
|
||||
if (cmdHash[cmd]) {
|
||||
cmdHash[cmd](session, params);
|
||||
} else {
|
||||
session.rspErr(404, 'not found');
|
||||
}
|
||||
}
|
||||
|
||||
function init() {
|
||||
app.registerHandler('GM', 'execCmd', execCmd);
|
||||
}
|
||||
|
||||
exports.init = init;
|
Loading…
x
Reference in New Issue
Block a user