Changeset View
Changeset View
Standalone View
Standalone View
src/aphront/response/AphrontAjaxResponse.php
Show All 25 Lines | if ($this->disableConsole) { | ||||
$console = null; | $console = null; | ||||
} else { | } else { | ||||
$request = $this->getRequest(); | $request = $this->getRequest(); | ||||
$console = $request->getApplicationConfiguration()->getConsole(); | $console = $request->getApplicationConfiguration()->getConsole(); | ||||
} | } | ||||
return $console; | return $console; | ||||
} | } | ||||
public function buildResponseString() { | public function buildResponseString() { | ||||
$request = $this->getRequest(); | |||||
$console = $this->getConsole(); | $console = $this->getConsole(); | ||||
if ($console) { | if ($console) { | ||||
// NOTE: We're stripping query parameters here both for readability and | // NOTE: We're stripping query parameters here both for readability and | ||||
// to mitigate BREACH and similar attacks. The parameters are available | // to mitigate BREACH and similar attacks. The parameters are available | ||||
// in the "Request" tab, so this should not impact usability. See T3684. | // in the "Request" tab, so this should not impact usability. See T3684. | ||||
$uri = $this->getRequest()->getRequestURI(); | $path = $request->getPath(); | ||||
$uri = new PhutilURI($uri); | |||||
$uri->setQueryParams(array()); | |||||
Javelin::initBehavior( | Javelin::initBehavior( | ||||
'dark-console', | 'dark-console', | ||||
array( | array( | ||||
'uri' => (string)$uri, | 'uri' => $path, | ||||
'key' => $console->getKey($this->getRequest()), | 'key' => $console->getKey($request), | ||||
'color' => $console->getColor(), | 'color' => $console->getColor(), | ||||
'quicksand' => $this->getRequest()->isQuicksand(), | 'quicksand' => $request->isQuicksand(), | ||||
)); | )); | ||||
} | } | ||||
epriestley: Test plan: viewed a revision in Differential, opened DarkConsole, saw the Ajax "request" tabs… | |||||
// Flatten the response first, so we initialize any behaviors and metadata | // Flatten the response first, so we initialize any behaviors and metadata | ||||
// we need to. | // we need to. | ||||
$content = array( | $content = array( | ||||
'payload' => $this->content, | 'payload' => $this->content, | ||||
); | ); | ||||
$this->encodeJSONForHTTPResponse($content); | $this->encodeJSONForHTTPResponse($content); | ||||
$response = CelerityAPI::getStaticResourceResponse(); | $response = CelerityAPI::getStaticResourceResponse(); | ||||
$request = $this->getRequest(); | |||||
if ($request) { | if ($request) { | ||||
$viewer = $request->getViewer(); | $viewer = $request->getViewer(); | ||||
if ($viewer) { | if ($viewer) { | ||||
$postprocessor_key = $viewer->getUserSetting( | $postprocessor_key = $viewer->getUserSetting( | ||||
PhabricatorAccessibilitySetting::SETTINGKEY); | PhabricatorAccessibilitySetting::SETTINGKEY); | ||||
if (strlen($postprocessor_key)) { | if (strlen($postprocessor_key)) { | ||||
$response->setPostprocessorKey($postprocessor_key); | $response->setPostprocessorKey($postprocessor_key); | ||||
} | } | ||||
Show All 20 Lines |
Test plan: viewed a revision in Differential, opened DarkConsole, saw the Ajax "request" tabs populate on the left.