mirror of
https://github.com/screentinker/screentinker.git
synced 2026-08-13 22:03:13 -06:00
Adds a pluggable email transport so self-hosters without Azure/M365 can send
mail through any standard SMTP server (Postfix, Gmail, Mailgun, SendGrid, corp
relay). Graph stays the default; behavior is byte-for-byte unchanged when
EMAIL_TRANSPORT is unset or "graph".
- config: EMAIL_TRANSPORT ("graph"|"smtp", default graph) + SMTP_HOST/PORT/
SECURE/USER/PASSWORD/FROM.
- services/email.js: branch by transport behind the SAME public sendEmail()/
isConfigured() surface. SMTP via nodemailer (lazy-required, like MSAL).
Shared across both transports: the "[ScreenTinker] " subject prefix (unless
rawSubject), the GRAPH_DEV_RESTRICT_TO allow-list, html-from-text derivation,
and the never-throws contract (failures log + return sent:false). SMTP_SECURE
true=implicit TLS(465)/false=STARTTLS(587). Auth optional (unauthenticated
relay ok); SMTP_USER without SMTP_PASSWORD is flagged. SMTP_FROM parses
"Name <addr>". New emailConfigStatus() for startup diagnostics.
- server.js: startup logs the transport and a LOUD error when the selected
transport is partially configured (some fields set, others missing) or when
EMAIL_TRANSPORT is invalid (falls back to graph). A fully-unset transport
stays a silent stdout fallback (unchanged dev behavior).
- nodemailer ^6.9.16 added as a production dep (bundled in the Docker image).
- .env.example + README: SMTP config section, Gmail example, transport table.
- test/email-transport.test.js: 15 tests — transport selection, config
validation (missing/partial/invalid), SMTP message building (from/prefix/
fromName override/text alt), sendEmail routing (mocked nodemailer), rawSubject,
dev-restrict on smtp, and the smtp_error never-throws path.
462/462 server tests pass. Boot verified for all four states (configured,
misconfigured, invalid, default).
Closes #173
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
37 lines
968 B
JSON
37 lines
968 B
JSON
{
|
|
"name": "screentinker",
|
|
"version": "1.9.6",
|
|
"description": "ScreenTinker - Digital Signage Management Server",
|
|
"main": "server.js",
|
|
"scripts": {
|
|
"start": "node --env-file-if-exists=.env server.js",
|
|
"dev": "node --watch --env-file-if-exists=.env server.js",
|
|
"test": "node --test --test-concurrency=2"
|
|
},
|
|
"dependencies": {
|
|
"@azure/msal-node": "^5.2.1",
|
|
"archiver": "^7.0.1",
|
|
"bcryptjs": "^3.0.3",
|
|
"better-sqlite3": "^9.4.3",
|
|
"cors": "^2.8.5",
|
|
"express": "^4.18.2",
|
|
"express-rate-limit": "^8.3.1",
|
|
"google-auth-library": "^10.6.2",
|
|
"helmet": "^8.1.0",
|
|
"jsonwebtoken": "^9.0.3",
|
|
"multer": "^1.4.5-lts.1",
|
|
"nodemailer": "^6.9.16",
|
|
"otplib": "^12.0.1",
|
|
"qrcode": "^1.5.4",
|
|
"sharp": "^0.33.2",
|
|
"socket.io": "^4.7.2",
|
|
"stripe": "^20.4.1",
|
|
"unzipper": "^0.12.3",
|
|
"uuid": "^14.0.0"
|
|
},
|
|
"devDependencies": {
|
|
"js-yaml": "^4.2.0",
|
|
"socket.io-client": "^4.8.3"
|
|
}
|
|
}
|