mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Lotsa typescript bullshit
This commit is contained in:
parent
b7ac485689
commit
b927988017
65 changed files with 801 additions and 8447 deletions
|
@ -28,21 +28,21 @@ const port = isRoot ? 80 : 8080
|
|||
const httpsport = isRoot ? 443 : 5001
|
||||
|
||||
import express from 'express'
|
||||
import logger from './utils/logger.js'
|
||||
import vhost from 'vhost'
|
||||
import utils from './utils/utils.js'
|
||||
import http from 'http'
|
||||
import https from 'https'
|
||||
import cors from 'cors'
|
||||
import cookieParser from 'cookie-parser'
|
||||
import { uuidv4 } from 'uuid'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
import dbtools from './utils/dbtools.js'
|
||||
import reqlogger from './middlewares/reqlogger.middleware.js'
|
||||
import extraModulesFile from rc / extraModules.json
|
||||
import modulesFile from rc / modules.json
|
||||
import usersDBPath from ata / dbs / users.db
|
||||
import idStats from './utils/ids.js'
|
||||
import logger from './utils/logger'
|
||||
import utils from './utils/utils'
|
||||
import dbtools from './utils/dbtools'
|
||||
import reqlogger from './middlewares/reqlogger.middleware'
|
||||
import idStats from './utils/ids'
|
||||
const extraModulesFile = './src/extraModules.json'
|
||||
const modulesFile = './src/modules.json'
|
||||
const usersDBPath = './data/dbs/users.db'
|
||||
idStats.Load()
|
||||
logger.Load()
|
||||
|
||||
|
@ -57,6 +57,16 @@ interface Module {
|
|||
urls: Array<string>
|
||||
nextdir?: string
|
||||
isNextJs?: boolean
|
||||
app: express.Application
|
||||
dailyAction: Function
|
||||
cleanup: Function
|
||||
}
|
||||
|
||||
export interface SetupData {
|
||||
url: string
|
||||
publicdirs: Array<string>
|
||||
userDB?: any
|
||||
nextdir?: string
|
||||
}
|
||||
|
||||
if (!utils.FileExists(usersDBPath)) {
|
||||
|
@ -150,7 +160,7 @@ app.use(
|
|||
Object.keys(modules).forEach(function(key) {
|
||||
const module = modules[key]
|
||||
try {
|
||||
import mod from module.path
|
||||
const mod = require(module.path).default // eslint-disable-line
|
||||
// const mod = require(module.path)
|
||||
logger.Log(`Loading ${mod.name} module`, logger.GetColor('yellow'))
|
||||
|
||||
|
@ -171,7 +181,6 @@ Object.keys(modules).forEach(function(key) {
|
|||
module.app = modApp.app
|
||||
module.dailyAction = modApp.dailyAction
|
||||
module.cleanup = modApp.cleanup
|
||||
|
||||
module.urls.forEach((url) => {
|
||||
app.use(vhost(url, module.app))
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue