minor
This commit is contained in:
parent
80d2dbd06b
commit
bb9f7cca47
4 changed files with 15 additions and 15 deletions
|
@ -74,7 +74,6 @@ import dayjs from 'dayjs'
|
|||
|
||||
import { mdiFileImport, mdiFormatTitle, mdiTagMultiple, mdiCloseCircle } from '@mdi/js'
|
||||
|
||||
import List from '@/components/List'
|
||||
import Editor from '@/components/Editor'
|
||||
import ImportDialog from '@/components/ImportDialog'
|
||||
import MediaInput from '@/components/MediaInput'
|
||||
|
@ -84,7 +83,6 @@ import DateInput from '@/components/DateInput'
|
|||
export default {
|
||||
name: 'NewEvent',
|
||||
components: {
|
||||
List,
|
||||
Editor,
|
||||
ImportDialog,
|
||||
MediaInput,
|
||||
|
@ -125,8 +123,8 @@ export default {
|
|||
|
||||
data.event.place.name = event.place.name
|
||||
data.event.place.address = event.place.address || ''
|
||||
const from = dayjs.unix(event.start_datetime)
|
||||
const due = event.end_datetime && dayjs.unix(event.end_datetime)
|
||||
const from = dayjs.unix(event.start_datetime).tz()
|
||||
const due = event.end_datetime && dayjs.unix(event.end_datetime).tz()
|
||||
data.date = {
|
||||
recurrent: event.recurrent,
|
||||
from: from.toDate(),
|
||||
|
@ -161,7 +159,6 @@ export default {
|
|||
},
|
||||
tags: [],
|
||||
page: { month, year },
|
||||
fileList: [],
|
||||
id: null,
|
||||
date: { from: null, due: null, recurrent: null },
|
||||
edit: false,
|
||||
|
@ -240,12 +237,12 @@ export default {
|
|||
formData.append('description', this.event.description)
|
||||
formData.append('multidate', !!this.date.multidate)
|
||||
let [hour, minute] = this.date.fromHour.split(':')
|
||||
formData.append('start_datetime', dayjs(this.date.from).hour(Number(hour)).minute(Number(minute)).second(0).unix())
|
||||
formData.append('start_datetime', dayjs(this.date.from).hour(Number(hour)).minute(Number(minute)).second(0).tz().unix())
|
||||
if (this.date.dueHour) {
|
||||
[hour, minute] = this.date.dueHour.split(':')
|
||||
formData.append('end_datetime', dayjs(this.date.due).hour(Number(hour)).minute(Number(minute)).second(0).unix())
|
||||
formData.append('end_datetime', dayjs(this.date.due).hour(Number(hour)).minute(Number(minute)).second(0).tz().unix())
|
||||
} else if (!!this.date.multidate) {
|
||||
formData.append('end_datetime', dayjs(this.date.due).hour(24).minute(0).second(0).unix())
|
||||
formData.append('end_datetime', dayjs(this.date.due).hour(24).minute(0).second(0).tz().unix())
|
||||
}
|
||||
|
||||
if (this.edit) {
|
||||
|
|
|
@ -132,7 +132,7 @@ module.exports = () => {
|
|||
* @param {image} [image] - Image
|
||||
*/
|
||||
|
||||
// allow anyone to add an event (anon event has to be confirmed, TODO: flood protection)
|
||||
// allow anyone to add an event (anon event has to be confirmed, flood protection)
|
||||
api.post('/event', eventController.isAnonEventAllowed, SPAMProtectionApiRateLimiter, upload.single('image'), eventController.add)
|
||||
|
||||
// api.get('/event/search', eventController.search)
|
||||
|
|
|
@ -6,8 +6,8 @@ const next = (req, res, next) => next()
|
|||
const instanceApiRateLimiter = {
|
||||
|
||||
DDOSProtectionApiRateLimiter: (process.env.NODE_ENV === 'test' ? next : rateLimit({
|
||||
windowMs: 60 * 1000, // 5 minutes
|
||||
max: 100, // Limit each IP to 100 requests per `window` (here, per 5 minutes)
|
||||
windowMs: 60 * 1000, // 1 minutes
|
||||
max: 100, // Limit each IP to 100 requests per `window`
|
||||
standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers
|
||||
legacyHeaders: false, // Disable the `X-RateLimit-*` headers
|
||||
handler: (request, response, next, options) => {
|
||||
|
@ -16,9 +16,12 @@ const instanceApiRateLimiter = {
|
|||
}
|
||||
})),
|
||||
|
||||
|
||||
/** This is a limiter used to avoid spam
|
||||
* (used during the registration, pass recovery, posting events) */
|
||||
SPAMProtectionApiRateLimiter: (process.env.NODE_ENV === 'test' ? next : rateLimit({
|
||||
windowMs: 5 * 60 * 1000, // 10 minutes
|
||||
max: 3, // Limit each IP to 3 requests per `window` (here, per 15 minutes)
|
||||
windowMs: 5 * 60 * 1000, // 5 minutes
|
||||
max: 3, // Limit each IP to 3 requests per `window` (here, per 5 minutes)
|
||||
standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers
|
||||
legacyHeaders: false, // Disable the `X-RateLimit-*` headers
|
||||
handler: (request, response, next, options) => {
|
||||
|
|
|
@ -61,7 +61,7 @@ const mail = {
|
|||
...locals,
|
||||
locale,
|
||||
config: { title: settings.title, baseurl: settings.baseurl, description: settings.description, admin_email: settings.admin_email },
|
||||
datetime: datetime => moment.unix(datetime).locale(locale).format('ddd, D MMMM HH:mm')
|
||||
datetime: datetime => moment.unix(datetime).tz().locale(locale).format('ddd, D MMMM HH:mm')
|
||||
}
|
||||
}
|
||||
return email.send(msg)
|
||||
|
|
Loading…
Reference in a new issue