mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Moved public dirs to seperate directories
This commit is contained in:
parent
fe580747d6
commit
4e22b94b5d
9 changed files with 59 additions and 14 deletions
|
@ -1,33 +1,39 @@
|
||||||
{
|
{
|
||||||
"dataEditor": {
|
"dataEditor": {
|
||||||
"path": "./modules/dataEditor/dataEditor.js",
|
"path": "./modules/dataEditor/dataEditor.js",
|
||||||
|
"publicdirs": [ "qminingPublic/", "modules/dataEditor/public/" ],
|
||||||
"name": "dataeditor",
|
"name": "dataeditor",
|
||||||
"urls": [ "dataeditor.frylabs.net" ],
|
"urls": [ "dataeditor.frylabs.net" ],
|
||||||
"isNextJs": true
|
"isNextJs": true
|
||||||
},
|
},
|
||||||
"qmining": {
|
"qmining": {
|
||||||
"path": "./modules/qmining/qmining.js",
|
"path": "./modules/qmining/qmining.js",
|
||||||
|
"publicdirs": [ "qminingPublic/", "modules/qmining/public/" ],
|
||||||
"name": "qmining",
|
"name": "qmining",
|
||||||
"urls": [ "qmining.frylabs.net" ],
|
"urls": [ "qmining.frylabs.net" ],
|
||||||
"isNextJs": true
|
"isNextJs": true
|
||||||
},
|
},
|
||||||
"api": {
|
"api": {
|
||||||
"path": "./modules/api/api.js",
|
"path": "./modules/api/api.js",
|
||||||
|
"publicdirs": [ "qminingPublic/" ],
|
||||||
"name": "api",
|
"name": "api",
|
||||||
"urls": [ "api.frylabs.net", "localhost" ]
|
"urls": [ "api.frylabs.net", "localhost" ]
|
||||||
},
|
},
|
||||||
"main": {
|
"main": {
|
||||||
"path": "./modules/main/main.js",
|
"path": "./modules/main/main.js",
|
||||||
|
"publicdirs": [ "public/" ],
|
||||||
"name": "main",
|
"name": "main",
|
||||||
"urls": [ "frylabs.net", "www.frylabs.net" ]
|
"urls": [ "frylabs.net", "www.frylabs.net" ]
|
||||||
},
|
},
|
||||||
"sio": {
|
"sio": {
|
||||||
"path": "./modules/sio/sio.js",
|
"path": "./modules/sio/sio.js",
|
||||||
|
"publicdirs": [ "sioPublic/" ],
|
||||||
"name": "sio",
|
"name": "sio",
|
||||||
"urls": [ "sio.frylabs.net" ]
|
"urls": [ "sio.frylabs.net" ]
|
||||||
},
|
},
|
||||||
"stuff": {
|
"stuff": {
|
||||||
"path": "./modules/stuff/stuff.js",
|
"path": "./modules/stuff/stuff.js",
|
||||||
|
"publicdirs": [ "stuffPublic/" ],
|
||||||
"name": "stuff",
|
"name": "stuff",
|
||||||
"urls": [ "stuff.frylabs.net" ]
|
"urls": [ "stuff.frylabs.net" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ const daysAfterUserGetsPWs = 2 // days after user gets pw-s
|
||||||
|
|
||||||
let userDB
|
let userDB
|
||||||
let url
|
let url
|
||||||
|
let publicdirs = []
|
||||||
|
|
||||||
function GetApp () {
|
function GetApp () {
|
||||||
app.use(bodyParser.urlencoded({
|
app.use(bodyParser.urlencoded({
|
||||||
|
@ -79,7 +80,10 @@ function GetApp () {
|
||||||
'/badtestsender'
|
'/badtestsender'
|
||||||
]
|
]
|
||||||
}))
|
}))
|
||||||
app.use(express.static('public'))
|
publicdirs.forEach((pdir) => {
|
||||||
|
logger.Log(`Using public dir: ${pdir}`)
|
||||||
|
app.use(express.static(pdir))
|
||||||
|
})
|
||||||
app.use(busboy({
|
app.use(busboy({
|
||||||
limits: {
|
limits: {
|
||||||
fileSize: 50000 * 1024 * 1024
|
fileSize: 50000 * 1024 * 1024
|
||||||
|
@ -653,4 +657,5 @@ exports.getApp = GetApp
|
||||||
exports.setup = (data) => {
|
exports.setup = (data) => {
|
||||||
userDB = data.userDB
|
userDB = data.userDB
|
||||||
url = data.url
|
url = data.url
|
||||||
|
publicdirs = data.publicdirs
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ const logger = require('../../utils/logger.js')
|
||||||
const auth = require('../../middlewares/auth.middleware.js')
|
const auth = require('../../middlewares/auth.middleware.js')
|
||||||
|
|
||||||
let userDB
|
let userDB
|
||||||
|
let publicdirs = []
|
||||||
|
|
||||||
function GetApp () {
|
function GetApp () {
|
||||||
app.use(bodyParser.urlencoded({
|
app.use(bodyParser.urlencoded({
|
||||||
|
@ -50,8 +51,10 @@ function GetApp () {
|
||||||
'/getVeteranPw'
|
'/getVeteranPw'
|
||||||
]
|
]
|
||||||
}))
|
}))
|
||||||
app.use(express.static('modules/dataEditor/public'))
|
publicdirs.forEach((pdir) => {
|
||||||
app.use(express.static('public'))
|
logger.Log(`Using public dir: ${pdir}`)
|
||||||
|
app.use(express.static(pdir))
|
||||||
|
})
|
||||||
app.use(busboy({
|
app.use(busboy({
|
||||||
limits: {
|
limits: {
|
||||||
fileSize: 10000 * 1024 * 1024
|
fileSize: 10000 * 1024 * 1024
|
||||||
|
@ -103,4 +106,5 @@ exports.name = 'Data editor'
|
||||||
exports.getApp = GetApp
|
exports.getApp = GetApp
|
||||||
exports.setup = (data) => {
|
exports.setup = (data) => {
|
||||||
userDB = data.userDB
|
userDB = data.userDB
|
||||||
|
publicdirs = data.publicdirs
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,17 +25,22 @@ const bodyParser = require('body-parser')
|
||||||
const busboy = require('connect-busboy')
|
const busboy = require('connect-busboy')
|
||||||
const app = express()
|
const app = express()
|
||||||
|
|
||||||
// const logger = require('../../utils/logger.js')
|
const logger = require('../../utils/logger.js')
|
||||||
// const utils = require('../utils/utils.js')
|
// const utils = require('../utils/utils.js')
|
||||||
// const actions = require('../utils/actions.js')
|
// const actions = require('../utils/actions.js')
|
||||||
|
|
||||||
|
let publicdirs = []
|
||||||
|
|
||||||
function GetApp () {
|
function GetApp () {
|
||||||
app.set('view engine', 'ejs')
|
app.set('view engine', 'ejs')
|
||||||
app.set('views', [
|
app.set('views', [
|
||||||
'./modules/main/views',
|
'./modules/main/views',
|
||||||
'./sharedViews'
|
'./sharedViews'
|
||||||
])
|
])
|
||||||
app.use(express.static('public'))
|
publicdirs.forEach((pdir) => {
|
||||||
|
logger.Log(`Using public dir: ${pdir}`)
|
||||||
|
app.use(express.static(pdir))
|
||||||
|
})
|
||||||
app.use(busboy({
|
app.use(busboy({
|
||||||
limits: {
|
limits: {
|
||||||
fileSize: 10000 * 1024 * 1024
|
fileSize: 10000 * 1024 * 1024
|
||||||
|
@ -73,6 +78,7 @@ function GetApp () {
|
||||||
|
|
||||||
exports.name = 'Main'
|
exports.name = 'Main'
|
||||||
exports.getApp = GetApp
|
exports.getApp = GetApp
|
||||||
exports.setup = (x) => {
|
exports.setup = (data) => {
|
||||||
url = x.url
|
url = data.url
|
||||||
|
publicdirs = data.publicdirs
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ const logger = require('../../utils/logger.js')
|
||||||
const auth = require('../../middlewares/auth.middleware.js')
|
const auth = require('../../middlewares/auth.middleware.js')
|
||||||
|
|
||||||
let donateURL = ''
|
let donateURL = ''
|
||||||
|
let publicdirs = []
|
||||||
let userDB
|
let userDB
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -61,8 +62,10 @@ function GetApp () {
|
||||||
'/irc'
|
'/irc'
|
||||||
]
|
]
|
||||||
}))
|
}))
|
||||||
app.use(express.static('modules/qmining/public'))
|
publicdirs.forEach((pdir) => {
|
||||||
app.use(express.static('public'))
|
logger.Log(`Using public dir: ${pdir}`)
|
||||||
|
app.use(express.static(pdir))
|
||||||
|
})
|
||||||
app.use(busboy({
|
app.use(busboy({
|
||||||
limits: {
|
limits: {
|
||||||
fileSize: 10000 * 1024 * 1024
|
fileSize: 10000 * 1024 * 1024
|
||||||
|
@ -201,4 +204,5 @@ exports.name = 'Qmining'
|
||||||
exports.getApp = GetApp
|
exports.getApp = GetApp
|
||||||
exports.setup = (data) => {
|
exports.setup = (data) => {
|
||||||
userDB = data.userDB
|
userDB = data.userDB
|
||||||
|
publicdirs = data.publicdirs
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,13 +31,18 @@ const utils = require('../../utils/utils.js')
|
||||||
|
|
||||||
const uloadFiles = './public/f'
|
const uloadFiles = './public/f'
|
||||||
|
|
||||||
|
let publicdirs = []
|
||||||
|
|
||||||
function GetApp () {
|
function GetApp () {
|
||||||
app.set('view engine', 'ejs')
|
app.set('view engine', 'ejs')
|
||||||
app.set('views', [
|
app.set('views', [
|
||||||
'./modules/sio/views',
|
'./modules/sio/views',
|
||||||
'./sharedViews'
|
'./sharedViews'
|
||||||
])
|
])
|
||||||
app.use(express.static('public'))
|
publicdirs.forEach((pdir) => {
|
||||||
|
logger.Log(`Using public dir: ${pdir}`)
|
||||||
|
app.use(express.static(pdir))
|
||||||
|
})
|
||||||
app.use(busboy({
|
app.use(busboy({
|
||||||
limits: {
|
limits: {
|
||||||
fileSize: 10000 * 1024 * 1024
|
fileSize: 10000 * 1024 * 1024
|
||||||
|
@ -102,3 +107,6 @@ function GetApp () {
|
||||||
|
|
||||||
exports.name = 'Sio'
|
exports.name = 'Sio'
|
||||||
exports.getApp = GetApp
|
exports.getApp = GetApp
|
||||||
|
exports.setup = (data) => {
|
||||||
|
publicdirs = data.publicdirs
|
||||||
|
}
|
||||||
|
|
|
@ -31,13 +31,18 @@ const logger = require('../../utils/logger.js')
|
||||||
|
|
||||||
const listedFiles = './public/files'
|
const listedFiles = './public/files'
|
||||||
|
|
||||||
|
let publicdirs = []
|
||||||
|
|
||||||
function GetApp () {
|
function GetApp () {
|
||||||
app.set('view engine', 'ejs')
|
app.set('view engine', 'ejs')
|
||||||
app.set('views', [
|
app.set('views', [
|
||||||
'./modules/stuff/views',
|
'./modules/stuff/views',
|
||||||
'./sharedViews'
|
'./sharedViews'
|
||||||
])
|
])
|
||||||
app.use(express.static('public'))
|
publicdirs.forEach((pdir) => {
|
||||||
|
logger.Log(`Using public dir: ${pdir}`)
|
||||||
|
app.use(express.static(pdir))
|
||||||
|
})
|
||||||
app.use(busboy({
|
app.use(busboy({
|
||||||
limits: {
|
limits: {
|
||||||
fileSize: 10000 * 1024 * 1024
|
fileSize: 10000 * 1024 * 1024
|
||||||
|
@ -213,6 +218,7 @@ function GetApp () {
|
||||||
|
|
||||||
exports.name = 'Stuff'
|
exports.name = 'Stuff'
|
||||||
exports.getApp = GetApp
|
exports.getApp = GetApp
|
||||||
exports.setup = (x) => {
|
exports.setup = (data) => {
|
||||||
url = x.url
|
url = data.url
|
||||||
|
publicdirs = data.publicdirs
|
||||||
}
|
}
|
||||||
|
|
BIN
qminingPublic/favicon.ico
Executable file
BIN
qminingPublic/favicon.ico
Executable file
Binary file not shown.
After Width: | Height: | Size: 252 KiB |
|
@ -112,10 +112,16 @@ Object.keys(modules).forEach(function (k, i) {
|
||||||
try {
|
try {
|
||||||
let mod = require(x.path)
|
let mod = require(x.path)
|
||||||
logger.Log(`Loading ${mod.name} module`, logger.GetColor('yellow'))
|
logger.Log(`Loading ${mod.name} module`, logger.GetColor('yellow'))
|
||||||
|
|
||||||
|
x.publicdirs.forEach((pdir) => {
|
||||||
|
utils.CreatePath(pdir)
|
||||||
|
})
|
||||||
|
|
||||||
if (mod.setup) {
|
if (mod.setup) {
|
||||||
mod.setup({
|
mod.setup({
|
||||||
url: 'https://' + x.urls[0],
|
url: 'https://' + x.urls[0],
|
||||||
userDB: userDB
|
userDB: userDB,
|
||||||
|
publicdirs: x.publicdirs
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue