-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates Node to version 14, updates NPM modules (#335)
Major Upgrade of Node and NPM packages * Updates Node to version 14, updates dependencies to latest version. Updates ejs views to use updated ejs include syntax. Updates various methods due to NPM package updates and breaking changes. Replaces no longer maintained NPM libraries with alternatives. Signed-off-by: Dan Cunningham <[email protected]> * update readme to node 14 Signed-off-by: Dan Cunningham <[email protected]> * Fix updated APN methods and setters Signed-off-by: Dan Cunningham <[email protected]> * Refactors close logic due to Node upgrade changes to event order Signed-off-by: Dan Cunningham <[email protected]> * Updates APN2 for http/2 requireemnts, use new p8 auth key for PNS Signed-off-by: Dan Cunningham <[email protected]> * Updated FCM xmpp libray and logic Signed-off-by: Dan Cunningham <[email protected]>
- Loading branch information
1 parent
73bf3e5
commit c8274fe
Showing
43 changed files
with
5,567 additions
and
4,465 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,13 @@ | |
"jid": "[email protected]", | ||
"password": "password" | ||
}, | ||
"apn" : { | ||
"team": "PB1234567", | ||
"keyId": "BLABLA1", | ||
"host": "api.development.push.apple.com", | ||
"defaultTopic": "es.spaphone.openhab", | ||
"signingKey": "certs/aps/AuthKey.p8" | ||
}, | ||
"ifttt" : { | ||
"iftttChannelKey" : "key", | ||
"iftttTestToken" : "token" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,10 @@ | |
"key" : "some express key" | ||
}, | ||
"apn" : { | ||
"gateway": "gateway.push.apple.com", | ||
"cert": "certs/aps/aps_production_cert.pem", | ||
"key": "certs/aps/aps_production_key.pem", | ||
"passphrase": "passphrase" | ||
"team": "PB1234567", | ||
"keyId": "BLABLA1", | ||
"defaultTopic": "es.spaphone.openhab", | ||
"signingKey": "certs/aps/AuthKey.p8" | ||
}, | ||
"gcm" : { | ||
"jid": "[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,11 @@ | ||
var moment = require('moment'), | ||
tz = require('timezone/loaded'), | ||
time = require('time'); | ||
var { DateTime } = require('luxon'); | ||
|
||
module.exports = function (date, timezone) { | ||
var strftime_format = '%F %T %z', // used to convert a date into a normalized strftime format with timezone | ||
moment_format = 'YYYY-MM-DD HH:mm:ss zz'; // moment.js LDML format for parsing date strings | ||
|
||
/** | ||
* Convert a Javascript Date into node-time wrapper with the appropriate timezone. | ||
* @param date {Date} Javascript Date object | ||
* @param timezone {String} Olson timezone for this date (e.g. 'America/New_York') | ||
* @return node-time object with the appropriate timezone | ||
*/ | ||
var to_local = function (date, timezone) { | ||
var tz_date; | ||
|
||
if (timezone === 'undefined') { | ||
timezone = 'UTC'; | ||
} | ||
tz_date = new time.Date(date); | ||
tz_date.setTimezone(timezone); // localize the date into the specified timezone | ||
return local_datetime = tz(tz_date, strftime_format, timezone); // localized format w timezone offset | ||
} | ||
|
||
/** | ||
* Convert a Javascript Date into a Moment.js moment obj with the appropriate timezone. | ||
* Using the returned moment, you can call for example 'moment.calendar()' to get a | ||
* human readable relative time such as 'last Friday at 3:52 PM'. | ||
* @param date {Date} Javascript Date object | ||
* @param timezone {String} Olson timezone for this date (e.g. 'America/New_York') | ||
* @return moment with the appropriate timezone | ||
* @return luxon object with the appropriate timezone | ||
*/ | ||
var to_moment = function (date, timezone) { | ||
var local_datetime = to_local(date, timezone); | ||
return moment(local_datetime, moment_format); | ||
} | ||
|
||
return to_moment(date, timezone); | ||
return DateTime.fromJSDate(date).setZone(timezone || 'UTC') | ||
} |
Oops, something went wrong.