Changed condition for displaying robots/sitemap
This commit is contained in:
parent
fddbdef4db
commit
75ca114c8e
|
@ -3332,8 +3332,10 @@ while [ "${WHILE}" -lt "2" ]; do
|
|||
exit 0
|
||||
;;
|
||||
"bot"|"bot_https"|"domain"|"domain_https" )
|
||||
_br "${2}"
|
||||
read_domain "${2}"
|
||||
sh_not
|
||||
_s "${2}"
|
||||
read_bomain "${3}"
|
||||
if [ "${1}" = "bot_https" ] || [ "${1}" = "domain_https" ]; then
|
||||
read_cloudflare_email "${4}"
|
||||
|
@ -3398,6 +3400,7 @@ while [ "${WHILE}" -lt "2" ]; do
|
|||
_line
|
||||
fi
|
||||
post_commands "${CP_BOMAIN}"
|
||||
_br
|
||||
exit 0
|
||||
;;
|
||||
"bench"|"benchmark"|"speedtest" )
|
||||
|
|
|
@ -55,25 +55,30 @@ router.get('/?', function(req, res) {
|
|||
var host = req.get('host');
|
||||
var host_domain = url.parse(protocol + '://' + host).hostname;
|
||||
|
||||
if (
|
||||
(config.bomain && host_domain === config.subdomain + config.domain) ||
|
||||
(config.bomain && host_domain === config.ru.subdomain + config.ru.domain) ||
|
||||
(config.bomain && config.mirrors.indexOf(host_domain) + 1) ||
|
||||
(!req.userinfo.bot.main && !config.user_bot)
|
||||
) {
|
||||
res.send('User-agent: *\nDisallow: /');
|
||||
} else {
|
||||
res.send(
|
||||
config.codes.robots +
|
||||
'\n\n' +
|
||||
'Sitemap: ' +
|
||||
(req.userinfo && req.userinfo.origin
|
||||
? req.userinfo.origin
|
||||
: config.protocol + config.subdomain + config.domain) +
|
||||
'/' +
|
||||
config.urls.sitemap
|
||||
);
|
||||
if (!config.user_bot) {
|
||||
if (!req.userinfo.bot.main) {
|
||||
return res.send('User-agent: *\nDisallow: /');
|
||||
}
|
||||
if (
|
||||
(config.bomain || config.ru.bomain) &&
|
||||
(host_domain === config.subdomain + config.domain ||
|
||||
host_domain === config.ru.subdomain + config.ru.domain ||
|
||||
config.mirrors.indexOf(host_domain) + 1)
|
||||
) {
|
||||
return res.send('User-agent: *\nDisallow: /');
|
||||
}
|
||||
}
|
||||
|
||||
res.send(
|
||||
config.codes.robots +
|
||||
'\n\n' +
|
||||
'Sitemap: ' +
|
||||
(req.userinfo && req.userinfo.origin
|
||||
? req.userinfo.origin
|
||||
: config.protocol + config.subdomain + config.domain) +
|
||||
'/' +
|
||||
config.urls.sitemap
|
||||
);
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
@ -574,28 +574,28 @@ router.get('/:level1?/:level2?/:level3?/:level4?', function(req, res, next) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!req.userinfo.bot.main && !config.user_bot && template === 'sitemap') {
|
||||
return next({
|
||||
status: 404,
|
||||
message: 'The sitemap is available only to search bots.'
|
||||
});
|
||||
}
|
||||
|
||||
if (template === 'sitemap') {
|
||||
var host = req.get('host');
|
||||
var host_domain = url_parse.parse(config.protocol + '://' + host)
|
||||
.hostname;
|
||||
if (
|
||||
(config.bomain && host_domain === config.subdomain + config.domain) ||
|
||||
(config.bomain &&
|
||||
host_domain === config.ru.subdomain + config.ru.domain) ||
|
||||
(config.bomain && config.mirrors.indexOf(host_domain) + 1) ||
|
||||
(!req.userinfo.bot.main && !config.user_bot)
|
||||
) {
|
||||
return next({
|
||||
status: 404,
|
||||
message: 'The sitemap is available only to search bots.'
|
||||
});
|
||||
if (!config.user_bot) {
|
||||
if (!req.userinfo.bot.main) {
|
||||
return next({
|
||||
status: 404,
|
||||
message: 'The sitemap is available only to search bots.'
|
||||
});
|
||||
}
|
||||
var host = req.get('host');
|
||||
var host_domain = url_parse.parse(config.protocol + '://' + host)
|
||||
.hostname;
|
||||
if (
|
||||
(config.bomain || config.ru.bomain) &&
|
||||
(host_domain === config.subdomain + config.domain ||
|
||||
host_domain === config.ru.subdomain + config.ru.domain ||
|
||||
config.mirrors.indexOf(host_domain) + 1)
|
||||
) {
|
||||
return next({
|
||||
status: 404,
|
||||
message: 'The sitemap is available only to search bots.'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue