Added an API endpoint that triggers an RSS campaign.
This commit is contained in:
parent
e786964411
commit
428fb9db7b
8 changed files with 88 additions and 7 deletions
|
@ -312,7 +312,6 @@ class CampaignSender {
|
|||
const sendConfiguration = this.sendConfiguration;
|
||||
|
||||
const {html, text, attachments} = await this._getMessage(campaign, list, subscriptionGrouped, mergeTags, true);
|
||||
console.log(html);
|
||||
|
||||
const campaignAddress = [campaign.cid, list.cid, subscriptionGrouped.cid].join('.');
|
||||
|
||||
|
|
|
@ -5,10 +5,12 @@ const log = require('./log');
|
|||
const path = require('path');
|
||||
const senders = require('./senders');
|
||||
|
||||
let messageTid = 0;
|
||||
let feedcheckProcess;
|
||||
|
||||
module.exports = {
|
||||
spawn
|
||||
spawn,
|
||||
scheduleCheck
|
||||
};
|
||||
|
||||
function spawn(callback) {
|
||||
|
@ -34,3 +36,13 @@ function spawn(callback) {
|
|||
log.error('Feed', 'Feedcheck process exited with code %s signal %s', code, signal);
|
||||
});
|
||||
}
|
||||
|
||||
function scheduleCheck() {
|
||||
feedcheckProcess.send({
|
||||
type: 'scheduleCheck',
|
||||
tid: messageTid
|
||||
});
|
||||
|
||||
messageTid++;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,15 +86,18 @@ module.exports.loggedIn = (req, res, next) => {
|
|||
};
|
||||
|
||||
module.exports.authByAccessToken = (req, res, next) => {
|
||||
if (!req.query.access_token) {
|
||||
const accessToken = req.get('access-token') || req.query.access_token
|
||||
|
||||
if (!accessToken) {
|
||||
res.status(403);
|
||||
res.json({
|
||||
error: 'Missing access_token',
|
||||
data: []
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
users.getByAccessToken(req.query.access_token).then(user => {
|
||||
users.getByAccessToken(accessToken).then(user => {
|
||||
req.user = user;
|
||||
next();
|
||||
}).catch(err => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue