From 6a96193ffc6cbf791a9e4682aba7cf23f79a4f9f Mon Sep 17 00:00:00 2001 From: lesion Date: Wed, 3 Jul 2019 16:33:03 +0200 Subject: [PATCH] v0.9.17 --- README.md | 5 ++++- nuxt.config.js | 6 +++--- package.json | 6 ++---- pages/admin.vue | 4 ++-- server/api/controller/export.js | 10 +++++++--- server/api/mail.js | 6 +++++- server/api/models/index.js | 2 +- server/index.js | 3 ++- 8 files changed, 26 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index c0f57d01..886744aa 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ ## gancio -### event manager for radical communities +### shared agenda for local communities > :warning: Gancio is under heavy development, > if something is not working as expected, it's expected :D + ## Install You will need `npm` or `yarn` installed in your system. @@ -34,3 +35,5 @@ yarn build yarn start ``` + +Made with :heart: by [underscore hacklab](https://autistici.org/underscore) \ No newline at end of file diff --git a/nuxt.config.js b/nuxt.config.js index 7e2ac89a..8dee98bd 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -13,9 +13,9 @@ 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' } - ], + // serverMiddleware: [ + // { path: '/api', handler: '@/server/api/index.js' } + // ], server: conf.server, diff --git a/package.json b/package.json index 3d9e12df..322fe6e9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gancio", - "version": "0.9.15", + "version": "0.9.17", "description": "A shared agenda for local communities", "author": "lesion", "scripts": { @@ -36,7 +36,6 @@ "dependencies": { "@nuxtjs/auth": "^4.6.5", "@nuxtjs/axios": "^5.5.3", - "arg": "^4.1.0", "axios": "^0.19.0", "bcrypt": "^3.0.5", "body-parser": "^1.18.3", @@ -54,11 +53,10 @@ "inquirer": "^6.3.1", "jsonwebtoken": "^8.5.1", "less": "^3.9.0", - "mastodon-api": "^1.3.0", + "mastodon-api": "lesion/mastodon-api", "morgan": "^1.9.1", "multer": "^1.4.1", "nuxt": "^2.8.1", - "nuxt-env": "^0.1.0", "nuxt-i18n": "^5.12.4", "pg": "^7.11.0", "sequelize": "^5.8.7", diff --git a/pages/admin.vue b/pages/admin.vue index c861c74b..8bff7736 100644 --- a/pages/admin.vue +++ b/pages/admin.vue @@ -42,8 +42,8 @@ @click='delete_user(data.row)') {{$t('admin.delete_user')}} div(v-else) span {{$t('common.me')}} - no-ssr - el-pagination(:page-size='perPage' :currentPage.sync='userPage' :total='users.length') + no-ssr + el-pagination(:page-size='perPage' :currentPage.sync='userPage' :total='users.length') //- PLACES el-tab-pane.pt-1 diff --git a/server/api/controller/export.js b/server/api/controller/export.js index ae464516..8c9c54df 100644 --- a/server/api/controller/export.js +++ b/server/api/controller/export.js @@ -1,4 +1,4 @@ -const { event: Event, place: Place } = require('../models') +const { event: Event, place: Place, tag: Tag } = require('../models') const { Op } = require('sequelize') const moment = require('moment') const ics = require('ics') @@ -9,11 +9,15 @@ const exportController = { const type = req.params.type const tags = req.query.tags const places = req.query.places + const where = {} const yesterday = moment().subtract('1', 'day').unix() + let where_tags = {} + if (tags) { - where.tag = tags.split(',') + where_tags = { where: { tag: tags.split(',') } } } + if (places) { where.placeId = places.split(',') } @@ -27,7 +31,7 @@ const exportController = { attributes: { exclude: ['createdAt', 'updatedAt'] }, - include: [{ model: Place, attributes: ['name', 'id', 'address'] }] + include: [ { model: Tag, ...where_tags }, { model: Place, attributes: ['name', 'id', 'address'] }] }) switch (type) { case 'feed': diff --git a/server/api/mail.js b/server/api/mail.js index fdea5681..2a198376 100644 --- a/server/api/mail.js +++ b/server/api/mail.js @@ -2,6 +2,7 @@ const Email = require('email-templates') const path = require('path') const moment = require('moment') const config = require('config') +const settings = require('./controller/settings') moment.locale('it') const mail = { @@ -23,7 +24,10 @@ const mail = { send: true, i18n: { directory: path.join(__dirname, '..', '..', 'locales', 'email'), - defaultLocale: 'it' + syncFiles: false, + updateFiles: false, + defaultLocale: settings.locale, + objectNotation: true }, transport: config.smtp }) diff --git a/server/api/models/index.js b/server/api/models/index.js index eb1266de..a2624f25 100644 --- a/server/api/models/index.js +++ b/server/api/models/index.js @@ -8,7 +8,7 @@ const db = {} const sequelize = new Sequelize(config.db) sequelize.authenticate().catch( e => { - consola.error('Error connecting to DB: ', e) + consola.error('Error connecting to DB: ', String(e)) process.exit(-1) }) diff --git a/server/index.js b/server/index.js index 1cec5ce8..5e04a4a8 100644 --- a/server/index.js +++ b/server/index.js @@ -26,9 +26,10 @@ async function start() { } - // Give nuxt middleware to express app.use(morgan('dev')) app.use('/media/', express.static(config.upload_path)) + app.use('/api', require('./api/index')) + // Give nuxt middleware to express app.use(nuxt.render) // Listen the server