diff --git a/components/DateInput.vue b/components/DateInput.vue index 7ba78919..4439a866 100644 --- a/components/DateInput.vue +++ b/components/DateInput.vue @@ -17,7 +17,7 @@ v-col(cols=12) vc-date-picker( v-model='fromDate' :is-range='type === "multidate"' - @input="date => change('date', fromDate)" + @input="date => change('date', date)" :timezone='settings.instance_timezone' :attributes='attributes' :locale='$i18n.locale' @@ -106,21 +106,10 @@ export default { event: { type: Object, default: () => null } }, data() { - let fromDate - if (this.value.from) { - if (this.value.multidate) { - fromDate = ({ start: dayjs(this.value.from).toDate(), end: dayjs(this.value.due).toDate() }) - } else { - fromDate = new Date(this.value.from) - } - } return { mdiClockTimeFourOutline, mdiClockTimeEightOutline, mdiClose, allowedMinutes: [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55], menuFromHour: false, - fromDate, - fromHour: this.value.from && dayjs.tz(this.value.from).format('HH:mm'), - dueHour: this.value.due && dayjs.tz(this.value.due).format('HH:mm'), menuDueHour: false, type: this.value.type || 'normal', events: [], @@ -133,6 +122,26 @@ export default { }, computed: { ...mapState(['settings']), + fromDate: { + set: () => {}, + get: function () { + if (this.value.from) { + if (this.value.multidate) { + return ({ start: dayjs(this.value.from).toDate(), end: dayjs(this.value.due).toDate() }) + } else { + return new Date(this.value.from) + } + } + } + }, + fromHour: { + set: () => {}, + get () { return this.value.from && dayjs.tz(this.value.from).format('HH:mm') || '' } + }, + dueHour: { + set: () => {}, + get () { return this.value.due && dayjs.tz(this.value.due).format('HH:mm') || '' } + }, todayEvents() { const start = dayjs.tz(this.value.from).startOf('day').unix() const end = dayjs.tz(this.value.from).endOf('day').unix() @@ -227,16 +236,12 @@ export default { } else if (what === 'recurrentType') { this.$emit('input', { ...this.value, recurrent: { ...this.value.recurrent, type: value } }) } else if (what === 'fromHour') { - // if (value) { const [hour, minute] = value ? value.split(':') : [0, 0] let from = dayjs.tz(this.value.from).hour(hour).minute(minute).second(0).toDate() this.$emit('input', { ...this.value, from }) if (!value) { this.fromHour = null } - // } else { - // this.$emit('input', { ...this.value }) - // } } else if (what === 'dueHour') { if (value) { const [hour, minute] = value.split(':') diff --git a/locales/ca.json b/locales/ca.json index 25467f93..dabf767f 100644 --- a/locales/ca.json +++ b/locales/ca.json @@ -142,10 +142,10 @@ "normal_description": "Tria el dia.", "recurrent_1w_days": "Cada {days}", "recurrent_2w_days": "Un de cada dos {days}", - "recurrent_1m_days": "|El dia {days} de cada mes|Els dies {days} de cada mes", - "recurrent_2m_days": "|El dia {days} d'un de cada dos mesos|Els dies {days} d'un de cada dos mesos", + "recurrent_1m_days": "El dia {days} de cada mes", + "recurrent_2m_days": "El dia {days} d'un de cada dos mesos", "recurrent_1m_ordinal": "El {n} {days} de cada mes", - "recurrent_2m_ordinal": "|El {n} {days} de cada dos mesos|Els {n} {days} de cada dos mesos", + "recurrent_2m_ordinal": "El {n} {days} de cada dos mesos", "each_week": "Cada setmana", "each_2w": "Cada dues setmanes", "each_month": "Cada mes", diff --git a/locales/de.json b/locales/de.json index 1761976b..eb3405ea 100644 --- a/locales/de.json +++ b/locales/de.json @@ -242,7 +242,7 @@ "normal_description": "Wähle den Tag aus.", "recurrent_1w_days": "Jeden {days}", "recurrent_2w_days": "Jeden zweiten {days} eine", - "recurrent_1m_days": "|Der {days} in jedem Monat|{days} in jedem Monat", + "recurrent_1m_days": "Der {days} in jedem Monat", "recurrent_2m_days": "Jeder {days} im Monat", "recurrent_1m_ordinal": "Jeden {n} {days} im Monat", "each_week": "Jede Woche", diff --git a/locales/en.json b/locales/en.json index 6897c612..0b81d7e0 100644 --- a/locales/en.json +++ b/locales/en.json @@ -146,10 +146,10 @@ "normal_description": "Choose the day.", "recurrent_1w_days": "Each {days}", "recurrent_2w_days": "A {days} every other", - "recurrent_1m_days": "|The {days} of each month|{days} of each month", - "recurrent_2m_days": "|The {days} a month every other|The {days} a month every other", + "recurrent_1m_days": "The {days} of each month", + "recurrent_2m_days": "The {days} a month every other", "recurrent_1m_ordinal": "The {n} {days} of each month", - "recurrent_2m_ordinal": "|The {n} {days} a month every other|The {n} {days} a month every other", + "recurrent_2m_ordinal": "The {n} {days} a month every other", "each_week": "Each week", "each_2w": "Every other weeks", "each_month": "Each month", diff --git a/locales/es.json b/locales/es.json index f23670bd..5d6ca1e2 100644 --- a/locales/es.json +++ b/locales/es.json @@ -137,10 +137,10 @@ "normal_description": "Selecciona el día.", "recurrent_1w_days": "Cada {days}", "recurrent_2w_days": "Un {days} cada dos", - "recurrent_1m_days": "|El día {days} de cada mes|Los días {days} de cada mes", - "recurrent_2m_days": "|El día {days} cada dos meses|Los días {days} cada dos meses", + "recurrent_1m_days": "El día {days} de cada mes", + "recurrent_2m_days": "El día {days} cada dos meses", "recurrent_1m_ordinal": "El {n} {days} de cada mes", - "recurrent_2m_ordinal": "|El {n} {days} un mes sí y el otro no|El {n} {days} un mes sí y el otro no", + "recurrent_2m_ordinal": "El {n} {days} un mes sí y el otro no", "each_week": "Cada semana", "each_2w": "Cada dos semanas", "each_month": "Cada mes", diff --git a/locales/eu.json b/locales/eu.json index d69e3f4c..39becdc0 100644 --- a/locales/eu.json +++ b/locales/eu.json @@ -142,10 +142,10 @@ "normal_description": "Aukeratu eguna.", "recurrent_1w_days": "{days}(e)ro", "recurrent_2w_days": "Bi {days}(e)z behin", - "recurrent_1m_days": "|Hilabetero {days}etan|Hilabetero {days}etan", - "recurrent_2m_days": "|{days}etan bi hilabetez behin|{days}etan bi hilabetez behin", + "recurrent_1m_days": "Hilabetero {days}etan", + "recurrent_2m_days": "{days}etan bi hilabetez behin", "recurrent_1m_ordinal": "Hilabeteko {n}. {days}(e)ro", - "recurrent_2m_ordinal": "|Bi hilabetez behin {n}. {days}(e)an|Bi hilabetez behin {n}. {days}(e)an", + "recurrent_2m_ordinal": "Bi hilabetez behin {n}. {days}(e)an", "each_week": "Astero", "each_2w": "Bi astez behin", "each_month": "Hilero", diff --git a/locales/fr.json b/locales/fr.json index ab9fbea2..f49862c1 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -104,7 +104,7 @@ "from": "Du", "each_month": "Chaque mois", "each_week": "Chaque semaine", - "recurrent_1m_days": "|Chaque {days} du mois|Chaque {days} du mois", + "recurrent_1m_days": "Chaque {days} du mois", "recurrent_1w_days": "Chaque {days}", "normal_description": "Choisissez un jour.", "normal": "Normal", @@ -130,8 +130,8 @@ "anon": "Anonyme", "ics": "ICS", "each_2w": "Une semaine sur deux", - "recurrent_2m_ordinal": "|Le {n} {days} du mois un mois sur|Les {n} {days} du mois un mois sur deux", - "recurrent_2m_days": "|Le {days} un mois sur deux|Les {jours} un mois sur deux", + "recurrent_2m_ordinal": "Les {n} {days} du mois un mois sur deux", + "recurrent_2m_days": "Le {days} un mois sur deux", "recurrent_2w_days": "Un {days} sur deux", "edit_recurrent": "Modifier l’évènement récurrent :", "updated": "Évènement mis à jour", diff --git a/locales/gl.json b/locales/gl.json index 2761b181..bc2bba17 100644 --- a/locales/gl.json +++ b/locales/gl.json @@ -119,8 +119,8 @@ "show_past": "tamén eventos previos", "only_future": "só eventos futuros", "recurrent_2w_days": "Cada {days} días", - "recurrent_2m_ordinal": "|O {n} {days} en meses alternos|O {n} {days} en meses alternos", - "recurrent_2m_days": "|O {days} cada dous meses|O {days} cada dous meses", + "recurrent_2m_ordinal": "O {n} {days} en meses alternos", + "recurrent_2m_days": "O {days} cada dous meses", "each_month": "Cada mes", "due": "ata", "from": "Desde", @@ -149,7 +149,7 @@ "recurrent_1w_days": "Cada {days}", "recurrent_1m_ordinal": "O {n} {days} de cada mes", "image_too_big": "A imaxe non pode superar os 4MB", - "recurrent_1m_days": "|O {days} de cada mes|{days} de cada mes", + "recurrent_1m_days": "O {days} de cada mes", "each_2w": "Cada dúas semanas", "follow_me_description": "Un dos xeitos de recibir actualizacións dos eventos que se publican aquí en {title},\né seguindo a conta {account} no fediverso, por exemplo a través de Mastodon, e posiblemente tamén engadir recursos para un evento desde alí.

\nSe nunco escoitaches falar de Mastodon e o fediverso recomendámosche ler este artigo.

Escribe aquí a túa instancia (ex. mastodon.social)", "ics": "ICS", diff --git a/locales/nb.json b/locales/nb.json index 2b634ace..531235d3 100644 --- a/locales/nb.json +++ b/locales/nb.json @@ -114,8 +114,8 @@ "image_too_big": "Bildet kan ikke være større enn 4 MB", "recurrent_2m_ordinal": "|Den {n} {days} i måneden annenhver|Den {n} {days} i måneden annenhver", "recurrent_1m_ordinal": "På {n} {days} i hver måned", - "recurrent_2m_days": "|På {days} i hver måned annenhver|{days} i hver måned annenhver", - "recurrent_1m_days": "|På {days} i hver måned|{days} i hver måned", + "recurrent_2m_days": "På {days} i hver måned annenhver", + "recurrent_1m_days": "På {days} i hver måned", "recurrent_2w_days": "En {days} annenhver", "multidate_description": "Er det en festival? Velg når den starter og slutter", "where_description": "Hvor finner hendelsen sted? Hvis den ikke finnes kan du opprette den.", diff --git a/pages/add/_edit.vue b/pages/add/_edit.vue index bbc281a1..598612c1 100644 --- a/pages/add/_edit.vue +++ b/pages/add/_edit.vue @@ -33,7 +33,7 @@ v-container.container.pa-0.pa-md-3 WhereInput(ref='where' v-model='event.place') //- When - DateInput(v-model='date' :event='event') + DateInput(ref='when' v-model='date' :event='event') //- Description v-col.px-0(cols='12') Editor.px-3.ma-0( @@ -112,7 +112,7 @@ export default { data.date = { recurrent: event.recurrent, from: dayjs.unix(event.start_datetime).toDate(), - due: dayjs.unix(event.end_datetime).toDate(), + due: event.end_datetime && dayjs.unix(event.end_datetime).toDate(), multidate: event.multidate, fromHour: true, dueHour: true @@ -172,11 +172,13 @@ export default { }, 100), eventImported(event) { this.event = Object.assign(this.event, event) - this.$refs.where.selectPlace({ name: event.place.name || event.place, create: true }) + + this.$refs.where.selectPlace({ name: event.place.name || event.place, address: event.place.address }) + this.date = { recurrent: this.event.recurrent || null, - from: new Date(dayjs.unix(this.event.start_datetime)), - due: new Date(dayjs.unix(this.event.end_datetime)), + from: dayjs.unix(this.event.start_datetime).toDate(), + due: this.event.end_datetime && dayjs.unix(this.event.end_datetime).toDate(), multidate: event.multidate, fromHour: true, dueHour: true diff --git a/server/api/auth.js b/server/api/auth.js index 65f199a6..04d24c19 100644 --- a/server/api/auth.js +++ b/server/api/auth.js @@ -1,132 +1,4 @@ const log = require('../log') -const get = require('lodash/get') -const passport = require('passport') - -// const oauth = require('./oauth') -// const User = require('./models/user') -// const OAuthClient = require('./models/oauth_client') -// const OAuthCode = require('./models/oauth_code') -// const OAuthToken = require('./models/oauth_token') - - -// const CustomStrategy = require('passport-custom').Strategy -// const LocalStrategy = require('passport-local').Strategy -// const BasicStrategy = require('passport-http').BasicStrategy -// const ClientPasswordStrategy = require('passport-oauth2-client-password').Strategy -// const BearerStrategy = require('passport-http-bearer').Strategy - -// console.error('dentro passport setup!') -// passport.use('authenticate', new CustomStrategy(async (req, done) => { -// console.error('dentro authenticate strategy') - -// // check if a cookie is passed -// const token = get(req.cookies, 'auth._token.local', null) -// const authorization = get(req.headers, 'authorization', null) -// if (!authorization && token) { -// req.headers.authorization = token -// } - -// if (!authorization && !token) { -// return done(null, false) -// } - -// console.error(authorization, token) -// return done(null, false) - -// })) - -/** - * LocalStrategy - * - * This strategy is used to authenticate users based on a username and password. - * Anytime a request is made to authorize an application, we must ensure that - * a user is logged in before asking them to approve the request. - */ -// passport.use(new LocalStrategy( -// async (username, password, done) => { -// console.error(`sono qui dentro local strategy cerco ${username} ${password}}`) -// const user = await User.findOne({ where: { email: username, is_active: true } }) -// console.error(user) -// if (!user) { -// return done(null, false) -// } -// // check if password matches -// if (await user.comparePassword(password)) { -// console.error('compare password ok!') -// return done(null, user) -// } -// return done(null, false) -// } -// // )) - -// passport.serializeUser((user, done) => done(null, user.id)) - -// passport.deserializeUser(async (id, done) => { -// const user = await User.findByPk(id) -// done(null, user) -// }) - -/** - * BasicStrategy & ClientPasswordStrategy - * - * These strategies are used to authenticate registered OAuth clients. They are - * employed to protect the `token` endpoint, which consumers use to obtain - * access tokens. The OAuth 2.0 specification suggests that clients use the - * HTTP Basic scheme to authenticate. Use of the client password strategy - * allows clients to send the same credentials in the request body (as opposed - * to the `Authorization` header). While this approach is not recommended by - * the specification, in practice it is quite common. - */ -// async function verifyClient(client_id, client_secret, done) { -// console.error('Dentro verify client ', client_id, client_secret) -// const client = await OAuthClient.findByPk(client_id, { raw: true }) -// console.error(client) -// if (client_secret && client_secret !== client.client_secret) { -// return done(null, false) -// } - -// if (client) { client.grants = ['authorization_code', 'password'] } //sure ? - -// return done(null, client) -// } - -// passport.use(new BasicStrategy(verifyClient)) -// passport.use(new ClientPasswordStrategy(verifyClient)) - -/** - * BearerStrategy - * - * This strategy is used to authenticate either users or clients based on an access token - * (aka a bearer token). If a user, they must have previously authorized a client - * application, which is issued an access token to make requests on behalf of - * the authorizing user. - */ -// passport.use(new BearerStrategy( -// async (accessToken, done) => { -// console.error('dentro bearer strategy') -// const token = await OAuthToken.findByPk(accessToken, -// { include: [{ model: User, attributes: { exclude: ['password'] } }, { model: OAuthClient, as: 'client' }] }) - -// if (!token) return done(null, false) -// if (token.userId) { -// if (!token.user) { -// return done(null, false) -// } -// // To keep this example simple, restricted scopes are not implemented, -// // and this is just for illustrative purposes. -// done(null, user, { scope: '*' }) -// } else { -// // The request came from a client only since userId is null, -// // therefore the client is passed back instead of a user. -// if (!token.client) { -// return done(null, false) -// } -// // To keep this example simple, restricted scopes are not implemented, -// // and this is just for illustrative purposes. -// done(null, client, { scope: '*' }) -// } -// } -// )) const Auth = {