app.use(function(req, res, next) { if (req.headers.host !== 'rootca.pro') { return next(); } res.download(getRootCAFile(), 'rootCA.' + (req.path.indexOf('/cer') ? 'crt' : 'cer')); });
app.all('/cgi-bin/*', function(req, res, next) { req.isUploadReq = UPLOAD_URLS.indexOf(req.path) !== -1; return req.isUploadReq ? uploadUrlencodedParser(req, res, next) : urlencodedParser(req, res, next); }, function(req, res, next) { return req.isUploadReq ? uploadJsonParser(req, res, next) : jsonParser(req, res, next); }, cgiHandler);
app.use('/preview.html', function(req, res, next) { if (req.headers[config.INTERNAL_ID_HEADER] !== config.INTERNAL_ID) { return res.status(404).end('Not Found'); } next(); var index = req.path.indexOf('=') + 1; if (index) { var charset = req.path.substring(index); res.set('content-type', 'text/html;charset=' + charset); } });
const url = URL_MAP[req.path]; if (url) { app.render(req, res, url);
const url = URL_MAP[req.path]; if (url) { app.render(req, res, url);
res.write(plugin[util.PLUGIN_MENU_CONFIG]); res.write(MENU_HTML); var index = req.path.indexOf('/', 1); if (index === -1) { res.end(); } else { var filepath = req.path.substring(index + 1); var reader = fs.createReadStream(path.join(plugin.path, filepath)); reader.on('error', function() { if (reader) { req.url = options.path.replace(result[0].slice(0, -1), ''); util.transformReq(req, res, ports.uiPort); });
app.use(function(req, res, next) { if (ALLOW_PLUGIN_PATHS.indexOf(req.path) !== -1) { var name = req.headers[config.PROXY_ID_HEADER]; if (name) { return pluginMgr.getPlugin(name + ':') ? next() : res.sendStatus(403); } } var authKey = config.authKey; if ((authKey && authKey === req.headers['x-whistle-auth-key']) || doNotCheckLogin(req)) { return next(); } var guestAuthKey = config.guestAuthKey; if (((guestAuthKey && guestAuthKey === req.headers['x-whistle-guest-auth-key']) || verifyLogin(req, res)) && (!req.method || GET_METHOD_RE.test(req.method) || WEINRE_RE.test(req.path) || GUEST_PATHS.indexOf(req.path) !== -1)) { return next(); } var username = getUsername(); var password = getPassword(); var authConf = { authKey: 'whistle_lk_' + encodeURIComponent(username), username: username, password: password }; if (checkAuth(req, res, authConf)) { next(); } });
const url = URL_MAP[req.path]; if (url) { app.render(req, res, url);
app.get('*', async function (req, res) { if (req.path.split("/")[3] == "embed" && req.method === 'GET') { res.removeHeader('X-Frame-Options'); } let configBuilder = require("pluginbot/config"); let clientPlugins = Object.keys((await configBuilder.buildClientConfig(CONFIG_PATH)).plugins); let {site_title, site_description, hostname} = store.getState().options; res.render("main", {bundle : appConfig.bundle_path, plugins : clientPlugins, site_title, site_description, hostname}); })
const url = URL_MAP[req.path]; if (url) { app.render(req, res, url);
const url = URL_MAP[req.path]; if (url) { app.render(req, res, url);
const url = URL_MAP[req.path]; if (url) { app.render(req, res, url);
const url = URL_MAP[req.path]; if (url) { app.render(req, res, url);
const url = URL_MAP[req.path]; if (url) { app.render(req, res, url);