mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-06 23:52:38 -05:00
Added "/2/config" alias for config API.
This commit is contained in:
@@ -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())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user