Skip to content

Commit eb9a861

Browse files
committed
Merge branch 'test'
2 parents 869223f + 425e798 commit eb9a861

File tree

3 files changed

+48
-41
lines changed

3 files changed

+48
-41
lines changed

index.js

+13-20
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ function startWebConfig() {
149149
// console.log(configData)
150150
res.send(JSON.stringify(sessionFile.get() || {}));
151151
});
152+
webApp.post('/wakeup', (req, res) => {
153+
// console.log('req: ', req.headers);
154+
logger.info(`Server Wakeup Received | Reason: (${req.headers.wakesrc})`);
155+
res.send("OK");
156+
});
152157
webApp.get('/checkVersion', (req, res) => {
153158
// console.log(configData)
154159
res.send(JSON.stringify(checkVersion()));
@@ -574,28 +579,12 @@ let remSessionItem = (key) => {
574579
sessionData = sessionFile.get();
575580
};
576581

577-
var clearSession = (url) => {
582+
var clearSession = () => {
578583
remSessionItem('csrf');
579584
remSessionItem('cookie');
580585
remSessionItem('cookieData');
581586
if (runTimeData.savedConfig.cookieData) delete runTimeData.savedConfig.cookieData;
582-
if (url) {
583-
let options = {
584-
method: 'DELETE',
585-
uri: url,
586-
json: true
587-
};
588-
reqPromise(options)
589-
.then((resp) => {
590-
// console.log('resp:', resp);
591-
if (resp) {
592-
logger.info(`** Sent Remove Alexa Cookie Data Request to ${configData.settings.hubPlatform} Successfully! **`);
593-
}
594-
})
595-
.catch((err) => {
596-
logger.error(`ERROR: Unable to send Alexa Cookie Data to ${configData.settings.hubPlatform}: ` + err.message);
597-
});
598-
}
587+
sendClearAuthToST();
599588
};
600589

601590
function getRemoteCookie(alexaOptions) {
@@ -656,7 +645,10 @@ function sendCookiesToEndpoint(url, cookieData) {
656645

657646
function isCookieValid(cookieData) {
658647
return new Promise(resolve => {
659-
if (!(cookieData && cookieData.loginCookie && cookieData.csrf)) resolve(false);
648+
if (!(cookieData && cookieData.loginCookie && cookieData.csrf)) {
649+
logger.error(`isCookieValid ERROR | Cookie or CSRF value not received!!!`);
650+
resolve(false);
651+
}
660652
reqPromise({
661653
method: 'GET',
662654
uri: `https://alexa.${configData.settings.amazonDomain}/api/bootstrap`,
@@ -675,10 +667,11 @@ function isCookieValid(cookieData) {
675667
// logger.info(`** Alexa Cookie Valid (${valid}) **`);
676668
resolve(valid);
677669
}
670+
resolve(true);
678671
})
679672
.catch((err) => {
680673
logger.error(`ERROR: Unable to validate Alexa Cookie Data: ` + err.message);
681-
resolve(false);
674+
resolve(true);
682675
});
683676
});
684677
}

package-lock.json

+33-19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "echo-speaks-server",
3-
"version": "2.4.0",
3+
"version": "2.4.1",
44
"author": "Anthony Santilli",
55
"contributors": [
66
{
@@ -20,7 +20,7 @@
2020
"express-remove-route": "1.0.0",
2121
"find-free-port": "^2.0.0",
2222
"getos": "^3.1.4",
23-
"http-proxy-middleware": "^0.20.0",
23+
"http-proxy-middleware": "^0.21.0",
2424
"http-proxy-response-rewrite": "^0.0.1",
2525
"https": "^1.0.0",
2626
"moment": "^2.24.0",

0 commit comments

Comments
 (0)