mirror of
https://github.com/DirectoryLister/DirectoryLister.git
synced 2025-09-02 18:33:04 +02:00
Updated configuration to use Config::createFromDirectory() method
This commit is contained in:
@@ -27,6 +27,6 @@ class ConfigComposer
|
||||
*/
|
||||
public function __invoke(): void
|
||||
{
|
||||
$this->container->set(Config::class, new Config('app/config'));
|
||||
$this->container->set(Config::class, Config::createFromDirectory('app/config'));
|
||||
}
|
||||
}
|
||||
|
@@ -41,12 +41,12 @@ class FinderComposer
|
||||
public function __invoke(): void
|
||||
{
|
||||
$finder = Finder::create()->depth(0)->followLinks();
|
||||
$finder->ignoreVCS($this->config->get('ignore_vcs_files', false));
|
||||
$finder->ignoreVCS($this->config->get('app.ignore_vcs_files', false));
|
||||
$finder->filter(function (SplFileInfo $file) {
|
||||
return ! $this->hiddenFiles()->contains($file->getRealPath());
|
||||
});
|
||||
|
||||
$sortOrder = $this->config->get('sort_order', 'name');
|
||||
$sortOrder = $this->config->get('app.sort_order', 'name');
|
||||
if ($sortOrder instanceof Closure) {
|
||||
$finder->sort($sortOrder);
|
||||
} else {
|
||||
@@ -74,7 +74,7 @@ class FinderComposer
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->config->get('reverse_sort', false)) {
|
||||
if ($this->config->get('app.reverse_sort', false)) {
|
||||
$finder->reverseSorting();
|
||||
}
|
||||
|
||||
@@ -89,8 +89,8 @@ class FinderComposer
|
||||
protected function hiddenFiles(): Collection
|
||||
{
|
||||
return Collection::make(
|
||||
$this->config->get('hidden_files', [])
|
||||
)->when($this->config->get('hide_app_files', true), function (Collection $collection) {
|
||||
$this->config->get('app.hidden_files', [])
|
||||
)->when($this->config->get('app.hide_app_files', true), function (Collection $collection) {
|
||||
return $collection->merge(self::APP_FILES);
|
||||
})->map(function (string $file) {
|
||||
return glob($file, GLOB_BRACE | GLOB_NOSORT);
|
||||
|
@@ -35,14 +35,14 @@ class ViewComposer
|
||||
*/
|
||||
public function __invoke(): void
|
||||
{
|
||||
$twig = new Twig("app/themes/{$this->config->get('theme', 'default')}");
|
||||
$twig = new Twig("app/themes/{$this->config->get('app.theme', 'default')}");
|
||||
|
||||
$twig->getEnvironment()->setCache(
|
||||
$this->config->get('view_cache', 'app/cache/views')
|
||||
$this->config->get('cache.view_cache', 'app/cache/views')
|
||||
);
|
||||
|
||||
$twig->getEnvironment()->getExtension(CoreExtension::class)->setDateFormat(
|
||||
$this->config->get('date_format', 'Y-m-d H:i:s'), '%d days'
|
||||
$this->config->get('app.date_format', 'Y-m-d H:i:s'), '%d days'
|
||||
);
|
||||
|
||||
$this->registerGlobalFunctions($twig);
|
||||
|
@@ -34,7 +34,7 @@ class FileInfoController
|
||||
}
|
||||
|
||||
$file = new SplFileInfo($path);
|
||||
if ($file->getSize() >= $this->config->get('max_hash_size', 1000000000)) {
|
||||
if ($file->getSize() >= $this->config->get('app.max_hash_size', 1000000000)) {
|
||||
return $response->withStatus(500, 'File size too large');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user