Blade -> Twig (almost finished)

This commit is contained in:
Pig Fang 2019-09-19 22:13:25 +08:00
parent 84f760d930
commit 82140b6893
46 changed files with 483 additions and 437 deletions

View File

@ -36,7 +36,14 @@ class SetupController extends Controller
return redirect('setup/info');
} catch (\Exception $e) {
return view('setup.wizard.database');
return view('setup.wizard.database', [
'host' => env('DB_HOST'),
'port' => env('DB_PORT'),
'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD'),
'database' => env('DB_DATABASE'),
'prefix' => env('DB_PREFIX'),
]);
}
}
@ -155,8 +162,7 @@ class SetupController extends Controller
$filesystem->put(storage_path('install.lock'), '');
return view('setup.wizard.finish')->with([
'email' => $request->input('email'),
'password' => $request->input('password'),
'email' => $request->input('email'),
]);
}

View File

@ -3,12 +3,13 @@
namespace App\Providers;
use View;
use App\Services\Webpack;
use App\Http\View\Composers;
use Illuminate\Support\ServiceProvider;
class ViewServiceProvider extends ServiceProvider
{
public function boot()
public function boot(Webpack $webpack)
{
View::composer(['home', '*.base', 'shared.header'], function ($view) {
$view->with([
@ -59,5 +60,16 @@ class ViewServiceProvider extends ServiceProvider
.'?onload=vueRecaptchaApiLoaded&render=explicit'
);
});
View::composer(['errors.*', 'setup.*'], function ($view) use ($webpack) {
$view->with([
'styles' => [
$webpack->url('setup.css'),
],
'scripts' => [
$webpack->url('language-chooser.js'),
],
]);
});
}
}

View File

@ -0,0 +1,6 @@
const chooser: HTMLInputElement | null = document.querySelector('#language-chooser')
if (chooser) {
chooser.addEventListener('change', () => {
window.location.href = `?lang=${chooser.value}`
})
}

View File

@ -66,10 +66,10 @@ wizard:
text: To proceed with the installation, please fill this form with the details of the initial admin account. Don't worry, you can always change these settings later.
admin-email: Admin Email
admin-notice: This is the <b>UNIQUE</b> super admin account who can GIVE or CANCEL other users' admin privilege.
admin-notice: This is the UNIQUE super admin account who can GIVE or CANCEL other users' admin privilege.
nickname: Nickname
password: Password
pwd-notice: <b>Attention:</b> You will need the password to log in. Please keep it at a secure place.
pwd-notice: 'Attention: You will need the password to log in. Please keep it at a secure place.'
confirm-pwd: Confirm password
site-name: Site name
site-name-notice: This will be shown on every page.

View File

@ -65,10 +65,10 @@ wizard:
text: 你需要填写一些基本信息。无需担心填错,这些信息以后可以再次修改。
admin-email: 管理员邮箱
admin-notice: 这是<b>唯一</b>的超级管理员账号,可添加或移除其他管理员。
admin-notice: 这是唯一的超级管理员账号,可添加或移除其他管理员。
nickname: 昵称
password: 密码
pwd-notice: <b>重要:</b>你将需要此密码来登录管理皮肤站,请将其保存在安全的位置。
pwd-notice: 重要:你将需要此密码来登录管理皮肤站,请将其保存在安全的位置。
confirm-pwd: 重复密码
site-name: 站点名称
site-name-notice: 将会显示在首页以及标题栏

View File

@ -1,11 +0,0 @@
@extends('errors.general')
@section('title', '403 Forbidden')
@section('content')
<h1>403 Forbidden
@include('setup.wizard.language')
</h1>
<p>@lang('errors.exception.detail', ['msg' => $exception->getMessage() ?: trans('errors.http.msg-403')])</p>
@endsection

View File

@ -0,0 +1,9 @@
{% extends 'errors.base' %}
{% block title %}403 Forbidden{% endblock %}
{% block message %}
<p>
{{ trans('errors.exception.detail', {msg: exception.message ?: trans('errors.http.msg-403')}) }}
</p>
{% endblock %}

View File

@ -1,11 +0,0 @@
@extends('errors.general')
@section('title', '404 Not Found')
@section('content')
<h1>404 Not Found
@include('setup.wizard.language')
</h1>
<p>@lang('errors.exception.detail', ['msg' => $exception->getMessage() ?: trans('errors.http.msg-404')])</p>
@endsection

View File

@ -0,0 +1,9 @@
{% extends 'errors.base' %}
{% block title %}404 Not Found{% endblock %}
{% block message %}
<p>
{{ trans('errors.exception.detail', {msg: exception.message ?: trans('errors.http.msg-404')}) }}
</p>
{% endblock %}

View File

@ -1,11 +0,0 @@
@extends('errors.general')
@section('title', '500 Internal Server Error')
@section('content')
<h1>500 Internal Server Error
@include('setup.wizard.language')
</h1>
<p>{{ trans('errors.exception.detail', ['msg' => $exception->getMessage() ?: trans('errors.http.msg-500')]) }}</p>
@endsection

View File

@ -0,0 +1,9 @@
{% extends 'errors.base' %}
{% block title %}500 Internal Server Error{% endblock %}
{% block message %}
<p>
{{ trans('errors.exception.detail', {msg: exception.message ?: trans('errors.http.msg-500')}) }}
</p>
{% endblock %}

View File

@ -1,11 +0,0 @@
@extends('errors.general')
@section('title', '503 Service Unavailable')
@section('content')
<h1>Be right back.
@include('setup.wizard.language')
</h1>
<p>@lang('errors.exception.detail', ['msg' => $exception->getMessage() ?: trans('errors.http.msg-503')])</p>
@endsection

View File

@ -0,0 +1,9 @@
{% extends 'errors.base' %}
{% block title %}503 Service Unavailable{% endblock %}
{% block message %}
<p>
{{ trans('errors.exception.detail', {msg: exception.message ?: trans('errors.http.msg-503')}) }}
</p>
{% endblock %}

View File

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex,nofollow">
<title>{% block title %}{% endblock %} - {{ site_name }}</title>
{% for style in styles %}
<link rel="stylesheet" href="{{ style }}">
{% endfor %}
</head>
<body class="container">
<p id="logo">
<a href="{{ url('/') }}" tabindex="-1">{{ site_name }}</a>
</p>
<h1>
{% block subtitle %}{{ block('title') }}{% endblock %}
{{ include('errors.languages') }}
</h1>
{% block message %}{% endblock %}
{% for script in scripts %}
<script src="{{ script }}"></script>
{% endfor %}
</body>
</html>

View File

@ -1,14 +0,0 @@
@extends('errors.general')
@section('title', trans('errors.general.title'))
@section('content')
<h1>@lang('errors.general.title')
@include('setup.wizard.language')
</h1>
<p>{{ $message }}</p>
<p>{!! nl2br(trans('errors.exception.message')) !!}</p>
@endsection

View File

@ -0,0 +1,8 @@
{% extends 'errors.base' %}
{% block title %}{{ trans('errors.general.title') }}{% endblock %}
{% block message %}
<p>{{ message }}</p>
<p>{{ trans('errors.exception.message')|nl2br }}</p>
{% endblock %}

View File

@ -1,27 +0,0 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex,nofollow" />
<title>@yield('title') - {{ option_localized('site_name') }}</title>
<link rel="stylesheet" href="{{ webpack_assets('setup.css') }}">
</head>
<body class="container">
<p id="logo"><a href="https://github.com/bs-community/blessing-skin-server" tabindex="-1">{{ option_localized('site_name') }}</a></p>
@yield('content')
<script>
function refreshWithLangPrefer() {
var e = document.getElementById("language-chooser");
var lang = e.options[e.selectedIndex].value;
window.location = "?lang="+lang;
}
</script>
</body>
</html>

View File

@ -0,0 +1,10 @@
<select id="language-chooser">
{% for code, locale in config('locales') %}
{% if locale.alias is empty %}
<option
value="{{ code }}"
{{ code == app.getLocale() ? 'selected="selected"' }}
>{{ locale.name }}</option>
{% endif %}
{% endfor %}
</select>

View File

@ -1,12 +0,0 @@
@extends('errors.general')
@section('title', trans('errors.general.title'))
@section('content')
<h1>@lang('errors.general.title')
@include('setup.wizard.language')
</h1>
<p>@lang('errors.exception.code', ['code' => $code])</p>
<p>{!! trans('errors.exception.detail', ['msg' => $message]) !!}</p>
@endsection

View File

@ -0,0 +1,8 @@
{% extends 'errors.base' %}
{% block title %}{{ trans('errors.general.title') }}{% endblock %}
{% block message %}
<p>{{ trans('errors.exception.code', {code: code}) }}</p>
<p>{{ trans('errors.exception.detail', {msg: message})|nl2br }}</p>
{% endblock %}

View File

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex,nofollow">
<title>
{% block title %}{{ trans('setup.wizard.master.title') }}{% endblock %}
</title>
{% for style in styles %}
<link rel="stylesheet" href="{{ style }}">
{% endfor %}
</head>
<body class="container">
<p id="logo">
<a href="https://github.com/bs-community/blessing-skin-server" tabindex="-1">
Blessing Skin Server
</a>
</p>
<h1>
{% block subtitle %}{{ block('title') }}{% endblock %}
{{ include('errors.languages') }}
</h1>
{% block content %}{% endblock %}
{% for script in scripts %}
<script src="{{ script }}"></script>
{% endfor %}
</body>
</html>

View File

@ -1,13 +0,0 @@
@extends('setup.master')
@section('content')
<h1>
@lang('setup.locked.title')
@include('setup.wizard.language')
</h1>
<p>@lang('setup.locked.text')</p>
<p class="step">
<a href="{{ url('/') }}" class="button button-large">@lang('setup.locked.button')</a>
</p>
@endsection

View File

@ -0,0 +1,12 @@
{% extends 'setup.base' %}
{% block subtitle %}{{ trans('setup.locked.title') }}{% endblock %}
{% block content %}
<p>{{ trans('setup.locked.text') }}</p>
<p class="step">
<a href="{{ url('/') }}" class="button button-large">
{{ trans('setup.locked.button') }}
</a>
</p>
{% endblock %}

View File

@ -1,30 +0,0 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex,nofollow" />
<title>@lang('setup.wizard.master.title')</title>
<link rel="shortcut icon" href="{{ webpack_assets('favicon.ico') }}">
<link rel="stylesheet" type="text/css" href="{{ webpack_assets('setup.css') }}">
@yield('style')
</head>
<body class="container">
<p id="logo"><a href="https://github.com/bs-community/blessing-skin-server" tabindex="-1">Blessing Skin Server</a></p>
@yield('content')
<script>
function refreshWithLangPrefer() {
var e = document.getElementById("language-chooser");
var lang = e.options[e.selectedIndex].value;
window.location = "?lang="+lang;
}
</script>
@yield('script')
</body>
</html>

View File

@ -1,16 +0,0 @@
@extends('setup.updates.master')
@section('content')
<h1>
@lang('setup.updates.changelog.title')
@include('setup.wizard.language')
</h1>
{!! app('parsedown')->text(
@file_get_contents(resource_path('misc/changelogs/'.app()->getLocale().'/'.config('app.version').'.md'))
) !!}
<p class="step">
<a href="{{ url('/') }}" class="button button-large">@lang('general.index')</a>
</p>
@endsection

View File

@ -1,30 +0,0 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex,nofollow" />
<title>@lang('setup.updates.master.title')</title>
<link rel="shortcut icon" href="{{ webpack_assets('favicon.ico') }}">
<link rel="stylesheet" type="text/css" href="{{ webpack_assets('setup.css') }}">
</head>
<body class="container">
<p id="logo">
<a href="https://github.com/bs-community/blessing-skin-server" tabindex="-1">
{{ option_localized('site_name') }}
</a>
</p>
@yield('content')
<script>
function refreshWithLangPrefer() {
var e = document.getElementById("language-chooser");
var lang = e.options[e.selectedIndex].value;
window.location = "?lang="+lang;
}
</script>
</body>
</html>

View File

@ -1,14 +0,0 @@
@extends('setup.updates.master')
@section('content')
<h1>
@lang('setup.updates.success.title')
@include('setup.wizard.language')
</h1>
<p>@lang('setup.updates.success.text', ['version' => config('app.version')])</p>
<p class="step">
<a href="{{ url('/setup/changelog') }}" class="button button-large">@lang('setup.updates.welcome.button')</a>
</p>
@endsection

View File

@ -0,0 +1,16 @@
{% extends 'setup.base' %}
{% block title %}{{ trans('setup.updates.master.title') }}{% endblock %}
{% block subtitle %}{{ trans('setup.updates.success.title') }}{% endblock %}
{% block content %}
<p>
{{ trans('setup.updates.success.text', {version: config('app.version')}) }}
</p>
<p class="step">
<a href="{{ url('/') }}" class="button button-large">
{{ trans('setup.updates.welcome.button') }}
</a>
</p>
{% endblock %}

View File

@ -1,16 +0,0 @@
@extends('setup.updates.master')
@section('content')
<h1>
@lang('setup.updates.welcome.title')
@include('setup.wizard.language')
</h1>
<p>{!! nl2br(trans('setup.updates.welcome.text', ['version' => config('app.version')])) !!}</p>
<p class="step">
<a href="{{ url('/setup/exec-update') }}" class="button button-large">
@lang('setup.updates.welcome.button')
</a>
</p>
@endsection

View File

@ -0,0 +1,16 @@
{% extends 'setup.base' %}
{% block title %}{{ trans('setup.updates.master.title') }}{% endblock %}
{% block subtitle %}{{ trans('setup.updates.welcome.title') }}{% endblock %}
{% block content %}
<p>
{{ trans('setup.updates.welcome.text', {version: config('app.version')})|nl2br }}
</p>
<p class="step">
<a href="{{ url('/setup/exec-update') }}" class="button button-large">
{{ trans('setup.updates.welcome.button') }}
</a>
</p>
{% endblock %}

View File

@ -1,90 +0,0 @@
@extends('setup.master')
@section('content')
<h1>@lang('setup.wizard.database.title')
@include('setup.wizard.language')
</h1>
<p>@lang('setup.wizard.database.text')</p>
<form id="setup" method="post" action="{{ url('setup/database') }}" novalidate="novalidate">
@csrf
<table class="form-table">
<tr class="form-field form-required">
<th scope="row"><label for="type">@lang('setup.wizard.database.type')</label></th>
<td>
<input name="type" type="radio" value="mysql" id="type-mysql" checked />
<label for="type-mysql">MySQL / MariaDB</label>
<input name="type" type="radio" value="pgsql" id="type-pgsql" />
<label for="type-pgsql">PostgreSQL</label>
<input name="type" type="radio" value="sqlite" id="type-sqlite" />
<label for="type-sqlite">SQLite</label>
</td>
</tr>
<tr class="form-field form-required">
<th scope="row"><label for="host">@lang('setup.wizard.database.host')</label></th>
<td>
<input name="host" type="text" id="host" size="25" value="{{ env('DB_HOST') }}" />
</td>
</tr>
<tr class="form-field form-required">
<th scope="row"><label for="port">@lang('setup.wizard.database.port')</label></th>
<td>
<input name="port" type="text" id="port" size="25" value="{{ env('DB_PORT') }}" />
</td>
</tr>
<tr class="form-field form-required">
<th scope="row"><label for="username">@lang('setup.wizard.database.username')</label></th>
<td>
<input name="username" type="text" id="username" size="25" value="{{ env('DB_USERNAME') }}" />
</td>
</tr>
<tr class="form-field form-required">
<th scope="row"><label for="password">@lang('setup.wizard.database.password')</label></th>
<td>
<input type="password" name="password" id="password" class="regular-text" value="{{ env('DB_PASSWORD') }}" />
</td>
</tr>
<tr class="form-field form-required">
<th scope="row"><label for="db">@lang('setup.wizard.database.db')</label></th>
<td>
<input name="db" type="text" id="db" size="25" value="{{ env('DB_DATABASE') }}" />
<p>@lang('setup.wizard.database.db-notice')</p>
</td>
</tr>
<tr>
<th scope="row"><label for="prefix">@lang('setup.wizard.database.prefix')</label></th>
<td>
<input name="prefix" type="text" id="prefix" size="25" value="{{ env('DB_PREFIX') }}" />
<p>@lang('setup.wizard.database.prefix-notice')</p>
</td>
</tr>
</table>
@if (count($errors) > 0)
<div class="alert alert-warning" role="alert">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<p class="step">
<input type="submit" name="submit" id="submit" class="button button-large" value="@lang('setup.wizard.welcome.button')" />
</p>
</form>
@endsection
@section('script')
<script>
var port = document.getElementById('port')
document.getElementById('type-mysql').onchange = function () {
port.value = 3306
}
document.getElementById('type-pgsql').onchange = function () {
port.value = 5432
}
</script>
@endsection

View File

@ -0,0 +1,136 @@
{% extends 'setup.base' %}
{% block subtitle %}{{ trans('setup.wizard.database.title') }}{% endblock %}
{% block content %}
<p>{{ trans('setup.wizard.database.text') }}</p>
<form
id="setup"
method="post"
action="{{ url('setup/database') }}"
novalidate="novalidate"
>
{{ csrf_field() }}
<table class="form-table">
<tr class="form-field form-required">
<th scope="row">
<label for="type">{{ trans('setup.wizard.database.type') }}</label>
</th>
<td>
<input name="type" type="radio" value="mysql" id="type-mysql" checked>
<label for="type-mysql">MySQL / MariaDB</label>
<input name="type" type="radio" value="pgsql" id="type-pgsql">
<label for="type-pgsql">PostgreSQL</label>
<input name="type" type="radio" value="sqlite" id="type-sqlite">
<label for="type-sqlite">SQLite</label>
</td>
</tr>
<tr class="form-field form-required">
<th scope="row">
<label for="host">{{ trans('setup.wizard.database.host') }}</label>
</th>
<td>
<input
name="host"
type="text"
id="host"
size="25"
value="{{ host }}"
>
</td>
</tr>
<tr class="form-field form-required">
<th scope="row">
<label for="port">{{ trans('setup.wizard.database.port') }}</label>
</th>
<td>
<input
name="port"
type="text"
id="port"
size="25"
value="{{ port }}"
>
</td>
</tr>
<tr class="form-field form-required">
<th scope="row">
<label for="username">{{ trans('setup.wizard.database.username') }}</label>
</th>
<td>
<input
name="username"
type="text"
id="username"
size="25"
value="{{ username }}"
>
</td>
</tr>
<tr class="form-field form-required">
<th scope="row">
<label for="password">{{ trans('setup.wizard.database.password') }}</label>
</th>
<td>
<input
type="password"
name="password"
id="password"
class="regular-text"
value="{{ password }}"
>
</td>
</tr>
<tr class="form-field form-required">
<th scope="row">
<label for="db">{{ trans('setup.wizard.database.db') }}</label>
</th>
<td>
<input
name="db"
type="text"
id="db"
size="25"
value="{{ database }}"
>
<p>{{ trans('setup.wizard.database.db-notice') }}</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="prefix">{{ trans('setup.wizard.database.prefix') }}</label>
</th>
<td>
<input
name="prefix"
type="text"
id="prefix"
size="25"
value="{{ prefix }}"
>
<p>{{ trans('setup.wizard.database.prefix-notice') }}</p>
</td>
</tr>
</table>
{% if errors.any %}
<div class="alert alert-warning" role="alert">
<ul>
{% for error in errors.all %}
<li>{{ error }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
<p class="step">
<input
type="submit"
name="submit"
id="submit"
class="button button-large"
value="{{ trans('setup.wizard.welcome.button') }}"
>
</p>
</form>
{% endblock %}

View File

@ -1,24 +0,0 @@
@extends('setup.master')
@section('content')
<h1>@lang('setup.wizard.finish.title')
@include('setup.wizard.language')
</h1>
<p>@lang('setup.wizard.finish.text')</p>
<table class="form-table install-success">
<tr>
<th>@lang('auth.email')</th>
<td>{{ $email }}</td>
</tr>
<tr>
<th>@lang('auth.password')</th>
<td><p><em>{{ $password }}</em></p></td>
</tr>
</table>
<p class="step">
<a href="../" class="button button-large">@lang('general.index')</a>
</p>
@endsection

View File

@ -0,0 +1,18 @@
{% extends 'setup.base' %}
{% block subtitle %}{{ trans('setup.wizard.finish.title') }}{% endblock %}
{% block content %}
<p>{{ trans('setup.wizard.finish.text') }}</p>
<table class="form-table install-success">
<tr>
<th>{{ trans('auth.email') }}</th>
<td>{{ email }}</td>
</tr>
</table>
<p class="step">
<a href="{{ url('/') }}" class="button button-large">
{{ trans('general.index') }}
</a>
</p>
{% endblock %}

View File

@ -1,71 +0,0 @@
@extends('setup.master')
@section('content')
<h1>@lang('setup.wizard.info.title')
@include('setup.wizard.language')
</h1>
<p>@lang('setup.wizard.info.text')</p>
<form id="setup" method="post" action="{{ url('setup/finish') }}" novalidate="novalidate">
@csrf
<table class="form-table">
<tr>
<th scope="row"><label for="email">@lang('setup.wizard.info.admin-email')</label></th>
<td>
<input name="email" type="email" id="email" size="25" value="" />
<p>{!! trans('setup.wizard.info.admin-notice') !!}</p>
</td>
</tr>
<tr>
<th scope="row"><label for="email">@lang('setup.wizard.info.nickname')</label></th>
<td>
<input name="nickname" type="text" id="nickname" size="25" value="" />
</td>
</tr>
<tr class="form-field form-required">
<th scope="row"><label for="password">@lang('setup.wizard.info.password')</label></th>
<td>
<input type="password" name="password" id="password" class="regular-text" autocomplete="off" />
<p>{!! trans('setup.wizard.info.pwd-notice') !!}</p>
</td>
</tr>
<tr class="form-field form-required">
<th scope="row"><label for="password_confirmation">@lang('setup.wizard.info.confirm-pwd')</label></th>
<td>
<input type="password" name="password_confirmation" id="password_confirmation" autocomplete="off" />
</td>
</tr>
<tr>
<th scope="row"><label for="site_name">@lang('setup.wizard.info.site-name')</label></th>
<td>
<input name="site_name" type="text" id="site_name" size="25" value="{{ config('options.site_name') }}" />
<p>@lang('setup.wizard.info.site-name-notice')</p>
</td>
</tr>
<tr>
<th scope="row"><label for="generate_random">@lang('setup.wizard.info.secure')</label></th>
<td>
<label for="generate_random">
<input name="generate_random" type="checkbox" id="generate_random" size="25" value="on" checked />
@lang('setup.wizard.info.secure-notice')
</label>
</td>
</tr>
</table>
@if (count($errors) > 0)
<div class="alert alert-warning" role="alert">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<p class="step">
<input type="submit" name="submit" id="submit" class="button button-large" value="@lang('setup.wizard.info.button')" />
</p>
</form>
@endsection

View File

@ -0,0 +1,112 @@
{% extends 'setup.base' %}
{% block subtitle %}{{ trans('setup.wizard.info.title') }}{% endblock %}
{% block content %}
<p>{{ trans('setup.wizard.info.text') }}</p>
<form
id="setup"
method="post"
action="{{ url('setup/finish') }}"
novalidate="novalidate"
>
{{ csrf_field() }}
<table class="form-table">
<tr>
<th scope="row">
<label for="email">{{ trans('setup.wizard.info.admin-email') }}</label>
</th>
<td>
<input name="email" type="email" id="email" size="25">
<p>{{ trans('setup.wizard.info.admin-notice') }}</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="email">{{ trans('setup.wizard.info.nickname') }}</label>
</th>
<td>
<input name="nickname" type="text" id="nickname" size="25">
</td>
</tr>
<tr class="form-field form-required">
<th scope="row">
<label for="password">{{ trans('setup.wizard.info.password') }}</label>
</th>
<td>
<input type="password" name="password" id="password" class="regular-text">
<p>{{ trans('setup.wizard.info.pwd-notice') }}</p>
</td>
</tr>
<tr class="form-field form-required">
<th scope="row">
<label for="password_confirmation">
{{ trans('setup.wizard.info.confirm-pwd') }}
</label>
</th>
<td>
<input
type="password"
name="password_confirmation"
id="password_confirmation"
>
</td>
</tr>
<tr>
<th scope="row">
<label for="site_name">
{{ trans('setup.wizard.info.site-name') }}
</label>
</th>
<td>
<input
name="site_name"
type="text"
id="site_name"
size="25"
value="{{ config('options.site_name') }}"
>
<p>{{ trans('setup.wizard.info.site-name-notice') }}</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="generate_random">{{ trans('setup.wizard.info.secure') }}</label>
</th>
<td>
<label for="generate_random">
<input
name="generate_random"
type="checkbox"
id="generate_random"
size="25"
value="on"
checked
>
{{ trans('setup.wizard.info.secure-notice') }}
</label>
</td>
</tr>
</table>
{% if errors.any %}
<div class="alert alert-warning" role="alert">
<ul>
{% for error in errors.all %}
<li>{{ error }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
<p class="step">
<input
type="submit"
name="submit"
id="submit"
class="button button-large"
value="{{ trans('setup.wizard.info.button') }}"
>
</p>
</form>
{% endblock %}

View File

@ -1,7 +0,0 @@
<select id="language-chooser" onchange="refreshWithLangPrefer()">
@foreach(config('locales') as $code => $langInfo)
@if (!isset($langInfo['alias']))
<option value="{{ $code }}" {!! $code == config('app.locale') ? 'selected="selected"' : '' !!}>{{ $langInfo['short_name'] }} - {{ $langInfo['name'] }}</option>
@endif
@endforeach
</select>

View File

@ -1,13 +0,0 @@
@extends('setup.master')
@section('content')
<h1>@lang('setup.wizard.welcome.title')
@include('setup.wizard.language')
</h1>
<p>@lang('setup.wizard.welcome.text', ['version' => config('app.version')])</p>
<p class="step">
<a href="{{ url('setup/database') }}" class="button button-large">@lang('setup.wizard.welcome.button')</a>
</p>
@endsection

View File

@ -0,0 +1,12 @@
{% extends 'setup.base' %}
{% block subtitle %}{{ trans('setup.wizard.welcome.title') }}{% endblock %}
{% block content %}
<p>{{ trans('setup.wizard.welcome.text', {version: config('app.version')}) }}</p>
<p class="step">
<a href="{{ url('setup/database') }}" class="button button-large">
{{ trans('setup.wizard.welcome.button') }}
</a>
</p>
{% endblock %}

View File

@ -179,6 +179,5 @@ Route::group(['prefix' => 'setup'], function () {
Route::group(['middleware' => 'authorize'], function () {
Route::view('/update', 'setup.updates.welcome')->middleware('setup');
Route::any('/exec-update', 'SetupController@update')->middleware('setup');
Route::view('/changelog', 'setup.updates.changelog');
});
});

View File

@ -171,7 +171,7 @@ class AuthControllerTest extends TestCase
$this->get('/auth/register')->assertSee('Register');
option(['user_can_register' => false]);
$this->get('/auth/register')->assertSee(trans('auth.register.close'));
$this->get('/auth/register')->assertSee(e(trans('auth.register.close')));
}
public function testHandleRegister()

View File

@ -62,7 +62,7 @@ class PluginControllerTest extends TestCase
// Plugin is enabled but it doesn't have config view
$this->get('/admin/plugins/config/fake3')
->assertSee(trans('admin.plugins.operations.no-config-notice'))
->assertSee(e(trans('admin.plugins.operations.no-config-notice')))
->assertNotFound();
// Plugin has config view

View File

@ -185,8 +185,7 @@ class SetupControllerTest extends TestCase
'site_name' => 'bs',
'generate_random' => true,
])->assertSee(trans('setup.wizard.finish.title'))
->assertSee('a@b.c')
->assertSee('12345678');
->assertSee('a@b.c');
$superAdmin = \App\Models\User::find(1);
$this->assertEquals('a@b.c', $superAdmin->email);
$this->assertTrue($superAdmin->verifyPassword('12345678'));

