From bf062547624d036f8219f8251b3fd51b3d7bab22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xos=C3=A9=20M?= Date: Thu, 9 Jun 2022 03:08:00 +0000 Subject: [PATCH 001/102] Translated using Weblate (Galician) Currently translated at 100.0% (256 of 256 strings) Translation: Gancio/Web Translate-URL: https://hosted.weblate.org/projects/gancio/web/gl/ --- locales/gl.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/locales/gl.json b/locales/gl.json index 8818f74c..6329cff6 100644 --- a/locales/gl.json +++ b/locales/gl.json @@ -86,7 +86,9 @@ "url": "URL", "theme": "Decorado", "import": "Importar", - "tags": "Cancelos" + "tags": "Cancelos", + "close": "Pechar", + "blobs": "Blobs" }, "recover": { "not_valid_code": "Algo fallou." @@ -223,7 +225,10 @@ "new_announcement": "Novo anuncio", "smtp_description": "", "wrong_domain_warning": "O url base configurado en config.json ({baseurl) é diferente ao que estás a visitar ({url})", - "event_remove_ok": "Evento eliminado" + "event_remove_ok": "Evento eliminado", + "edit_blob": "Editar Blob", + "new_blob": "Novo blob", + "blobs_description": "Blobs son agrupamentos de eventos por etiquetas e lugares. Mostraranse na páxina de inicio" }, "auth": { "not_confirmed": "Aínda non foi confirmado…", From 15f5b9509cd7821d9855b49e8e8846f57233fb7d Mon Sep 17 00:00:00 2001 From: Txopi Date: Mon, 13 Jun 2022 17:45:02 +0000 Subject: [PATCH 002/102] Translated using Weblate (Basque) Currently translated at 98.4% (252 of 256 strings) Translation: Gancio/Web Translate-URL: https://hosted.weblate.org/projects/gancio/web/eu/ --- locales/eu.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/locales/eu.json b/locales/eu.json index d324839e..316fb5a1 100644 --- a/locales/eu.json +++ b/locales/eu.json @@ -86,7 +86,8 @@ "import": "Inportatu", "reset": "Berrezarri", "theme": "Itxura", - "tags": "Etiketak" + "tags": "Etiketak", + "close": "Itxi" }, "login": { "description": "Saioa hasten baduzu ekitaldi berriak sortu ahal izango dituzu.", From 3ae9070d9561a060a30547edafd930bee8c7cb31 Mon Sep 17 00:00:00 2001 From: Nathan Date: Wed, 15 Jun 2022 09:28:45 +0000 Subject: [PATCH 003/102] Translated using Weblate (French) Currently translated at 99.2% (254 of 256 strings) Translation: Gancio/Web Translate-URL: https://hosted.weblate.org/projects/gancio/web/fr/ --- locales/fr.json | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/locales/fr.json b/locales/fr.json index 5e494dc2..d50e5b7a 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -86,7 +86,9 @@ "send": "Envoyer", "export": "Exporter", "label": "Nom", - "max_events": "Nb. max d'événements" + "max_events": "Nb. max d'événements", + "blobs": "Blobs", + "close": "Fermer" }, "event": { "follow_me_description": "Une des manières de rester informé sur les évènements publiés ici sur {title}\nest de suivre le compte {account} sur le fediverse, par exemple via Mastodon, et pourquoi pas d'ajouter des ressources à un évènement à partir de là.

\nSi vous n'avez jamais entendu parler de Mastodon and du fediverse, nous vous recommandons de lire cet article (en anglais).

Saisissez votre nom d'instance ci-dessous (par ex. mastodon.social)", @@ -218,7 +220,10 @@ "smtp_test_success": "Un e-mail de test a été envoyé à {admin_email}, veuillez vérifier votre boîte de réception", "admin_email": "E-mail de l'administrateur", "widget": "Vignette active", - "event_remove_ok": "Événement supprimé" + "event_remove_ok": "Événement supprimé", + "new_blob": "Nouveau blob", + "edit_blob": "Modifier le blob", + "blobs_description": "Les blobs sont des regroupements d'événements par étiquette et par lieu. Ils seront affichés sur la page d'accueil" }, "oauth": { "scopes": { @@ -278,6 +283,7 @@ "completed": "Configuration terminée", "completed_description": "

Vous pouvez désormais vous connectez avec le compte utilisateur suivant :

Identifiant : {email}
Mot de passe : {password}

