@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorResourceSite extends PhabricatorSite {
4
5 public function getDescription() {
6 return pht('Serves static resources like images, CSS and JS.');
7 }
8
9 public function getPriority() {
10 return 2000;
11 }
12
13 public function newSiteForRequest(AphrontRequest $request) {
14 $host = $request->getHost();
15
16 $uri = PhabricatorEnv::getEnvConfig('security.alternate-file-domain');
17 if (!phutil_nonempty_string($uri)) {
18 return null;
19 }
20
21 if ($this->isHostMatch($host, array($uri))) {
22 return new PhabricatorResourceSite();
23 }
24
25 return null;
26 }
27
28 public function getRoutingMaps() {
29 $applications = PhabricatorApplication::getAllInstalledApplications();
30
31 $maps = array();
32 foreach ($applications as $application) {
33 $maps[] = $this->newRoutingMap()
34 ->setApplication($application)
35 ->setRoutes($application->getResourceRoutes());
36 }
37
38 return $maps;
39 }
40
41}