diff --git a/public/foreignone/robots.txt b/public/foreignone/robots.txt new file mode 100644 index 0000000..d7cd58c --- /dev/null +++ b/public/foreignone/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: /admin/ \ No newline at end of file diff --git a/public/ic/robots.txt b/public/ic/robots.txt new file mode 100644 index 0000000..4f9540b --- /dev/null +++ b/public/ic/robots.txt @@ -0,0 +1 @@ +User-agent: * \ No newline at end of file diff --git a/src/handlers/foreignone/MainHandler.php b/src/handlers/foreignone/MainHandler.php index 5a34dd5..ce5732c 100644 --- a/src/handlers/foreignone/MainHandler.php +++ b/src/handlers/foreignone/MainHandler.php @@ -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]}"); + } } \ No newline at end of file diff --git a/src/handlers/foreignone/ServicesHandler.php b/src/handlers/foreignone/ServicesHandler.php deleted file mode 100644 index 382f161..0000000 --- a/src/handlers/foreignone/ServicesHandler.php +++ /dev/null @@ -1,28 +0,0 @@ -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]}"); - } -} \ No newline at end of file diff --git a/src/routes.php b/src/routes.php index 715f570..521a172 100644 --- a/src/routes.php +++ b/src/routes.php @@ -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}',