", "start": "Commencer", - "copy_password_dialog": "Oui, vous devez copier le mot de passe !" + "copy_password_dialog": "Oui, vous devez copier le mot de passe !", + "https_warning": "Vous consultez le site en HTTP, n'oubliez pas de modifier la valeur de baseurl dans config.json si vous passez en HTTPS !" } } From f25521be1b1cdd2a688d86ebed2e707642241610 Mon Sep 17 00:00:00 2001 From: fadelkon Date: Thu, 16 Jun 2022 16:02:38 +0000 Subject: [PATCH 004/102] Translated using Weblate (Catalan) Currently translated at 100.0% (256 of 256 strings) Translation: Gancio/Web Translate-URL: https://hosted.weblate.org/projects/gancio/web/ca/ --- locales/ca.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/locales/ca.json b/locales/ca.json index fd027ead..d3d9da56 100644 --- a/locales/ca.json +++ b/locales/ca.json @@ -86,7 +86,9 @@ "theme": "Tema", "tags": "Etiquetes", "label": "Etiqueta", - "max_events": "Nre. màx. d'activitats" + "max_events": "Nre. màx. d'activitats", + "close": "Tanca", + "blobs": "Blobs" }, "login": { "description": "Amb la sessió iniciada pots afegir activitats noves.", @@ -232,7 +234,10 @@ "smtp_test_button": "Envia un correu de prova", "widget": "Giny", "wrong_domain_warning": "La url base configurada a config.json ({baseurl}) difereix de la que esteu visitant ({url})", - "event_remove_ok": "S'ha suprimit l'esdeveniment" + "event_remove_ok": "S'ha suprimit l'esdeveniment", + "new_blob": "Nou blob", + "blobs_description": "Els blobs són agrupacions d'activitats per etiquetes i llocs. Es mostren a la pàgina principal", + "edit_blob": "Edita el blob" }, "auth": { "not_confirmed": "Encara no s'ha confirmat…", From a38b75a797b8c6928f677f79dc668c35aca3488f Mon Sep 17 00:00:00 2001 From: Txopi Date: Sat, 18 Jun 2022 17:07:39 +0000 Subject: [PATCH 005/102] Translated using Weblate (Basque) Currently translated at 100.0% (256 of 256 strings) Translation: Gancio/Web Translate-URL: https://hosted.weblate.org/projects/gancio/web/eu/ --- locales/eu.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/locales/eu.json b/locales/eu.json index 316fb5a1..50606158 100644 --- a/locales/eu.json +++ b/locales/eu.json @@ -87,7 +87,8 @@ "reset": "Berrezarri", "theme": "Itxura", "tags": "Etiketak", - "close": "Itxi" + "close": "Itxi", + "blobs": "Mordoak" }, "login": { "description": "Saioa hasten baduzu ekitaldi berriak sortu ahal izango dituzu.", @@ -233,7 +234,10 @@ "smtp_description": "
  • Administratzaileak eposta bat jaso beharko luke anonimo batek ekitaldi bat gehitzen duenean (gaituta badago).
  • Administratzaileak eposta bat jaso beharko luke izena emateko eskari bakoitzeko (gaituta badago).
  • Erabiltzaileak eposta bat jaso beharko luke izena emateko eskariarekin.
  • Erabiltzaileak eposta bat jaso beharko luke izen ematea baieztatzean.
  • Erabiltzaileak eposta bat jaso beharko luke administratzaileak zuzenean izena emanez gero.
  • Erabiltzaileek eposta bat jaso beharko lukete pasahitza ahazten dutenean.
