public dir fixes

This commit is contained in:
mrfry 2023-05-01 09:17:13 +02:00
parent 066598ba76
commit 5a34115869
4 changed files with 5 additions and 13 deletions

View file

@ -31,6 +31,7 @@ import {
} from '../../../types/basicTypes'
import dbtools from '../../../utils/dbtools'
import { queueWork } from '../../../worker/workerPool'
import constants from '../../../constants'
const minimumAlowwedSessions = 2 // how many sessions are allowed for a user
const usersDbBackupPath = 'data/dbs/backup'
@ -91,9 +92,8 @@ function createDefaultUser(userDb: Database) {
const validationTokenName = 'qmining' // readValidationTokenName()
function setup(data: SubmoduleData): Submodule {
const { app, userDB, url } = data
const domain: any = url
logger.DebugLog(`Cookie domain: ${domain}`, 'cookie', 1)
const { app, userDB } = data
logger.DebugLog(`Cookie domain: ${constants.domain}`, 'cookie', 1)
const userCount = dbtools
.TableInfo(userDB, 'users')
@ -245,7 +245,7 @@ function setup(data: SubmoduleData): Submodule {
// https://www.npmjs.com/package/cookie
res.cookie('sessionID', sessionID, {
domain: domain,
domain: constants.domain,
expires: new Date(
new Date().getTime() + 10 * 365 * 24 * 60 * 60 * 1000
),

View file

@ -42,7 +42,6 @@ import dbtools from './utils/dbtools'
import reqlogger from './middlewares/reqlogger.middleware'
import idStats from './utils/ids'
import { paths, validateAndSetupFiles } from './utils/files'
import constants from './constants'
const logFile = paths.logDir + logger.logFileName
const vlogFile = paths.vlogDir + logger.logFileName
@ -233,7 +232,6 @@ Object.keys(modules).forEach(function (key) {
if (mod.setup) {
mod.setup({
url: constants.domain, // used by api.ts -> userManagement.ts -> cookies
userDB: userDB,
nextdir: module.nextdir,
httpServer: httpServer,

View file

@ -121,7 +121,6 @@ export interface ModuleSpecificData {
export interface SubmoduleData {
app: express.Application
url: string
userDB?: Database
nextdir?: string
moduleSpecificData: ModuleSpecificData

View file

@ -139,17 +139,12 @@ export const ModuleSchema: Schema = {
type: 'object',
properties: {
path: { type: 'string' },
publicdirs: {
type: 'array',
minItems: 1, // FIXME: make this a single string, no need for array
items: { type: 'string' },
},
nextDir: { type: 'string' },
name: { type: 'string' },
route: { type: 'string' },
isNextJs: { type: 'boolean' },
},
required: ['path', 'publicdirs', 'name', 'route'],
required: ['path', 'name', 'route'],
}
export const ModulesSchema: Schema = {