mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-01-12 13:44:41 +08:00
Tweak service providers for code readability
This commit is contained in:
parent
3cf5c646c6
commit
93b3a165ab
@ -22,20 +22,8 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
// Replace HTTP_HOST with site url setted in options to prevent CDN source problems
|
||||
if (! option('auto_detect_asset_url')) {
|
||||
$rootUrl = option('site_url');
|
||||
|
||||
if ($this->app['url']->isValidUrl($rootUrl)) {
|
||||
$this->app['url']->forceRootUrl($rootUrl);
|
||||
}
|
||||
}
|
||||
|
||||
if (option('force_ssl') || Utils::isRequestSecure()) {
|
||||
$this->app['url']->forceScheme('https');
|
||||
}
|
||||
|
||||
View::addExtension('tpl', 'blade');
|
||||
// Control the URL generated by url() function
|
||||
$this->configureUrlGenerator();
|
||||
|
||||
Event::listen(Events\RenderingHeader::class, function($event) {
|
||||
// Provide some application information for javascript
|
||||
@ -72,5 +60,32 @@ class AppServiceProvider extends ServiceProvider
|
||||
if ($this->app->environment() !== 'production') {
|
||||
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
|
||||
}
|
||||
|
||||
// Support *.tpl extension name
|
||||
View::addExtension('tpl', 'blade');
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the \Illuminate\Routing\UrlGenerator.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
protected function configureUrlGenerator()
|
||||
{
|
||||
if (! option('auto_detect_asset_url')) {
|
||||
$rootUrl = option('site_url');
|
||||
|
||||
// Replace HTTP_HOST with site_url set in options,
|
||||
// to prevent CDN source problems.
|
||||
if ($this->app['url']->isValidUrl($rootUrl)) {
|
||||
$this->app['url']->forceRootUrl($rootUrl);
|
||||
}
|
||||
}
|
||||
|
||||
if (option('force_ssl') || Utils::isRequestSecure()) {
|
||||
$this->app['url']->forceSchema('https');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +231,6 @@ return [
|
||||
'Option' => App\Services\Facades\Option::class,
|
||||
'Utils' => App\Services\Utils::class,
|
||||
'Minecraft' => App\Services\Minecraft::class,
|
||||
'Updater' => App\Services\Updater::class,
|
||||
],
|
||||
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user