global public dir for every server module

This commit is contained in:
mrfry
2023-05-01 08:59:22 +02:00
parent eed99e6f02
commit 0381f6ddab
18 changed files with 55 additions and 225 deletions
-7
View File
@@ -69,7 +69,6 @@ interface Modules {
interface Module {
path: string
publicdirs: Array<string>
name: string
route: string
nextdir?: string
@@ -81,7 +80,6 @@ interface Module {
export interface SetupData {
url: string
publicdirs: Array<string>
userDB?: Database
nextdir?: string
httpServer: http.Server
@@ -233,15 +231,10 @@ Object.keys(modules).forEach(function (key) {
const mod = require(module.path).default // eslint-disable-line
// const mod = require(module.path)
module.publicdirs.forEach((pdir) => {
utils.CreatePath(pdir)
})
if (mod.setup) {
mod.setup({
url: constants.domain, // used by api.ts -> userManagement.ts -> cookies
userDB: userDB,
publicdirs: module.publicdirs,
nextdir: module.nextdir,
httpServer: httpServer,
httpsServer: httpsServer,