RobotsTxt: specify more verbose classes

Summary:
Using PhabricatorRobotsController overwrites robots.txt for blogs, URL shortener, and CDN domains. Using [PhabricatorRobotsPlatformController](https://we.phorge.it/book/dev/class/PhabricatorRobotsPlatformController/) should fix it.

Signed-off-by: Yongmin Hong <revi@omglol.email>

Test Plan: Reload personal-phorge.revicdn.net/robots.txt and it is not verbatim copy of issuetracker.revi.xyz/robots.txt

Reviewers: #acl_sudoers, #blessed_reviewers, revi

Reviewed By: #acl_sudoers, #blessed_reviewers, revi

Differential Revision: https://issuetracker.revi.xyz/D9
This commit is contained in:
revi 2024-05-02 19:46:24 +09:00
parent 0e1656da0c
commit 88946a7fe2
Signed by: revi
GPG key ID: 1EB4F6CEEA100E94
2 changed files with 6 additions and 2 deletions

View file

@ -12,5 +12,7 @@ jobs:
phpsyntax:
runs-on: ubuntu-latest
steps:
- name: PHP Basic Syntax Check
- name: "PHP Basic Syntax Check [robots.txt]"
run: php -l PhabExt/PhabricatorCustomRobotsTxtController.php
- name: "PHP Basic Syntax Check [time.php]"
run: php -l time.php

View file

@ -1,6 +1,6 @@
<?php
abstract class PhabricatorRobotsController extends PhabricatorController {
abstract class PhabricatorRobotsPlatformController extends PhabricatorRobotsController {
public function shouldRequireLogin() {
return false;
@ -103,6 +103,8 @@ public function processRequest() {
$content = implode("\n", $out)."\n";
// ToDo: Cloudflare does not cache the robots.txt due to the presence of Set-Cookie.
// T126
return id(new AphrontPlainTextResponse())
->setContent($content)
->setCacheDurationInSeconds(phutil_units('2 hours in seconds'))