diff --git a/app/Http/Controllers/Dash/IndexController.php b/app/Http/Controllers/Dash/IndexController.php index 9fc0a4a..83e27f1 100644 --- a/app/Http/Controllers/Dash/IndexController.php +++ b/app/Http/Controllers/Dash/IndexController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Dash; use App\Interfaces\PageRepositoryInterface; use App\Services\AuthService; use App\Services\ThemeService; +use App\Services\SortingService; use App\Http\Controllers\Controller; class IndexController extends Controller @@ -12,15 +13,18 @@ class IndexController extends Controller protected PageRepositoryInterface $pages; protected AuthService $auth; protected ThemeService $themes; + protected SortingService $sort; public function __construct( PageRepositoryInterface $pageRepository, AuthService $authService, ThemeService $themeService, + SortingService $sortingService ) { $this->pages = $pageRepository; $this->auth = $authService; $this->themes = $themeService; + $this->sort = $sortingService; } public function login() @@ -79,4 +83,9 @@ class IndexController extends Controller "title" => $title, ]); } + + public function settings() + { + return view('back.settings', $this->sort->settings()); + } } diff --git a/app/Providers/FipamoServiceProvider.php b/app/Providers/FipamoServiceProvider.php index d50622a..c241733 100644 --- a/app/Providers/FipamoServiceProvider.php +++ b/app/Providers/FipamoServiceProvider.php @@ -63,6 +63,7 @@ class FipamoServiceProvider extends ServiceProvider new SettingsService(new DocService()), new ContentService(), new StringService(), + new ThemeService(new SettingsService(new DocService())) ), new SettingsService(new DocService()), new ContentService(), @@ -74,6 +75,7 @@ class FipamoServiceProvider extends ServiceProvider new SettingsService(new DocService()), new ContentService(), new StringService(), + new ThemeService(new SettingsService(new DocService())) ); }); diff --git a/app/Services/SettingsService.php b/app/Services/SettingsService.php index d56bb5b..586498d 100644 --- a/app/Services/SettingsService.php +++ b/app/Services/SettingsService.php @@ -32,6 +32,12 @@ class SettingsService return $this->settings['global']; } + public function getEmail() + { + $this->settings = $this->loadSettings(); + return $this->settings['email']; + } + public function getMenu() { $this->settings = $this->loadSettings(); diff --git a/app/Services/SortingService.php b/app/Services/SortingService.php index 35973b0..80cb885 100644 --- a/app/Services/SortingService.php +++ b/app/Services/SortingService.php @@ -2,6 +2,8 @@ namespace App\Services; +use Carbon\Carbon; + use function _\find; use function _\filter; @@ -12,15 +14,18 @@ class SortingService private $settings; private $contents; private $strings; + private $themes; public function __construct( SettingsService $settingsService, ContentService $contentService, - StringService $stringService + StringService $stringService, + ThemeService $themeService, ) { $this->settings = $settingsService; $this->contents = $contentService; $this->strings = $stringService; + $this->themes = $themeService; } public function tags() @@ -177,13 +182,11 @@ class SortingService ]); } } - $meta = [ 'who' => $page['author'], 'when' => $page['created'], 'tags' => $tags, ]; - // if page feature isn't empty, find image from list and set it as background image // if it is empty, just use global background if ($page['feature'] != '' || $page['feature'] != null) { @@ -199,7 +202,6 @@ class SortingService } } } - //TODO: get rid of if statement and always return recent and featured $recent = []; $featured = []; $limit = 4; @@ -248,4 +250,32 @@ class SortingService ]; return $pageOptions; } + + public function settings() + { + $global = $this->settings->getGlobal(); + $email = $this->settings->getEmail(); + $updated = new Carbon($global['last_backup']); + $status = session('member') != '' ? true : false; + $pageOptions = [ + 'title' => 'Settings', + 'private' => $global['private'], + 'renderOnSave' => $global['renderOnSave'], + 'background' => $global['background'], + 'member' => session('member'), + 'ftoken' => session('form_token'), + 'siteTitle' => $global['title'], + 'baseUrl' => $global['base_url'], + 'desc' => $global['descriptions'], + 'lastBackup' => $updated->format('Y M D d'), + 'currentTheme' => $global['theme'], + 'themes' => $this->themes->getThemes(), + 'apiStatus' => isset($global['externalAPI']) ? $global['externalAPI'] : 'false', + 'dynamicRenderStatus' => isset($global['dynamicRender']) ? $global['dynamicRender'] : 'false', + 'mailOption' => $email['active'], + 'mailConfig' => $email, + 'status' => $status, + ]; + return $pageOptions; + } } diff --git a/content/themes/fipamo-default-v2/theme.json b/content/themes/fipamo-default-v2/theme.json index 2516364..2db0c43 100644 --- a/content/themes/fipamo-default-v2/theme.json +++ b/content/themes/fipamo-default-v2/theme.json @@ -1,7 +1,7 @@ { - "name": "fipamo-default", - "display-name": "Fipamo Oh Won", + "name": "fipamo-default-v2", + "display-name": "Fipamo Oh Too", "author": "Are0h", "description": "The most dangerous default theme in the known universe.", "version": "1.0.0" -} \ No newline at end of file +} diff --git a/resources/views/back/settings.blade.php b/resources/views/back/settings.blade.php new file mode 100644 index 0000000..684f7a8 --- /dev/null +++ b/resources/views/back/settings.blade.php @@ -0,0 +1,112 @@ +@extends('frame') + +@section('title', 'The Dash | '. $title) + +@section('main-content') +
+
+
+
+ +
+
+
+ +
+
+ + + + + +
+ +
+
+ @if($lastBackup != '') + LAST BACK UP
+ {{ $lastBackup }}
+ @else + span No back ups. Frowny face. + @endif +
+
+ @if(isset($apiStatus) && $apiStatus == 'true') + + @else + + + @endif + @if(isset($dynamicRenderStatus) && $dynamicRenderStatus == 'true') + + + @else + + + @endif +
+
+
+ @foreach($themes as $theme) + @if($theme['name'] == $currentTheme) + + @else + + @endif + @endforeach +
+
+
+ @if($mailOption == "option-none" or $mailOption == "") + NONE + @else + NONE + @endif + @if($mailOption == "option-mg" or $mailOption == "") + MAILGUN + @else + MAILGUN + @endif + @if($mailOption == "option-smtp" or $mailOption == "") + SMTP + @else + SMTP + @endif + @include('forms.mailforms') + +
+
+ +
+ {{ $member['key'] }} +
+
+ {{ $ftoken }} +
+
+
+@endsection diff --git a/resources/views/forms/mailforms.blade.php b/resources/views/forms/mailforms.blade.php new file mode 100644 index 0000000..66cf979 --- /dev/null +++ b/resources/views/forms/mailforms.blade.php @@ -0,0 +1,31 @@ +@if($mailOption == "option-smtp") +
+ + + +
+
+ + +
+@elseif($mailOption == 'option-mg') +
+ + + +
+
+ + +
+@else +
+ + + +
+
+ + +
+@endif diff --git a/routes/web.php b/routes/web.php index 1a7f6d7..3e5dfdd 100644 --- a/routes/web.php +++ b/routes/web.php @@ -30,6 +30,7 @@ Route::group(['prefix' => 'dashboard', 'middleware' => 'member.check'], function Route::get("/start", [IndexController::class, 'start'])->name('start'); Route::get("/pages/{pageFilter?}/{pageNum?}", [IndexController::class, 'book']); Route::get("/page/{mode}/{uuid}", [IndexController::class, 'page']); + Route::get("/settings", [IndexController::class, 'settings']); Route::get("/logout", [AuthController::class, 'exit']); });