同步操作将从 赵建辉/rtty 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
You first need to send a command to the server through POST, the message format is as follows.
{"devid": "test", "username": "test", "password": "test", "cmd": "echo", "params": ["hello rtty"], "env": {"x": "12"}}
The devid, username, cmd in the message must be provided. Password, params, and env are optional. Params is a JSON array and env is a JSON object.
Then the server returns a unique token.
{"token":"7fb8dcfe3fee2129427276b692987338"}
Then use the token as a URL parameter to query the command execution result from the server. If the command is executed, the server will return the command execution result in json format.
{"code":0,"stdout":"aGVsbG8gcnR0eQo=","stderr":""}
The stdout and stderr in the response are base64 encoded.
If any of the steps fail, the server will return an error message in json format.
{"err": 1002, "msg":"device offline"}
All error codes are as follows
1001 invalid format
1002 device offline
1003 server is busy
1004 timeout
1005 pending
1006 invalid token
1 operation not permitted
2 not found
3 no mem
4 sys error
5 stdout+stderr is too big
function queryCmdResp(token) {
$.getJSON('https://your-server:5912/cmd?token=' + token, function(r) {
if (r.stdout) {
console.log(window.atob(r.stdout))
} else {
console.log(r)
}
});
}
var data = {devid: 'test', username: 'test', password: 'test', cmd: 'echo', params: ['hello rtty']};
$.post('http://your-server:5912/cmd', JSON.stringify(data), function(r) {
if (!r.token) {
console.log(r)
return;
}
setTimeout(function () {
queryCmdResp(r.token);
}, 100);
});
function queryCmdResp(token) {
axios.get('http://your-server:5912/cmd?token=' + token).then(function(r) {
var resp = r.data;
if (resp.stdout) {
console.log(window.atob(resp.stdout))
} else {
console.log(resp)
}
});
}
var data = {devid: 'test', username: 'test', password: 'test', cmd: 'echo', params: ['hello rtty']};
axios.post('http://your-server:5912/cmd', data).then(function(r) {
var resp = r.data;
if (!resp.token) {
console.log(r)
return;
}
setTimeout(function () {
queryCmdResp(resp.token);
}, 100);
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。