Is there an api for admin panel?
Possible noob question.
I know on cryptonote universal there is url can enter with password to get all admin info in json?
Is there a way I can grab all the miners and their hashrates?
The admin page is at http://<your domain or your server IP>/admin.html, there is no /#/. (look https://github.com/Snipa22/nodejs-pool#deployment-via-installer step 6. )
Before this, you need to manually add a encrypted password to MySQL in table pool.users,
you can get the detailed implementation of the function at:
/lib/api.js
app.post('/authenticate', function (req, res) {
let hmac;
try{
hmac = crypto.createHmac('sha256', global.config.api.secKey).update(req.body.password).digest('hex');
} catch (e) {
return res.status(401).send({'success': false, msg: 'Invalid username/password'});
}
global.mysql.query("SELECT * FROM users WHERE username = ? AND ((pass IS null AND email = ?) OR (pass = ?))", [req.body.username, req.body.password, hmac]).then(function (rows) {
if (rows.length === 0) {
return res.status(401).send({'success': false, msg: 'Invalid username/password'});
}
let token = jwt.sign({id: rows[0].id, admin: rows[0].admin}, global.config.api.secKey, {expiresIn: '1d'});
return res.json({'success': true, 'msg': token});
});
});
I can login to the admin page I just want to grab the info so I can make my own app for phone
Is http://<your domain or your server IP>/admin.html#/workers ?
This api (GET http://<your domain or your server IP>:8001/admin/userList) response:
[
{
"paid": null,
"due": 359290257801668,
"address": "9tYwxk2EBJ2Ct9eYEcwUhE1QQuxbGNM6mYVUC4ew6B73Agk9MWFVR9rDCif2reRm7NNSemFhr2mwND5hzpnqZvgqBmiEpBp",
"workers": [ ],
"lastHash": 0,
"totalHashes": 0,
"hashRate": 0,
"goodShares": 0,
"badShares": 0
},
{
"paid": null,
"due": 1471716706066907,
"address": "9wRbY3jqnMPMfdg6Yjdavk4MkRP5Sin5ZCC3gLV2Ms2xcNoNZtkGSJL7TcEtxiTpcSbLmcZZqdWFGA5G6yEE83n1Ejzczi9",
"workers": [
{
"worker": "x",
"hashRate": 10,
"lastHash": 1524473102504,
"totalHashes": 241194,
"goodShares": 285
}
],
"lastHash": 1524473102504,
"totalHashes": 241194,
"hashRate": 10,
"goodShares": 285
},
{
"paid": null,
"due": 1370264730366597,
"address": "9wzvo1zrqMENeBqJW7dPLiWXQXByUtVZXi5yyN4aXy8ffBpu2NiWU3ABKpFVtwsvyueGqpEJgBoPNLj45oU3wZwtHaYE5fQ",
"workers": [
{
"worker": "x",
"hashRate": 39,
"lastHash": 1524473186632,
"totalHashes": 294730,
"goodShares": 327
}
],
"lastHash": 1524473186632,
"totalHashes": 294730,
"hashRate": 39,
"goodShares": 327
},
{
"paid": null,
"due": 598031670170919,
"address": "9zf7Ji3JU42LquuM8wdpkWgHVi5jp5MpLe7x1nM5dDED5TMftVcrcA1d7S35oqE6QyKFFYi62cqLvaWWDGFz9wC35ZjiptK",
"workers": [
{
"worker": "x",
"hashRate": 7,
"lastHash": 1524473143697,
"totalHashes": 82060,
"goodShares": 361
}
],
"lastHash": 1524473143697,
"totalHashes": 82060,
"hashRate": 7,
"goodShares": 361
},
{
"paid": null,
"due": 11466710354613,
"address": "A2GiJXHVj6MBo3vi3L1nfsWANepdDa741Z44RmbHxSLiJ3eEM6JWo15XBoAYZTsqGehEfNRrvzL7o8p1MaKsuXWuRLZiMSE",
"workers": [ ],
"lastHash": 0,
"totalHashes": 0,
"hashRate": 0,
"goodShares": 0,
"badShares": 0
},
{
"paid": null,
"due": 11466710354613,
"address": "A2Q5n5HEtHe9Wt43fiybAicDcBZneVminVUBJtUsP1R9KWv3bHXzo3sVoYBnnPMbwmAL8drmvwBVxSbMSTY63Mqv5ZGYKtS",
"workers": [ ],
"lastHash": 0,
"totalHashes": 0,
"hashRate": 0,
"goodShares": 0,
"badShares": 0
}
]
I want to use crontab to write it to a file. When I try
GET http://127.0.0.1:8001/admin/userList
on server get the error below also tried
curl -u Administrator:Password123 -X GET http://127.0.0.1:8001/admin/userList
{"success":false,"msg":"No token provided."}, sorry if stupid questions : P never done this before
This API requires administrator privileges, you need login system first. And you need to bring a cookie if you want to send a request from a third party.