send emails with less spam points
This commit is contained in:
@@ -2,8 +2,9 @@
|
|||||||
"email.register.subject": "Richiesta registrazione ricevuta",
|
"email.register.subject": "Richiesta registrazione ricevuta",
|
||||||
"email.register": "Abbiamo ricevuto la richiesta di registrazione. La confermeremo quanto prima.\n Ciao",
|
"email.register": "Abbiamo ricevuto la richiesta di registrazione. La confermeremo quanto prima.\n Ciao",
|
||||||
"email.confirm": "Il tuo account su gancio è stato attivato e quindi puoi cominciare a pubblicare eventi",
|
"email.confirm": "Il tuo account su gancio è stato attivato e quindi puoi cominciare a pubblicare eventi",
|
||||||
|
"email.recover.subject": "Recupero password",
|
||||||
"email.recover": "Ciao, hai richiesto un recupero della password su gancio.",
|
"email.recover": "Ciao, hai richiesto un recupero della password su gancio.",
|
||||||
"email.press_here": "Premi qui",
|
"email.press_here": "Premi qui",
|
||||||
"email.confirm.subject": "Registrazione confermata",
|
"email.confirm.subject": "Registrazione confermata",
|
||||||
"email.user_confirm": "Ciao, il tuo account su <a href='{{config.baseurl}}'>{{config.title}}<a/> è stato creato. <a href='{{config.baseurl}}/user_confirm/{{user.recover_code}}'>Confermalo</a>."
|
"email.user_confirm": "Ciao, il tuo account su <a href='{{config.baseurl}}'>{{config.title}}<a/> è stato creato. <a href='{{config.baseurl}}/user_confirm/{{user.recover_code}}'>Confermalo</a>."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ module.exports = {
|
|||||||
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
|
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
|
||||||
},
|
},
|
||||||
dev: (process.env.NODE_ENV !== 'production'),
|
dev: (process.env.NODE_ENV !== 'production'),
|
||||||
//serverMiddleware: [
|
|
||||||
//{ path: '/api', handler: '~/server/api/index.js' }
|
|
||||||
//],
|
|
||||||
|
|
||||||
server: conf.server,
|
server: conf.server,
|
||||||
|
|
||||||
@@ -41,7 +38,7 @@ module.exports = {
|
|||||||
'@/plugins/filters', // text filters, datetime, etc.
|
'@/plugins/filters', // text filters, datetime, etc.
|
||||||
'@/plugins/vue-awesome', // icon
|
'@/plugins/vue-awesome', // icon
|
||||||
'@/plugins/axios', // axios baseurl configuration
|
'@/plugins/axios', // axios baseurl configuration
|
||||||
{ src: '@/plugins/v-calendar', ssr: false }, // calendar, TO-REDO
|
{ src: '@/plugins/v-calendar', ssr: false }, // calendar, fix ssr
|
||||||
'@/plugins/i18n.js'
|
'@/plugins/i18n.js'
|
||||||
],
|
],
|
||||||
|
|
||||||
@@ -82,17 +79,17 @@ module.exports = {
|
|||||||
** Build configuration
|
** Build configuration
|
||||||
*/
|
*/
|
||||||
build: {
|
build: {
|
||||||
// optimization: {
|
optimization: {
|
||||||
// splitChunks: {
|
splitChunks: {
|
||||||
// cacheGroups: {
|
cacheGroups: {
|
||||||
// element: {
|
element: {
|
||||||
// test: /[\\/]node_modules[\\/](element-ui)[\\/]/,
|
test: /[\\/]node_modules[\\/](element-ui)[\\/]/,
|
||||||
// name: 'element-ui',
|
name: 'element-ui',
|
||||||
// chunks: 'all'
|
chunks: 'all'
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
transpile: [/^element-ui/, /^vue-awesome/],
|
transpile: [/^element-ui/, /^vue-awesome/],
|
||||||
splitChunks: {
|
splitChunks: {
|
||||||
layouts: true
|
layouts: true
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"author": "lesion",
|
"author": "lesion",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev:nuxt": "cross-env NODE_ENV=development nuxt dev",
|
"dev:nuxt": "cross-env NODE_ENV=development nuxt dev",
|
||||||
"dev": "cross-env DEBUG=fediverse:* NODE_ENV=development nodemon server/index.js --watch server",
|
"dev": "cross-env DEBUG=fediverse:* NODE_ENV=development nuxt",
|
||||||
"build": "nuxt build",
|
"build": "nuxt build",
|
||||||
"start": "cross-env sequelize db:migrate && NODE_ENV=production node server/cli.js",
|
"start": "cross-env sequelize db:migrate && NODE_ENV=production node server/cli.js",
|
||||||
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
|
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
|
||||||
|
|||||||
@@ -58,8 +58,10 @@ const userController = {
|
|||||||
const old_path = path.join(config.upload_path, event.image_path)
|
const old_path = path.join(config.upload_path, event.image_path)
|
||||||
const old_thumb_path = path.join(config.upload_path, 'thumb', event.image_path)
|
const old_thumb_path = path.join(config.upload_path, 'thumb', event.image_path)
|
||||||
try {
|
try {
|
||||||
await fs.unlink(old_path)
|
console.error('media files not removed')
|
||||||
await fs.unlink(old_thumb_path)
|
// TOFIX
|
||||||
|
// await fs.unlink(old_path)
|
||||||
|
// await fs.unlink(old_thumb_path)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
@@ -125,7 +127,7 @@ const userController = {
|
|||||||
if (req.user)
|
if (req.user)
|
||||||
federation.sendEvent(event, req.user)
|
federation.sendEvent(event, req.user)
|
||||||
|
|
||||||
res.json(200)
|
// res.sendStatus(200)
|
||||||
|
|
||||||
// send notification (mastodon/email/confirmation)
|
// send notification (mastodon/email/confirmation)
|
||||||
// notifier.notifyEvent(event.id)
|
// notifier.notifyEvent(event.id)
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
p= t('email.recover')
|
<!DOCTYPE html>
|
||||||
|
html(lang="en")
|
||||||
|
head
|
||||||
|
meta(charset="UTF-8")
|
||||||
|
meta(name="viewport", content="width=device-width, initial-scale=1.0")
|
||||||
|
meta(http-equiv="X-UA-Compatible", content="ie=edge")
|
||||||
|
title #{config.title}
|
||||||
|
body
|
||||||
|
p= t('email.recover')
|
||||||
|
|
||||||
<a href="#{config.baseurl}/recover/#{user.recover_code}">#{t('email.press_here')}</a>
|
hr
|
||||||
|
<a href="#{config.baseurl}/recover/#{user.recover_code}">#{t('email.press_here')}</a>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
= `[Gancio] Richiesta password recovery`
|
= `[#{config.title}] ${t('email.recover')}`
|
||||||
|
|||||||
@@ -1 +1,10 @@
|
|||||||
p !{t('email.user_confirm', { config, user })}
|
<!DOCTYPE html>
|
||||||
|
html(lang="en")
|
||||||
|
head
|
||||||
|
meta(charset="UTF-8")
|
||||||
|
meta(name="viewport", content="width=device-width, initial-scale=1.0")
|
||||||
|
meta(http-equiv="X-UA-Compatible", content="ie=edge")
|
||||||
|
title #{config.title}
|
||||||
|
body
|
||||||
|
|
||||||
|
p !{t('email.user_confirm', { config, user })}
|
||||||
|
|||||||
@@ -4,15 +4,21 @@ const debug = require('debug')('fediverse:comment')
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
async create (req, res) {
|
async create (req, res) {
|
||||||
|
const body = req.body
|
||||||
//search for related event
|
//search for related event
|
||||||
const inReplyTo = body.object.inReplyTo
|
const inReplyTo = body.object.inReplyTo
|
||||||
const match = inReplyTo.match(`${config.baseurl}/federation/m/(.*)`)
|
const match = inReplyTo.match(`${config.baseurl}/federation/m/(.*)`)
|
||||||
if (!match || match.length<2) return res.status(404).send('Event not found!')
|
if (!match || match.length<2) return res.status(404).send('Event not found!')
|
||||||
const event = await Event.findByPk(Number(match[1]))
|
let event = await Event.findByPk(Number(match[1]))
|
||||||
|
|
||||||
if (!event) return res.status(404).send('Event not found!')
|
debug('comment coming for %s', inReplyTo)
|
||||||
debug('comment from %s to %s', req.body.actor, event.titles)
|
if (!event) {
|
||||||
|
// in reply to another comment...
|
||||||
|
const comment = await Comment.findByPk(inReplyTo, { include: [Event] })
|
||||||
|
if (!comment) return res.status(404).send('Not found')
|
||||||
|
event = comment.event
|
||||||
|
}
|
||||||
|
debug('comment from %s to "%s"', req.body.actor, event.title)
|
||||||
|
|
||||||
await Comment.create({
|
await Comment.create({
|
||||||
activitypub_id: body.object.id,
|
activitypub_id: body.object.id,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
const fetch = require('node-fetch')
|
const fetch = require('node-fetch')
|
||||||
const request = require('request')
|
// const request = require('request')
|
||||||
const crypto = require('crypto')
|
const crypto = require('crypto')
|
||||||
const config = require('config')
|
const config = require('config')
|
||||||
const httpSignature = require('http-signature')
|
const httpSignature = require('http-signature')
|
||||||
@@ -29,29 +29,23 @@ const Helpers = {
|
|||||||
console.error('header ', header)
|
console.error('header ', header)
|
||||||
console.error('requestTo ', toInbox)
|
console.error('requestTo ', toInbox)
|
||||||
console.error('host ', toOrigin.hostname)
|
console.error('host ', toOrigin.hostname)
|
||||||
request({
|
const response = await fetch(toInbox, {
|
||||||
url: toInbox,
|
|
||||||
headers: {
|
headers: {
|
||||||
'Host': toOrigin.hostname,
|
'Host': toOrigin.hostname,
|
||||||
'Date': d.toUTCString(),
|
'Date': d.toUTCString(),
|
||||||
'Signature': header,
|
'Signature': header,
|
||||||
'Content-Type': 'application/activity+json; charset=utf-8'
|
'Content-Type': 'application/activity+json; charset=utf-8',
|
||||||
|
'Accept': 'application/activity+json, application/json; chartset=utf-8'
|
||||||
},
|
},
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
json: true,
|
body: JSON.stringify(message) })
|
||||||
body: message
|
|
||||||
}, function (error, response){
|
console.log('Response:', response.body, response.statusCode, response.status, response.statusMessage)
|
||||||
if (error) {
|
|
||||||
console.log('Error:', error, response.body)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.log('Response:', response.body, response.statusCode, response.status, response.statusMessage)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
async sendEvent(event, user) {
|
async sendEvent(event, user) {
|
||||||
const followers = user.followers
|
const followers = user.followers
|
||||||
for(let follower of followers) {
|
for(let follower of followers) {
|
||||||
|
debug('Notify %s with event %s', follower, event.title)
|
||||||
const body = event.toAP(user.username, follower)
|
const body = event.toAP(user.username, follower)
|
||||||
body['@context'] = 'https://www.w3.org/ns/activitystreams'
|
body['@context'] = 'https://www.w3.org/ns/activitystreams'
|
||||||
Helpers.signAndSend(body, user, follower)
|
Helpers.signAndSend(body, user, follower)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ router.post('/u/:name/inbox', Helpers.verifySignature, async (req, res) => {
|
|||||||
Follows.follow(req, res)
|
Follows.follow(req, res)
|
||||||
break
|
break
|
||||||
case 'Undo':
|
case 'Undo':
|
||||||
// unfollow || unlike
|
// unfollow || unlike || unboost
|
||||||
if (b.object.type === 'Follow') {
|
if (b.object.type === 'Follow') {
|
||||||
Follows.unfollow(req, res)
|
Follows.unfollow(req, res)
|
||||||
} else if (b.object.type === 'Like') {
|
} else if (b.object.type === 'Like') {
|
||||||
|
|||||||
Reference in New Issue
Block a user