", "widget": "Tresna", "event_remove_ok": "Ekitaldia ezabatu da", - "wrong_domain_warning": "config.json-en konfiguratuta dagoen baseurl ({baseurl}) ez da bisitatzen ari zaren berbera ({url})" + "wrong_domain_warning": "config.json-en konfiguratuta dagoen baseurl ({baseurl}) ez da bisitatzen ari zaren berbera ({url})", + "new_blob": "Mordo berria", + "blobs_description": "Mordoak etiketen eta lekuen arabera multzokatutako ekitaldiak dira. Hasiera-orrialdean bistaratzen dira", + "edit_blob": "Editatu mordoa" }, "auth": { "not_confirmed": "Oraindik baieztatu gabe dago…", From 7516fd3d36782c4087d1ab76c44d3d9d90dba69b Mon Sep 17 00:00:00 2001 From: lesion Date: Wed, 22 Jun 2022 11:31:14 +0200 Subject: [PATCH 006/102] fix ctrl+c during setup --- server/initialize.server.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/server/initialize.server.js b/server/initialize.server.js index bda4340d..3fff8448 100644 --- a/server/initialize.server.js +++ b/server/initialize.server.js @@ -3,12 +3,14 @@ const config = require('../server/config') const initialize = { // close connections/port/unix socket async shutdown (exit = true) { - const log = require('../server/log') - const TaskManager = require('../server/taskManager').TaskManager - if (TaskManager) { TaskManager.stop() } - log.info('Closing DB') - const sequelize = require('../server/api/models') - await sequelize.close() + if (config.status == 'READY') { + const log = require('../server/log') + const TaskManager = require('../server/taskManager').TaskManager + if (TaskManager) { TaskManager.stop() } + log.info('Closing DB') + const sequelize = require('../server/api/models') + await sequelize.close() + } process.off('SIGTERM', initialize.shutdown) process.off('SIGINT', initialize.shutdown) if (exit) { From 1c181cba650f15ccf6f3682952829f65aab2844a Mon Sep 17 00:00:00 2001 From: lesion Date: Wed, 22 Jun 2022 14:07:28 +0200 Subject: [PATCH 007/102] minor --- components/DateInput.vue | 2 ++ components/WhereInput.vue | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/components/DateInput.vue b/components/DateInput.vue index 30381170..0a42b4d1 100644 --- a/components/DateInput.vue +++ b/components/DateInput.vue @@ -45,6 +45,7 @@ v-col(cols=12) :label="$t('event.from')" :value="fromHour" :disabled='!value.from' + readonly :prepend-icon="mdiClockTimeFourOutline" :rules="[$validators.required('event.from')]" v-bind="attrs" @@ -70,6 +71,7 @@ v-col(cols=12) :label="$t('event.due')" :value="dueHour" :disabled='!fromHour' + readonly :prepend-icon="mdiClockTimeEightOutline" v-bind="attrs" v-on="on") diff --git a/components/WhereInput.vue b/components/WhereInput.vue index 42d08e6b..900d5f6f 100644 --- a/components/WhereInput.vue +++ b/components/WhereInput.vue @@ -16,8 +16,8 @@ v-row @change='selectPlace') template(v-slot:item="{ item, attrs, on }") v-list-item(v-bind='attrs' v-on='on') - v-list-item-content(two-line v-if='item.create && search') - v-list-item-title {{item.name}} + v-list-item-content(two-line v-if='item.create') + v-list-item-title {{$t('common.add')}} {{item.name}} v-list-item-content(two-line v-else) v-list-item-title(v-text='item.name') v-list-item-subtitle(v-text='item.address') @@ -76,7 +76,7 @@ export default { this.places = await this.$axios.$get(`place?search=${search}`) if (!search && this.places.length) { return this.places } const matches = this.places.find(p => search === p.name.toLocaleLowerCase()) - if (!matches) { + if (!matches && search) { this.places.unshift({ create: true, name: ev.target.value.trim() }) } }, 100), From 969e5184c0af49e9a800112c0e348f124ab2f608 Mon Sep 17 00:00:00 2001 From: lesion Date: Wed, 22 Jun 2022 15:30:13 +0200 Subject: [PATCH 008/102] fix add / modify event with duplicated tag --- server/api/controller/tag.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/api/controller/tag.js b/server/api/controller/tag.js index b8574d69..1f2f882b 100644 --- a/server/api/controller/tag.js +++ b/server/api/controller/tag.js @@ -1,5 +1,6 @@ const Tag = require('../models/tag') const Event = require('../models/event') +const uniq = require('lodash/uniq') const { where, fn, col, Op } = require('sequelize') const exportController = require('./export') @@ -14,7 +15,7 @@ module.exports = { // search for already existing tags (tag is the same as TaG) const existingTags = await Tag.findAll({ where: { [Op.and]: where(fn('LOWER', col('tag')), { [Op.in]: lowercaseTags }) } }) const lowercaseExistingTags = existingTags.map(t => t.tag.toLocaleLowerCase()) - const remainingTags = trimmedTags.filter(t => ! lowercaseExistingTags.includes(t.toLocaleLowerCase())) + const remainingTags = uniq(trimmedTags.filter(t => ! lowercaseExistingTags.includes(t.toLocaleLowerCase()))) // create remaining tags (cannot use updateOnDuplicate or manage conflicts) return [].concat( From e5e4ac46aef35200a65012d40a74cd8ebe0fbc4c Mon Sep 17 00:00:00 2001 From: lesion Date: Wed, 22 Jun 2022 17:51:42 +0200 Subject: [PATCH 009/102] fix some import/export issue --- server/api/controller/export.js | 2 +- server/helpers.js | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/server/api/controller/export.js b/server/api/controller/export.js index 176a6f6f..cff654f0 100644 --- a/server/api/controller/export.js +++ b/server/api/controller/export.js @@ -96,7 +96,7 @@ const exportController = { location: `${e.place.name} - ${e.place.address}`, url: `${settings.baseurl}/event/${e.slug || e.id}`, status: 'CONFIRMED', - categories: e.tags.map(t => t.tag), + categories: e.tags, alarms } }) diff --git a/server/helpers.js b/server/helpers.js index 57cf6372..03e6dffd 100644 --- a/server/helpers.js +++ b/server/helpers.js @@ -19,7 +19,7 @@ const DOMPurify = require('dompurify') const { JSDOM } = require('jsdom') const { window } = new JSDOM('') const domPurify = DOMPurify(window) -const URL = require('url') +const url = require('url') const locales = require('../locales') domPurify.addHook('beforeSanitizeElements', node => { @@ -30,7 +30,7 @@ domPurify.addHook('beforeSanitizeElements', node => { // remove FB tracking param if (href.includes('fbclid=')) { try { - const url = new URL.URL(href) + const url = new url.URL(href) url.searchParams.delete('fbclid') node.setAttribute('href', url.href) if (text.includes('fbclid=')) { @@ -176,18 +176,21 @@ module.exports = { } const events = data.items.map(e => { const props = e.properties - const media = get(props, 'featured[0]') + let media = get(props, 'featured[0]') + if (media) { + media = url.resolve(URL, media) + } return { title: get(props, 'name[0]', ''), description: get(props, 'description[0]', ''), place: { - name: get(props, 'location[0].properties.name', '') || get(props, 'location[0]'), - address: get(props, 'location[0].properties.street-address') + name: get(props, 'location[0].properties.name[0].value', '') || get(props, 'location[0].properties.name', '') || get(props, 'location[0]'), + address: get(props, 'location[0].properties.street-address[0]') || get(props, 'location[0].properties.street-address') }, start_datetime: dayjs(get(props, 'start[0]', '')).unix(), end_datetime: dayjs(get(props, 'end[0]', '')).unix(), tags: get(props, 'category', []), - media: media ? [{ name: get(props, 'name[0]', ''), url: get(props, 'featured[0]'), focalpoint: [0, 0] }] : [] + media: media ? [{ name: get(props, 'name[0]', ''), url: media, focalpoint: [0, 0] }] : [] } }) return res.json(events) @@ -201,9 +204,9 @@ module.exports = { return { title: get(event, 'summary', ''), description: get(event, 'description', ''), - place: get(event, 'location', ''), - start: get(event, 'dtstart', ''), - end: get(event, 'dtend', '') + place: { name: get(event, 'location', '') }, + start_datetime: dayjs(get(event, 'startDate', null)).unix(), + end_datetime: dayjs(get(event, 'endDate', null)).unix() } })) } From 5d4626ee5eb82c92f62d3a68b8a9fa6c98c47c20 Mon Sep 17 00:00:00 2001 From: lesion Date: Wed, 22 Jun 2022 17:51:56 +0200 Subject: [PATCH 010/102] minor --- pages/add/_edit.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/add/_edit.vue b/pages/add/_edit.vue index f6657b46..563d76d2 100644 --- a/pages/add/_edit.vue +++ b/pages/add/_edit.vue @@ -64,7 +64,7 @@ v-card-actions v-spacer - v-btn(@click='done' :loading='loading' :disabled='!valid || loading' + v-btn(@click='done' :loading='loading' :disabled='!valid || loading' outlined color='primary') {{edit?$t('common.save'):$t('common.send')}} @@ -173,7 +173,7 @@ export default { }, 100), eventImported (event) { this.event = Object.assign(this.event, event) - this.$refs.where.selectPlace({ name: event.place.name, create: true }) + this.$refs.where.selectPlace({ name: event.place.name || event.place, create: true }) this.date = { recurrent: this.event.recurrent || null, from: new Date(dayjs.unix(this.event.start_datetime)), From e4e1dd2c6e4d9130ea4f108fa8533724c94b4b9c Mon Sep 17 00:00:00 2001 From: lesion Date: Wed, 22 Jun 2022 17:53:05 +0200 Subject: [PATCH 011/102] new Dockerfile image and docker-compose --- docs/docker/Dockerfile | 26 +++++++++++++++++-------- docs/docker/docker-compose.yml | 5 +---- docs/docker/entrypoint.sh | 4 ---- docs/docker/mariadb/docker-compose.yml | 5 +---- docs/docker/postgres/docker-compose.yml | 5 +---- docs/docker/sqlite/docker-compose.yml | 5 +---- 6 files changed, 22 insertions(+), 28 deletions(-) delete mode 100755 docs/docker/entrypoint.sh diff --git a/docs/docker/Dockerfile b/docs/docker/Dockerfile index 670f2db2..11c20ab2 100644 --- a/docs/docker/Dockerfile +++ b/docs/docker/Dockerfile @@ -1,8 +1,18 @@ -FROM node:17-slim -RUN bash -c "apt update -y && apt install git -y && apt clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp" -RUN yarn global remove gancio || true -RUN yarn cache clean -RUN yarn global add --latest --production --silent https://gancio.org/latest.tgz -ADD entrypoint.sh / -RUN chmod 755 /entrypoint.sh -ENTRYPOINT [ "/bin/sh", "/entrypoint.sh" ] +FROM debian:stable-slim AS nodejs-base +RUN apt-get -q update && \ + env DEBIAN_FRONTEND=noninteractive apt-get -y install nodejs && \ + apt-get clean && rm -fr /var/lib/apt/lists/* + +FROM nodejs-base AS build +RUN apt-get -q update && \ + env DEBIAN_FRONTEND=noninteractive apt-get -y install git yarnpkg && \ + yarnpkg global add --latest --production --silent http://192.168.10.159:8080/l.tgz && \ + apt-get clean && rm -fr /var/lib/apt/lists/* + +FROM nodejs-base +COPY --from=build /usr/local/share/.config/yarn/ /usr/local/share/.config/yarn/ +RUN ln -s ../share/.config/yarn/global/node_modules/.bin/gancio /usr/local/bin/gancio + +ENTRYPOINT ["/usr/local/bin/gancio"] + + diff --git a/docs/docker/docker-compose.yml b/docs/docker/docker-compose.yml index fdb433bb..54e4f97e 100644 --- a/docs/docker/docker-compose.yml +++ b/docs/docker/docker-compose.yml @@ -2,9 +2,8 @@ version: '3' services: gancio: - build: . restart: always - image: gancio + image: cisti/gancio container_name: gancio environment: - PATH=$PATH:/home/node/.yarn/bin @@ -12,8 +11,6 @@ services: - NODE_ENV=production - GANCIO_DB_DIALECT=sqlite - GANCIO_DB_STORAGE=./gancio.sqlite - entrypoint: /entrypoint.sh - command: gancio start volumes: - ./data:/home/node/data ports: diff --git a/docs/docker/entrypoint.sh b/docs/docker/entrypoint.sh deleted file mode 100755 index 7f124b75..00000000 --- a/docs/docker/entrypoint.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -chown -R node:node /home/node -su node -c "$*" - diff --git a/docs/docker/mariadb/docker-compose.yml b/docs/docker/mariadb/docker-compose.yml index 3dab105e..d47a90ce 100644 --- a/docs/docker/mariadb/docker-compose.yml +++ b/docs/docker/mariadb/docker-compose.yml @@ -14,9 +14,8 @@ services: - MARIADB_RANDOM_ROOT_PASSWORD=yes restart: always gancio: - build: . restart: always - image: gancio + image: cisti/gancio container_name: gancio environment: - PATH=$PATH:/home/node/.yarn/bin @@ -28,8 +27,6 @@ services: - GANCIO_DB_DATABASE=gancio - GANCIO_DB_USERNAME=gancio - GANCIO_DB_PASSWORD=gancio - command: gancio start - entrypoint: /entrypoint.sh volumes: - ./data:/home/node/data ports: diff --git a/docs/docker/postgres/docker-compose.yml b/docs/docker/postgres/docker-compose.yml index ad0a61f7..9234ba2d 100644 --- a/docs/docker/postgres/docker-compose.yml +++ b/docs/docker/postgres/docker-compose.yml @@ -16,9 +16,8 @@ services: ports: - 5432:5432 gancio: - build: . restart: always - image: gancio + image: cisti/gancio container_name: gancio environment: - PATH=$PATH:/home/node/.yarn/bin @@ -30,8 +29,6 @@ services: - GANCIO_DB_DATABASE=gancio - GANCIO_DB_USERNAME=gancio - GANCIO_DB_PASSWORD=gancio - command: gancio start - entrypoint: /entrypoint.sh volumes: - ./data:/home/node/data ports: diff --git a/docs/docker/sqlite/docker-compose.yml b/docs/docker/sqlite/docker-compose.yml index fdb433bb..54e4f97e 100644 --- a/docs/docker/sqlite/docker-compose.yml +++ b/docs/docker/sqlite/docker-compose.yml @@ -2,9 +2,8 @@ version: '3' services: gancio: - build: . restart: always - image: gancio + image: cisti/gancio container_name: gancio environment: - PATH=$PATH:/home/node/.yarn/bin @@ -12,8 +11,6 @@ services: - NODE_ENV=production - GANCIO_DB_DIALECT=sqlite - GANCIO_DB_STORAGE=./gancio.sqlite - entrypoint: /entrypoint.sh - command: gancio start volumes: - ./data:/home/node/data ports: From b94f400c64c2a07ff80e2ae7e5b2140b1044bd23 Mon Sep 17 00:00:00 2001 From: lesion Date: Thu, 23 Jun 2022 01:02:09 +0200 Subject: [PATCH 012/102] fix link on blur --- components/Editor.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Editor.vue b/components/Editor.vue index 1d0ace89..9597e5bb 100644 --- a/components/Editor.vue +++ b/components/Editor.vue @@ -57,7 +57,7 @@ v-btn(icon text tabindex='-1' :class='{ primary: isActive.link() }' @click='commands.link({href: getMarkAttrs("link") && getMarkAttrs("link").href ? "" : "https://"}); $refs.link.focus();') v-icon(v-text='mdiLink') - v-text-field.pt-0.ml-1(v-show='isActive.link()' ref='link' @focus='focus' @blur='blur' hide-details + v-text-field.pt-0.ml-1(v-show='isActive.link()' ref='link' @focus='focus' @blur='e => { blur(); commands.link({ href: e.target.value}) }' hide-details :value='isActive.link() && getMarkAttrs("link") && getMarkAttrs("link").href || ""' @keypress.enter='commands.link({ href: $event.target.value}); editor.focus()') From 1862e0cb60d0d3faa68d1470163e8793ac5abf6c Mon Sep 17 00:00:00 2001 From: lesion Date: Thu, 23 Jun 2022 13:07:46 +0200 Subject: [PATCH 013/102] better smtp setup, allow local sendmail, add secure flag, auth not required --- components/admin/SMTP.vue | 81 +++++++++++++++++++++++++---------- components/admin/Settings.vue | 3 +- locales/en.json | 5 ++- locales/it.json | 2 +- 4 files changed, 65 insertions(+), 26 deletions(-) diff --git a/components/admin/SMTP.vue b/components/admin/SMTP.vue index b866a446..de1cc016 100644 --- a/components/admin/SMTP.vue +++ b/components/admin/SMTP.vue @@ -4,22 +4,34 @@ v-card-text p(v-html="$t('admin.smtp_description')") v-form(v-model='isValid') + v-text-field(v-model='admin_email' @blur="save('admin_email', admin_email )" - :label="$t('admin.admin_email')" + :label="$t('admin.sender_email')" :rules="$validators.email") - v-text-field(v-model='smtp.host' - :label="$t('admin.smtp_hostname')" - :rules="[$validators.required('admin.smtp_hostname')]") - v-text-field(v-model='smtp.auth.user' - :label="$t('common.user')" - :rules="[$validators.required('common.user')]") + v-switch(v-model='smtp.sendmail' + :label="$t('admin.smtp_use_sendmail')") - v-text-field(v-model='smtp.auth.pass' - :label="$t('common.password')" - :rules="[$validators.required('common.password')]" - type='password') + template(v-if='!smtp.sendmail') + + v-text-field(v-model='smtp.host' + :label="$t('admin.smtp_hostname')" + :rules="[$validators.required('admin.smtp_hostname')]") + + v-text-field(v-model='smtp.port' + :label="$t('admin.smtp_port')" + :rules="[$validators.required('admin.smtp_port')]") + + v-switch(v-model='smtp.secure' + :label="$t('admin.smtp_secure')") + + v-text-field(v-model='smtp.auth.user' + :label="$t('common.user')") + + v-text-field(v-model='smtp.auth.pass' + :label="$t('common.password')" + type='password') v-card-actions v-spacer @@ -31,14 +43,16 @@ import { mapActions, mapState } from 'vuex' export default { data ({ $store }) { - const smtp = { host: '', auth: { user: '', pass: '' } } - if ($store.state.settings.smtp) { - smtp.host = $store.state.settings.smtp.host - if ($store.state.settings.smtp.auth) { - smtp.auth.user = $store.state.settings.smtp.auth.user - smtp.auth.pass = $store.state.settings.smtp.auth.pass - } - } + const smtp = { auth: {}, ...$store.state.settings.smtp } + // if ($store.state.settings.smtp) { + // smtp.host = $store.state.settings.smtp.host + // if ($store.state.settings.smtp.auth) { + // smtp.auth.user = $store.state.settings.smtp.auth.user + // smtp.auth.pass = $store.state.settings.smtp.auth.pass + // } else { + // smtp.auth = {} + // } + // } return { isValid: false, loading: false, @@ -47,13 +61,28 @@ export default { } }, computed: mapState(['settings']), + watch: { + 'smtp.secure' (value) { + this.smtp.port = value ? 465 : 25 + } + }, methods: { ...mapActions(['setSetting']), async testSMTP () { this.loading = true try { - await this.setSetting({ key: 'smtp', value: this.smtp }) - await this.$axios.$post('/settings/smtp', { smtp: this.smtp }) + const smtp = JSON.parse(JSON.stringify(this.smtp)) + console.error(smtp) + if (!smtp.auth.user) { + console.error('ma non sono qui dentro !??!') + delete smtp.auth + } + if (!smtp.secure) { + smtp.secure = false + smtp.ignoreTLS = true + } + // await this.setSetting({ key: 'smtp', value: JSON.parse(JSON.stringify(this.smtp)) }) + await this.$axios.$post('/settings/smtp', { smtp }) this.$root.$message(this.$t('admin.smtp_test_success', { admin_email: this.admin_email }), { color: 'success' }) } catch (e) { console.error(e) @@ -67,9 +96,15 @@ export default { } }, done () { - if (this.smtp.auth.pass) { - this.setSetting({ key: 'smtp', value: JSON.parse(JSON.stringify(this.smtp)) }) + const smtp = JSON.parse(JSON.stringify(this.smtp)) + if (!smtp.auth.user) { + delete smtp.auth } + if (!smtp.secure) { + smtp.secure = false + smtp.ignoreTLS = true + } + this.setSetting({ key: 'smtp', value: smtp }) this.$emit('close') }, diff --git a/components/admin/Settings.vue b/components/admin/Settings.vue index 7c1e6dc5..332750c4 100644 --- a/components/admin/Settings.vue +++ b/components/admin/Settings.vue @@ -85,7 +85,8 @@ export default { computed: { ...mapState(['settings']), showSMTPAlert () { - return !this.setup && (!this.settings.admin_email || !this.settings.smtp || !this.settings.smtp.host || !this.settings.smtp.auth.user) + return !this.setup && + (!this.settings.admin_email || !this.settings.smtp || (!this.settings.smtp.sendmail && !this.settings.smtp.host)) }, instance_locale: { get () { return this.settings.instance_locale }, diff --git a/locales/en.json b/locales/en.json index 29228af6..8d1da0e4 100644 --- a/locales/en.json +++ b/locales/en.json @@ -229,10 +229,13 @@ "new_announcement": "New announcement", "show_smtp_setup": "Email settings", "smtp_hostname": "SMTP Hostname", + "smtp_port": "SMTP Port", + "smtp_secure": "SMTP Secure (TLS or STARTTLS)", "smtp_description": "
  • Admin should receive an email when anon event is added (if enabled).
  • Admin should receive email of registration request (if enabled).
  • User should receive an email of registration request.
  • User should receive email of confirmed registration.
  • User should receive a confirmation email when subscribed directly by admin.
  • Users should receive email to restore password when they forgot it
