Compare commits
2 Commits
5b17eb15a2
...
04abff06ec
| Author | SHA1 | Date | |
|---|---|---|---|
| 04abff06ec | |||
| 52d5a314de |
@@ -15,7 +15,18 @@ import { indexApi } from './manticore.js';
|
||||
import { fetchScenesById } from './scenes.js';
|
||||
|
||||
const logger = initLogger();
|
||||
const resend = new Resend(config.email.apiKey);
|
||||
const resend = (() => {
|
||||
if (config.email.enabled) {
|
||||
try {
|
||||
return new Resend(config.email.apiKey);
|
||||
}
|
||||
catch (error) {
|
||||
logger.error(`Failed to initialize Resend: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
})();
|
||||
|
||||
function getImagePath(media) {
|
||||
if (!media) {
|
||||
@@ -441,6 +452,11 @@ async function sendEmailAlerts() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!resend) {
|
||||
logger.warn('E-mails are enabled, but Resend is not initialized');
|
||||
return;
|
||||
}
|
||||
|
||||
const qualifyingUsers = await knex('notifications')
|
||||
.select('users.id as user_id', 'users.settings', knex.raw('max(emailed_at) as last_email'))
|
||||
.where('notifications.email', true)
|
||||
|
||||
Reference in New Issue
Block a user