Merge branch 'master' into dev

This commit is contained in:
lesion 2022-09-21 12:34:21 +02:00
commit 019161eff9
No known key found for this signature in database
GPG key ID: 352918250B012177
12 changed files with 713 additions and 595 deletions

View file

@ -1,5 +1,14 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
### 1.5.5 - 21 set '22
- fix #185 - wrong res.download api usage
- fix some dialog background on light theme
- update sequelize and remove live patch
- improve events filtering on selected day
- allow tags complete removals
- improve homepage performance
- docs: add scheme to nginx proxy configuration
### 1.5.4 - 6 set '22 ### 1.5.4 - 6 set '22
- Update webcomponent deps - Update webcomponent deps
- Refactor datime display in webcomponent - Refactor datime display in webcomponent

View file

@ -1,13 +1,11 @@
import dayjs from 'dayjs' import dayjs from 'dayjs'
export function attributesFromEvents(_events) { export function attributesFromEvents(_events) {
// const colors = ['teal', 'green', 'yellow', 'teal', 'indigo', 'green', 'red', 'purple', 'pink', 'gray']
// merge events with same date // merge events with same date
let attributes = [] let attributes = []
const now = dayjs().unix() const now = dayjs().unix()
for (let e of _events) { for (let e of _events) {
const key = dayjs.unix(e.start_datetime).tz().format('YYYYMMDD') const key = Math.floor(e.start_datetime/(3600*24)) // dayjs.unix(e.start_datetime).tz().format('YYYYMMDD')
const c = (e.end_datetime || e.start_datetime) < now ? 'vc-past' : '' const c = (e.end_datetime || e.start_datetime) < now ? 'vc-past' : ''
if (e.multidate) { if (e.multidate) {

View file

@ -16,52 +16,15 @@ v-card.h-event.event.d-flex(itemscope itemtype="https://schema.org/Event")
v-chip.ml-1.mt-1(v-for='tag in event.tags.slice(0, 6)' small :to='`/tag/${tag}`' v-chip.ml-1.mt-1(v-for='tag in event.tags.slice(0, 6)' small :to='`/tag/${tag}`'
:key='tag' outlined color='primary') {{ tag }} :key='tag' outlined color='primary') {{ tag }}
client-only
v-menu(offset-y eager)
template(v-slot:activator="{ on }")
v-btn.align-self-end(icon v-on='on' color='primary' title='more' aria-label='more')
v-icon(v-text='mdiDotsVertical')
v-list(dense)
v-list-item-group
v-list-item(@click='clipboard(`${settings.baseurl}/event/${event.slug || event.id}`)')
v-list-item-icon
v-icon(v-text='mdiContentCopy')
v-list-item-content
v-list-item-title {{ $t('common.copy_link') }}
v-list-item(:href='`/api/event/${event.slug || event.id}.ics`')
v-list-item-icon
v-icon(v-text='mdiCalendarExport')
v-list-item-content
v-list-item-title {{ $t('common.add_to_calendar') }}
v-list-item(v-if='is_mine' :to='`/add/${event.id}`')
v-list-item-icon
v-icon(v-text='mdiPencil')
v-list-item-content
v-list-item-title {{ $t('common.edit') }}
v-list-item(v-if='is_mine' @click='remove(false)')
v-list-item-icon
v-icon(color='error' v-text='mdiDeleteForever')
v-list-item-content
v-list-item-title {{ $t('common.remove') }}
template(#placeholder)
v-btn.align-self-end(icon color='primary' aria-label='more')
v-icon(v-text='mdiDotsVertical')
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
import clipboard from '../assets/clipboard'
import MyPicture from '~/components/MyPicture' import MyPicture from '~/components/MyPicture'
import { import { mdiRepeat } from '@mdi/js'
mdiRepeat, mdiPencil, mdiDotsVertical, mdiContentCopy,
mdiCalendarExport, mdiDeleteForever, mdiCalendar, mdiMapMarker
} from '@mdi/js'
export default { export default {
data() { data() {
return { return { mdiRepeat }
mdiRepeat, mdiPencil, mdiDotsVertical, mdiContentCopy, mdiCalendarExport,
mdiDeleteForever, mdiMapMarker, mdiCalendar
}
}, },
components: { components: {
MyPicture MyPicture
@ -70,27 +33,6 @@ export default {
event: { type: Object, default: () => ({}) }, event: { type: Object, default: () => ({}) },
lazy: Boolean lazy: Boolean
}, },
mixins: [clipboard], computed: mapState(['settings'])
computed: {
...mapState(['settings']),
is_mine() {
if (!this.$auth.user) {
return false
}
return (
this.event.userId === this.$auth.user.id || this.$auth.user.is_admin
)
}
},
methods: {
async remove() {
const ret = await this.$root.$confirm('event.remove_confirmation')
if (!ret) { return }
await this.$axios.delete(`/event/${this.event.id}`)
this.$emit('destroy', this.event.id)
this.$root.$message('admin.event_remove_ok')
}
}
} }
</script> </script>

View file

@ -8,6 +8,15 @@ nav_order: 10
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
### 1.5.5 - 21 set '22
- fix #185 - wrong res.download api usage
- fix some dialog background on light theme
- update sequelize and remove live patch
- improve events filtering on selected day
- allow tags complete removals
- improve homepage performance
- docs: add scheme to nginx proxy configuration
### 1.5.4 - 6 set '22 ### 1.5.4 - 6 set '22
- Update webcomponent deps - Update webcomponent deps
- Refactor datime display in webcomponent - Refactor datime display in webcomponent

View file

@ -29,6 +29,8 @@ server {
location @proxy { location @proxy {
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:13120; proxy_pass http://127.0.0.1:13120;
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"common": { "common": {
"add_event": "Nuovo evento", "add_event": "Aggiungi evento",
"next": "Continua", "next": "Continua",
"export": "Esporta", "export": "Esporta",
"send": "Invia", "send": "Invia",

View file

@ -1,6 +1,6 @@
{ {
"name": "gancio", "name": "gancio",
"version": "1.5.4", "version": "1.5.5",
"description": "A shared agenda for local communities", "description": "A shared agenda for local communities",
"author": "lesion", "author": "lesion",
"scripts": { "scripts": {
@ -51,7 +51,7 @@
"http-signature": "^1.3.6", "http-signature": "^1.3.6",
"https-proxy-agent": "^5.0.1", "https-proxy-agent": "^5.0.1",
"ical.js": "^1.5.0", "ical.js": "^1.5.0",
"ics": "^2.37.0", "ics": "^2.40.0",
"jsdom": "^20.0.0", "jsdom": "^20.0.0",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"linkify-html": "^3.0.4", "linkify-html": "^3.0.4",
@ -63,10 +63,10 @@
"mkdirp": "^1.0.4", "mkdirp": "^1.0.4",
"multer": "^1.4.5-lts.1", "multer": "^1.4.5-lts.1",
"mysql2": "^2.3.3", "mysql2": "^2.3.3",
"nuxt-edge": "2.16.0-27616340.013f051b", "nuxt-edge": "2.16.0-27715704.54e852f",
"pg": "^8.8.0", "pg": "^8.8.0",
"sequelize": "^6.21.4", "sequelize": "^6.21.6",
"sequelize-slugify": "^1.6.1", "sequelize-slugify": "^1.6.2",
"sharp": "^0.27.2", "sharp": "^0.27.2",
"sqlite3": "^5.0.11", "sqlite3": "^5.0.11",
"telegraf": "^4.9.1", "telegraf": "^4.9.1",
@ -75,14 +75,14 @@
"umzug": "^2.3.0", "umzug": "^2.3.0",
"v-calendar": "^2.4.1", "v-calendar": "^2.4.1",
"vue-i18n": "^8.26.7", "vue-i18n": "^8.26.7",
"vuetify": "2.6.9", "vuetify": "2.6.10",
"winston": "^3.8.1", "winston": "^3.8.2",
"winston-daily-rotate-file": "^4.7.1", "winston-daily-rotate-file": "^4.7.1",
"yargs": "^17.5.0" "yargs": "^17.5.0"
}, },
"devDependencies": { "devDependencies": {
"@nuxtjs/vuetify": "^1.12.3", "@nuxtjs/vuetify": "^1.12.3",
"jest": "^29.0.0", "jest": "^29.0.3",
"prettier": "^2.7.1", "prettier": "^2.7.1",
"pug": "^3.0.2", "pug": "^3.0.2",
"pug-plain-loader": "^1.1.0", "pug-plain-loader": "^1.1.0",

View file

@ -91,7 +91,7 @@ export default {
if (this.selectedDay) { if (this.selectedDay) {
const min = dayjs.tz(this.selectedDay).startOf('day').unix() const min = dayjs.tz(this.selectedDay).startOf('day').unix()
const max = dayjs.tz(this.selectedDay).endOf('day').unix() const max = dayjs.tz(this.selectedDay).endOf('day').unix()
return this.events.filter(e => (e.start_datetime <= max && e.end_datetime >= min) && (this.show_recurrent || !e.parentId)) return this.events.filter(e => (e.start_datetime <= max && (e.end_datetime || e.start_datetime) >= min) && (this.show_recurrent || !e.parentId))
} else if (this.isCurrentMonth) { } else if (this.isCurrentMonth) {
return this.events.filter(e => ((e.end_datetime ? e.end_datetime > now : e.start_datetime + 2 * 60 * 60 > now) && (this.show_recurrent || !e.parentId))) return this.events.filter(e => ((e.end_datetime ? e.end_datetime > now : e.start_datetime + 2 * 60 * 60 > now) && (this.show_recurrent || !e.parentId)))
} else { } else {

View file

@ -570,8 +570,8 @@ const eventController = {
let tags = [] let tags = []
if (body.tags) { if (body.tags) {
tags = await tagController._findOrCreate(body.tags) tags = await tagController._findOrCreate(body.tags)
await event.setTags(tags)
} }
await event.setTags(tags)
let newEvent = await Event.findByPk(event.id, { include: [Tag, Place] }) let newEvent = await Event.findByPk(event.id, { include: [Tag, Place] })
newEvent = newEvent.get() newEvent = newEvent.get()

View file

@ -1,9 +1,5 @@
const Sequelize = require('sequelize') const Sequelize = require('sequelize')
// this is an hack: https://github.com/sequelize/sequelize/pull/14800
const livePatchMariaDBDialect = require('sequelize/lib/dialects/mariadb/query')
livePatchMariaDBDialect.prototype.handleJsonSelectQuery = () => null
const Umzug = require('umzug') const Umzug = require('umzug')
const path = require('path') const path = require('path')
const config = require('../../config') const config = require('../../config')

View file

@ -108,8 +108,12 @@ module.exports = {
const router = express.Router() const router = express.Router()
// serve images/thumb // serve images/thumb
router.use('/media/', express.static(config.upload_path, { immutable: true, maxAge: '1y' }), (_req, res) => res.sendStatus(404)) router.use('/media/', express.static(config.upload_path, { immutable: true, maxAge: '1y' }), (_req, res) => res.sendStatus(404))
router.use('/download/:filename', (req, res, next) => { router.use('/download/:filename', (req, res) => {
return res.download(req.params.filename, undefined, { root: config.upload_path }, err => res.status(404).send('Not found (but nice try 😊)')) return res.download(req.params.filename, undefined, { root: config.upload_path }, err => {
if (err) {
res.status(404).send('Not found (but nice try 😊)')
}
})
}) })
router.use('/noimg.svg', express.static('./static/noimg.svg')) router.use('/noimg.svg', express.static('./static/noimg.svg'))

1186
yarn.lock

File diff suppressed because it is too large Load diff