", "smtp_test_success": "A test email is sent to {admin_email}, please check your inbox", "smtp_test_button": "Send a test email", - "admin_email": "Admin e-mail", + "smtp_use_sendmail": "Use sendmail", + "sender_email": "Sender e-mail", "widget": "Widget", "wrong_domain_warning": "The baseurl configured in config.json ({baseurl}) differs from the one you're visiting ({url})", "new_collection": "New collection", diff --git a/locales/it.json b/locales/it.json index 84b2caf2..140affde 100644 --- a/locales/it.json +++ b/locales/it.json @@ -227,7 +227,7 @@ "new_announcement": "Nuovo annuncio", "show_smtp_setup": "Impostazioni email", "widget": "Widget", - "smtp_description": "
  • L'amministratore riceve una email quando viene aggiunto un evento anonimo (se abilitati).
  • L'amministratore riceve le mail di richiesta di registrazione (se abilitata).
  • L persone ricevono una mail di conferma della registrazione richiesta.
  • Le persone ricevono le email della registrazione confermata.
  • Le persone ricevono una mail di avviso quando vengono registrate direttamente da admin.
  • Le persone ricevono la mail per modificare la password quando l'hanno dimenticata
", + "smtp_description": "
  • L'amministratore riceve una email quando viene aggiunto un evento anonimo (se abilitati).
  • L'amministratore riceve le mail di richiesta di registrazione (se abilitata).
  • Le persone ricevono una mail di conferma della registrazione richiesta.
  • Le persone ricevono le email della registrazione confermata.
  • Le persone ricevono una mail di avviso quando vengono registrate direttamente da admin.
  • Le persone ricevono la mail per modificare la password quando l'hanno dimenticata
