optimize bundle size and resize/sharp image upload

fix #11
This commit is contained in:
lesion
2019-03-07 22:39:12 +01:00
parent 817359043d
commit 5f55d487db
13 changed files with 97 additions and 32 deletions

View File

@@ -110,6 +110,9 @@ const userController = {
async updateEvent (req, res) {
const body = req.body
const event = await Event.findByPk(body.id)
if (!req.user.is_admin && event.userId !== req.user.id) {
return res.sendStatus(403)
}
body.description = body.description
.replace(/(<([^>]+)>)/ig, '') // remove all tags from description
@@ -142,11 +145,6 @@ const userController = {
return res.json(newEvent)
},
async getMyEvents (req, res) {
const events = await req.user.getEvents()
res.json(events)
},
async getAuthURL (req, res) {
const instance = req.body.instance
const { client_id, client_secret } = await Mastodon.createOAuthApp(`https://${instance}/api/v1/apps`, 'eventi', 'read write', `${config.baseurl}/settings`)