33 lines
825 B
JavaScript
33 lines
825 B
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
const mime = require('mime-types');
|
|
|
|
const authModes = [
|
|
"free",
|
|
"confirmation",
|
|
"whitelist",
|
|
"password",
|
|
];
|
|
|
|
function getBGMain () {
|
|
let bgMain = global.config.source.bgmain;
|
|
if (typeof bgMain === "string") {
|
|
if (!path.isAbsolute(bgMain))
|
|
bgMain = path.join(__dirname, "..", bgMain);
|
|
const mimetype = mime.lookup(bgMain);
|
|
const base64content = fs.readFileSync(bgMain, { encoding: 'base64' });
|
|
return `data:${mimetype};base64,${base64content}`;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
module.exports = {
|
|
name: global.config.server.info.name,
|
|
tag: global.config.server.info.tag,
|
|
authMode: authModes[global.config.server["auth-mode"] ?? 1],
|
|
secureMode: global.config.server.secureMode ?? false,
|
|
extSource: {
|
|
bgmain: getBGMain(),
|
|
}
|
|
};
|