", "smtp_hostname": "SMTP Hostname", "smtp_test_success": "Una mail di test è stata inviata all'indirizzo {admin_email}, controlla la tua casella di posta", "smtp_test_button": "Invia una mail di prova", From 24efa270b6784a4b549700bac46eb56704b64fab Mon Sep 17 00:00:00 2001 From: lesion Date: Thu, 23 Jun 2022 14:23:44 +0200 Subject: [PATCH 014/102] minor --- components/admin/SMTP.vue | 43 ++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/components/admin/SMTP.vue b/components/admin/SMTP.vue index de1cc016..76428876 100644 --- a/components/admin/SMTP.vue +++ b/components/admin/SMTP.vue @@ -13,30 +13,33 @@ v-switch(v-model='smtp.sendmail' :label="$t('admin.smtp_use_sendmail')") - template(v-if='!smtp.sendmail') + v-row(v-show='!smtp.sendmail') + v-col(cols=12 md=9) + v-text-field(v-model='smtp.host' + :label="$t('admin.smtp_hostname')" + :rules="[$validators.required('admin.smtp_hostname')]") + v-col(cols=12 md=3) + v-text-field(v-model='smtp.port' + :label="$t('admin.smtp_port')" + :rules="[$validators.required('admin.smtp_port')]") - v-text-field(v-model='smtp.host' - :label="$t('admin.smtp_hostname')" - :rules="[$validators.required('admin.smtp_hostname')]") + v-col(cols=12) + v-switch(v-model='smtp.secure' + :label="$t('admin.smtp_secure')") + + v-col(md=6) + v-text-field(v-model='smtp.auth.user' + :label="$t('common.user')") - v-text-field(v-model='smtp.port' - :label="$t('admin.smtp_port')" - :rules="[$validators.required('admin.smtp_port')]") - - v-switch(v-model='smtp.secure' - :label="$t('admin.smtp_secure')") - - v-text-field(v-model='smtp.auth.user' - :label="$t('common.user')") - - v-text-field(v-model='smtp.auth.pass' - :label="$t('common.password')" - type='password') + v-col(md=6) + v-text-field(v-model='smtp.auth.pass' + :label="$t('common.password')" + type='password') v-card-actions v-spacer - v-btn(color='primary' @click='testSMTP' :loading='loading' :disabled='loading || !isValid') {{$t('admin.smtp_test_button')}} - v-btn(color='warning' @click="done") {{$t("common.ok")}} + v-btn(color='primary' @click='testSMTP' :loading='loading' :disabled='loading || !isValid' outlined) {{$t('admin.smtp_test_button')}} + v-btn(color='warning' @click="done" outlined) {{$t("common.ok")}}