mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 10:01:06 +00:00
Added "/2/config" alias for config API.
This commit is contained in:
parent
46f1661fd9
commit
3c5cb142cb
1 changed files with 10 additions and 2 deletions
|
@ -57,6 +57,14 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
static const char *kConfigPathV1 = "/1/config";
|
||||||
|
static const char *kConfigPathV2 = "/2/config";
|
||||||
|
|
||||||
|
} // namespace xmrig
|
||||||
|
|
||||||
|
|
||||||
class xmrig::BasePrivate
|
class xmrig::BasePrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -296,7 +304,7 @@ void xmrig::Base::onFileChanged(const String &fileName)
|
||||||
void xmrig::Base::onRequest(IApiRequest &request)
|
void xmrig::Base::onRequest(IApiRequest &request)
|
||||||
{
|
{
|
||||||
if (request.method() == IApiRequest::METHOD_GET) {
|
if (request.method() == IApiRequest::METHOD_GET) {
|
||||||
if (request.url() == "/1/config") {
|
if (request.url() == kConfigPathV1 || request.url() == kConfigPathV2) {
|
||||||
if (request.isRestricted()) {
|
if (request.isRestricted()) {
|
||||||
return request.done(403);
|
return request.done(403);
|
||||||
}
|
}
|
||||||
|
@ -306,7 +314,7 @@ void xmrig::Base::onRequest(IApiRequest &request)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (request.method() == IApiRequest::METHOD_PUT || request.method() == IApiRequest::METHOD_POST) {
|
else if (request.method() == IApiRequest::METHOD_PUT || request.method() == IApiRequest::METHOD_POST) {
|
||||||
if (request.url() == "/1/config") {
|
if (request.url() == kConfigPathV1 || request.url() == kConfigPathV2) {
|
||||||
request.accept();
|
request.accept();
|
||||||
|
|
||||||
if (!reload(request.json())) {
|
if (!reload(request.json())) {
|
||||||
|
|
Loading…
Reference in a new issue