mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
public dir fixes
This commit is contained in:
parent
066598ba76
commit
5a34115869
4 changed files with 5 additions and 13 deletions
|
@ -31,6 +31,7 @@ import {
|
||||||
} from '../../../types/basicTypes'
|
} from '../../../types/basicTypes'
|
||||||
import dbtools from '../../../utils/dbtools'
|
import dbtools from '../../../utils/dbtools'
|
||||||
import { queueWork } from '../../../worker/workerPool'
|
import { queueWork } from '../../../worker/workerPool'
|
||||||
|
import constants from '../../../constants'
|
||||||
|
|
||||||
const minimumAlowwedSessions = 2 // how many sessions are allowed for a user
|
const minimumAlowwedSessions = 2 // how many sessions are allowed for a user
|
||||||
const usersDbBackupPath = 'data/dbs/backup'
|
const usersDbBackupPath = 'data/dbs/backup'
|
||||||
|
@ -91,9 +92,8 @@ function createDefaultUser(userDb: Database) {
|
||||||
const validationTokenName = 'qmining' // readValidationTokenName()
|
const validationTokenName = 'qmining' // readValidationTokenName()
|
||||||
|
|
||||||
function setup(data: SubmoduleData): Submodule {
|
function setup(data: SubmoduleData): Submodule {
|
||||||
const { app, userDB, url } = data
|
const { app, userDB } = data
|
||||||
const domain: any = url
|
logger.DebugLog(`Cookie domain: ${constants.domain}`, 'cookie', 1)
|
||||||
logger.DebugLog(`Cookie domain: ${domain}`, 'cookie', 1)
|
|
||||||
|
|
||||||
const userCount = dbtools
|
const userCount = dbtools
|
||||||
.TableInfo(userDB, 'users')
|
.TableInfo(userDB, 'users')
|
||||||
|
@ -245,7 +245,7 @@ function setup(data: SubmoduleData): Submodule {
|
||||||
|
|
||||||
// https://www.npmjs.com/package/cookie
|
// https://www.npmjs.com/package/cookie
|
||||||
res.cookie('sessionID', sessionID, {
|
res.cookie('sessionID', sessionID, {
|
||||||
domain: domain,
|
domain: constants.domain,
|
||||||
expires: new Date(
|
expires: new Date(
|
||||||
new Date().getTime() + 10 * 365 * 24 * 60 * 60 * 1000
|
new Date().getTime() + 10 * 365 * 24 * 60 * 60 * 1000
|
||||||
),
|
),
|
||||||
|
|
|
@ -42,7 +42,6 @@ import dbtools from './utils/dbtools'
|
||||||
import reqlogger from './middlewares/reqlogger.middleware'
|
import reqlogger from './middlewares/reqlogger.middleware'
|
||||||
import idStats from './utils/ids'
|
import idStats from './utils/ids'
|
||||||
import { paths, validateAndSetupFiles } from './utils/files'
|
import { paths, validateAndSetupFiles } from './utils/files'
|
||||||
import constants from './constants'
|
|
||||||
|
|
||||||
const logFile = paths.logDir + logger.logFileName
|
const logFile = paths.logDir + logger.logFileName
|
||||||
const vlogFile = paths.vlogDir + logger.logFileName
|
const vlogFile = paths.vlogDir + logger.logFileName
|
||||||
|
@ -233,7 +232,6 @@ Object.keys(modules).forEach(function (key) {
|
||||||
|
|
||||||
if (mod.setup) {
|
if (mod.setup) {
|
||||||
mod.setup({
|
mod.setup({
|
||||||
url: constants.domain, // used by api.ts -> userManagement.ts -> cookies
|
|
||||||
userDB: userDB,
|
userDB: userDB,
|
||||||
nextdir: module.nextdir,
|
nextdir: module.nextdir,
|
||||||
httpServer: httpServer,
|
httpServer: httpServer,
|
||||||
|
|
|
@ -121,7 +121,6 @@ export interface ModuleSpecificData {
|
||||||
|
|
||||||
export interface SubmoduleData {
|
export interface SubmoduleData {
|
||||||
app: express.Application
|
app: express.Application
|
||||||
url: string
|
|
||||||
userDB?: Database
|
userDB?: Database
|
||||||
nextdir?: string
|
nextdir?: string
|
||||||
moduleSpecificData: ModuleSpecificData
|
moduleSpecificData: ModuleSpecificData
|
||||||
|
|
|
@ -139,17 +139,12 @@ export const ModuleSchema: Schema = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
path: { type: 'string' },
|
path: { type: 'string' },
|
||||||
publicdirs: {
|
|
||||||
type: 'array',
|
|
||||||
minItems: 1, // FIXME: make this a single string, no need for array
|
|
||||||
items: { type: 'string' },
|
|
||||||
},
|
|
||||||
nextDir: { type: 'string' },
|
nextDir: { type: 'string' },
|
||||||
name: { type: 'string' },
|
name: { type: 'string' },
|
||||||
route: { type: 'string' },
|
route: { type: 'string' },
|
||||||
isNextJs: { type: 'boolean' },
|
isNextJs: { type: 'boolean' },
|
||||||
},
|
},
|
||||||
required: ['path', 'publicdirs', 'name', 'route'],
|
required: ['path', 'name', 'route'],
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ModulesSchema: Schema = {
|
export const ModulesSchema: Schema = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue