ewelink-api icon indicating copy to clipboard operation
ewelink-api copied to clipboard

Connection through proxy not implemented

Open belichuk opened this issue 5 years ago • 1 comments

I used proxy in my local network for security reasons. But ewelink-api doesn't support proxy.

What was checked: src/mixins/getCredentials.js

const request = await fetch(`${this.getApiUrl()}/user/login`, {
  method: 'post',
  headers: { Authorization: `Sign ${makeAuthorizationSign(body)}` },
  body: JSON.stringify(body),
});

src/mixins/makeRequest.js

const payload = {
  method,
  headers: {
    Authorization: `Bearer ${this.at}`,
    'Content-Type': 'application/json',
  },
};
...
const request = await fetch(requestUrl, payload);

};

This could be solved in several ways, but most simple is to add package https-proxy-agent (see node-https-proxy-agent). @skydiver Let me know if you interesting to implement or approve PR to support proxy functionality.

belichuk avatar Sep 14 '20 12:09 belichuk

@belichuk sorry for the delay on the response 😳

today version 3.1 was merged and released, you're welcome to open that PR (if still interested)

skydiver avatar Oct 12 '20 23:10 skydiver