Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new command: "clean log v2" #350

Closed

Conversation

MVladislav
Copy link
Contributor

Add new command: "clean log v2"

See more general info and details under discussion.

  • Tested with Deebot T10 over HA - Deebot-4-Home-Assistant integration
  • Info
    • added api for app/dln/api/log/clean_result/list
    • authentication is updated for use of different api prefix
    • possible this will not fully work with official api, as the request send by POST and should be a GET, i tested it with the offline bumper version
Ecovacs Home App Home Assistant
clean_log_v2 clean_log_v2_home clean_log_v2_home_2

- requested over "app/dln/api/" api instead "api/"
- authentication is updated for use of different api prefix
Copy link

codecov bot commented Nov 15, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (8f6e947) 78.92% compared to head (60703f6) 79.21%.

Files Patch % Lines
deebot_client/authentication.py 25.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #350      +/-   ##
==========================================
+ Coverage   78.92%   79.21%   +0.28%     
==========================================
  Files          62       63       +1     
  Lines        2548     2583      +35     
  Branches      465      467       +2     
==========================================
+ Hits         2011     2046      +35     
  Misses        494      494              
  Partials       43       43              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@edenhaus edenhaus added the pr: new-feature PR, which adds a new feature label Nov 16, 2023
Comment on lines +39 to +47
"auth": json.dumps(
{
"with": "users",
"userid": credentials.user_id,
"realm": "ecouser.net",
"token": credentials.token,
"resource": device_info.resource,
}
),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that the auth must be passed as query param? Normally the authenticator will add it automatically but in the body...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from what the app sends as request yes, this is the communication captured over mitm:

request:

GET https://api-app.dc-eu.ww.ecouser.net/app/dln/api/log/clean_result/list?did=REPLACED_DID&res=Gy2C&country=DE&size=10&auth=REPLACED_AUTH&version=v2&logType=clean&before=1699152310000&lang=EN&et1=1699152310545&defaultLang=zh_cn&channel=google_play HTTP/2.0
country: DE
accept: application/json
sign: REPLACED_SIGN
userid: REPLACED_USER_ID
token: REPLACED_TOKEN
authorization: Bearer REPLACED_TOKEN
v: 2.4.1
appid: ecovacs
plat: android
lang: EN
content-type: application/json
ts: 1699152310572
ucid: REPLACED_UC_ID
accept-encoding: gzip
user-agent: okhttp/4.9.1
content-length: 0

response:

HTTP/2.0 200
content-type: application/json; charset=utf-8
date: Sun, 05 Nov 2023 02:45:10 GMT
content-length: 40

{"code":0,"message":"success","data":[]}

request as curl:

curl -H 'country: DE' -H 'accept: application/json' -H 'sign: REPLACED_SIGN' -H 'userid: REPLACED_USER_ID' -H 'token: REPLACED_TOKEN' -H 'authorization: Bearer REPLACED_TOKEN' -H 'v: 2.4.1' -H 'appid: ecovacs' -H 'plat: android' -H 'lang: EN' -H 'content-type: application/json' -H 'ts: 1699152310572' -H 'ucid: REPLACED_UC:ID' --compressed -H 'user-agent: okhttp/4.9.1' 'https://api-app.dc-eu.ww.ecouser.net/app/dln/api/log/clean_result/list?did=REPLACED_DID&res=Gy2C&country=DE&size=10&auth=REPLACED_AUTH&version=v2&logType=clean&before=1699152310000&lang=EN&et1=1699152310545&defaultLang=zh_cn&channel=google_play'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happen if we omit the auth in the query params?
Does the request still work?

@edenhaus edenhaus marked this pull request as draft December 4, 2023 17:42
@MVladislav
Copy link
Contributor Author

@MVladislav MVladislav closed this Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: new-feature PR, which adds a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants