|
|
@ -94,7 +94,7 @@ const shutdown = async () => { |
|
|
|
export const main = async (opts) => { |
|
|
|
export const main = async (opts) => { |
|
|
|
const auth = await import("../lib/auth.js"); |
|
|
|
const auth = await import("../lib/auth.js"); |
|
|
|
|
|
|
|
|
|
|
|
if(opts.DANGER_ADMIN) { |
|
|
|
if(opts.DANGER_ADMIN === "1") { |
|
|
|
const { media_servers } = await import("../lib/config.js"); |
|
|
|
const { media_servers } = await import("../lib/config.js"); |
|
|
|
app.use(cors({origin: media_servers})); |
|
|
|
app.use(cors({origin: media_servers})); |
|
|
|
|
|
|
|
|
|
|
@ -150,13 +150,13 @@ export const main = async (opts) => { |
|
|
|
domain: auth.cookie_domain, |
|
|
|
domain: auth.cookie_domain, |
|
|
|
httpOnly: false, |
|
|
|
httpOnly: false, |
|
|
|
sameSite: "strict", |
|
|
|
sameSite: "strict", |
|
|
|
secure: !opts.DANGER_ADMIN, |
|
|
|
secure: opts.DANGER_ADMIN !== "1", |
|
|
|
}, |
|
|
|
}, |
|
|
|
saveUninitialized: false, |
|
|
|
saveUninitialized: false, |
|
|
|
store: auth.sessionStore, |
|
|
|
store: auth.sessionStore, |
|
|
|
resave: false, |
|
|
|
resave: false, |
|
|
|
secret: auth.cookie_secret, |
|
|
|
secret: auth.cookie_secret, |
|
|
|
proxy: !opts.DANGER_ADMIN |
|
|
|
proxy: opts.DANGER_ADMIN !== "1" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const session_handler = session(session_config); |
|
|
|
const session_handler = session(session_config); |
|
|
@ -218,7 +218,7 @@ export const main = async (opts) => { |
|
|
|
app.use(express.static('public')); |
|
|
|
app.use(express.static('public')); |
|
|
|
app.use("/media", express.static('media')); |
|
|
|
app.use("/media", express.static('media')); |
|
|
|
|
|
|
|
|
|
|
|
if(opts.DANGER_ADMIN) { |
|
|
|
if(opts.DANGER_ADMIN === "1") { |
|
|
|
log.warn("!!!!!! Exposing client/bando/demos to the network because you set DANGER_ADMIN."); |
|
|
|
log.warn("!!!!!! Exposing client/bando/demos to the network because you set DANGER_ADMIN."); |
|
|
|
app.use("/bando/demos/", express.static("admin/bando/demos")); |
|
|
|
app.use("/bando/demos/", express.static("admin/bando/demos")); |
|
|
|
} |
|
|
|
} |
|
|
@ -253,7 +253,7 @@ export const main = async (opts) => { |
|
|
|
login: func.login === true |
|
|
|
login: func.login === true |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if(opts.DANGER_ADMIN) { |
|
|
|
if(opts.DANGER_ADMIN === "1") { |
|
|
|
if(devtools.api[route_path] == undefined) { |
|
|
|
if(devtools.api[route_path] == undefined) { |
|
|
|
// new thing so set up its data initially
|
|
|
|
// new thing so set up its data initially
|
|
|
|
devtools.api[route_path] = { name: route_path, functions: [func_info] }; |
|
|
|
devtools.api[route_path] = { name: route_path, functions: [func_info] }; |
|
|
@ -291,7 +291,7 @@ export const main = async (opts) => { |
|
|
|
|
|
|
|
|
|
|
|
socket_routes[target_name] = func |
|
|
|
socket_routes[target_name] = func |
|
|
|
|
|
|
|
|
|
|
|
if(opts.DANGER_ADMIN) { |
|
|
|
if(opts.DANGER_ADMIN === "1") { |
|
|
|
devtools.sockets[target_name] = { |
|
|
|
devtools.sockets[target_name] = { |
|
|
|
route_path, target_name, file_name, code: func.toString() |
|
|
|
route_path, target_name, file_name, code: func.toString() |
|
|
|
} |
|
|
|
} |
|
|
|