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

Download logs feature - Replace logger library #123

Merged
merged 4 commits into from
Mar 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bundle/
temp/
temp/
dist/
203 changes: 145 additions & 58 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"ip": "^1.1.5",
"is-online": "^8.2.1",
"joi": "^14.3.0",
"log4js": "^3.0.6",
"macaddress": "^0.2.9",
"miio": "^0.15.6",
"moment": "^2.23.0",
Expand All @@ -81,6 +80,7 @@
"suncalc": "^1.8.0",
"tsoa": "2.4.3",
"tuyapi": "^5.1.2",
"winston": "^3.2.1",
"yeelight-awesome": "^1.0.12"
},
"devDependencies": {
Expand Down Expand Up @@ -109,9 +109,9 @@
"del-cli": "^1.1.0",
"mocha": "^6.1.4",
"nyc": "^15.0.0",
"pkg": "^4.4.3",
"prettier": "^1.19.1",
"simple-git": "^1.121.0",
"pkg": "^4.4.3",
"ts-node": "^7.0.1",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
Expand Down
12 changes: 7 additions & 5 deletions backend/src/business-layer/remoteConnectionBl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ export class RemoteConnectionBl {
/** Start sending ack message interval */
setInterval(() => {
/** If status is not OK or Connection problem
* dont send ack message.
* (If remote server not set yet, ther is no point to try sending ack).
* don't send ack message.
* (If remote server not set yet, there is no point to try sending ack).
*/
if (this.remoteConnectionStatus !== 'connectionOK' && this.remoteConnectionStatus !== 'cantReachRemoteServer') {
return;
Expand Down Expand Up @@ -204,7 +204,7 @@ export class RemoteConnectionBl {
}

return new Promise<void | ErrorResponse>(async (resolve, reject) => {
await this.sendMessage({
this.sendMessage({
localMessagesType: 'unregisterAccount',
message: {
unregisterAccount: {
Expand Down Expand Up @@ -306,7 +306,7 @@ export class RemoteConnectionBl {
} catch (error) {}
}

/** Close manualy web socket to remote server */
/** Close manually web socket to remote server */
private closeRemoteConnection() {
try {
this.webSocketClient.disconnect();
Expand Down Expand Up @@ -504,15 +504,17 @@ export class RemoteConnectionBl {
request.set('Cookie', `session=${httpRequest.httpSession}`);
/** send request and wait for response */
const response = await request.send(httpRequest.httpBody);

/** send response back to remote server */
this.sendMessage({
localMessagesType: 'httpResponse',
message: {
httpResponse: {
requestId: httpRequest.requestId,
httpStatus: response.status,
httpBody: response.body,
httpBody: response.type === 'application/json' ? response.body : response.text,
httpSession: this.extractCookie(response.header),
httpHeaders: response.header,
},
},
});
Expand Down
Loading