This commit is contained in:
lesion 2022-04-27 10:07:04 +02:00
parent 4e8f945a3b
commit 5ae3a9eeb3
No known key found for this signature in database
GPG key ID: 352918250B012177
5 changed files with 11 additions and 12 deletions

View file

@ -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

View file

@ -1,3 +1,4 @@
// needed by sequelize
const config = require('./config')
config.load()
module.exports = config.db

View file

@ -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

View file

@ -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')

View file

@ -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)