homebridge-smtp-motion
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -5,4 +5,6 @@ "use strict"; | ||
}; | ||
const bunyan_1 = __importDefault(require("bunyan")); | ||
const http_1 = __importDefault(require("http")); | ||
const smtp_server_1 = require("smtp-server"); | ||
const http_1 = __importDefault(require("http")); | ||
const stream_1 = __importDefault(require("stream")); | ||
const PLUGIN_NAME = 'homebridge-smtp-motion'; | ||
@@ -23,3 +25,21 @@ const PLATFORM_NAME = 'smtpMotion'; | ||
const log = this.log; | ||
const server = new smtp_server_1.SMTPServer({ authOptional: true, onData(stream, session, callback) { | ||
const logStream = new stream_1.default.Writable({ | ||
write: (chunk, encoding, callback) => { | ||
const data = JSON.parse(chunk); | ||
this.log.debug('[SMTP Server] ' + data.msg); | ||
callback(); | ||
} | ||
}); | ||
const bunyanLog = bunyan_1.default.createLogger({ | ||
name: 'ftp', | ||
streams: [{ | ||
stream: logStream | ||
}] | ||
}); | ||
const server = new smtp_server_1.SMTPServer({ authOptional: true, | ||
disabledCommands: ['STARTTLS'], | ||
logger: bunyanLog, onAuth(auth, session, callback) { | ||
callback(null, { user: true }); | ||
}, | ||
onData(stream, session, callback) { | ||
stream.on('data', () => { }); | ||
@@ -29,3 +49,3 @@ stream.on('end', callback); | ||
const name = rcptTo.address.split('@')[0].replace(/\+/g, ' '); | ||
log.debug(name + ' Motion Detected!'); | ||
log('[' + name + '] Email received.'); | ||
try { | ||
@@ -35,3 +55,3 @@ http_1.default.get('http://127.0.0.1:' + httpPort + '/motion?' + name); | ||
catch (ex) { | ||
log.error(name + ': Error making HTTP call: ' + ex); | ||
log.error('[' + name + '] Error making HTTP call: ' + ex); | ||
} | ||
@@ -38,0 +58,0 @@ }); |
{ | ||
"displayName": "Homebridge SMTP Motion", | ||
"name": "homebridge-smtp-motion", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Converts SMTP messages into HTTP motion alerts that homebridge-camera-ffmpeg understands", | ||
@@ -28,4 +28,4 @@ "main": "dist/index.js", | ||
"format": "markdownlint --fix *.md", | ||
"lint": "eslint **/*.ts --fix", | ||
"lint-check": "eslint **/*.ts", | ||
"lint": "eslint src/*.ts --fix", | ||
"lint-check": "eslint src/*.ts", | ||
"prepare": "npm run build", | ||
@@ -39,3 +39,4 @@ "prepublishOnly": "npm run lint-check", | ||
"@typescript-eslint/parser": "^3.7.0", | ||
"@types/node": "14.0.25", | ||
"@types/bunyan": "^1.8.6", | ||
"@types/node": "14.0.26", | ||
"@types/smtp-server": "3.5.4", | ||
@@ -60,4 +61,5 @@ "eslint": "^7.5.0", | ||
"dependencies": { | ||
"bunyan": ">=1.8.14", | ||
"smtp-server": ">=3.7.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
11543
95
2
10
+ Addedbunyan@>=1.8.14
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedbunyan@2.0.5(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addeddtrace-provider@0.8.8(transitive)
+ Addedexeunt@1.1.0(transitive)
+ Addedglob@6.0.4(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedmoment@2.30.1(transitive)
+ Addedmv@2.1.1(transitive)
+ Addednan@2.19.0(transitive)
+ Addedncp@2.0.0(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedrimraf@2.4.5(transitive)
+ Addedsafe-json-stringify@1.2.0(transitive)
+ Addedwrappy@1.0.2(transitive)