View File

@ -158,7 +158,7 @@ class TextureControllerTest extends TestCase
$player = factory(Player::class)->create();
$this->get("/skin/{$player->name}.png")
->assertSee(trans('general.texture-not-uploaded', ['type' => 'skin']));
->assertSee(e(trans('general.texture-not-uploaded', ['type' => 'skin'])));
$player->tid_skin = $skin->tid;
$player->save();

View File

@ -6,7 +6,9 @@ class ForbiddenIETest extends TestCase
{
public function testHandle()
{
$this->get('/', ['user-agent' => 'MSIE'])->assertSee(trans('errors.http.ie'));
$this->get('/', ['user-agent' => 'Trident'])->assertSee(trans('errors.http.ie'));
$this->get('/', ['user-agent' => 'MSIE'])
->assertSee(e(trans('errors.http.ie')));
$this->get('/', ['user-agent' => 'Trident'])
->assertSee(e(trans('errors.http.ie')));
}
}

View File

@ -14,6 +14,7 @@ const config = {
entry: {
index: './resources/assets/src/index.ts',
'check-updates': './resources/assets/src/scripts/check-updates.ts',
'language-chooser': './resources/assets/src/scripts/language-chooser.ts',
style: [
'bootstrap/dist/css/bootstrap.min.css',
'admin-lte/dist/css/alt/AdminLTE-without-plugins.min.css',