add image for bots in ecovacs home
add endpoint for /api/pim/file/get so an image is displayed for bots in the ecovacs home app
This commit is contained in:
parent
3aefbe2fd8
commit
18f3a807f1
4 changed files with 20 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -17,6 +17,7 @@ tests/*
|
||||||
# Ignore logs/data/certs
|
# Ignore logs/data/certs
|
||||||
logs/*
|
logs/*
|
||||||
data/*
|
data/*
|
||||||
|
!data/web*
|
||||||
certs/*
|
certs/*
|
||||||
|
|
||||||
# Except README in logs/data/certs
|
# Except README in logs/data/certs
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import ssl
|
||||||
import string
|
import string
|
||||||
import random
|
import random
|
||||||
import bumper
|
import bumper
|
||||||
|
import os
|
||||||
from bumper.models import *
|
from bumper.models import *
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
@ -142,6 +143,7 @@ class ConfServer:
|
||||||
"/api/dim/devmanager.do", self.handle_dim_devmanager
|
"/api/dim/devmanager.do", self.handle_dim_devmanager
|
||||||
), # EcoVacs Home
|
), # EcoVacs Home
|
||||||
web.post("/lookup.do", self.handle_lookup),
|
web.post("/lookup.do", self.handle_lookup),
|
||||||
|
web.get("/api/pim/file/get/{id}", self.handle_pimFile)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
# Direct register from app:
|
# Direct register from app:
|
||||||
|
|
@ -1275,6 +1277,16 @@ class ConfServer:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
confserverlog.exception("{}".format(e))
|
confserverlog.exception("{}".format(e))
|
||||||
|
|
||||||
|
|
||||||
|
async def handle_pimFile(self, request):
|
||||||
|
try:
|
||||||
|
fileID = request.match_info.get("id", "")
|
||||||
|
|
||||||
|
return web.FileResponse(os.path.join(bumper.data_dir,"web","robotvac_image.jpg"))
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
confserverlog.exception("{}".format(e))
|
||||||
|
|
||||||
async def disconnect(self):
|
async def disconnect(self):
|
||||||
try:
|
try:
|
||||||
confserverlog.info("shutting down")
|
confserverlog.info("shutting down")
|
||||||
|
|
|
||||||
BIN
data/web/robotvac_image.jpg
Normal file
BIN
data/web/robotvac_image.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 143 KiB |
|
|
@ -497,6 +497,11 @@ async def test_getProductIotMap(aiohttp_client):
|
||||||
assert jsonresp["code"] == bumper.RETURN_API_SUCCESS
|
assert jsonresp["code"] == bumper.RETURN_API_SUCCESS
|
||||||
|
|
||||||
|
|
||||||
|
# Test getPimFile
|
||||||
|
resp = await client.get("/api/pim/file/get/123")
|
||||||
|
assert resp.status == 200
|
||||||
|
|
||||||
|
|
||||||
async def test_getUsersAPI(aiohttp_client):
|
async def test_getUsersAPI(aiohttp_client):
|
||||||
remove_existing_db()
|
remove_existing_db()
|
||||||
bumper.db = "tests/tmp.db" # Set db location for testing
|
bumper.db = "tests/tmp.db" # Set db location for testing
|
||||||
|
|
@ -906,3 +911,5 @@ async def test_dim_devmanager(aiohttp_client):
|
||||||
test_resp = json.loads(text)
|
test_resp = json.loads(text)
|
||||||
assert test_resp["ret"] == "fail"
|
assert test_resp["ret"] == "fail"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue