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

Display bullet next to request with errors in DarkConsole.

Summary:
I always put a `phlog()` somewhere or something fails and I have hard times figuring out which request it was.

Also fix safe HTML in panel.

Test Plan: Looked at DarkConsole with error on main page, AJAX request and both.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

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

+32 -13
+5 -5
src/__celerity_resource_map__.php
··· 1348 1348 ), 1349 1349 'javelin-behavior-dark-console' => 1350 1350 array( 1351 - 'uri' => '/res/635a9422/rsrc/js/core/behavior-dark-console.js', 1351 + 'uri' => '/res/1e2c7a5e/rsrc/js/core/behavior-dark-console.js', 1352 1352 'type' => 'js', 1353 1353 'requires' => 1354 1354 array( ··· 4050 4050 'uri' => '/res/pkg/26980a1c/core.pkg.js', 4051 4051 'type' => 'js', 4052 4052 ), 4053 - '6d1d1e99' => 4053 + '4ccfeb47' => 4054 4054 array( 4055 4055 'name' => 'darkconsole.pkg.js', 4056 4056 'symbols' => ··· 4058 4058 0 => 'javelin-behavior-dark-console', 4059 4059 1 => 'javelin-behavior-error-log', 4060 4060 ), 4061 - 'uri' => '/res/pkg/6d1d1e99/darkconsole.pkg.js', 4061 + 'uri' => '/res/pkg/4ccfeb47/darkconsole.pkg.js', 4062 4062 'type' => 'js', 4063 4063 ), 4064 4064 '8aaacd1b' => ··· 4228 4228 'javelin-behavior-aphront-drag-and-drop-textarea' => '27c55b30', 4229 4229 'javelin-behavior-aphront-form-disable-on-submit' => '26980a1c', 4230 4230 'javelin-behavior-audit-preview' => 'f96657b8', 4231 - 'javelin-behavior-dark-console' => '6d1d1e99', 4231 + 'javelin-behavior-dark-console' => '4ccfeb47', 4232 4232 'javelin-behavior-device' => '26980a1c', 4233 4233 'javelin-behavior-differential-accept-with-errors' => '27c55b30', 4234 4234 'javelin-behavior-differential-add-reviewers-and-ccs' => '27c55b30', ··· 4244 4244 'javelin-behavior-differential-user-select' => '27c55b30', 4245 4245 'javelin-behavior-diffusion-commit-graph' => 'f96657b8', 4246 4246 'javelin-behavior-diffusion-pull-lastmodified' => 'f96657b8', 4247 - 'javelin-behavior-error-log' => '6d1d1e99', 4247 + 'javelin-behavior-error-log' => '4ccfeb47', 4248 4248 'javelin-behavior-global-drag-and-drop' => '26980a1c', 4249 4249 'javelin-behavior-history-install' => '26980a1c', 4250 4250 'javelin-behavior-konami' => '26980a1c',
+9
src/aphront/console/DarkConsoleCore.php
··· 83 83 return $key; 84 84 } 85 85 86 + public function getColor() { 87 + foreach ($this->getPlugins() as $plugin) { 88 + if ($plugin->getColor()) { 89 + return $plugin->getColor(); 90 + } 91 + } 92 + } 93 + 86 94 public function render(AphrontRequest $request) { 87 95 $user = $request->getUser(); 88 96 $visible = $user ? $user->getConsoleVisible() : true; ··· 94 102 'class' => 'dark-console', 95 103 'style' => $visible ? '' : 'display: none;', 96 104 'data-console-key' => $this->getKey($request), 105 + 'data-console-color' => $this->getColor(), 97 106 ), 98 107 ''); 99 108 }
+2 -1
src/aphront/console/DarkConsoleDataController.php
··· 51 51 $panel = $obj->renderPanel(); 52 52 53 53 if (!empty($_COOKIE['phsid'])) { 54 - $panel = str_replace( 54 + $panel = PhutilSafeHTML::applyFunction( 55 + 'str_replace', 55 56 $_COOKIE['phsid'], 56 57 '(session-key)', 57 58 $panel);
+1
src/aphront/response/AphrontAjaxResponse.php
··· 42 42 array( 43 43 'uri' => (string)$this->getRequest()->getRequestURI(), 44 44 'key' => $console->getKey($this->getRequest()), 45 + 'color' => $console->getColor(), 45 46 )); 46 47 } 47 48
+15 -7
webroot/rsrc/js/core/behavior-dark-console.js
··· 12 12 var root = statics.root || setup_console(); 13 13 14 14 config.key = config.key || root.getAttribute('data-console-key'); 15 + 16 + if (!('color' in config)) { 17 + config.color = root.getAttribute('data-console-color'); 18 + } 19 + 15 20 add_request(config); 16 21 17 22 // Do first-time setup. ··· 71 76 href: '#' 72 77 }; 73 78 74 - var link = JX.$N('a', attr, config.uri); 79 + var link = JX.$N('a', attr, [get_bullet(config.color), ' ', config.uri]); 75 80 statics.el.reqs.appendChild(link); 76 81 statics.req.all[config.key] = link; 77 82 ··· 81 86 } 82 87 83 88 89 + function get_bullet(color) { 90 + if (!color) { 91 + return null; 92 + } 93 + return JX.$N('span', {style: {color: color}}, "\u2022"); 94 + } 95 + 96 + 84 97 // Select a request (on load, or when the user clicks one). 85 98 function select_request(key) { 86 99 var req = statics.req; ··· 155 168 href: '#' 156 169 }; 157 170 158 - var bullet = null; 159 - if (tab.color) { 160 - bullet = JX.$N('span', {style: {color: tab.color}}, "\u2022"); 161 - } 162 - 163 - var link = JX.$N('a', attr, [bullet, ' ', tab.name]); 171 + var link = JX.$N('a', attr, [get_bullet(tab.color), ' ', tab.name]); 164 172 links.push(link); 165 173 statics.tab.all[tab['class']] = link; 166 174 first = first || tab['class'];