GithubHelp home page GithubHelp logo

doganm95 / ewelink-rest-api-server Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 3.0 2.74 MB

Server-code accepting http requests to control ewelink devices

License: MIT License

JavaScript 96.65% Dockerfile 3.35%
ewelink itead docker server

ewelink-rest-api-server's People

Contributors

dependabot[bot] avatar doganm95 avatar nkrasko avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

ewelink-rest-api-server's Issues

Server not reading params.switch from POST

When posting to the Docker container using a body such as:

{  
    "params": {
        "switch": "on"
    },
    "deviceid": "xxxxxxx"
}

The server crashes and logs the following:

file:///usr/src/app/server/server.js:31
    const requestedActionOnDevice = req.body.params.switch != undefined && req.body.params.switch != "" ? String(req.body.params.switch) : undefined;
                                                    ^

TypeError: Cannot read property 'switch' of undefined
    at file:///usr/src/app/server/server.js:31:53
    at Layer.handle [as handle_request] (/usr/src/app/server/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/src/app/server/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/usr/src/app/server/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/usr/src/app/server/node_modules/express/lib/router/layer.js:95:5)
    at /usr/src/app/server/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/usr/src/app/server/node_modules/express/lib/router/index.js:335:12)
    at next (/usr/src/app/server/node_modules/express/lib/router/index.js:275:10)
    at jsonParser (/usr/src/app/server/node_modules/body-parser/lib/types/json.js:119:7)
    at Layer.handle [as handle_request] (/usr/src/app/server/node_modules/express/lib/router/layer.js:95:5)```

Authentication failed

Thank you very much for this work!

I am having a hard time to get the authentication right.
I am using the same username (my mailadres) and password as I am using to log in to the ewelink app.
I am in the Netherlands, and have set the region to "eu"

When starting, I see an error in the docker log:
Authentication failed. The application will continue and respond with the error message, to make sure you are informed.

I am in doubt of the right region, so i also tried "nl". In that case I get a docker log error:
FetchError: request to https://nl-api.coolkit.cc:8080/api/user/login failed, reason: getaddrinfo ENOTFOUND nl-api.coolkit.cc

Which makes me think my eu region is correct.

Should I use the same credentials as using in the ewelink app?

Kind regards

Secure and expose

Code should be secured against exploits/injections etc, so it can be exposed to the internet for external access by port forwarding.

every login try should be logged into a db, and successful logins should give a notification, possibly over tasker on android.

Container restart on file change

Container should detect file changes in any mounted volume and auto-restart on change detection.

comparison options:

  • by hash (resource hungry for big files)
  • by size (bad)
  • by date (probably best)

This would enable changing certs in the ssl directory and having the container restart automatically.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.