@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
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make celerity be able to render full uris

Summary: ...and use 'em in the phame blog case.

Test Plan: viewed blog.phabricator.dev and it actually looked right!

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1373

Differential Revision: https://secure.phabricator.com/D3666

+29 -6
+2 -2
src/aphront/configuration/AphrontApplicationConfiguration.php
··· 160 160 $path = '/phame/posts/'.trim($path, '/').'/'; 161 161 } 162 162 163 - // TODO - now we need to tell Celerity to render static resources with 164 - // full URIs like secure.phabricator.org/rsrc/blahblah 163 + $celerity = CelerityAPI::getStaticResourceResponse(); 164 + $celerity->setUseFullURI(true); 165 165 } 166 166 167 167 list($controller, $uri_data) = $this->buildControllerForPath($path);
+27 -4
src/infrastructure/celerity/CelerityStaticResourceResponse.php
··· 33 33 private $metadataBlock = 0; 34 34 private $behaviors = array(); 35 35 private $hasRendered = array(); 36 + private $useFullURI = false; 36 37 37 38 public function __construct() { 38 39 if (isset($_REQUEST['__metablock__'])) { ··· 85 86 return $this; 86 87 } 87 88 89 + /** 90 + * If set to true, Celerity will print full URIs (including the domain) 91 + * for static resources. 92 + */ 93 + public function setUseFullURI($should) { 94 + $this->useFullURI = $should; 95 + return $this; 96 + } 97 + 98 + private function shouldUseFullURI() { 99 + return $this->useFullURI; 100 + } 101 + 88 102 public function renderSingleResource($symbol) { 89 103 $map = CelerityResourceMap::getInstance(); 90 104 $resolved = $map->resolveResources(array($symbol)); ··· 119 133 } 120 134 121 135 private function renderResource(array $resource) { 136 + $uri = $this->getURI($resource['uri']); 122 137 switch ($resource['type']) { 123 138 case 'css': 124 - $path = phutil_escape_html($resource['uri']); 125 - return '<link rel="stylesheet" type="text/css" href="'.$path.'" />'; 139 + return '<link rel="stylesheet" type="text/css" href="'.$uri.'" />'; 126 140 case 'js': 127 - $path = phutil_escape_html($resource['uri']); 128 - return '<script type="text/javascript" src="'.$path.'">'. 141 + return '<script type="text/javascript" src="'.$uri.'">'. 129 142 '</script>'; 130 143 } 131 144 throw new Exception("Unable to render resource."); 145 + } 146 + 147 + private function getURI($path) { 148 + $path = phutil_escape_html($path); 149 + if ($this->shouldUseFullURI()) { 150 + $uri = PhabricatorEnv::getCDNURI($path); 151 + } else { 152 + $uri = $path; 153 + } 154 + return $uri; 132 155 } 133 156 134 157 public function renderHTMLFooter() {