diff --git a/locales/email/it.json b/locales/email/it.json
index ff32d993..ba704515 100644
--- a/locales/email/it.json
+++ b/locales/email/it.json
@@ -2,8 +2,9 @@
"email.register.subject": "Richiesta registrazione ricevuta",
"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.recover.subject": "Recupero password",
"email.recover": "Ciao, hai richiesto un recupero della password su gancio.",
"email.press_here": "Premi qui",
"email.confirm.subject": "Registrazione confermata",
"email.user_confirm": "Ciao, il tuo account su {{config.title}} è stato creato. Confermalo."
-}
\ No newline at end of file
+}
diff --git a/nuxt.config.js b/nuxt.config.js
index 9ca6d657..f27ed32e 100644
--- a/nuxt.config.js
+++ b/nuxt.config.js
@@ -13,9 +13,6 @@ module.exports = {
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
},
dev: (process.env.NODE_ENV !== 'production'),
- //serverMiddleware: [
- //{ path: '/api', handler: '~/server/api/index.js' }
- //],
server: conf.server,
@@ -41,7 +38,7 @@ module.exports = {
'@/plugins/filters', // text filters, datetime, etc.
'@/plugins/vue-awesome', // icon
'@/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'
],
@@ -82,17 +79,17 @@ module.exports = {
** Build configuration
*/
build: {
- // optimization: {
- // splitChunks: {
- // cacheGroups: {
- // element: {
- // test: /[\\/]node_modules[\\/](element-ui)[\\/]/,
- // name: 'element-ui',
- // chunks: 'all'
- // }
- // }
- // }
- // },
+ optimization: {
+ splitChunks: {
+ cacheGroups: {
+ element: {
+ test: /[\\/]node_modules[\\/](element-ui)[\\/]/,
+ name: 'element-ui',
+ chunks: 'all'
+ }
+ }
+ }
+ },
transpile: [/^element-ui/, /^vue-awesome/],
splitChunks: {
layouts: true
diff --git a/package.json b/package.json
index 9ececb25..679c5f83 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,7 @@
"author": "lesion",
"scripts": {
"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",
"start": "cross-env sequelize db:migrate && NODE_ENV=production node server/cli.js",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
diff --git a/server/api/controller/user.js b/server/api/controller/user.js
index 621ebf11..40f06fe9 100644
--- a/server/api/controller/user.js
+++ b/server/api/controller/user.js
@@ -58,8 +58,10 @@ const userController = {
const old_path = path.join(config.upload_path, event.image_path)
const old_thumb_path = path.join(config.upload_path, 'thumb', event.image_path)
try {
- await fs.unlink(old_path)
- await fs.unlink(old_thumb_path)
+ console.error('media files not removed')
+ // TOFIX
+ // await fs.unlink(old_path)
+ // await fs.unlink(old_thumb_path)
} catch (e) {
console.error(e)
}
@@ -125,7 +127,7 @@ const userController = {
if (req.user)
federation.sendEvent(event, req.user)
- res.json(200)
+ // res.sendStatus(200)
// send notification (mastodon/email/confirmation)
// notifier.notifyEvent(event.id)
diff --git a/server/emails/recover/html.pug b/server/emails/recover/html.pug
index fb8a9b9c..86c3c7b6 100644
--- a/server/emails/recover/html.pug
+++ b/server/emails/recover/html.pug
@@ -1,3 +1,12 @@
-p= t('email.recover')
+
+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')
-#{t('email.press_here')}
\ No newline at end of file
+ hr
+ #{t('email.press_here')}
diff --git a/server/emails/recover/subject.pug b/server/emails/recover/subject.pug
index 6d0067a6..156103ca 100644
--- a/server/emails/recover/subject.pug
+++ b/server/emails/recover/subject.pug
@@ -1 +1 @@
-= `[Gancio] Richiesta password recovery`
+= `[#{config.title}] ${t('email.recover')}`
diff --git a/server/emails/user_confirm/html.pug b/server/emails/user_confirm/html.pug
index 4228d6d8..37f6aa32 100644
--- a/server/emails/user_confirm/html.pug
+++ b/server/emails/user_confirm/html.pug
@@ -1 +1,10 @@
-p !{t('email.user_confirm', { config, user })}
+
+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 })}
diff --git a/server/federation/comments.js b/server/federation/comments.js
index 319b307b..15ef55d0 100644
--- a/server/federation/comments.js
+++ b/server/federation/comments.js
@@ -4,15 +4,21 @@ const debug = require('debug')('fediverse:comment')
module.exports = {
async create (req, res) {
-
+ const body = req.body
//search for related event
const inReplyTo = body.object.inReplyTo
const match = inReplyTo.match(`${config.baseurl}/federation/m/(.*)`)
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 from %s to %s', req.body.actor, event.titles)
+ debug('comment coming for %s', inReplyTo)
+ 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({
activitypub_id: body.object.id,
diff --git a/server/federation/helpers.js b/server/federation/helpers.js
index 9b14ef99..35fc7a0f 100644
--- a/server/federation/helpers.js
+++ b/server/federation/helpers.js
@@ -1,5 +1,5 @@
const fetch = require('node-fetch')
-const request = require('request')
+// const request = require('request')
const crypto = require('crypto')
const config = require('config')
const httpSignature = require('http-signature')
@@ -29,29 +29,23 @@ const Helpers = {
console.error('header ', header)
console.error('requestTo ', toInbox)
console.error('host ', toOrigin.hostname)
- request({
- url: toInbox,
+ const response = await fetch(toInbox, {
headers: {
'Host': toOrigin.hostname,
'Date': d.toUTCString(),
'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',
- json: true,
- body: message
- }, function (error, response){
- if (error) {
- console.log('Error:', error, response.body)
- }
- else {
- console.log('Response:', response.body, response.statusCode, response.status, response.statusMessage)
- }
- })
+ body: JSON.stringify(message) })
+
+ console.log('Response:', response.body, response.statusCode, response.status, response.statusMessage)
},
async sendEvent(event, user) {
const followers = user.followers
for(let follower of followers) {
+ debug('Notify %s with event %s', follower, event.title)
const body = event.toAP(user.username, follower)
body['@context'] = 'https://www.w3.org/ns/activitystreams'
Helpers.signAndSend(body, user, follower)
diff --git a/server/federation/index.js b/server/federation/index.js
index 15199762..b092f333 100644
--- a/server/federation/index.js
+++ b/server/federation/index.js
@@ -38,7 +38,7 @@ router.post('/u/:name/inbox', Helpers.verifySignature, async (req, res) => {
Follows.follow(req, res)
break
case 'Undo':
- // unfollow || unlike
+ // unfollow || unlike || unboost
if (b.object.type === 'Follow') {
Follows.unfollow(req, res)
} else if (b.object.type === 'Like') {