Changed condition for displaying robots/sitemap

This commit is contained in:
zeldaroot 2021-06-26 00:26:48 +03:00
parent fddbdef4db
commit 75ca114c8e
3 changed files with 47 additions and 39 deletions

View file

@ -3332,8 +3332,10 @@ while [ "${WHILE}" -lt "2" ]; do
exit 0 exit 0
;; ;;
"bot"|"bot_https"|"domain"|"domain_https" ) "bot"|"bot_https"|"domain"|"domain_https" )
_br "${2}"
read_domain "${2}" read_domain "${2}"
sh_not sh_not
_s "${2}"
read_bomain "${3}" read_bomain "${3}"
if [ "${1}" = "bot_https" ] || [ "${1}" = "domain_https" ]; then if [ "${1}" = "bot_https" ] || [ "${1}" = "domain_https" ]; then
read_cloudflare_email "${4}" read_cloudflare_email "${4}"
@ -3398,6 +3400,7 @@ while [ "${WHILE}" -lt "2" ]; do
_line _line
fi fi
post_commands "${CP_BOMAIN}" post_commands "${CP_BOMAIN}"
_br
exit 0 exit 0
;; ;;
"bench"|"benchmark"|"speedtest" ) "bench"|"benchmark"|"speedtest" )

View file

@ -55,25 +55,30 @@ router.get('/?', function(req, res) {
var host = req.get('host'); var host = req.get('host');
var host_domain = url.parse(protocol + '://' + host).hostname; var host_domain = url.parse(protocol + '://' + host).hostname;
if ( if (!config.user_bot) {
(config.bomain && host_domain === config.subdomain + config.domain) || if (!req.userinfo.bot.main) {
(config.bomain && host_domain === config.ru.subdomain + config.ru.domain) || return res.send('User-agent: *\nDisallow: /');
(config.bomain && config.mirrors.indexOf(host_domain) + 1) || }
(!req.userinfo.bot.main && !config.user_bot) if (
) { (config.bomain || config.ru.bomain) &&
res.send('User-agent: *\nDisallow: /'); (host_domain === config.subdomain + config.domain ||
} else { host_domain === config.ru.subdomain + config.ru.domain ||
res.send( config.mirrors.indexOf(host_domain) + 1)
config.codes.robots + ) {
'\n\n' + return res.send('User-agent: *\nDisallow: /');
'Sitemap: ' + }
(req.userinfo && req.userinfo.origin
? req.userinfo.origin
: config.protocol + config.subdomain + config.domain) +
'/' +
config.urls.sitemap
);
} }
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; module.exports = router;

View file

@ -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') { if (template === 'sitemap') {
var host = req.get('host'); if (!config.user_bot) {
var host_domain = url_parse.parse(config.protocol + '://' + host) if (!req.userinfo.bot.main) {
.hostname; return next({
if ( status: 404,
(config.bomain && host_domain === config.subdomain + config.domain) || message: 'The sitemap is available only to search bots.'
(config.bomain && });
host_domain === config.ru.subdomain + config.ru.domain) || }
(config.bomain && config.mirrors.indexOf(host_domain) + 1) || var host = req.get('host');
(!req.userinfo.bot.main && !config.user_bot) var host_domain = url_parse.parse(config.protocol + '://' + host)
) { .hostname;
return next({ if (
status: 404, (config.bomain || config.ru.bomain) &&
message: 'The sitemap is available only to search bots.' (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.'
});
}
} }
} }