Skip to content

Commit 89caab1

Browse files
committed
Merge branch 'development' into release
2 parents 446b4a7 + 4f18fea commit 89caab1

File tree

156 files changed

+4072
-2513
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+4072
-2513
lines changed

.github/translators.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,3 +530,6 @@ Shadluk Avan (quldosh) :: Uzbek
530530
Marci (MartonPoto) :: Hungarian
531531
Michał Sadurski (wheeskeey) :: Polish
532532
JanDziaslo :: Polish
533+
Charllys Fernandes (CharllysFernandes) :: Portuguese, Brazilian
534+
Ilgiz Zigangirov (inov8) :: Russian
535+
Max Israelsson (Blezie) :: Swedish

app/Access/Oidc/OidcService.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ public function login(): array
4949
$url = $provider->getAuthorizationUrl();
5050
session()->put('oidc_pkce_code', $provider->getPkceCode() ?? '');
5151

52+
$returnUrl = Theme::dispatch(ThemeEvents::OIDC_AUTH_PRE_REDIRECT, $url);
53+
if (is_string($returnUrl)) {
54+
$url = $returnUrl;
55+
}
56+
5257
return [
5358
'url' => $url,
5459
'state' => $provider->getState(),

app/App/Providers/AppServiceProvider.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ public function boot(): void
6565
URL::forceScheme($isHttps ? 'https' : 'http');
6666
}
6767

68+
// Set SMTP mail driver to use a local domain matching the app domain,
69+
// which helps avoid defaulting to a 127.0.0.1 domain
70+
if ($appUrl) {
71+
$hostName = parse_url($appUrl, PHP_URL_HOST) ?: null;
72+
config()->set('mail.mailers.smtp.local_domain', $hostName);
73+
}
74+
6875
// Allow longer string lengths after upgrade to utf8mb4
6976
Schema::defaultStringLength(191);
7077

app/App/Providers/ThemeServiceProvider.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
use BookStack\Theming\ThemeEvents;
66
use BookStack\Theming\ThemeService;
7+
use BookStack\Theming\ThemeViews;
8+
use Illuminate\Support\Facades\Blade;
79
use Illuminate\Support\ServiceProvider;
810

911
class ThemeServiceProvider extends ServiceProvider
@@ -24,7 +26,26 @@ public function boot(): void
2426
{
2527
// Boot up the theme system
2628
$themeService = $this->app->make(ThemeService::class);
29+
$viewFactory = $this->app->make('view');
30+
$themeViews = new ThemeViews($viewFactory->getFinder());
31+
32+
// Use a custom include so that we can insert theme views before/after includes.
33+
// This is done, even if no theme is active, so that view caching does not create problems
34+
// when switching between themes or when switching a theme on/off.
35+
$viewFactory->share('__themeViews', $themeViews);
36+
Blade::directive('include', function ($expression) {
37+
return "<?php echo \$__themeViews->handleViewInclude({$expression}, array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1])); ?>";
38+
});
39+
40+
if (!$themeService->getTheme()) {
41+
return;
42+
}
43+
44+
$themeService->loadModules();
2745
$themeService->readThemeActions();
2846
$themeService->dispatch(ThemeEvents::APP_BOOT, $this->app);
47+
48+
$themeViews->registerViewPathsForTheme($themeService->getModules());
49+
$themeService->dispatch(ThemeEvents::THEME_REGISTER_VIEWS, $themeViews);
2950
}
3051
}

app/App/helpers.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ function setting(?string $key = null, mixed $default = null): mixed
8181

8282
/**
8383
* Get a path to a theme resource.
84-
* Returns null if a theme is not configured and
85-
* therefore a full path is not available for use.
84+
* Returns null if a theme is not configured, and therefore a full path is not available for use.
8685
*/
8786
function theme_path(string $path = ''): ?string
8887
{

app/Config/view.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@
88
* Do not edit this file unless you're happy to maintain any changes yourself.
99
*/
1010

11-
// Join up possible view locations
12-
$viewPaths = [realpath(base_path('resources/views'))];
13-
if ($theme = env('APP_THEME', false)) {
14-
array_unshift($viewPaths, base_path('themes/' . $theme));
15-
}
16-
1711
return [
1812

1913
// App theme
@@ -26,7 +20,7 @@
2620
// Most templating systems load templates from disk. Here you may specify
2721
// an array of paths that should be checked for your views. Of course
2822
// the usual Laravel view path has already been registered for you.
29-
'paths' => $viewPaths,
23+
'paths' => [realpath(base_path('resources/views'))],
3024

3125
// Compiled View Path
3226
// This option determines where all the compiled Blade templates will be

0 commit comments

Comments
 (0)