From 745b9247c94d14dbdf019d204ed5383a067af32c Mon Sep 17 00:00:00 2001
From: lesion
Date: Thu, 30 May 2019 12:12:51 +0200
Subject: [PATCH] .
---
.vscode/vscode-kanban.json | 66 +++++----
components/Calendar.vue | 23 ++--
components/Home.vue | 22 ++-
components/Search.vue | 26 +---
layouts/iframe.vue | 4 +-
locales/en.js | 3 +
locales/es.js | 3 +
locales/it.js | 125 ++++++++++++++++++
.../20190521100417-act_ids_comment_data.js | 30 +++++
migrations/20190522104158-bigint.js | 27 ++++
migrations/20190527205032-tag_id_weight.js | 29 ++++
models/index.js | 37 ++++++
package.json | 2 +-
pages/add/_edit.vue | 15 +--
pages/admin.vue | 4 +-
pages/embed/list.vue | 11 +-
pages/event/_id.vue | 4 +-
pages/export.vue | 19 ++-
pages/recover/_code.vue | 52 ++++++++
pages/register.vue | 5 +-
plugins/filters.js | 4 +-
plugins/initialize.js | 9 ++
server/api/auth.js | 1 +
server/api/controller/bot.js | 1 +
server/api/controller/event.js | 36 ++---
server/api/controller/export.js | 19 ++-
server/api/controller/user.js | 13 +-
server/api/models/event.js | 4 +-
server/api/models/user.js | 2 +-
server/emails/confirm/html.pug | 4 +
server/emails/event/html.pug | 18 +++
server/emails/event/subject.pug | 1 +
server/emails/mail.css | 8 ++
server/emails/recover/html.pug | 3 +
server/emails/recover/subject.pug | 1 +
server/emails/register/html.pug | 6 +
server/emails/register/subject.pug | 1 +
server/index.js | 4 +
server/{cron.js => notifier.js} | 17 ++-
static/favicon.ico | Bin 1150 -> 4286 bytes
static/gancio.png | Bin 0 -> 4711 bytes
store/index.js | 33 ++---
widgets/examples/index.html | 17 ---
widgets/list/index.html | 0
widgets/list/index.js | 12 --
widgets/list/style.css | 3 -
46 files changed, 543 insertions(+), 181 deletions(-)
create mode 100644 locales/en.js
create mode 100644 locales/es.js
create mode 100644 locales/it.js
create mode 100644 migrations/20190521100417-act_ids_comment_data.js
create mode 100644 migrations/20190522104158-bigint.js
create mode 100644 migrations/20190527205032-tag_id_weight.js
create mode 100644 models/index.js
create mode 100644 pages/recover/_code.vue
create mode 100644 plugins/initialize.js
create mode 100644 server/emails/confirm/html.pug
create mode 100644 server/emails/event/html.pug
create mode 100644 server/emails/event/subject.pug
create mode 100644 server/emails/mail.css
create mode 100644 server/emails/recover/html.pug
create mode 100644 server/emails/recover/subject.pug
create mode 100644 server/emails/register/html.pug
create mode 100644 server/emails/register/subject.pug
rename server/{cron.js => notifier.js} (83%)
create mode 100644 static/gancio.png
delete mode 100644 widgets/examples/index.html
delete mode 100644 widgets/list/index.html
delete mode 100644 widgets/list/index.js
delete mode 100644 widgets/list/style.css
diff --git a/.vscode/vscode-kanban.json b/.vscode/vscode-kanban.json
index cfcc8869..afb914a9 100644
--- a/.vscode/vscode-kanban.json
+++ b/.vscode/vscode-kanban.json
@@ -31,6 +31,18 @@
"title": "export page",
"type": "bug"
},
+ {
+ "assignedTo": {
+ "name": "lesion"
+ },
+ "category": "feature",
+ "creation_time": "2019-04-23T19:55:59.993Z",
+ "id": "10",
+ "prio": 1,
+ "references": [],
+ "title": "gestione errori form aggiungi evento",
+ "type": "bug"
+ },
{
"assignedTo": {
"name": "lesion"
@@ -73,6 +85,15 @@
}
],
"in-progress": [
+ {
+ "assignedTo": {
+ "name": "lesion"
+ },
+ "creation_time": "2019-04-30T22:00:29.237Z",
+ "id": "17",
+ "references": [],
+ "title": "porcoddio la config arriva anche al client ovviamente, devo separare!"
+ },
{
"assignedTo": {
"name": "lesion"
@@ -85,18 +106,6 @@
],
"testing": [],
"todo": [
- {
- "assignedTo": {
- "name": "lesion"
- },
- "category": "feature",
- "creation_time": "2019-04-23T19:55:59.993Z",
- "id": "10",
- "prio": 1,
- "references": [],
- "title": "gestione errori form aggiungi evento",
- "type": "bug"
- },
{
"assignedTo": {
"name": "lesion"
@@ -168,6 +177,24 @@
"references": [],
"title": "colori te prego!"
},
+ {
+ "assignedTo": {
+ "name": "lesion"
+ },
+ "creation_time": "2019-05-27T20:42:22.581Z",
+ "id": "24",
+ "references": [],
+ "title": "copy to clipboard"
+ },
+ {
+ "assignedTo": {
+ "name": "lesion"
+ },
+ "creation_time": "2019-05-29T13:08:20.887Z",
+ "id": "25",
+ "references": [],
+ "title": "creazione script di backup"
+ },
{
"assignedTo": {
"name": "lesion"
@@ -214,15 +241,6 @@
"references": [],
"title": "popup sul calendario"
},
- {
- "assignedTo": {
- "name": "lesion"
- },
- "creation_time": "2019-04-30T22:00:29.237Z",
- "id": "17",
- "references": [],
- "title": "porcoddio la config arriva anche al client ovviamente, devo separare!"
- },
{
"assignedTo": {
"name": "lesion"
@@ -259,10 +277,10 @@
"assignedTo": {
"name": "lesion"
},
- "creation_time": "2019-05-27T20:42:22.581Z",
- "id": "24",
+ "creation_time": "2019-05-29T13:10:04.463Z",
+ "id": "26",
"references": [],
- "title": "copy to clipboard"
+ "title": "v-calendar colori e eventi multidays..."
}
]
}
\ No newline at end of file
diff --git a/components/Calendar.vue b/components/Calendar.vue
index fb0b8a92..5ecd0b44 100644
--- a/components/Calendar.vue
+++ b/components/Calendar.vue
@@ -7,7 +7,6 @@
:attributes='attributes'
:from-page.sync='page'
is-expanded
- show-clear-margin
is-inline
@dayclick='click')
@@ -15,7 +14,7 @@
@@ -36,5 +40,19 @@ section {
width: 100%;
max-width: 1500px;
margin: 0 auto;
+
+ .top {
+ position: fixed;
+ bottom: 10px;
+ right: 10px;
+ z-index: 1;
+ opacity: 0.7;
+ font-size: 16px;
+ }
+
+ .totop {
+ position: absolute;
+ top: 0px;
+ }
}
diff --git a/components/Search.vue b/components/Search.vue
index 16280382..5080cbd4 100644
--- a/components/Search.vue
+++ b/components/Search.vue
@@ -23,7 +23,6 @@
-
diff --git a/layouts/iframe.vue b/layouts/iframe.vue
index 858c52d1..2cc8469e 100644
--- a/layouts/iframe.vue
+++ b/layouts/iframe.vue
@@ -1,3 +1,3 @@
-
- nuxt
+
+
diff --git a/locales/en.js b/locales/en.js
new file mode 100644
index 00000000..f01ae3b9
--- /dev/null
+++ b/locales/en.js
@@ -0,0 +1,3 @@
+{
+ "registration_email": "registration_email"
+}
\ No newline at end of file
diff --git a/locales/es.js b/locales/es.js
new file mode 100644
index 00000000..f01ae3b9
--- /dev/null
+++ b/locales/es.js
@@ -0,0 +1,3 @@
+{
+ "registration_email": "registration_email"
+}
\ No newline at end of file
diff --git a/locales/it.js b/locales/it.js
new file mode 100644
index 00000000..99abf698
--- /dev/null
+++ b/locales/it.js
@@ -0,0 +1,125 @@
+const it = {
+ common: {
+ add_event: 'Nuovo evento',
+ next: 'Continua',
+ export: 'Esporta',
+ send: 'Invia',
+ where: 'Dove',
+ address: 'Indirizzo',
+ when: 'Quando',
+ what: 'Cosa',
+ media: 'Media',
+ login: 'Entra',
+ email: 'Email',
+ password: 'Password',
+ register: 'Registrati',
+ description: 'Descrizione',
+ remove: 'Elimina',
+ hide: 'Nascondi',
+ search: 'Cerca',
+ edit: 'Modifica',
+ info: 'Info',
+ confirm: 'Conferma',
+ admin: 'Amministra',
+ users: 'Utenti',
+ events: 'Eventi',
+ places: 'Luoghi',
+ settings: 'Opzioni',
+ actions: 'Azioni',
+ deactivate: 'Disattiva',
+ remove_admin: 'Rimuovi Admin',
+ activate: 'Attiva',
+ save: 'Salva',
+ preview: 'Anteprima',
+ logout: 'Esci',
+ share: 'Esporta',
+ name: 'Nome',
+ associate: 'Associa',
+ edit_event: 'Modifica evento',
+ related: 'Memoria storica',
+ add: 'Aggiungi',
+ logout_ok: 'Uscita correttamente',
+ copy: 'Copia'
+ },
+
+ login: {
+ description: `Entrando puoi pubblicare nuovi eventi.`,
+ check_email: 'Controlla la tua posta (anche lo spam)',
+ not_registered: 'Non sei registrata?',
+ forgot_password: 'Dimenticato la password?',
+ error: 'Errore: ',
+ insert_email: 'Inserisci la mail',
+ ok: 'Tutto rego'
+ },
+
+ export: {
+ intro: `Contrariamente alle piattaforme del capitalismo, che fanno di tutto per tenere
+ i dati e gli utenti al loro interno, crediamo che le informazioni, come le persone,
+ debbano essere libere. Per questo puoi rimanere aggiornata sugli eventi che vuoi, come meglio credi, senza necessariamente passare da questo sito.`,
+ email_description: `Puoi ricevere via mail gli eventi che ti interessano.`,
+ insert_your_address: 'Indirizzo email',
+ feed_description: `Per seguire gli aggiornamenti da computer o smartphone senza la necessità di aprire periodicamente il sito, il metodo consigliato è quello dei Feed RSS.
+
+ Con i feed rss utilizzi un'apposita applicazione per ricevere aggiornamenti dai siti che più ti interessano. È un buon metodo per seguire anche molti siti in modo molto rapido, senza necessità di creare un account o altre complicazioni.
+
+ Se hai Android, ti consigliamo Flym o Feeder
+ Per iPhone/iPad puoi usare Feed4U
+ Per il computer fisso/portatile consigliamo Feedbro, da installare all'interno di Firefox o di Chrome e compatibile con tutti i principali sistemi operativi.
+
+ Aggiungendo questo link al tuo lettore di feed, rimarrai aggiornata.`,
+ ical_description: `I computer e gli smartphone sono comunemente attrezzati con un'applicazione per gestire un calendario. A questi programmi solitamente è possibile far importare un calendario remoto.`,
+ list_description: `Se hai un sito web e vuoi mostrare una lista di eventi, puoi usare il seguente codice`
+ },
+
+ register: {
+ description: `I movimenti hanno bisogno di organizzarsi e autofinanziarsi. Questo è un dono per voi, usatelo solo per eventi non commerciali e ovviamente antifascisti, antisessisti, antirazzisti.
+ Prima di poter pubblicare dobbiamo approvare l'account , considera che dietro questo sito ci sono delle persone di
+ carne e sangue, scrivici quindi due righe per farci capire che eventi vorresti pubblicare.`,
+ error: 'Errore: '
+ },
+
+ event: {
+ anon: 'Anonimo',
+ anon_description: `Puoi inserire un evento senza rigistrarti o fare il login,
+ ma in questo caso dovrai aspettare che qualcuno lo legga confermando che si
+ tratta di un evento adatto a questo spazio, delegando questa scelta.
+ Puoi fare il login o registrarti ,
+ altrimenti vai avanti e riceverai una risposta il prima possibile.`,
+ multidate_description: 'tanti giorni',
+ date_description: `Quand'è il gancio?`,
+ dates_description: 'Che giorni?',
+ same_day: 'stesso giorno',
+ what_description: 'Nome evento',
+ description_description: 'Descrizione, dajene di copia/incolla',
+ tag_description: 'Tag...',
+ media_description: 'Puoi aggiungere un volantino',
+ time_start_description: 'Comincia alle',
+ time_end_description: 'Se vuoi puoi specificare un orario di fine.',
+ added: 'Evento aggiunto',
+ added_anon: 'Evento aggiunto, verrà confermato quanto prima.',
+ where_description: `Dov'è il gancio? Se il posto non è presente, scrivilo e premi invio. `,
+ confirmed: 'Evento confermato'
+ },
+
+ admin: {
+ mastodon_instance: 'Istanza',
+ mastodon_description: 'Puoi associare un account mastodon a questa istanza di gancio, ogni evento verrà pubblicato lì.',
+ place_description: `Nel caso in cui un luogo sia errato o cambi indirizzo, puoi modificarlo. Considera che tutti gli eventi associati a questo luogo cambieranno indirizzo (anche quelli passati!)`,
+ event_confirm_description: 'Puoi confermare qui gli eventi inseriti da utenti anonimi'
+ },
+
+ auth: {
+ not_confirmed: 'Non abbiamo ancora confermato questa mail...',
+ fail: 'Autenticazione fallita. Sicura la password è giusta? E la mail?'
+ },
+
+ settings: {
+ change_password: 'Cambia password'
+ },
+
+ err: {
+ register_error: 'Errore nella registrazione'
+ }
+}
+
+export default it
\ No newline at end of file
diff --git a/migrations/20190521100417-act_ids_comment_data.js b/migrations/20190521100417-act_ids_comment_data.js
new file mode 100644
index 00000000..817bf390
--- /dev/null
+++ b/migrations/20190521100417-act_ids_comment_data.js
@@ -0,0 +1,30 @@
+'use strict';
+
+module.exports = {
+ up: (queryInterface, Sequelize) => {
+ /*
+ Add altering commands here.
+ Return a promise to correctly handle asynchronicity.
+
+ Example:
+ return queryInterface.createTable('users', { id: Sequelize.INTEGER });
+ */
+ const a = queryInterface.addColumn('events', 'activitypub_ids', Sequelize.ARRAY(Sequelize.DOUBLE), { index: true })
+ const b = queryInterface.addColumn('comments', 'data', Sequelize.JSON)
+ return Promise.all([a, b])
+
+ },
+
+ down: (queryInterface, Sequelize) => {
+ /*
+ Add reverting commands here.
+ Return a promise to correctly handle asynchronicity.
+
+ Example:
+ return queryInterface.dropTable('users');
+ */
+ const b = queryInterface.removeColumn('comments', 'data')
+ const a = queryInterface.removeColumn('events', 'activitypub_ids')
+ return Promise.all([a, b])
+ }
+};
diff --git a/migrations/20190522104158-bigint.js b/migrations/20190522104158-bigint.js
new file mode 100644
index 00000000..8a49325b
--- /dev/null
+++ b/migrations/20190522104158-bigint.js
@@ -0,0 +1,27 @@
+'use strict';
+
+module.exports = {
+ up: (queryInterface, Sequelize) => {
+ /*
+ Add altering commands here.
+ Return a promise to correctly handle asynchronicity.
+
+ Example:
+ return queryInterface.createTable('users', { id: Sequelize.INTEGER });
+ */
+ const a = queryInterface.changeColumn('events', 'activitypub_id', { type: Sequelize.BIGINT, index: true })
+ const b = queryInterface.changeColumn('events', 'activitypub_ids', { type: Sequelize.ARRAY(Sequelize.BIGINT), index: true, defaultValue: [] })
+ const c = queryInterface.changeColumn('comments', 'activitypub_id', { type: Sequelize.BIGINT, index: true})
+ return Promise.all([a, b, c])
+ },
+
+ down: (queryInterface, Sequelize) => {
+ /*
+ Add reverting commands here.
+ Return a promise to correctly handle asynchronicity.
+
+ Example:
+ return queryInterface.dropTable('users');
+ */
+ }
+};
diff --git a/migrations/20190527205032-tag_id_weight.js b/migrations/20190527205032-tag_id_weight.js
new file mode 100644
index 00000000..49457fa7
--- /dev/null
+++ b/migrations/20190527205032-tag_id_weight.js
@@ -0,0 +1,29 @@
+'use strict';
+
+module.exports = {
+ up: async (queryInterface, Sequelize) => {
+ /*
+ Add altering commands here.
+ Return a promise to correctly handle asynchronicity.
+
+ Example:
+ return queryInterface.createTable('users', { id: Sequelize.INTEGER });
+ */
+ await queryInterface.addColumn('tags', 'weigth', Sequelize.INTEGER)
+ await queryInterface.sequelize.query('update "tags" SET weigth=subquery.c from (SELECT COUNT(*) as c, "tagTag" from "tagEvent" group by "tagTag") as subquery where "subquery"."tagTag"="tags"."tag";')
+ await queryInterface.addColumn('places', 'weigth', Sequelize.INTEGER)
+ await queryInterface.sequelize.query('update "places" SET weigth=subquery.c from (SELECT COUNT(*) as c, "placeId" from "events" group by "placeId") as subquery where "subquery"."placeId"="places"."id";')
+ },
+
+ down: async (queryInterface, Sequelize) => {
+ /*
+ Add reverting commands here.
+ Return a promise to correctly handle asynchronicity.
+
+ Example:
+ return queryInterface.dropTable('users');
+ */
+ await queryInterface.removeColumn('tags', 'weigth', Sequelize.INTEGER)
+ await queryInterface.removeColumn('places', 'weigth', Sequelize.INTEGER)
+ }
+};
diff --git a/models/index.js b/models/index.js
new file mode 100644
index 00000000..c1a3d6d5
--- /dev/null
+++ b/models/index.js
@@ -0,0 +1,37 @@
+'use strict';
+
+const fs = require('fs');
+const path = require('path');
+const Sequelize = require('sequelize');
+const basename = path.basename(__filename);
+const env = process.env.NODE_ENV || 'development';
+const config = require(__dirname + '/../config/config.json')[env];
+const db = {};
+
+let sequelize;
+if (config.use_env_variable) {
+ sequelize = new Sequelize(process.env[config.use_env_variable], config);
+} else {
+ sequelize = new Sequelize(config.database, config.username, config.password, config);
+}
+
+fs
+ .readdirSync(__dirname)
+ .filter(file => {
+ return (file.indexOf('.') !== 0) && (file !== basename) && (file.slice(-3) === '.js');
+ })
+ .forEach(file => {
+ const model = sequelize['import'](path.join(__dirname, file));
+ db[model.name] = model;
+ });
+
+Object.keys(db).forEach(modelName => {
+ if (db[modelName].associate) {
+ db[modelName].associate(db);
+ }
+});
+
+db.sequelize = sequelize;
+db.Sequelize = Sequelize;
+
+module.exports = db;
diff --git a/package.json b/package.json
index 417becf3..34dfb391 100644
--- a/package.json
+++ b/package.json
@@ -41,7 +41,7 @@
"sequelize-cli": "^5.4.0",
"sharp": "^0.22.0",
"sqlite3": "^4.0.6",
- "v-calendar": "^1.0.0-beta.10",
+ "v-calendar": "^1.0.0-beta.13",
"vue-awesome": "^3.5.1",
"vue-custom-element": "^3.2.6",
"vue-i18n": "^8.10.0",
diff --git a/pages/add/_edit.vue b/pages/add/_edit.vue
index 37047935..06e9d46b 100644
--- a/pages/add/_edit.vue
+++ b/pages/add/_edit.vue
@@ -26,10 +26,9 @@
filterable allow-create
default-first-option
)
- el-option(v-for='place in places_name' :label='place' :value='place' :key='place.id')
- br
- br
- div {{$t("common.address")}} {{event.place.name}}
+ el-option(v-for='place in places' :label='place.name' :value='place.name' :key='place.id')
+ span {{place.name}} - {{place.weigth}}
+ div {{$t("common.address")}}
el-input.mb-3(ref='address' v-model='event.place.address'
:disabled='places_name.indexOf(event.place.name)>-1'
@keydown.native.enter='next')
@@ -89,9 +88,9 @@
:on-change='uploadedFile'
:multiple='false'
:file-list="fileList"
- )
- i.el-icon-upload
- div.el-upload__text {{$t('event.media_description')}}
+ )
+ i.el-icon-upload
+ div.el-upload__text {{$t('event.media_description')}}
el-button.float-right(@click='done' :disabled='!couldProceed') {{edit?$t('common.edit'):$t('common.send')}}
@@ -153,7 +152,7 @@ export default {
computed: {
...mapState({
tags: state => state.tags.map(t => t.tag ),
- places_name: state => state.places.map(p => p.name ),
+ places_name: state => state.places.map(p => p.name ).sort((a, b) => b.weigth-a.weigth),
places: state => state.places,
user: state => state.user,
events: state => state.events
diff --git a/pages/admin.vue b/pages/admin.vue
index fd8997b9..b15bbb01 100644
--- a/pages/admin.vue
+++ b/pages/admin.vue
@@ -27,7 +27,7 @@
template(slot='label')
v-icon(name='map-marker-alt')
span.ml-1 {{$t('common.places')}}
- p {{$t('admin.place_description')}}
+ p(v-html="$t('admin.place_description')")
el-form.mb-2(:inline='true' label-width='120px')
el-form-item(:label="$t('common.name')")
el-input.mr-1(:placeholder='$t("common.name")' v-model='place.name')
@@ -201,7 +201,7 @@ export default {
await this.$axios.$get(`/event/confirm/${id}`)
this.loading = false
Message({
- message: this.$t('common.event_confirmed'),
+ message: this.$t('event.confirmed'),
type: 'success'
})
this.events = this.events.filter(e => e.id !== id)
diff --git a/pages/embed/list.vue b/pages/embed/list.vue
index 7ca16b0c..5d224613 100644
--- a/pages/embed/list.vue
+++ b/pages/embed/list.vue
@@ -12,15 +12,18 @@ export default {
components: { List },
async asyncData ({ $axios, req, res }) {
const title = req.query.title || SHARED_CONF.title
- const show_tags = req.query.showtags
const tags = req.query.tags
const places = req.query.places
const now = new Date()
- // TODO: filter future events based on tags/places/userid
- const events = await $axios.$get(`/event/${now.getMonth()}/${now.getFullYear()}`)
+ let params = []
+ if (places) params.push(`places=${places}`)
+ if (tags) params.push(`tags=${tags}`)
- return { show_tags, events, title }
+ params = params.length ? `?${params.join('&')}` : ''
+ const events = await $axios.$get(`/export/json${params}`)
+
+ return { events, title }
},
}
diff --git a/pages/event/_id.vue b/pages/event/_id.vue
index 34483559..21e4916b 100644
--- a/pages/event/_id.vue
+++ b/pages/event/_id.vue
@@ -13,9 +13,9 @@
h5.text-center {{event.title}}
div.nextprev
nuxt-link(v-if='prev' :to='`/event/${prev.id}`')
- el-button(icon='el-icon-arrow-left' round size='small' type='success' plain)
+ el-button(icon='el-icon-arrow-left' round type='success')
nuxt-link.float-right(v-if='next' :to='`/event/${next.id}`')
- el-button(icon='el-icon-arrow-right' round size='small' plain type='success')
+ el-button(icon='el-icon-arrow-right' round type='success')
//- image
img(:src='imgPath' v-if='event.image_path')
diff --git a/pages/export.vue b/pages/export.vue
index 76c1907c..bfeab302 100644
--- a/pages/export.vue
+++ b/pages/export.vue
@@ -1,11 +1,11 @@
el-dialog(:title='$t("common.export")' visible :before-close='close')
p {{$t('export.intro')}}
-
- li(v-if='filters.tags.length') {{$t('common.tags')}}:
- el-tag.ml-1(size='mini' v-for='tag in filters.tags' :key='tag.tag') {{tag}}
- li(v-if='filters.places.length') {{$t('common.places')}}:
- el-tag.ml-1(size='mini' v-for='place in filters.places' :key='place.id') {{place}}
+ Search
+ //- li(v-if='filters.tags.length') {{$t('common.tags')}}:
+ //- el-tag.ml-1(size='mini' v-for='tag in filters.tags' :key='tag.tag') {{tag}}
+ //- li(v-if='filters.places.length') {{$t('common.places')}}:
+ //- el-tag.ml-1(size='mini' v-for='place in filters.places' :key='place.id') {{place}}
el-tabs.mt-2(v-model='type')
el-tab-pane.pt-1(label='email' name='email')
@@ -55,13 +55,15 @@ import { mapState, mapGetters } from 'vuex'
import path from 'path'
import Calendar from '@/components/Calendar'
import List from '@/components/List'
+import Search from '@/components/Search'
+
import {intersection} from 'lodash'
import { Message } from 'element-ui'
const { SHARED_CONF } = require('@/config')
export default {
name: 'Export',
- components: { List },
+ components: { List, Search },
data () {
return {
type: 'email',
@@ -96,6 +98,11 @@ export default {
if (this.list.title) {
params.push(`title=${this.list.title}`)
}
+
+ if (this.filters.places) {
+ params.push(`places=${this.filters.places}`)
+ }
+
return ``
},
link () {
diff --git a/pages/recover/_code.vue b/pages/recover/_code.vue
new file mode 100644
index 00000000..9a595f15
--- /dev/null
+++ b/pages/recover/_code.vue
@@ -0,0 +1,52 @@
+
+ el-dialog(visible)
+ template(slot='title')
+ h5 {{$t('common.recover_password')}}
+ div(v-if='valid')
+ el-form
+ el-form-item {{$t('common.new_password')}}
+ el-input(type='password', v-model='new_password')
+ el-button(plain type="success" icon='el-icon-send', @click='change_password') {{$t('common.send')}}
+
+ div(v-else) {{$t('recover.not_valid_code')}}
+
+
+
+
+
+
diff --git a/pages/register.vue b/pages/register.vue
index b37d2917..9a57800e 100644
--- a/pages/register.vue
+++ b/pages/register.vue
@@ -41,12 +41,9 @@ export default {
})
this.$router.replace("/")
} catch (e) {
- console.log('DENTRO CATCH!!!', e)
const error = e && e.response && e.response.data && e.response.data.errors[0].message || e
- console.error(error)
- console.error(e)
Message({
- message: this.$t('register.error') + error,
+ message: this.$t('register.error') + this.$t(error),
type: 'error'
})
}
diff --git a/plugins/filters.js b/plugins/filters.js
index 7f109ac1..6661c538 100644
--- a/plugins/filters.js
+++ b/plugins/filters.js
@@ -4,7 +4,7 @@ import 'dayjs/locale/it'
moment.locale('it')
export default (a) => {
-
+ Vue.filter('linkify', value => value.replace(/(https?:\/\/[^\s]+)/g, '$1 '))
Vue.filter('datetime', value => moment(value).format('ddd, D MMMM HH:mm'))
Vue.filter('short_datetime', value => moment(value).format('D/MM HH:mm'))
Vue.filter('hour', value => moment(value).format('HH:mm'))
@@ -12,7 +12,7 @@ export default (a) => {
Vue.filter('month', value => moment(value).format('MMM'))
Vue.filter('event_when', event => {
if (event.multidate) {
- return moment(event.start_datetime).format('dddd, D MMMM HH:mm') + ' - ' + moment(event.end_datetime).format('ddd, D MMMM')
+ return moment(event.start_datetime).format('ddd, D MMMM HH:mm') + ' - ' + moment(event.end_datetime).format('ddd, D MMMM')
} else {
if (event.end_datetime && event.end_datetime !== event.start_datetime)
return moment(event.start_datetime).format('dddd, D MMMM HH:mm') + '-' + moment(event.end_datetime).format('HH:mm')
diff --git a/plugins/initialize.js b/plugins/initialize.js
new file mode 100644
index 00000000..1545d1b2
--- /dev/null
+++ b/plugins/initialize.js
@@ -0,0 +1,9 @@
+
+// TOFIX: not needed in any case (eg. embed)
+export default async ({ store, $axios }) => {
+ const now = new Date()
+ const events = await $axios.$get(`/event/${now.getMonth()}/${now.getFullYear()}`)
+ store.commit('setEvents', events)
+ const { tags, places } = await $axios.$get('/event/meta')
+ store.commit('update', { tags, places })
+}
diff --git a/server/api/auth.js b/server/api/auth.js
index ccffb034..21dcb8a5 100644
--- a/server/api/auth.js
+++ b/server/api/auth.js
@@ -11,6 +11,7 @@ const Auth = {
next()
},
async isAuth(req, res, next) {
+ console.error('ma sono dentro auth ?!?!', req.user)
if (!req.user) {
return res
.status(403)
diff --git a/server/api/controller/bot.js b/server/api/controller/bot.js
index bc509a03..ff21e12f 100644
--- a/server/api/controller/bot.js
+++ b/server/api/controller/bot.js
@@ -12,6 +12,7 @@ moment.locale('it')
const botController = {
bot: null,
async initialize () {
+ console.error('dentro bot inizialiteds')
const settings = await settingsController.settings()
if (!settings.mastodon_auth || !settings.mastodon_auth.access_token) return
const mastodon_auth = settings.mastodon_auth
diff --git a/server/api/controller/event.js b/server/api/controller/event.js
index aafc38b6..2d11824d 100644
--- a/server/api/controller/event.js
+++ b/server/api/controller/event.js
@@ -21,24 +21,22 @@ const eventController = {
async getMeta(req, res) {
const places = await Place.findAll({
- group: ['place.id'],
- order: [[Sequelize.fn("COUNT", Sequelize.col('events.id')), 'DESC']],
+ order: [[Sequelize.literal('weigth'), 'DESC']],
attributes: {
- include: [[Sequelize.fn("COUNT", Sequelize.col('events.id')), 'eventsCount']],
- exclude: ['createdAt', 'updatedAt']
+ include: [[Sequelize.fn('count', Sequelize.col('events.placeId')) ,'weigth']], // <---- Here you will get the total count of user
+ exclude: ['weigth', 'createdAt', 'updatedAt']
},
- include: { model: Event, attributes: [] }
+ include: [{ model: Event, attributes: [] }],
+ group: ['place.id']
})
const tags = await Tag.findAll({
- group: ['tag'],
- order: [[Sequelize.fn("COUNT", Sequelize.col('events.id')), 'DESC']],
- includeIgnoreAttributes:false,
+ order: [['weigth' , 'DESC']],
+ includeIgnoreAttributes: false,
attributes: {
- include: [[Sequelize.fn("COUNT", Sequelize.col('events.id')), 'eventsCount']],
exclude: ['createdAt', 'updatedAt']
- },
- include: { model: Event, attributes: [] }})
+ }
+ })
res.json({ tags, places })
},
@@ -92,7 +90,7 @@ const eventController = {
Comment,
{ model: Place, attributes: ['name', 'address'] }
] ,
- order: [ [Comment, 'id', 'DESC'] ]
+ order: [ [Comment, 'id', 'DESC'], [Tag, 'weigth', 'DESC'] ]
})
res.json(event)
},
@@ -177,15 +175,17 @@ const eventController = {
{ start_datetime: { [Op.lte]: end } }
]
},
- order: [['start_datetime', 'ASC']],
+ order: [
+ ['start_datetime', 'ASC'],
+ [Tag, 'weigth', 'DESC']
+ ],
include: [
- { model: User, required: false },
- Comment,
- Tag,
- { model: Place, required: false }
+ // { model: User, required: false },
+ // { type: Comment, required: false, attributes: ['']
+ { model: Tag, required: false, attributes: ['tag', 'weigth','color'] },
+ { model: Place, required: false, attributes: ['id', 'name', 'address'] }
]
})
- // console.log(events)
res.json(events)
}
diff --git a/server/api/controller/export.js b/server/api/controller/export.js
index ab74a4f9..56f31cff 100644
--- a/server/api/controller/export.js
+++ b/server/api/controller/export.js
@@ -8,6 +8,7 @@ const exportController = {
async export (req, res) {
console.log('type ', req.params.type)
+ console.error(req)
const type = req.params.type
const tags = req.query.tags
const places = req.query.places
@@ -18,14 +19,20 @@ const exportController = {
whereTag.tag = tags.split(',')
}
if (places) {
- wherePlace.name = places.split(',')
+ wherePlace.id = places.split(',')
}
+ console.error(places)
const events = await Event.findAll({
- where: { is_visible: true, start_datetime: { [Op.gte]: yesterday } },
- include: [Comment, {
- model: Tag,
- where: whereTag
- }, { model: Place, where: wherePlace } ]
+ order: ['start_datetime'],
+ where: {
+ is_visible: true,
+ start_datetime: { [Op.gte]: yesterday },
+ placeId: places.split(',')
+ },
+ attributes: {
+ exclude: ['createdAt', 'updatedAt']
+ },
+ include: [{model: Place, attributes: ['name', 'id', 'address', 'weigth']}]
})
switch (type) {
case 'feed':
diff --git a/server/api/controller/user.js b/server/api/controller/user.js
index 00bf0728..6fc85777 100644
--- a/server/api/controller/user.js
+++ b/server/api/controller/user.js
@@ -74,17 +74,14 @@ const userController = {
async addEvent(req, res) {
const body = req.body
- // remove description tag and create anchor tags
- const description = body.description
- .replace(/(<([^>]+)>)/ig, '')
- .replace(/(https?:\/\/[^\s]+)/g, '$1 ')
-
const eventDetails = {
title: body.title,
- description,
+ description: body.description.replace(/(<([^>]+)>)/ig, ''),
multidate: body.multidate,
start_datetime: body.start_datetime,
end_datetime: body.end_datetime,
+
+ // publish this event if authenticated
is_visible: !!req.user
}
@@ -94,7 +91,7 @@ const userController = {
let event = await Event.create(eventDetails)
- // create place
+ // create place if needs to
let place
try {
place = await Place.findOrCreate({ where: { name: body.place_name },
@@ -140,7 +137,7 @@ const userController = {
body.description = body.description
.replace(/(<([^>]+)>)/ig, '') // remove all tags from description
- .replace(/(https?:\/\/[^\s]+)/g, '$1 ') // add links
+ // .replace(/(https?:\/\/[^\s]+)/g, '$1 ') // add links
await event.update(body)
let place
diff --git a/server/api/models/event.js b/server/api/models/event.js
index d5185c12..dab0f5e0 100644
--- a/server/api/models/event.js
+++ b/server/api/models/event.js
@@ -19,7 +19,8 @@ const Event = db.define('event', {
})
const Tag = db.define('tag', {
- tag: { type: Sequelize.STRING, index: true, unique: true, },
+ tag: { type: Sequelize.STRING, index: true, unique: true, primaryKey: true },
+ weigth: { type: Sequelize.INTEGER, defaultValue: 0 },
color: { type: Sequelize.STRING }
})
@@ -43,6 +44,7 @@ const Notification = db.define('notification', {
const Place = db.define('place', {
name: { type: Sequelize.STRING, unique: true, index: true },
+ weigth: { type: Sequelize.INTEGER, defaultValue: 0 },
address: { type: Sequelize.STRING }
})
diff --git a/server/api/models/user.js b/server/api/models/user.js
index e6a13ff3..697acb7d 100644
--- a/server/api/models/user.js
+++ b/server/api/models/user.js
@@ -5,7 +5,7 @@ const db = require('../db')
const User = db.define('user', {
email: {
type: Sequelize.STRING,
- unique: { msg: 'Email already exists' },
+ unique: { msg: 'err.register_error' },
index: true,
allowNull: false
},
diff --git a/server/emails/confirm/html.pug b/server/emails/confirm/html.pug
new file mode 100644
index 00000000..e0f26aa1
--- /dev/null
+++ b/server/emails/confirm/html.pug
@@ -0,0 +1,4 @@
+p= t('confirm_email')
+
+hr
+small #{config.baseurl}
diff --git a/server/emails/event/html.pug b/server/emails/event/html.pug
new file mode 100644
index 00000000..2fefccc6
--- /dev/null
+++ b/server/emails/event/html.pug
@@ -0,0 +1,18 @@
+h3 #{event.title}
+p Dove: #{event.place.name} - #{event.place.address}
+p Quando: #{datetime(event.start_datetime)}
+br
+if event.image_path
+
+p #{event.description}
+
+each tag in event.tags
+ span ##{tag.tag}
+br
+#{config.baseurl}/event/#{event.id}
+hr
+if to_confirm
+ p Puoi confermare questo evento qui
+else
+ p Puoi eliminare queste notifiche qui
+#{config.title} - #{config.description}
diff --git a/server/emails/event/subject.pug b/server/emails/event/subject.pug
new file mode 100644
index 00000000..fd159324
--- /dev/null
+++ b/server/emails/event/subject.pug
@@ -0,0 +1 @@
+= `[${config.title}] ${event.title} @${event.place.name} ${datetime(event.start_datetime)}`
diff --git a/server/emails/mail.css b/server/emails/mail.css
new file mode 100644
index 00000000..6dd4fb48
--- /dev/null
+++ b/server/emails/mail.css
@@ -0,0 +1,8 @@
+table {
+ width: 100%;
+ border-collapse: collapse;
+}
+
+table, th, td {
+ border: 1px solid #555;
+}
diff --git a/server/emails/recover/html.pug b/server/emails/recover/html.pug
new file mode 100644
index 00000000..fd8cb11a
--- /dev/null
+++ b/server/emails/recover/html.pug
@@ -0,0 +1,3 @@
+p= t('recover_email')
+
+#{t('press here')}
\ No newline at end of file
diff --git a/server/emails/recover/subject.pug b/server/emails/recover/subject.pug
new file mode 100644
index 00000000..6d0067a6
--- /dev/null
+++ b/server/emails/recover/subject.pug
@@ -0,0 +1 @@
+= `[Gancio] Richiesta password recovery`
diff --git a/server/emails/register/html.pug b/server/emails/register/html.pug
new file mode 100644
index 00000000..8cdb9def
--- /dev/null
+++ b/server/emails/register/html.pug
@@ -0,0 +1,6 @@
+p= t('registration_email')
+
+hr
+small #{config.title} / #{config.description}
+br
+small #{config.baseurl}
\ No newline at end of file
diff --git a/server/emails/register/subject.pug b/server/emails/register/subject.pug
new file mode 100644
index 00000000..7d19cd3e
--- /dev/null
+++ b/server/emails/register/subject.pug
@@ -0,0 +1 @@
+= `[Gancio] Richiesta registrazione`
diff --git a/server/index.js b/server/index.js
index 9033002f..4ffd53f5 100644
--- a/server/index.js
+++ b/server/index.js
@@ -7,11 +7,14 @@ const path = require('path')
const { Nuxt, Builder } = require('nuxt')
const app = express()
const cors = require('cors')
+const notifier = require('./notifier')
+
const corsConfig = {
allowedHeaders: ['Authorization'],
exposeHeaders: ['Authorization']
}
+
// Import and Set Nuxt.js options
const config = require('../nuxt.config.js')
config.dev = !(process.env.NODE_ENV === 'production')
@@ -47,3 +50,4 @@ async function start() {
})
}
start()
+notifier.startLoop(20)
diff --git a/server/cron.js b/server/notifier.js
similarity index 83%
rename from server/cron.js
rename to server/notifier.js
index 08a6c462..a92eff40 100644
--- a/server/cron.js
+++ b/server/notifier.js
@@ -21,6 +21,7 @@ async function sendNotification (notification, event, eventNotification) {
if (settings.mastodon_auth.instance && settings.mastodon_auth.access_token) {
const b = bot.post(settings.mastodon_auth, event).then(b => {
event.activitypub_id = b.data.id
+ // event.activitypub_ids.push(b.data.id)
return event.save()
})
promises.push(b)
@@ -29,7 +30,8 @@ async function sendNotification (notification, event, eventNotification) {
return Promise.all(promises)
}
-async function loop () {
+async function notify() {
+ console.error('dentro il loop di notify')
settings = await settingsController.settings()
// get all event notification in queue
const eventNotifications = await EventNotification.findAll({ where: { status: 'new' } })
@@ -51,5 +53,14 @@ async function loop () {
return Promise.all(promises)
}
-setInterval(loop, 260000)
-loop()
+let interval
+function startLoop(seconds) {
+ console.error('starting notifier loop')
+ interval = setInterval(notify, seconds*1000)
+}
+
+function stopLoop() {
+ stopInterval(interval)
+}
+
+module.exports = { startLoop, stopLoop }
\ No newline at end of file
diff --git a/static/favicon.ico b/static/favicon.ico
index 382fecbbf96d6e1e614e0e2cc8b73e355bd946cc..36b55d4a8ffc0352aa0c8daf717533f6b1b6c4aa 100644
GIT binary patch
literal 4286
zcmb`KT}WhQ7{|{tXpJAE((XDc=pwc(LSi_2lct0S?uBS#Z5K;{N;h?3c@c`S3sJIW
zP|#+(En#d}(p8jQc+rHpt((%KOQ2vZxw@p}M~zy|=+pmy=Da)SoH>qX2cPBVd*(UM
z`~2VYey^q-!@pCfH2&4T$kw!znx>rraA|db{v)sqH7#g2N-))
z=0~E-AOyrEjQtoCgJkUyRJ;fd)y>Grkd%}Zr?#s^_Zodc6{f
zMC|fXT3V{=b6uF%<|i?2#;~uczW^Qss$H7ihxPUKQc+PM+1c5acPg%?rY26Cj^g5C
zbNm&=)3{fe*7#S5p*Gv_puKv%!NEb<+uO6`-r3oarKKgAnVHeo-o(U&Y;A2>V$_ek
zygWS*^jK1p+UJbl@SO%~zI|$r6`#+i(j;AGWo21%LbnaD9}NE+DAl;vT4F0JE0fk$
z6;o4FEjgh(1a8IjIoGKF7qIT9ZEbBTOc!
z{VhZPCQ8*O(XykX!!akFqobpi_+T*T7@L-sW{HD_Iz!<<2~^*IZjY0$t}e%%bPfy*
z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OtxN2NRJ0=5I|(P)kJVcCMV#4hs)`p0CGwZJzp4kiTFCva)1ig@br0CokIewDfC
z0^0#YB0DH>LF&qQYHDz{8?Ji=M`@y&$>Wh`;~>%~X9II=C~*4Z!n~eP8jhi0$;E
z#~BkCKmd;ex0|#X@?Kz>6rX#n*)g%%Y!;^GVpZU847x6=%YeWGzROI^@z`}!+?&f)
ziH2D}n3KpvV5z{ITq-}hXuo|6rpws$=Km!3tCRe?%c%TT
zG>Fg>PcQZaW+EkPeFSb1vr|e#OP|1fQhe%8*J;C^xCB_5|0RY9TrSX^b8EI+;7bB0
z6n0_max6N_VpCwn`r!o55m=M6$VA|fz)u7|AY*Tgb~ZY=-j7{z3GjT**E$@5$pTLn
zAhM|J5%`{Hrl0o0FF1c%fD3`YL%SqbR<-{CTU*3%>N5{@YxG;L(pY0D`m}!|Izy0{rVv;}0ILGH7WJDwN%lPco{`yzit3Mn
z-&n3o@d&&_G{W_ucT*TGyMQ}Mnkjm;BQQ=}wcN#Okgk4ydd
zGcT}8S&KeQ*_oVfMg(RGd|6<%7g%f=K)26cNRy4lokQT=0^btY;swSQG_>dRM(?Ai
z4x(W~?-KZ1Q3q}k$`7OGNysQQ9*X0;yD ({
export const getters = {
token: state => state.token,
+
// filter current + future events only
// plus, filter matches search tag/place
-
filteredEvents: (state) => {
let events = state.events
@@ -50,7 +50,6 @@ export const getters = {
let lastDay = null
events = map(events, e => {
const currentDay = moment(e.start_datetime).date()
- console.log(currentDay)
e.newDay = (!lastDay || lastDay!==currentDay) && currentDay
lastDay = currentDay
return e
@@ -88,22 +87,9 @@ export const mutations = {
state.tags = tags
state.places = places
},
- // search
- addSearchTag(state, tag) {
- if (!state.filters.tags.find(t => t === tag.tag)) {
- state.filters.tags.push(tag.tag)
- } else {
- state.filters.tags = state.filters.tags.filter(t => t !== tag.tag)
- }
- },
setSearchTags(state, tags) {
state.filters.tags = tags
},
- addSearchPlace(state, place) {
- if (state.filters.places.find(p => p.name === place.name)) {
- state.filters.places.push(place)
- }
- },
setSearchPlaces(state, places) {
state.filters.places = places
},
@@ -122,26 +108,23 @@ export const actions = {
commit('update', { tags, places })
},
async addEvent({ commit }, formData) {
- const event = await this.$axios.$post('/user/event', formData) // .addEvent(formData)
- commit('addEvent', event)
+ const event = await this.$axios.$post('/user/event', formData)
+ if (event.user) {
+ commit('addEvent', event)
+ }
},
async updateEvent({ commit }, formData) {
const event = await this.$axios.$put('/user/event', formData)
- commit('updateEvent', event)
+ if (event.user) {
+ commit('updateEvent', event)
+ }
},
delEvent({ commit }, eventId) {
commit('delEvent', eventId)
},
- // search
- addSearchTag({ commit }, tag) {
- commit('addSearchTag', tag)
- },
setSearchTags({ commit }, tags) {
commit('setSearchTags', tags)
},
- addSearchPlace({ commit }, place) {
- commit('addSearchPlace', place)
- },
setSearchPlaces({ commit }, places) {
commit('setSearchPlaces', places)
},
diff --git a/widgets/examples/index.html b/widgets/examples/index.html
deleted file mode 100644
index e31c88d8..00000000
--- a/widgets/examples/index.html
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
- Gancio Widget Example
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/widgets/list/index.html b/widgets/list/index.html
deleted file mode 100644
index e69de29b..00000000
diff --git a/widgets/list/index.js b/widgets/list/index.js
deleted file mode 100644
index 0b47f6d7..00000000
--- a/widgets/list/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import Vue from 'vue'
-import vueCustomElement from 'vue-custom-element'
-import App from '../../components/List'
-// import router from './router'
-// import store from '../../store'
-
-Vue.use(vueCustomElement)
-
-// App.store = store
-// App.router = router
-Vue.customElement('gancio-widget', App)
-export default App
diff --git a/widgets/list/style.css b/widgets/list/style.css
deleted file mode 100644
index 87eb01f5..00000000
--- a/widgets/list/style.css
+++ /dev/null
@@ -1,3 +0,0 @@
-#gancio-widget {
- border: 1px solid black;
-}
\ No newline at end of file