From 96e0a0b57cc583f43332b733114e2c7230b6bc3b Mon Sep 17 00:00:00 2001 From: lesion Date: Wed, 24 Jul 2019 11:49:02 +0200 Subject: [PATCH] start with user favicon/locale personalization --- .vscode/vscode-kanban.json | 62 +++++++++++++++---------------- config/default.json | 1 + docs/settings.md | 13 +++++++ pages/admin.vue | 15 +++++++- server/api/controller/settings.js | 9 +++++ server/api/index.js | 2 + server/index.js | 6 ++- 7 files changed, 74 insertions(+), 34 deletions(-) diff --git a/.vscode/vscode-kanban.json b/.vscode/vscode-kanban.json index 3d0cba40..ca8d5070 100644 --- a/.vscode/vscode-kanban.json +++ b/.vscode/vscode-kanban.json @@ -8,28 +8,6 @@ "id": "23", "references": [], "title": "colori te prego!" - } - ], - "in-progress": [], - "testing": [], - "todo": [ - { - "assignedTo": { - "name": "lesion" - }, - "creation_time": "2019-06-01T21:00:22.155Z", - "id": "28", - "references": [], - "title": "activitypub stream" - }, - { - "assignedTo": { - "name": "lesion" - }, - "creation_time": "2019-05-27T15:42:35.467Z", - "id": "21", - "references": [], - "title": "all'admin deve mostrare un badge se ci sono pending operation" }, { "assignedTo": { @@ -40,15 +18,6 @@ "references": [], "title": "copy to clipboard" }, - { - "assignedTo": { - "name": "lesion" - }, - "creation_time": "2019-05-29T13:08:20.887Z", - "id": "25", - "references": [], - "title": "creazione script di backup" - }, { "assignedTo": { "name": "lesion" @@ -93,6 +62,37 @@ "id": "29", "references": [], "title": "settings di istanza (default filter, eg, eventi ricorrenti)" + } + ], + "in-progress": [], + "testing": [], + "todo": [ + { + "assignedTo": { + "name": "lesion" + }, + "creation_time": "2019-06-01T21:00:22.155Z", + "id": "28", + "references": [], + "title": "activitypub stream" + }, + { + "assignedTo": { + "name": "lesion" + }, + "creation_time": "2019-05-27T15:42:35.467Z", + "id": "21", + "references": [], + "title": "all'admin deve mostrare un badge se ci sono pending operation" + }, + { + "assignedTo": { + "name": "lesion" + }, + "creation_time": "2019-05-29T13:08:20.887Z", + "id": "25", + "references": [], + "title": "creazione script di backup" }, { "assignedTo": { diff --git a/config/default.json b/config/default.json index 8d0ff7de..43ec0d83 100644 --- a/config/default.json +++ b/config/default.json @@ -1,6 +1,7 @@ { "title": "Gancio", "description": "A shared agenda for local communities", + "favicon" : "../dist/favicon.ico", "baseurl": "http://localhost:13120", "server": { "host": "localhost", diff --git a/docs/settings.md b/docs/settings.md index 246668a3..f0869ee2 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -6,11 +6,23 @@ nav_order: 3 --- # Settings +Main `gancio` configuration is done with a configuration file. +This shoud be a `.json` or a `.js` file and could be specified using the `--config` flag. + +- eg. `gancio start --config ./config.json' +- eg. `pm2 start gancio start -- --config ~/config.json' + +Default configuration {: .no_toc } 1. TOC {:toc} + +#### Title +#### + + ## Default settings ```json { @@ -26,6 +38,7 @@ nav_order: 3 "storage": "/tmp/db.sqlite" }, "upload_path": "./", + "favicon": "../dist/favicon.ico", "smtp": { "auth": { "user": "", diff --git a/pages/admin.vue b/pages/admin.vue index 97ca27ad..40417d70 100644 --- a/pages/admin.vue +++ b/pages/admin.vue @@ -108,6 +108,18 @@ el-form-item(v-show='allow_recurrent_event' :label="$t('admin.recurrent_event_visible')") el-switch(v-model='recurrent_event_visible') + el-divider {{$t('admin.personalization')}} + span {{$t('common.info')}} + el-input(type='textarea' v-model='about') + + el-upload(action='' + :limit="1" + :auto-upload='false' + drag + accept='image/*' + :multiple='false') + + el-divider {{$t('admin.federation')}} el-form(inline @submit.native.prevent='associate_mastondon_instance' label-width='240px') p {{$t('admin.mastodon_description')}} @@ -147,7 +159,8 @@ export default { admin: false, }, tab: "0", - open: true + open: true, + about: '' } }, async mounted () { diff --git a/server/api/controller/settings.js b/server/api/controller/settings.js index b029f5f3..f4912175 100644 --- a/server/api/controller/settings.js +++ b/server/api/controller/settings.js @@ -1,6 +1,7 @@ const Mastodon = require('mastodon-api') const { setting: Setting } = require('../models') const config = require('config') + const settingsController = { settings: { initialized: false }, secretSettings: {}, @@ -36,6 +37,14 @@ const settingsController = { } }, + async getUserLocale(req, res) { + // console.error(res) + // load user locale specified in configuration + // res.json({ about: 'dentro user locale' }) + // res.sendStatus(200) + return false + }, + async setRequest(req, res) { const { key, value, is_secret } = req.body const ret = await settingsController.set(key, value, is_secret) diff --git a/server/api/index.js b/server/api/index.js index c32701f8..7bdec081 100644 --- a/server/api/index.js +++ b/server/api/index.js @@ -85,6 +85,8 @@ api.delete('/event/notification/:code', eventController.delNotification) api.get('/settings', settingsController.getAllRequest) api.post('/settings', jwt, fillUser, isAdmin, settingsController.setRequest) +api.get('/settings/user_locale', settingsController.getUserLocale) + // confirm event api.get('/event/confirm/:event_id', jwt, isAuth, isAdmin, eventController.confirm) api.get('/event/unconfirm/:event_id', jwt, isAuth, isAdmin, eventController.unconfirm) diff --git a/server/index.js b/server/index.js index 300a7a12..d977a156 100644 --- a/server/index.js +++ b/server/index.js @@ -23,7 +23,9 @@ async function start() { await nuxt.ready() } - app.use('/favicon.ico', express.static(path.resolve(__dirname, '../dist/favicon.ico'))) + // configurable favicon && logo + app.use('/favicon.ico', express.static(path.resolve(config.favicon))) + app.use(morgan('dev')) app.use('/media/', express.static(config.upload_path)) app.use('/api', require('./api/index')) @@ -31,7 +33,7 @@ async function start() { // Give nuxt middleware to express app.use(nuxt.render) - // Listen the server + // Listen const server = app.listen(nuxt_config.server) // close connections/port/unix socket