update Kirby

This commit is contained in:
isUnknown 2025-04-22 16:01:57 +02:00
parent ecd997c895
commit 1b05e91943
47 changed files with 963 additions and 307 deletions

View file

@ -1214,8 +1214,10 @@ class App
* @internal
* @throws \Kirby\Exception\NotFoundException if the home page cannot be found
*/
public function resolve(string|null $path = null, string|null $language = null): mixed
{
public function resolve(
string|null $path = null,
string|null $language = null
): mixed {
// set the current translation
$this->setCurrentTranslation($language);
@ -1263,6 +1265,12 @@ class App
// only try to return a representation
// when the page has been found
if ($page) {
// if extension is the default content type,
// redirect to page URL without extension
if ($extension === 'html') {
return Response::redirect($page->url(), 301);
}
try {
$response = $this->response();
$output = $page->render([], $extension);
@ -1407,7 +1415,7 @@ class App
public function sessionHandler(): AutoSession
{
return $this->sessionHandler ??= new AutoSession(
$this->root('sessions'),
($this->component('session::store'))($this),
$this->option('session', [])
);
}

View file

@ -584,7 +584,7 @@ class File extends ModelWithContent
*/
public function template(): string|null
{
return $this->template ??= $this->content()->get('template')->value();
return $this->template ??= $this->content('default')->get('template')->value();
}
/**

View file

@ -137,7 +137,10 @@ trait FileActions
$template = null;
}
$file = $file->update(['template' => $template]);
$file = $file->update(
['template' => $template],
'default'
);
// resize the file if configured by new blueprint
$create = $file->blueprint()->create();

View file

@ -82,7 +82,7 @@ class System
case 'git':
return $url . '/config';
case 'kirby':
return $url . '/composer.json';
return $url . '/LICENSE.md';
case 'site':
$root = $this->app->root('site');
$files = glob($root . '/blueprints/*.yml');

View file

@ -96,6 +96,9 @@ trait UserActions
/**
* Changes the user password
*
* If this method is used with user input, it is recommended to also
* confirm the current password by the user via `::validatePassword()`
*/
public function changePassword(
#[SensitiveParameter]

View file

@ -287,7 +287,7 @@ class Response
}
// send the content type header
header('Content-Type:' . $this->type() . '; charset=' . $this->charset());
header('Content-Type: ' . $this->type() . '; charset=' . $this->charset());
// print the response body
return $this->body();

View file

@ -214,7 +214,7 @@ class Assets
$js = [
'vue' => [
'nonce' => $this->nonce,
'src' => $this->url . '/js/vue.min.js'
'src' => $this->vue(),
],
'vendor' => [
'nonce' => $this->nonce,
@ -252,7 +252,7 @@ class Assets
// development version of Vue
$js['vendor']['src'] = null;
$js['index']['src'] = $this->url . '/src/index.js';
$js['vue']['src'] = $this->url . '/node_modules/vue/dist/vue.js';
$js['vue']['src'] = $this->vue(production: false);
// add vite dev client
$js['vite'] = [
@ -321,4 +321,19 @@ class Assets
'query' => null
])->toString(), '/');
}
/**
* Get the correct Vue script URL depending on dev mode
* and the enabled/disabled template compiler
*/
public function vue(bool $production = true): string
{
$script = $this->kirby->option('panel.vue.compiler', true) === true ? 'vue' : 'vue.runtime';
if ($production === false) {
return $this->url . '/node_modules/vue/dist/' . $script . '.js';
}
return $this->url . '/js/' . $script . '.min.js';
}
}