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