Change image API port, added TLS support, fixed content-type header
This commit is contained in:
parent
871979105c
commit
38e5a1d9f2
6 changed files with 12 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
# esmBot Image API
|
||||
The esmBot image API is a combined HTTP and WebSocket API running on port 8080. The API supports very basic authentication, which is defined on the server via the PASS environment variable and is sent from the client via the Authentication header in both HTTP and WS requests.
|
||||
The esmBot image API is a combined HTTP and WebSocket API running on port 3762. The API supports very basic authentication, which is defined on the server via the PASS environment variable and is sent from the client via the Authentication header in both HTTP and WS requests.
|
||||
|
||||
## HTTP
|
||||
|
||||
|
|
|
@ -196,7 +196,8 @@ httpServer.on("request", async (req, res) => {
|
|||
contentType = "image/webp";
|
||||
break;
|
||||
}
|
||||
res.setHeader("Content-Type", contentType);
|
||||
if (contentType) res.setHeader("Content-Type", contentType);
|
||||
else res.setHeader("Content-Type", ext);
|
||||
const data = jobs.get(id).data;
|
||||
jobs.delete(id);
|
||||
return res.end(data, (err) => {
|
||||
|
@ -230,8 +231,8 @@ httpServer.on("error", (e) => {
|
|||
console.error("An HTTP error occurred: ", e);
|
||||
});
|
||||
|
||||
httpServer.listen(8080, () => {
|
||||
log("HTTP and WS listening on port 8080");
|
||||
httpServer.listen(3762, () => {
|
||||
log("HTTP and WS listening on port 3762");
|
||||
});
|
||||
|
||||
const runJob = (job, ws) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue