From 5ae3a9eeb3bf5c7ed10397e76daeea63b76770cf Mon Sep 17 00:00:00 2001 From: lesion Date: Wed, 27 Apr 2022 10:07:04 +0200 Subject: [PATCH] minor --- server/api/controller/oauth.js | 3 +-- server/dbconfig.js | 1 + server/initialize.server.js | 5 ----- server/routes.js | 9 ++++----- store/index.js | 5 +++++ 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/server/api/controller/oauth.js b/server/api/controller/oauth.js index 7eef9277..f72d0b6b 100644 --- a/server/api/controller/oauth.js +++ b/server/api/controller/oauth.js @@ -137,8 +137,7 @@ const oauthController = { code.userId = user.id code.clientId = client.id code.expiresAt = dayjs(code.expiresAt).toDate() - const ret = await OAuthCode.create(code) - return ret + return OAuthCode.create(code) }, // TODO diff --git a/server/dbconfig.js b/server/dbconfig.js index 77b63199..6b865c76 100644 --- a/server/dbconfig.js +++ b/server/dbconfig.js @@ -1,3 +1,4 @@ // needed by sequelize const config = require('./config') +config.load() module.exports = config.db diff --git a/server/initialize.server.js b/server/initialize.server.js index 1fe1acb3..faa492cc 100644 --- a/server/initialize.server.js +++ b/server/initialize.server.js @@ -5,8 +5,6 @@ module.exports = function () { const log = require('../server/log') const settingsController = require('./api/controller/settings') const db = require('./api/models/index') - const dayjs = require('dayjs') - const timezone = require('dayjs/plugin/timezone') async function start (nuxt) { if (config.status == 'READY') { @@ -29,9 +27,6 @@ module.exports = function () { await settingsController.load() } - dayjs.extend(timezone) - dayjs.tz.setDefault(settingsController.settings.instance_timezone) - let TaskManager if (config.status === 'READY' && process.env.NODE_ENV == 'production') { TaskManager = require('../server/taskManager').TaskManager diff --git a/server/routes.js b/server/routes.js index bb302064..9cedb75f 100644 --- a/server/routes.js +++ b/server/routes.js @@ -34,13 +34,14 @@ if (config.status === 'READY') { // rss/ics/atom feed app.get('/feed/:type', cors(), exportController.export) - app.use('/.well-known', webfinger) app.use('/event/:slug', helpers.APRedirect) + // federation api / activitypub / webfinger / nodeinfo app.use('/federation', federation) + app.use('/.well-known', webfinger) -// ignore unimplemented ping url from fediverse + // ignore unimplemented ping url from fediverse app.use(spamFilter) // fill res.locals.user if request is authenticated @@ -54,7 +55,7 @@ if (config.status === 'READY') { app.use('/api', api) // // Handle 500 -app.use((error, req, res, next) => { +app.use((error, _req, res, _next) => { log.error('[ERROR]', error) res.status(500).send('500: Internal Server Error') }) @@ -63,8 +64,6 @@ app.use((error, req, res, next) => { // first nuxt component is ./pages/index.vue (with ./layouts/default.vue) // prefill current events, tags, places and announcements (used in every path) app.use(async (req, res, next) => { - // const start_datetime = getUnixTime(startOfWeek(startOfMonth(new Date()))) - // req.events = await eventController._select(start_datetime, 100) if (config.status === 'READY') { const eventController = require('./api/controller/event') diff --git a/store/index.js b/store/index.js index 6a3bf6ef..b86aa819 100644 --- a/store/index.js +++ b/store/index.js @@ -1,3 +1,7 @@ +// const dayjs = require('dayjs') +// const timezone = require('dayjs/plugin/timezone') +// dayjs.extend(timezone) + export const state = () => ({ locale: '', user_locale: {}, @@ -54,6 +58,7 @@ export const actions = { // we use it to get configuration from db, set locale, etc... nuxtServerInit ({ commit }, { req, res }) { commit('setSettings', res.locals.settings) + // dayjs.tz.(res.locals.settings.instance_timezone) if (res.locals.status === 'READY') { commit('setAnnouncements', res.locals.announcements) commit('update', res.locals.meta)