mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 22:10:55 +01:00
Put back "PhabricatorResourceSite"
Auditors: chad
This commit is contained in:
parent
8a906b0e18
commit
dc79d9ea84
1 changed files with 41 additions and 0 deletions
41
src/aphront/site/PhabricatorResourceSite.php
Normal file
41
src/aphront/site/PhabricatorResourceSite.php
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorResourceSite extends PhabricatorSite {
|
||||||
|
|
||||||
|
public function getDescription() {
|
||||||
|
return pht('Serves static resources like images, CSS and JS.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPriority() {
|
||||||
|
return 2000;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newSiteForRequest(AphrontRequest $request) {
|
||||||
|
$host = $request->getHost();
|
||||||
|
|
||||||
|
$uri = PhabricatorEnv::getEnvConfig('security.alternate-file-domain');
|
||||||
|
if (!strlen($uri)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->isHostMatch($host, array($uri))) {
|
||||||
|
return new PhabricatorResourceSite();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRoutingMaps() {
|
||||||
|
$applications = PhabricatorApplication::getAllInstalledApplications();
|
||||||
|
|
||||||
|
$maps = array();
|
||||||
|
foreach ($applications as $application) {
|
||||||
|
$maps[] = $this->newRoutingMap()
|
||||||
|
->setApplication($application)
|
||||||
|
->setRoutes($application->getResourceRoutes());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $maps;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue