Skip to content

Commit

Permalink
Merge pull request #1 from opencorero/dev
Browse files Browse the repository at this point in the history
New version added v1.1.0
  • Loading branch information
opencorero authored Jan 17, 2020
2 parents cc1fbe0 + 25a4e3c commit f25d4b0
Show file tree
Hide file tree
Showing 20 changed files with 594 additions and 93 deletions.
16 changes: 10 additions & 6 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<IfModule !mod_rewrite.c>
#For security reasons OpenCore needs mod_rewrite activated!
Deny from all
</IfModule>
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
Expand All @@ -9,16 +13,16 @@
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

RewriteCond %{REQUEST_URI} !(\.ico|\.gif|\.jpg|\.jpeg|\.png|\.js|\.css|\.svg|robots\.txt)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ public/$1 [L,NC]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ public/$1 [L,NC]
RewriteRule ^ public/index.php [L]
</IfModule>
37 changes: 30 additions & 7 deletions Framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Framework
private $request;
private $kernel;
private $registry;
private $routes_checked = [];

public function __construct()
{
Expand Down Expand Up @@ -116,23 +117,45 @@ public function handle($registry = null)
* @param object $registry
* @return bool
*/
public function checkRoute($route)
public function checkRoute($route, &$output)
{
//force admin route in case the request comes from admin side
if(defined('HTTPS_CATALOG')) {
$_SERVER['SCRIPT_NAME'] = str_replace(basename(DIR_APPLICATION) . '/', '', $_SERVER['SCRIPT_NAME']);

$route = 'admin/' . $route;
}

// Strip query string (?foo=bar) and decode URI
if (false !== $pos = strpos($route, '?')) {
$route = substr($route, 0, $pos);
}
$route = rawurldecode($route);

/**
* Avoid multi chekings for the same controller
*/
if(isset($this->routes_checked[$route])) {
return null;
} else {
$this->routes_checked[$route] = true;
}

$this->request = \Illuminate\Http\Request::capture();

/**
* force admin route in case the request comes from admin side
*/
if(defined('HTTPS_CATALOG')) {
$appBaseName = basename(DIR_APPLICATION) . '/';
$route = $appBaseName . $route;

$serverName = $this->request->server->get('SCRIPT_NAME');
$this->request->server->set('SCRIPT_NAME', str_replace($appBaseName, '', $serverName));
}

/**
* Change URI for partial loaded controllers like common/header, common/footer etc...
* in order to be able to override them
*/
if($output !== false) {
$this->request->server->set('REQUEST_URI', $route);
}

return $this->app->router->has($route) || $this->request->is($route . '*');
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ MIT license. Please see the [license file](LICENSE) for more information.


## TODO
* remove routes from other initiated vendors to be accessible -> logs & totem! URGENT!

* display jobs & failed_jobs lists in developer module
* admin user permission checked on modify | POST / PUT / DELETE
* move occore user permission changes inside OpenCore project in a separate method
Expand Down
148 changes: 148 additions & 0 deletions config/log-viewer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<?php

use Arcanedev\LogViewer\Contracts\Utilities\Filesystem;

return [

/* -----------------------------------------------------------------
| Log files storage path
| -----------------------------------------------------------------
*/

'storage-path' => storage_path('logs'),

/* -----------------------------------------------------------------
| Log files pattern
| -----------------------------------------------------------------
*/

'pattern' => [
'prefix' => Filesystem::PATTERN_PREFIX, // 'laravel-'
'date' => Filesystem::PATTERN_DATE, // '[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]'
'extension' => Filesystem::PATTERN_EXTENSION, // '.log'
],

/* -----------------------------------------------------------------
| Locale
| -----------------------------------------------------------------
| Supported locales :
| 'auto', 'ar', 'bg', 'de', 'en', 'es', 'et', 'fa', 'fr', 'hu', 'hy', 'id', 'it', 'ja', 'ko', 'nl',
| 'pl', 'pt-BR', 'ro', 'ru', 'sv', 'th', 'tr', 'zh-TW', 'zh'
*/

'locale' => 'auto',

/* -----------------------------------------------------------------
| Theme
| -----------------------------------------------------------------
| Supported themes :
| 'bootstrap-3', 'bootstrap-4'
| Make your own theme by adding a folder to the views directory and specifying it here.
*/

'theme' => 'bootstrap-3',

/* -----------------------------------------------------------------
| Route settings
| -----------------------------------------------------------------
*/

'route' => [
'enabled' => false,

'attributes' => [
'prefix' => 'admin/developer/log-viewer',

'middleware' => env('ARCANEDEV_LOGVIEWER_MIDDLEWARE') ? explode(',', env('ARCANEDEV_LOGVIEWER_MIDDLEWARE')) : 'App\Http\Middleware\AdminMiddleware',
],
],

/* -----------------------------------------------------------------
| Log entries per page
| -----------------------------------------------------------------
| This defines how many logs & entries are displayed per page.
*/

'per-page' => 30,

/* -----------------------------------------------------------------
| LogViewer's Facade
| -----------------------------------------------------------------
*/

'facade' => 'LogViewer',

/* -----------------------------------------------------------------
| Download settings
| -----------------------------------------------------------------
*/

'download' => [
'prefix' => 'laravel-',

'extension' => 'log',
],

/* -----------------------------------------------------------------
| Menu settings
| -----------------------------------------------------------------
*/

'menu' => [
'filter-route' => 'developer::admin.logs.filter',

'icons-enabled' => true,
],

/* -----------------------------------------------------------------
| Icons
| -----------------------------------------------------------------
*/

'icons' => [
/**
* Font awesome >= 4.3
* http://fontawesome.io/icons/
*/
'all' => 'fa fa-fw fa-list', // http://fontawesome.io/icon/list/
'emergency' => 'fa fa-fw fa-bug', // http://fontawesome.io/icon/bug/
'alert' => 'fa fa-fw fa-bullhorn', // http://fontawesome.io/icon/bullhorn/
'critical' => 'fa fa-fw fa-heartbeat', // http://fontawesome.io/icon/heartbeat/
'error' => 'fa fa-fw fa-times-circle', // http://fontawesome.io/icon/times-circle/
'warning' => 'fa fa-fw fa-exclamation-triangle', // http://fontawesome.io/icon/exclamation-triangle/
'notice' => 'fa fa-fw fa-exclamation-circle', // http://fontawesome.io/icon/exclamation-circle/
'info' => 'fa fa-fw fa-info-circle', // http://fontawesome.io/icon/info-circle/
'debug' => 'fa fa-fw fa-life-ring', // http://fontawesome.io/icon/life-ring/
],

/* -----------------------------------------------------------------
| Colors
| -----------------------------------------------------------------
*/

'colors' => [
'levels' => [
'empty' => '#D1D1D1',
'all' => '#8A8A8A',
'emergency' => '#B71C1C',
'alert' => '#D32F2F',
'critical' => '#F44336',
'error' => '#FF5722',
'warning' => '#FF9100',
'notice' => '#4CAF50',
'info' => '#1976D2',
'debug' => '#90CAF9',
],
],

/* -----------------------------------------------------------------
| Strings to highlight in stack trace
| -----------------------------------------------------------------
*/

'highlight' => [
'^#\d+',
'^Stack trace:',
],

];
Loading

0 comments on commit f25d4b0

Please sign in to comment.