diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index 772bb6b5..09186c2c 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -18,6 +18,17 @@ use App\Exceptions\PrettyPageException; class AuthController extends Controller { + public function login() + { + return view('auth.login', [ + 'extra' => [ + 'tooManyFails' => cache(sha1('login_fails_'.get_client_ip())) > 3, + 'recaptcha' => option('recaptcha_sitekey'), + 'invisible' => (bool) option('recaptcha_invisible'), + ], + ]); + } + public function handleLogin(Request $request, Captcha $captcha) { $this->validate($request, [ @@ -88,6 +99,7 @@ class AuthController extends Controller { if (option('user_can_register')) { return view('auth.register', [ + 'site_name' => option_localized('site_name'), 'extra' => [ 'player' => (bool) option('register_with_player_name'), 'recaptcha' => option('recaptcha_sitekey'), @@ -265,7 +277,7 @@ class AuthController extends Controller $user->verified = true; $user->save(); - return view('auth.verify'); + return view('auth.verify', ['site_name' => option_localized('site_name')]); } public function jwtLogin(Request $request) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 983c853f..f15be044 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -2,21 +2,38 @@ namespace App\Http\Controllers; +use Illuminate\Support\Arr; + class HomeController extends Controller { public function index() { - return view('index')->with('user', auth()->user()) - ->with('transparent_navbar', option('transparent_navbar', false)) - ->with('home_pic_url', option('home_pic_url') ?: config('options.home_pic_url')); + return view('home')->with('user', auth()->user()) + ->with('site_description', option_localized('site_description')) + ->with('transparent_navbar', (bool) option('transparent_navbar', false)) + ->with('fixed_bg', option('fixed_bg')) + ->with('hide_intro', option('hide_intro')) + ->with('home_pic_url', option('home_pic_url') ?: config('options.home_pic_url')) + ->with('user_can_register', option('user_can_register')); } public function apiRoot() { + $copyright = Arr::get( + [ + 'Powered with ❤ by Blessing Skin Server.', + 'Powered by Blessing Skin Server.', + 'Proudly powered by Blessing Skin Server.', + '由 Blessing Skin Server 强力驱动。', + '自豪地采用 Blessing Skin Server。', + ], + option_localized('copyright_prefer', 0) + ); + return response()->json([ 'blessing_skin' => config('app.version'), 'spec' => 0, - 'copyright' => bs_copyright(), + 'copyright' => $copyright, 'site_name' => option('site_name'), ]); } diff --git a/app/Http/Controllers/SkinlibController.php b/app/Http/Controllers/SkinlibController.php index f18245b1..4ec474ba 100644 --- a/app/Http/Controllers/SkinlibController.php +++ b/app/Http/Controllers/SkinlibController.php @@ -32,11 +32,6 @@ class SkinlibController extends Controller 8 => 'A PHP extension stopped the file upload.', ]; - public function index() - { - return view('skinlib.index', ['user' => Auth::user()]); - } - /** * Get skin library data filtered. * Available Query String: filter, uploader, page, sort, keyword, items_per_page. @@ -138,10 +133,18 @@ class SkinlibController extends Controller } } + $commentScript = get_string_replaced( + option('comment_script'), + [ + '{tid}' => $texture->tid, + '{name}' => $texture->name, + '{url}' => request()->url(), + ] + ); + return view('skinlib.show') ->with('texture', $texture) - ->with('with_out_filter', true) - ->with('user', $user) + ->with('comment_script', $commentScript) ->with('extra', [ 'download' => option('allow_downloading_texture'), 'currentUid' => $user ? $user->uid : 0, @@ -164,7 +167,6 @@ class SkinlibController extends Controller public function upload() { return view('skinlib.upload') - ->with('user', Auth::user()) ->with('extra', [ 'rule' => ($regexp = option('texture_name_regexp')) ? trans('skinlib.upload.name-rule-regexp', compact('regexp')) @@ -177,8 +179,7 @@ class SkinlibController extends Controller 'scorePrivate' => intval(option('private_score_per_storage')), 'award' => intval(option('score_award_per_texture')), 'contentPolicy' => app('parsedown')->text(option_localized('content_policy')), - ]) - ->with('with_out_filter', true); + ]); } public function handleUpload(Request $request) diff --git a/app/Providers/ViewServiceProvider.php b/app/Providers/ViewServiceProvider.php index 4e09009b..62bd9e2c 100644 --- a/app/Providers/ViewServiceProvider.php +++ b/app/Providers/ViewServiceProvider.php @@ -10,7 +10,7 @@ class ViewServiceProvider extends ServiceProvider { public function boot() { - View::composer(['*.base', 'shared.header'], function ($view) { + View::composer(['home', '*.base', 'shared.header'], function ($view) { $view->with([ 'site_name' => option_localized('site_name'), 'color_scheme' => option('color_scheme'), @@ -35,7 +35,7 @@ class ViewServiceProvider extends ServiceProvider View::composer('shared.user-panel', Composers\UserPanelComposer::class); - View::composer('shared.footer', function ($view) { + View::composer('shared.copyright', function ($view) { $customCopyright = get_string_replaced( option_localized('copyright_text'), [ @@ -50,5 +50,14 @@ class ViewServiceProvider extends ServiceProvider }); View::composer('shared.foot', Composers\FootComposer::class); + + View::composer('auth.*', function ($view) { + $view->with('enable_recaptcha', (bool) option('recaptcha_sitekey')); + $view->with( + 'recaptcha_url', + 'https://www.recaptcha.net/recaptcha/api.js' + .'?onload=vueRecaptchaApiLoaded&render=explicit' + ); + }); } } diff --git a/app/helpers.php b/app/helpers.php index e93e7c57..26d4746b 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -55,44 +55,6 @@ if (! function_exists('json')) { } } -if (! function_exists('bs_footer_extra')) { - function bs_footer_extra(): string - { - $extraContents = []; - - Event::dispatch(new App\Events\RenderingFooter($extraContents)); - - return implode("\n", $extraContents); - } -} - -if (! function_exists('bs_header_extra')) { - function bs_header_extra(): string - { - $extraContents = []; - - Event::dispatch(new App\Events\RenderingHeader($extraContents)); - - return implode("\n", $extraContents); - } -} - -if (! function_exists('bs_copyright')) { - function bs_copyright(): string - { - return Arr::get( - [ - 'Powered with ❤ by Blessing Skin Server.', - 'Powered by Blessing Skin Server.', - 'Proudly powered by Blessing Skin Server.', - '由 Blessing Skin Server 强力驱动。', - '自豪地采用 Blessing Skin Server。', - ], - option_localized('copyright_prefer', 0) - ); - } -} - if (! function_exists('option')) { /** * Get / set the specified option value. diff --git a/resources/assets/src/styles/auth.styl b/resources/assets/src/styles/auth.styl index 547a0f03..75d79e65 100644 --- a/resources/assets/src/styles/auth.styl +++ b/resources/assets/src/styles/auth.styl @@ -1,9 +1,8 @@ -.login-logo a, .register-logo a, .reset-logo a +.login-logo a font-family Minecraft, Ubuntu, 'Segoe UI', 'Microsoft Yahei', 'Microsoft Jhenghei', sans-serif transition all 0.2s ease-in-out - -.login-logo a:hover, .register-logo a:hover, .reset-logo a:hover - color #42a5f5 + &:hover + color #42a5f5 .captcha cursor pointer diff --git a/resources/views/admin/base.twig b/resources/views/admin/base.twig index 3e745839..3b1ea36f 100644 --- a/resources/views/admin/base.twig +++ b/resources/views/admin/base.twig @@ -17,7 +17,9 @@ {% block content %}{% endblock %} - {{ include('shared.footer') }} + {% block before_foot %}{% endblock %} {{ include('shared.foot') }} diff --git a/resources/views/admin/master.blade.php b/resources/views/admin/master.blade.php index e75cf369..fe4ffcf3 100644 --- a/resources/views/admin/master.blade.php +++ b/resources/views/admin/master.blade.php @@ -11,7 +11,9 @@ @include('shared.header') @include('shared.sidebar', ['scope' => 'admin']) @yield('content') - @include('shared.footer') + @include('shared.foot') diff --git a/resources/views/auth/base.twig b/resources/views/auth/base.twig new file mode 100644 index 00000000..fbd50a88 --- /dev/null +++ b/resources/views/auth/base.twig @@ -0,0 +1,22 @@ + + + + {{ include('shared.head') }} + {% block title %}{% endblock %} - {{ site_name }} + + + +
+ + +
+ {% block content %}{% endblock %} +
+
+ + {% block before_foot %}{% endblock %} + {{ include('shared.foot') }} + + diff --git a/resources/views/auth/bind.blade.php b/resources/views/auth/bind.blade.php deleted file mode 100644 index b2febf8a..00000000 --- a/resources/views/auth/bind.blade.php +++ /dev/null @@ -1,41 +0,0 @@ -@extends('auth.master') - -@section('title', trans('auth.bind.title')) - -@section('content') - -
- - -
- - -
- @csrf -
- - -
- -

@lang('auth.bind.introduction')

- - @if ($errors->count() > 0) -
{{ $errors->first() }}
- @endif - -
-
-
- -
-
-
- -
- -
- - -@endsection diff --git a/resources/views/auth/bind.twig b/resources/views/auth/bind.twig new file mode 100644 index 00000000..4e2e22ee --- /dev/null +++ b/resources/views/auth/bind.twig @@ -0,0 +1,34 @@ +{% extends 'auth.base' %} + +{% block title %}{{ trans('auth.bind.title') }}{% endblock %} + +{% block content %} +

{{ trans('auth.bind.message') }}

+
+ {{ csrf_field() }} +
+ + +
+ +

{{ trans('auth.bind.introduction') }}

+ + {% if errors.any %} +
{{ errors.first }}
+ {% endif %} + +
+
+
+ +
+
+
+{% endblock %} diff --git a/resources/views/auth/forgot.blade.php b/resources/views/auth/forgot.blade.php deleted file mode 100644 index fc182a44..00000000 --- a/resources/views/auth/forgot.blade.php +++ /dev/null @@ -1,32 +0,0 @@ -@extends('auth.master') - -@section('title', trans('auth.forgot.title')) - -@section('content') - -
- - -
- - - @if (Session::has('msg')) -
{{ Session::pull('msg') }}
- @endif - -
- -
- -
- -@include('common.recaptcha') - -@endsection diff --git a/resources/views/auth/forgot.twig b/resources/views/auth/forgot.twig new file mode 100644 index 00000000..20a6e911 --- /dev/null +++ b/resources/views/auth/forgot.twig @@ -0,0 +1,23 @@ +{% extends 'auth.base' %} + +{% block title %}{{ trans('auth.forgot.title') }}{% endblock %} + +{% block content %} +

{{ trans('auth.forgot.message') }}

+ {% if session_has('msg') %} +
{{ session_pull('msg') }}
+ {% endif %} +
+{% endblock %} + +{% block before_foot %} + {% if enable_recaptcha %} + + {% endif %} + +{% endblock %} diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php deleted file mode 100644 index 5b5a4ef2..00000000 --- a/resources/views/auth/login.blade.php +++ /dev/null @@ -1,41 +0,0 @@ -@extends('auth.master') - -@section('title', trans('auth.login.title')) - -@section('content') - -
- - -
- - - @if (Session::has('msg')) -
{{ Session::pull('msg') }}
- @endif - -
-
- @lang('auth.register-link') -
- -
- -@include('common.recaptcha') -@php -$extra = [ - 'tooManyFails' => cache(sha1('login_fails_'.get_client_ip())) > 3, - 'recaptcha' => option('recaptcha_sitekey'), - 'invisible' => (bool) option('recaptcha_invisible'), -]; -@endphp - - -@endsection diff --git a/resources/views/auth/login.twig b/resources/views/auth/login.twig new file mode 100644 index 00000000..6d25eab4 --- /dev/null +++ b/resources/views/auth/login.twig @@ -0,0 +1,27 @@ +{% extends 'auth.base' %} + +{% block title %}{{ trans('auth.login.title') }}{% endblock %} + +{% block content %} +

{{ trans('auth.login.message') }}

+ {% if session_has('msg') %} +
{{ session_pull('msg') }}
+ {% endif %} +
+
+ + {{ trans('auth.register-link') }} + +{% endblock %} + +{% block before_foot %} + {% if enable_recaptcha %} + + {% endif %} + +{% endblock %} diff --git a/resources/views/auth/master.blade.php b/resources/views/auth/master.blade.php deleted file mode 100644 index c8049344..00000000 --- a/resources/views/auth/master.blade.php +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - @yield('title') - {{ option_localized('site_name') }} - @include('common.favicon') - - - @include('common.theme-color') - @include('common.seo-meta-tags') - - @include('common.dependencies.style') - - - - - @yield('content') - - - - - - @include('common.dependencies.script') - - @yield('script') - - diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php deleted file mode 100644 index 19ca5ff3..00000000 --- a/resources/views/auth/register.blade.php +++ /dev/null @@ -1,27 +0,0 @@ -@extends('auth.master') - -@section('title', trans('auth.register.title')) - -@section('content') - -
- - -
- - -
-
- -
- -@include('common.recaptcha') - -@endsection diff --git a/resources/views/auth/register.twig b/resources/views/auth/register.twig new file mode 100644 index 00000000..40a08315 --- /dev/null +++ b/resources/views/auth/register.twig @@ -0,0 +1,22 @@ +{% extends 'auth.base' %} + +{% block title %}{{ trans('auth.register.title') }}{% endblock %} + +{% block content %} +

+ {{ trans('auth.register.message', {sitename: site_name}) }} +

+
+{% endblock %} + +{% block before_foot %} + {% if enable_recaptcha %} + + {% endif %} + +{% endblock %} diff --git a/resources/views/auth/reset.blade.php b/resources/views/auth/reset.blade.php deleted file mode 100644 index 18c462b1..00000000 --- a/resources/views/auth/reset.blade.php +++ /dev/null @@ -1,21 +0,0 @@ -@extends('auth.master') - -@section('title', trans('auth.reset.title')) - -@section('content') - -
- - -
- - -
-
- -
- - -@endsection diff --git a/resources/views/auth/reset.twig b/resources/views/auth/reset.twig new file mode 100644 index 00000000..e27f4cd4 --- /dev/null +++ b/resources/views/auth/reset.twig @@ -0,0 +1,10 @@ +{% extends 'auth.base' %} + +{% block title %}{{ trans('auth.reset.title') }}{% endblock %} + +{% block content %} +

+ {{ trans('auth.reset.message', {username: user.nickname}) }} +

+
+{% endblock %} diff --git a/resources/views/auth/verify.blade.php b/resources/views/auth/verify.blade.php deleted file mode 100644 index 6a4d3894..00000000 --- a/resources/views/auth/verify.blade.php +++ /dev/null @@ -1,32 +0,0 @@ -@extends('auth.master') - -@section('title', trans('auth.verify.title')) - -@section('content') - -
- - -
- - -
- @lang('auth.verify.success') -
- - - -
- -
- - -@endsection diff --git a/resources/views/auth/verify.twig b/resources/views/auth/verify.twig new file mode 100644 index 00000000..9fec0554 --- /dev/null +++ b/resources/views/auth/verify.twig @@ -0,0 +1,19 @@ +{% extends 'auth.base' %} + +{% block title %}{{ trans('auth.verify.title') }}{% endblock %} + +{% block content %} +

+ {{ trans('auth.verify.message', {sitename: site_name}) }} +

+
+ {{ trans('auth.verify.success') }} +
+
+
+ + {{ trans('auth.verify.button') }} + +
+
+{% endblock %} diff --git a/resources/views/common/copyright.blade.php b/resources/views/common/copyright.blade.php deleted file mode 100644 index 9175e825..00000000 --- a/resources/views/common/copyright.blade.php +++ /dev/null @@ -1,7 +0,0 @@ -{!! - str_replace( - 'Blessing Skin Server', - 'Blessing Skin Server', - bs_copyright() - ) -!!} diff --git a/resources/views/common/custom-copyright.blade.php b/resources/views/common/custom-copyright.blade.php deleted file mode 100644 index 765e116f..00000000 --- a/resources/views/common/custom-copyright.blade.php +++ /dev/null @@ -1,8 +0,0 @@ -{!! -get_string_replaced( - option_localized('copyright_text'), [ - '{site_name}' => option_localized('site_name'), - '{site_url}' => option('site_url'), - ] -) -!!} diff --git a/resources/views/common/dependencies/script.blade.php b/resources/views/common/dependencies/script.blade.php deleted file mode 100644 index 500f6cdc..00000000 --- a/resources/views/common/dependencies/script.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@inject('intl', 'App\Services\Translations\JavaScript') - -@if ($pluginI18n = $intl->plugin(app()->getLocale())) - -@endif - - -{{-- Content added by plugins dynamically --}} -{!! bs_footer_extra() !!} diff --git a/resources/views/common/dependencies/style.blade.php b/resources/views/common/dependencies/style.blade.php deleted file mode 100644 index a4997964..00000000 --- a/resources/views/common/dependencies/style.blade.php +++ /dev/null @@ -1,16 +0,0 @@ - -@if (app()->environment('development')) - -@endif - - - - -@if (isset($module)) - -@endif - - - -{{-- Content added by plugins dynamically --}} -{!! bs_header_extra() !!} diff --git a/resources/views/common/favicon.blade.php b/resources/views/common/favicon.blade.php deleted file mode 100644 index fed539b9..00000000 --- a/resources/views/common/favicon.blade.php +++ /dev/null @@ -1,6 +0,0 @@ -@php - $faviconUrl = \Illuminate\Support\Str::startsWith($url = (option('favicon_url') ?: config('options.favicon_url')), 'http') ? $url : url($url); -@endphp - - - diff --git a/resources/views/common/language.blade.php b/resources/views/common/language.blade.php deleted file mode 100644 index 7abef9cd..00000000 --- a/resources/views/common/language.blade.php +++ /dev/null @@ -1,26 +0,0 @@ - - diff --git a/resources/views/common/notifications-menu.blade.php b/resources/views/common/notifications-menu.blade.php deleted file mode 100644 index fd179350..00000000 --- a/resources/views/common/notifications-menu.blade.php +++ /dev/null @@ -1,30 +0,0 @@ -@php - $notifications = $user->unreadNotifications; - $count = $notifications->count(); -@endphp - - diff --git a/resources/views/common/recaptcha.blade.php b/resources/views/common/recaptcha.blade.php deleted file mode 100644 index 90bc5671..00000000 --- a/resources/views/common/recaptcha.blade.php +++ /dev/null @@ -1,4 +0,0 @@ -@if (option('recaptcha_sitekey')) - -@endif diff --git a/resources/views/common/seo-meta-tags.blade.php b/resources/views/common/seo-meta-tags.blade.php deleted file mode 100644 index 3143bee8..00000000 --- a/resources/views/common/seo-meta-tags.blade.php +++ /dev/null @@ -1,3 +0,0 @@ - - -{!! option('meta_extras') !!} diff --git a/resources/views/common/theme-color.blade.php b/resources/views/common/theme-color.blade.php deleted file mode 100644 index 3767fb4e..00000000 --- a/resources/views/common/theme-color.blade.php +++ /dev/null @@ -1,13 +0,0 @@ -@php -$colors = [ - 'blue' => '#3c8dbc', - 'yellow' => '#f39c12', - 'green' => '#00a65a', - 'purple' => '#605ca8', - 'red' => '#dd4b39', - 'black' => '#ffffff', -]; -preg_match('/skin-(\w+)?(?:-light)?/', option('color_scheme'), $matches); -@endphp - - diff --git a/resources/views/common/user-menu.blade.php b/resources/views/common/user-menu.blade.php deleted file mode 100644 index 507af8d1..00000000 --- a/resources/views/common/user-menu.blade.php +++ /dev/null @@ -1,48 +0,0 @@ - - diff --git a/resources/views/common/user-panel.blade.php b/resources/views/common/user-panel.blade.php deleted file mode 100644 index 59399d8c..00000000 --- a/resources/views/common/user-panel.blade.php +++ /dev/null @@ -1,33 +0,0 @@ -@php -$roles = [ - App\Models\User::BANNED => 'banned', - App\Models\User::NORMAL => 'normal', - App\Models\User::ADMIN => 'admin', - App\Models\User::SUPER_ADMIN => 'super-admin', -]; -$role = $roles[$user->permission]; -@endphp - -@php - $badges = []; - event(new \App\Events\RenderingBadges($badges)); -@endphp -
-
- email).'.png?tid='.$user->avatar) }}" alt="User Image"> -
-
-

{{ $user->nickname ?? $user->email }}

- @lang("admin.users.status.$role") - @if (count($badges) === 1) - {{ $badges[0][0] }} - @endif -
-
-@if (count($badges) > 1) -
- @foreach ($badges as $badge) - {{ $badge[0] }} - @endforeach -
-@endif diff --git a/resources/views/home.twig b/resources/views/home.twig new file mode 100644 index 00000000..2842412c --- /dev/null +++ b/resources/views/home.twig @@ -0,0 +1,154 @@ + + + + {{ include('shared.head') }} + {{ site_name }} + + + + +
+ {% if fixed_bg %} +
+ {% endif %} + +
+ +
+ +
+
+

{{ site_name }}

+

+ {{ site_description }} +

+

+ {% if auth_check() %} + + {{ trans('general.user-center') }} + + {% else %} + {% if user_can_register %} + + {{ trans('general.register') }} + + {% else %} + + {{ trans('general.login') }} + + {% endif %} + {% endif %} +

+
+
+ + {% if hide_intro %} + + {% endif %} +
+ + {% if not hide_intro %} +
+
+
+

{{ trans('index.features.title') }}

+
+
+ {% for item in ['first', 'second', 'third'] %} +
+ +

{{ trans("index.features.#{item}.name") }}

+

{{ trans("index.features.#{item}.desc") }}

+
+ {% endfor %} +
+
+
+
+
+
+
+ {{ trans('index.introduction', {sitename: site_name}) }} +
+ +
+
+ + {% endif %} + + + {{ include('shared.foot') }} + + diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php deleted file mode 100644 index f8ce29a2..00000000 --- a/resources/views/index.blade.php +++ /dev/null @@ -1,171 +0,0 @@ - - - - @include('shared.head') - {{ option_localized('site_name') }} - - - - - -
- @if (option('fixed_bg')) -
- @endif - -
- -
- -
-
-

{{ option_localized('site_name') }}

-

- {{ option_localized('site_description') }} -

-

- @guest - @if (option('user_can_register')) - @lang('general.register') - @else - @lang('general.login') - @endif - @else - @lang('general.user-center') - @endguest -

-
-
- - @if (option('hide_intro')) - - @endif -
- - @if (! option('hide_intro')) - -
-
-
-

{!! trans('index.features.title') !!}

-
-
-
- -

{!! trans('index.features.first.name') !!}

-

{!! trans('index.features.first.desc') !!}

-
-
- -

{!! trans('index.features.second.name') !!}

-

{!! trans('index.features.second.desc') !!}

-
-
- -

{!! trans('index.features.third.name') !!}

-

{!! trans('index.features.third.desc') !!}

-
-
-
-
-
- -
-
-
- {!! trans('index.introduction', ['sitename' => option_localized('site_name')]) !!} -
- - -
-
- @endif - - @if (! option('hide_intro')) - - @endif - - - - - @include('common.dependencies.script') - - diff --git a/resources/views/shared/copyright.twig b/resources/views/shared/copyright.twig new file mode 100644 index 00000000..982ccfc1 --- /dev/null +++ b/resources/views/shared/copyright.twig @@ -0,0 +1,19 @@ +{% set repo = 'https://github.com/bs-community/blessing-skin-server' %} + + + + + +{{ custom_copyright|raw }} diff --git a/resources/views/shared/footer.twig b/resources/views/shared/footer.twig index b1bd18b8..d340d9cf 100644 --- a/resources/views/shared/footer.twig +++ b/resources/views/shared/footer.twig @@ -1,20 +1,3 @@ -{% set repo = 'https://github.com/bs-community/blessing-skin-server' %} diff --git a/resources/views/skinlib/base.twig b/resources/views/skinlib/base.twig new file mode 100644 index 00000000..ae01cd41 --- /dev/null +++ b/resources/views/skinlib/base.twig @@ -0,0 +1,85 @@ + + + + {{ include('shared.head') }} + {% block title %}{% endblock %} - {{ site_name }} + + + +
+
+ +
+ + {% block content %}{% endblock %} + + +
+ {% block before_foot %}{% endblock %} + {{ include('shared.foot') }} + + diff --git a/resources/views/skinlib/index.blade.php b/resources/views/skinlib/index.blade.php deleted file mode 100644 index 5463afa9..00000000 --- a/resources/views/skinlib/index.blade.php +++ /dev/null @@ -1,7 +0,0 @@ -@extends('skinlib.master') - -@section('title', trans('general.skinlib')) - -@section('content') -
-@endsection diff --git a/resources/views/skinlib/index.twig b/resources/views/skinlib/index.twig new file mode 100644 index 00000000..518e6dde --- /dev/null +++ b/resources/views/skinlib/index.twig @@ -0,0 +1,7 @@ +{% extends 'skinlib.base' %} + +{% block title %}{{ trans('general.skinlib') }}{% endblock %} + +{% block content %} +
+{% endblock %} diff --git a/resources/views/skinlib/master.blade.php b/resources/views/skinlib/master.blade.php deleted file mode 100644 index 480163ad..00000000 --- a/resources/views/skinlib/master.blade.php +++ /dev/null @@ -1,87 +0,0 @@ - - - - @include('shared.head') - @yield('title') - {{ option_localized('site_name') }} - @yield('style') - - - -
- -
- -
- - @yield('content') - - - - -
- - - @include('common.dependencies.script') - - @yield('script') - - diff --git a/resources/views/skinlib/show.blade.php b/resources/views/skinlib/show.blade.php deleted file mode 100644 index 2085dd62..00000000 --- a/resources/views/skinlib/show.blade.php +++ /dev/null @@ -1,50 +0,0 @@ -@extends('skinlib.master') - -@section('title', $texture->name) - -@section('content') - -
-
- -
-

- @lang('skinlib.show.title') -

-
- - -
-
- - @if (option('comment_script')) -
-
-
-
-

@lang('skinlib.show.comment')

-
-
- {!! get_string_replaced(option('comment_script'), [ - '{tid}' => $texture->tid, - '{name}' => $texture->name, - '{url}' => request()->url() - ]) !!} -
-
-
-
- @endif - -
-
-
- - - -@endsection diff --git a/resources/views/skinlib/show.twig b/resources/views/skinlib/show.twig new file mode 100644 index 00000000..9d4ca7e2 --- /dev/null +++ b/resources/views/skinlib/show.twig @@ -0,0 +1,41 @@ +{% extends 'skinlib.base' %} + +{% block title %}{{ texture.name }}{% endblock %} + +{% block content %} +
+
+
+

{{ trans('skinlib.show.title') }}

+
+ +
+
+ + {% if comment_script %} +
+
+
+
+

{{ trans('skinlib.show.comment') }}

+
+
+ {{ comment_script|raw }} +
+
+
+
+ {% endif %} +
+
+
+{% endblock %} + +{% block before_foot %} + +{% endblock %} diff --git a/resources/views/skinlib/upload.blade.php b/resources/views/skinlib/upload.blade.php deleted file mode 100644 index c43510a4..00000000 --- a/resources/views/skinlib/upload.blade.php +++ /dev/null @@ -1,24 +0,0 @@ -@extends('skinlib.master') - -@section('title', trans('skinlib.upload.title')) - -@section('content') - -
-
- -
-

- @lang('skinlib.upload.title') -

-
- - -
-
-
- - -@endsection diff --git a/resources/views/skinlib/upload.twig b/resources/views/skinlib/upload.twig new file mode 100644 index 00000000..c92d10d7 --- /dev/null +++ b/resources/views/skinlib/upload.twig @@ -0,0 +1,20 @@ +{% extends 'skinlib.base' %} + +{% block title %}{{ trans('skinlib.upload.title') }}{% endblock %} + +{% block content %} +
+
+
+

{{ block('title') }}

+
+
+
+
+{% endblock %} + +{% block before_foot %} + +{% endblock %} diff --git a/resources/views/user/base.twig b/resources/views/user/base.twig index cef5cdf8..0924b000 100644 --- a/resources/views/user/base.twig +++ b/resources/views/user/base.twig @@ -17,7 +17,9 @@ {% block content %}{% endblock %} - {{ include('shared.footer') }} + {% block before_foot %}{% endblock %} {{ include('shared.foot') }} diff --git a/resources/views/user/bind.blade.php b/resources/views/user/bind.blade.php deleted file mode 100644 index b8211bff..00000000 --- a/resources/views/user/bind.blade.php +++ /dev/null @@ -1,16 +0,0 @@ -@extends('auth.master') - -@section('title', trans('user.player.bind.title')) - -@section('content') -
- - -
- -
-
-
-@endsection diff --git a/resources/views/user/bind.twig b/resources/views/user/bind.twig new file mode 100644 index 00000000..15679e1c --- /dev/null +++ b/resources/views/user/bind.twig @@ -0,0 +1,8 @@ +{% extends 'auth.base' %} + +{% block title %}{{ trans('user.player.bind.title') }}{% endblock %} + +{% block content %} +

{{ trans('user.player.bind.title') }}

+
+{% endblock %} diff --git a/resources/views/user/master.blade.php b/resources/views/user/master.blade.php index 7c3fd0b8..e6daf372 100644 --- a/resources/views/user/master.blade.php +++ b/resources/views/user/master.blade.php @@ -11,7 +11,9 @@ @include('shared.header') @include('shared.sidebar', ['scope' => 'user']) @yield('content') - @include('shared.footer') + @include('shared.foot') diff --git a/resources/views/vendor/passport/authorize.blade.php b/resources/views/vendor/passport/authorize.blade.php deleted file mode 100644 index 4c8350f4..00000000 --- a/resources/views/vendor/passport/authorize.blade.php +++ /dev/null @@ -1,39 +0,0 @@ -@extends('auth.master') - -@section('title', trans('auth.oauth.authorization.title')) - -@section('content') -
- - -
- - -
-
-
- @csrf - - - -
-
-
-
- @csrf - @method('DELETE') - - - -
-
-
-
-
-@endsection diff --git a/resources/views/vendor/passport/authorize.twig b/resources/views/vendor/passport/authorize.twig new file mode 100644 index 00000000..6ff8e096 --- /dev/null +++ b/resources/views/vendor/passport/authorize.twig @@ -0,0 +1,33 @@ +{% extends 'auth.base' %} + +{% block title %}{{ trans('auth.oauth.authorization.title') }}{% endblock %} + +{% block content %} +

+ {{ trans('auth.oauth.authorization.introduction', {name: client.name}) }} +

+
+
+
+ {{ csrf_field() }} + + + +
+
+ +
+
+ {{ csrf_field() }} + {{ method_field('DELETE') }} + + + +
+
+
+{% endblock %} diff --git a/routes/web.php b/routes/web.php index 4d4e1735..64092e2d 100644 --- a/routes/web.php +++ b/routes/web.php @@ -23,7 +23,7 @@ Route::get('/locale/{lang}', 'HomeController@locale'); */ Route::group(['prefix' => 'auth'], function () { Route::group(['middleware' => 'guest'], function () { - Route::view('/login', 'auth.login'); + Route::get('/login', 'AuthController@login'); Route::get('/register', 'AuthController@register'); Route::get('/forgot', 'AuthController@forgot'); Route::get('/reset/{uid}', 'AuthController@reset')->name('auth.reset')->middleware('signed'); @@ -92,7 +92,7 @@ Route::group([ * Skin Library */ Route::group(['prefix' => 'skinlib'], function () { - Route::get('', 'SkinlibController@index'); + Route::view('', 'skinlib.index'); Route::any('/info/{tid}', 'SkinlibController@info'); Route::any('/show/{tid}', 'SkinlibController@show'); Route::any('/data', 'SkinlibController@getSkinlibFiltered'); diff --git a/tests/HttpTest/ControllersTest/AuthControllerTest.php b/tests/HttpTest/ControllersTest/AuthControllerTest.php index b6e42382..d2e26dad 100644 --- a/tests/HttpTest/ControllersTest/AuthControllerTest.php +++ b/tests/HttpTest/ControllersTest/AuthControllerTest.php @@ -36,6 +36,9 @@ class AuthControllerTest extends TestCase public function testLogin() { $this->get('/auth/login')->assertSee('Log in'); + + option(['recaptcha_sitekey' => 'key']); + $this->get('/auth/login')->assertSee('recaptcha.net'); } public function testHandleLogin() diff --git a/tests/HttpTest/ControllersTest/HomeControllerTest.php b/tests/HttpTest/ControllersTest/HomeControllerTest.php index 3006fcee..41546b73 100644 --- a/tests/HttpTest/ControllersTest/HomeControllerTest.php +++ b/tests/HttpTest/ControllersTest/HomeControllerTest.php @@ -48,7 +48,7 @@ class HomeControllerTest extends TestCase $this->get('/api')->assertJson([ 'blessing_skin' => config('app.version'), 'spec' => 0, - 'copyright' => bs_copyright(), + 'copyright' => 'Powered with ❤ by Blessing Skin Server.', 'site_name' => option('site_name'), ]); } diff --git a/tests/HttpTest/ControllersTest/PluginControllerTest.php b/tests/HttpTest/ControllersTest/PluginControllerTest.php index 34ccafcb..ed15c015 100644 --- a/tests/HttpTest/ControllersTest/PluginControllerTest.php +++ b/tests/HttpTest/ControllersTest/PluginControllerTest.php @@ -44,7 +44,7 @@ class PluginControllerTest extends TestCase ->once() ->andReturn(new Plugin('', [])); - $plugin = new Plugin(resource_path(''), ['config' => 'common/favicon.blade.php']); + $plugin = new Plugin(resource_path(''), ['config' => 'shared/head.twig']); $plugin->setEnabled(true); $mock->shouldReceive('get') ->with('fake4') diff --git a/tests/HttpTest/ControllersTest/SkinlibControllerTest.php b/tests/HttpTest/ControllersTest/SkinlibControllerTest.php index d21be01d..d39b7dd8 100644 --- a/tests/HttpTest/ControllersTest/SkinlibControllerTest.php +++ b/tests/HttpTest/ControllersTest/SkinlibControllerTest.php @@ -14,11 +14,6 @@ class SkinlibControllerTest extends TestCase { use DatabaseTransactions; - public function testIndex() - { - $this->get('/skinlib')->assertViewHas('user'); - } - public function testGetSkinlibFiltered() { $this->getJson('/skinlib/data') @@ -290,10 +285,7 @@ class SkinlibControllerTest extends TestCase // Show a texture $texture = factory(Texture::class)->create(); Storage::disk('textures')->put($texture->hash, ''); - $this->get('/skinlib/show/'.$texture->tid) - ->assertViewHas('texture') - ->assertViewHas('with_out_filter', true) - ->assertViewHas('user'); + $this->get('/skinlib/show/'.$texture->tid)->assertViewHas('texture'); // Guest should not see private texture $uploader = factory(User::class)->create(); @@ -349,10 +341,7 @@ class SkinlibControllerTest extends TestCase public function testUpload() { - $this->actAs('normal') - ->get('/skinlib/upload') - ->assertViewHas('user') - ->assertViewHas('with_out_filter', true); + $this->actAs('normal')->get('/skinlib/upload'); option(['texture_name_regexp' => 'abc']); $this->get('/skinlib/upload')->assertViewHas('extra'); diff --git a/tests/HttpTest/MiddlewareTest/RedirectToSetupTest.php b/tests/HttpTest/MiddlewareTest/RedirectToSetupTest.php index ddbd5627..7a5baebf 100644 --- a/tests/HttpTest/MiddlewareTest/RedirectToSetupTest.php +++ b/tests/HttpTest/MiddlewareTest/RedirectToSetupTest.php @@ -29,7 +29,7 @@ class RedirectToSetupTest extends TestCase ->with(base_path('.env')) ->andReturn(true); }); - $this->get('/')->assertViewIs('index'); + $this->get('/')->assertViewIs('home'); $this->get('/setup')->assertViewIs('setup.wizard.welcome'); $this->get('/')->assertRedirect('/setup'); }