robots.txt update; remove ServicesHandler

This commit is contained in:
E. S. 2025-05-16 14:01:50 +03:00
parent a4306aa176
commit 6bb44ce179
5 changed files with 13 additions and 32 deletions

View File

@ -0,0 +1,2 @@
User-agent: *
Disallow: /admin/

1
public/ic/robots.txt Normal file
View File

@ -0,0 +1 @@
User-agent: *

View File

@ -5,6 +5,7 @@ namespace app\foreignone;
use app\ThemesUtil;
use engine\http\errors\NotFound;
use engine\http\errors\PermanentRedirect;
use engine\http\errors\Redirect;
use engine\http\Response;
class MainHandler
@ -195,4 +196,12 @@ class MainHandler
'selected_lang' => $lang->value
]);
}
public function GET_latest(): Response {
global $config;
list($lang) = $this->input('lang');
if (!isset($config['book_versions'][$lang]))
throw new NotFound();
throw new Redirect("https://files.4in1.ws/4in1-{$lang}.pdf?{$config['book_versions'][$lang]}");
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace app\foreignone;
use engine\http\errors\NotFound;
use engine\http\errors\Redirect;
use engine\http\PlainTextResponse;
use engine\http\Response;
class ServicesHandler
extends BaseHandler
{
public function GET_robots_txt(): Response {
$txt = <<<TXT
User-agent: *
Disallow: /admin/
TXT;
return new PlainTextResponse($txt);
}
public function GET_latest(): Response {
global $config;
list($lang) = $this->input('lang');
if (!isset($config['book_versions'][$lang]))
throw new NotFound();
throw new Redirect("https://files.4in1.ws/4in1-{$lang}.pdf?{$config['book_versions'][$lang]}");
}
}

View File

@ -19,6 +19,7 @@ return [
'/' => 'index',
'{about,contacts}/' => 'about',
'feed.rss' => 'rss',
'latest-{en,ru}.pdf' => 'latest lang=${1}',
'('.$pagename_regex.')/' => 'page name=$(1)',
$wiki_root.'/' => 'page name='.$wiki_root,
$wiki_root.'/('.$pagename_regex.')/' => 'page name='.$wiki_root.'/$(1)',
@ -31,10 +32,6 @@ return [
'files/{'.implode(',', $files_collections).'}/' => 'collection collection=${1}',
'files/{'.implode(',', $coll_with_folder_support).'}/(\d+)/' => 'collection collection=${1} folder_id=$(1)',
],
'Services' => [
'robots.txt' => 'robots_txt',
'latest-{en,ru}.pdf' => 'latest lang=${1}'
],
'Admin' => [
'admin/' => 'index',
'admin/{login,logout,log}/' => '${1}',