Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tam committed Jul 9, 2021
2 parents dd2861b + eb225cc commit f1bae26
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.0.4 - 2021-07-09 [CRITICAL]
### Fixed
- Fix security vulnerability

## 3.0.3 - 2019-11-25
### Fixed
- Fix error when first file is not `*.log` (via [@sebschaefer](https://github.com/sebschaefer))
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ether/logs",
"description": "Access logs from the CP",
"version": "3.0.3",
"version": "3.0.4",
"type": "craft-plugin",
"minimum-stability": "dev",
"require": {
Expand Down
12 changes: 9 additions & 3 deletions src/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@

namespace ether\logs;

use Craft;

class Controller extends \craft\web\Controller
{

public function actionStream ()
{
$logsDir = \Craft::getAlias('@storage/logs');
$logFile = \Craft::$app->request->getParam('log');
$currentLog = \Craft::$app->request->get('log', $logFile);
$logsDir = Craft::getAlias('@storage/logs');
$logFile = Craft::$app->request->getParam('log');
$currentLog = basename(Craft::$app->request->get('log', $logFile));

if (strpos($currentLog, '.log') === false)
return '<p>You can only access <code>.log</code> files!</p>';

$log = file_get_contents($logsDir . '/' . $currentLog);

exit($log);
Expand Down
12 changes: 7 additions & 5 deletions src/templates/view.twig
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<form>
<select id="__logSwitch">
{% for file in logFiles %}
<option{{ file == currentLog ? ' selected' }}>{{ file }}</option>
{% endfor %}
</select>
<label class="select">
<select id="__logSwitch">
{% for file in logFiles %}
<option{{ file == currentLog ? ' selected' }}>{{ file }}</option>
{% endfor %}
</select>
</label>
</form>

<hr style="margin-bottom:0">
Expand Down

0 comments on commit f1bae26

Please sign in to comment.