Changeset View
Changeset View
Standalone View
Standalone View
src/aphront/site/PhabricatorResourceSite.php
| Show All 16 Lines | public function newSiteForRequest(AphrontRequest $request) { | ||||
| if (!strlen($uri)) { | if (!strlen($uri)) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| if ($this->isHostMatch($host, array($uri))) { | if ($this->isHostMatch($host, array($uri))) { | ||||
| return new PhabricatorResourceSite(); | return new PhabricatorResourceSite(); | ||||
| } | } | ||||
| // These are CDN routes, so we let them through even if the "Host" header | return null; | ||||
| // doesn't match anything we recognize. The | } | ||||
| $whitelist = array( | |||||
| '/res/', | |||||
| '/file/data/', | |||||
| '/file/xform/', | |||||
| ); | |||||
| $path = $request->getPath(); | public function getRoutingMaps() { | ||||
| if ($this->isPathPrefixMatch($path, $whitelist)) { | $applications = PhabricatorApplication::getAllInstalledApplications(); | ||||
| return new PhabricatorResourceSite(); | |||||
| $maps = array(); | |||||
| foreach ($applications as $application) { | |||||
| $maps[] = $this->newRoutingMap() | |||||
| ->setApplication($application) | |||||
| ->setRoutes($application->getResourceRoutes()); | |||||
| } | } | ||||
| return null; | return $maps; | ||||
| } | } | ||||
| } | } | ||||