diff --git a/app/Events/ConfigureExploreMenu.php b/app/Events/ConfigureExploreMenu.php new file mode 100644 index 00000000..42aad905 --- /dev/null +++ b/app/Events/ConfigureExploreMenu.php @@ -0,0 +1,20 @@ +menu = &$menu; + } +} diff --git a/app/Services/Hook.php b/app/Services/Hook.php index d6c5a685..a99be142 100644 --- a/app/Services/Hook.php +++ b/app/Services/Hook.php @@ -5,6 +5,7 @@ namespace App\Services; use Event; use Closure; use App\Events; +use Illuminate\Support\Str; class Hook { @@ -23,7 +24,7 @@ class Hook */ public static function addMenuItem($category, $position, array $menu) { - $class = $category == 'user' ? Events\ConfigureUserMenu::class : Events\ConfigureAdminMenu::class; + $class = 'App\Events\Configure'.Str::title($category).'Menu'; Event::listen($class, function ($event) use ($menu, $position, $category) { $new = []; diff --git a/app/helpers.php b/app/helpers.php index 1d55a6c8..a3d939be 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -3,6 +3,7 @@ use Carbon\Carbon; use App\Models\User; use Illuminate\Support\Arr; +use Illuminate\Support\Str; if (! function_exists('webpack_assets')) { function webpack_assets($relativeUri) @@ -95,6 +96,9 @@ if (! function_exists('bs_menu')) { case 'user': event(new App\Events\ConfigureUserMenu($menu)); break; + case 'explore': + event(new App\Events\ConfigureExploreMenu($menu)); + break; case 'admin': event(new App\Events\ConfigureAdminMenu($menu)); break; diff --git a/config/menu.php b/config/menu.php index d2952470..aa028843 100644 --- a/config/menu.php +++ b/config/menu.php @@ -38,4 +38,8 @@ $menu['admin'] = [ ['title' => 'general.check-update', 'link' => 'admin/update', 'icon' => 'fa-arrow-up'], ]; +$menu['explore'] = [ + ['title' => 'general.skinlib', 'link' => 'skinlib', 'icon' => 'fa-archive'], +]; + return $menu; diff --git a/resources/misc/changelogs/en/4.3.0.md b/resources/misc/changelogs/en/4.3.0.md index e9bab7b6..b056817d 100644 --- a/resources/misc/changelogs/en/4.3.0.md +++ b/resources/misc/changelogs/en/4.3.0.md @@ -2,6 +2,7 @@ - Supported Chrome's `theme-color`. - Allowed to customize HTTP status code for rejecting accessing private texture. +- Added configurable "Explore" menu. ## Tweaked diff --git a/resources/misc/changelogs/zh_CN/4.3.0.md b/resources/misc/changelogs/zh_CN/4.3.0.md index f6f2c298..4bcbd7a9 100644 --- a/resources/misc/changelogs/zh_CN/4.3.0.md +++ b/resources/misc/changelogs/zh_CN/4.3.0.md @@ -2,6 +2,7 @@ - 支持 Chrome 的 `theme-color` 属性 - 允许自定义拒绝访问私有材质时返回的 HTTP 状态码 +- 添加可自定义的「浏览」菜单 ## 调整 diff --git a/resources/views/user/master.blade.php b/resources/views/user/master.blade.php index 70de92ff..219b00ee 100644 --- a/resources/views/user/master.blade.php +++ b/resources/views/user/master.blade.php @@ -62,7 +62,7 @@ {!! bs_menu('user') !!}