Restored "GET /1/summary" endpoint.
This commit is contained in:
parent
691b2fabbf
commit
d9164c0b7b
14 changed files with 199 additions and 108 deletions
|
@ -28,8 +28,7 @@
|
|||
|
||||
xmrig::ApiRequest::ApiRequest(Source source, bool restricted) :
|
||||
m_restricted(restricted),
|
||||
m_source(source),
|
||||
m_state(STATE_NEW)
|
||||
m_source(source)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -43,10 +43,15 @@ protected:
|
|||
inline bool isDone() const override { return m_state == STATE_DONE; }
|
||||
inline bool isNew() const override { return m_state == STATE_NEW; }
|
||||
inline bool isRestricted() const override { return m_restricted; }
|
||||
inline int version() const override { return m_version; }
|
||||
inline RequestType type() const override { return m_type; }
|
||||
inline Source source() const override { return m_source; }
|
||||
inline void accept() override { m_state = STATE_ACCEPTED; }
|
||||
inline void done(int) override { m_state = STATE_DONE; }
|
||||
|
||||
int m_version = 1;
|
||||
RequestType m_type = REQ_UNKNOWN;
|
||||
|
||||
private:
|
||||
enum State {
|
||||
STATE_NEW,
|
||||
|
@ -56,7 +61,7 @@ private:
|
|||
|
||||
bool m_restricted;
|
||||
Source m_source;
|
||||
State m_state;
|
||||
State m_state = STATE_NEW;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -35,6 +35,17 @@ xmrig::HttpApiRequest::HttpApiRequest(const HttpData &req, bool restricted) :
|
|||
m_res(req.id()),
|
||||
m_url(req.url.c_str())
|
||||
{
|
||||
if (method() == METHOD_GET) {
|
||||
if (url() == "/1/summary" || url() == "/2/summary" || url() == "/api.json") {
|
||||
m_type = REQ_SUMMARY;
|
||||
}
|
||||
}
|
||||
|
||||
if (url().size() > 4) {
|
||||
if (memcmp(url().data(), "/2/", 3) == 0) {
|
||||
m_version = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue