Skip to content

Commit

Permalink
Add config option to enable/disable scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazoyer committed Jan 28, 2024
1 parent dda367f commit a6b8c0d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ pre {
padding-left: 1%;
padding-right: 1%;
}
.pre-scrollable {
max-height: 480px;
overflow-y: scroll;
}
a {
color: #000000;
text-decoration: none;
Expand Down
6 changes: 6 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@ $config['output']['show_command'] = true;
```
Defines if the command used to get the output should be displayed or not.

```php
$config['output']['scroll'] = true;
```
Defines if the result should be displayed as a scrollable element or a an
unscrollable element.

### Logs

```php
Expand Down
4 changes: 3 additions & 1 deletion includes/config.defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ function set_defaults_for_routers(&$parsed_config) {
// Output control
'output' => array(
// Show or hide command in output
'show_command' => true
'show_command' => true,
// Enable or disable scrolling when displaying result
'scroll' => true
),

// Filters
Expand Down
9 changes: 7 additions & 2 deletions routers/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct($global_config, $config, $id, $requester) {

// Set defaults if not present
if (!isset($this->config['timeout'])) {
$this->config['timeout'] = 30;
$this->config['timeout'] = 180;
}
if (!isset($this->config['disable_ipv6'])) {
$this->config['disable_ipv6'] = false;
Expand Down Expand Up @@ -103,7 +103,12 @@ protected function format_output($command, $output) {
if ($this->global_config['output']['show_command']) {
$displayable .= '<p><kbd>Command: '.$command.'</kdb></p>';
}
$displayable .= '<pre class="pre-scrollable">'.$output.'</pre>';
if ($this->global_config['output']['scroll']) {
$displayable .= '<pre class="pre-scrollable">';
} else {
$displayable .= '<pre>';
}
$displayable .= $output.'</pre>';

return $displayable;
}
Expand Down

0 comments on commit a6b8c0d

Please sign in to comment.