Update Composer packages
This commit is contained in:
parent
df93324906
commit
45bdef9a3b
378 changed files with 28466 additions and 28852 deletions
|
@ -57,6 +57,7 @@ return [
|
|||
},
|
||||
'type' => fn (File $file) => $file->type(),
|
||||
'url' => fn (File $file) => $file->url(),
|
||||
'uuid' => fn (File $file) => $file->uuid()?->toString()
|
||||
],
|
||||
'type' => 'Kirby\Cms\File',
|
||||
'views' => [
|
||||
|
@ -79,7 +80,8 @@ return [
|
|||
'size',
|
||||
'template',
|
||||
'type',
|
||||
'url'
|
||||
'url',
|
||||
'uuid'
|
||||
],
|
||||
'compact' => [
|
||||
'filename',
|
||||
|
@ -87,6 +89,7 @@ return [
|
|||
'link',
|
||||
'type',
|
||||
'url',
|
||||
'uuid'
|
||||
],
|
||||
'panel' => [
|
||||
'blueprint',
|
||||
|
@ -109,7 +112,8 @@ return [
|
|||
'prevWithTemplate' => 'compact',
|
||||
'template',
|
||||
'type',
|
||||
'url'
|
||||
'url',
|
||||
'uuid'
|
||||
]
|
||||
],
|
||||
];
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
|
||||
use Kirby\Cms\Helpers;
|
||||
use Kirby\Cms\Page;
|
||||
use Kirby\Form\Form;
|
||||
|
||||
|
@ -21,54 +20,25 @@ return [
|
|||
'hasFiles' => fn (Page $page) => $page->hasFiles(),
|
||||
'id' => fn (Page $page) => $page->id(),
|
||||
'isSortable' => fn (Page $page) => $page->isSortable(),
|
||||
/**
|
||||
* @deprecated 3.6.0
|
||||
* @todo Remove in 3.8.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
'next' => function (Page $page) {
|
||||
Helpers::deprecated('The API field page.next has been deprecated and will be removed in 3.8.0.');
|
||||
|
||||
return $page
|
||||
->nextAll()
|
||||
->filter('intendedTemplate', $page->intendedTemplate())
|
||||
->filter('status', $page->status())
|
||||
->filter('isReadable', true)
|
||||
->first();
|
||||
},
|
||||
'num' => fn (Page $page) => $page->num(),
|
||||
'options' => fn (Page $page) => $page->panel()->options(['preview']),
|
||||
'panelImage' => fn (Page $page) => $page->panel()->image(),
|
||||
'parent' => fn (Page $page) => $page->parent(),
|
||||
'parents' => fn (Page $page) => $page->parents()->flip(),
|
||||
/**
|
||||
* @deprecated 3.6.0
|
||||
* @todo Remove in 3.8.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
'prev' => function (Page $page) {
|
||||
Helpers::deprecated('The API field page.prev has been deprecated and will be removed in 3.8.0.');
|
||||
|
||||
return $page
|
||||
->prevAll()
|
||||
->filter('intendedTemplate', $page->intendedTemplate())
|
||||
->filter('status', $page->status())
|
||||
->filter('isReadable', true)
|
||||
->last();
|
||||
},
|
||||
'previewUrl' => fn (Page $page) => $page->previewUrl(),
|
||||
'siblings' => function (Page $page) {
|
||||
'num' => fn (Page $page) => $page->num(),
|
||||
'options' => fn (Page $page) => $page->panel()->options(['preview']),
|
||||
'panelImage' => fn (Page $page) => $page->panel()->image(),
|
||||
'parent' => fn (Page $page) => $page->parent(),
|
||||
'parents' => fn (Page $page) => $page->parents()->flip(),
|
||||
'previewUrl' => fn (Page $page) => $page->previewUrl(),
|
||||
'siblings' => function (Page $page) {
|
||||
if ($page->isDraft() === true) {
|
||||
return $page->parentModel()->children()->not($page);
|
||||
} else {
|
||||
return $page->siblings();
|
||||
}
|
||||
|
||||
return $page->siblings();
|
||||
},
|
||||
'slug' => fn (Page $page) => $page->slug(),
|
||||
'status' => fn (Page $page) => $page->status(),
|
||||
'template' => fn (Page $page) => $page->intendedTemplate()->name(),
|
||||
'title' => fn (Page $page) => $page->title()->value(),
|
||||
'url' => fn (Page $page) => $page->url(),
|
||||
'uuid' => fn (Page $page) => $page->uuid()?->toString()
|
||||
],
|
||||
'type' => 'Kirby\Cms\Page',
|
||||
'views' => [
|
||||
|
@ -76,7 +46,8 @@ return [
|
|||
'id',
|
||||
'title',
|
||||
'url',
|
||||
'num'
|
||||
'num',
|
||||
'uuid'
|
||||
],
|
||||
'default' => [
|
||||
'content',
|
||||
|
@ -88,7 +59,8 @@ return [
|
|||
'slug',
|
||||
'template',
|
||||
'title',
|
||||
'url'
|
||||
'url',
|
||||
'uuid'
|
||||
],
|
||||
'panel' => [
|
||||
'id',
|
||||
|
@ -102,7 +74,8 @@ return [
|
|||
'previewUrl',
|
||||
'slug',
|
||||
'title',
|
||||
'url'
|
||||
'url',
|
||||
'uuid'
|
||||
],
|
||||
'selector' => [
|
||||
'id',
|
||||
|
|
|
@ -32,28 +32,20 @@ return [
|
|||
'slugs' => fn () => Str::$language,
|
||||
'title' => fn () => $this->site()->title()->value(),
|
||||
'translation' => function () {
|
||||
if ($user = $this->user()) {
|
||||
$translationCode = $user->language();
|
||||
} else {
|
||||
$translationCode = $this->kirby()->panelLanguage();
|
||||
}
|
||||
$code = $this->user()?->language() ??
|
||||
$this->kirby()->panelLanguage();
|
||||
|
||||
if ($translation = $this->kirby()->translation($translationCode)) {
|
||||
return $translation;
|
||||
} else {
|
||||
return $this->kirby()->translation('en');
|
||||
}
|
||||
return $this->kirby()->translation($code) ??
|
||||
$this->kirby()->translation('en');
|
||||
},
|
||||
'kirbytext' => fn () => $this->kirby()->option('panel.kirbytext') ?? true,
|
||||
'user' => fn () => $this->user(),
|
||||
'version' => function () {
|
||||
$user = $this->user();
|
||||
|
||||
if ($user && $user->role()->permissions()->for('access', 'system') === true) {
|
||||
if ($this->user()?->role()->permissions()->for('access', 'system') === true) {
|
||||
return $this->kirby()->version();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
],
|
||||
'type' => 'Kirby\Cms\System',
|
||||
|
|
|
@ -24,7 +24,8 @@ return [
|
|||
'prev' => fn (User $user) => $user->prev(),
|
||||
'role' => fn (User $user) => $user->role(),
|
||||
'roles' => fn (User $user) => $user->roles(),
|
||||
'username' => fn (User $user) => $user->username()
|
||||
'username' => fn (User $user) => $user->username(),
|
||||
'uuid' => fn (User $user) => $user->uuid()?->toString()
|
||||
],
|
||||
'type' => 'Kirby\Cms\User',
|
||||
'views' => [
|
||||
|
@ -39,7 +40,8 @@ return [
|
|||
'options',
|
||||
'prev' => 'compact',
|
||||
'role',
|
||||
'username'
|
||||
'username',
|
||||
'uuid'
|
||||
],
|
||||
'compact' => [
|
||||
'avatar' => 'compact',
|
||||
|
@ -48,7 +50,8 @@ return [
|
|||
'language',
|
||||
'name',
|
||||
'role' => 'compact',
|
||||
'username'
|
||||
'username',
|
||||
'uuid'
|
||||
],
|
||||
'auth' => [
|
||||
'avatar' => 'compact',
|
||||
|
@ -72,6 +75,7 @@ return [
|
|||
'prev' => ['id', 'name'],
|
||||
'role',
|
||||
'username',
|
||||
'uuid'
|
||||
],
|
||||
]
|
||||
];
|
||||
|
|
|
@ -70,13 +70,11 @@ return [
|
|||
$user = $auth->login($email, $password, $long);
|
||||
}
|
||||
} else {
|
||||
if (isset($methods['code']) === true) {
|
||||
$mode = 'login';
|
||||
} elseif (isset($methods['password-reset']) === true) {
|
||||
$mode = 'password-reset';
|
||||
} else {
|
||||
throw new InvalidArgumentException('Login without password is not enabled');
|
||||
}
|
||||
$mode = match (true) {
|
||||
isset($methods['code']) => 'login',
|
||||
isset($methods['password-reset']) => 'password-reset',
|
||||
default => throw new InvalidArgumentException('Login without password is not enabled')
|
||||
};
|
||||
|
||||
$status = $auth->createChallenge($email, $long, $mode);
|
||||
}
|
||||
|
@ -87,13 +85,13 @@ return [
|
|||
'status' => 'ok',
|
||||
'user' => $this->resolve($user)->view('auth')->toArray()
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'code' => 200,
|
||||
'status' => 'ok',
|
||||
'challenge' => $status->challenge()
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'code' => 200,
|
||||
'status' => 'ok',
|
||||
'challenge' => $status->challenge()
|
||||
];
|
||||
}
|
||||
],
|
||||
[
|
||||
|
@ -105,4 +103,14 @@ return [
|
|||
return true;
|
||||
}
|
||||
],
|
||||
[
|
||||
'pattern' => 'auth/ping',
|
||||
'method' => 'POST',
|
||||
'auth' => false,
|
||||
'action' => function () {
|
||||
// refresh the session timeout
|
||||
$this->kirby()->session();
|
||||
return true;
|
||||
}
|
||||
],
|
||||
];
|
||||
|
|
|
@ -12,9 +12,7 @@ return [
|
|||
'pattern' => $pattern . '/files/(:any)/sections/(:any)',
|
||||
'method' => 'GET',
|
||||
'action' => function (string $path, string $filename, string $sectionName) {
|
||||
if ($section = $this->file($path, $filename)->blueprint()->section($sectionName)) {
|
||||
return $section->toResponse();
|
||||
}
|
||||
return $this->file($path, $filename)->blueprint()->section($sectionName)?->toResponse();
|
||||
}
|
||||
],
|
||||
[
|
||||
|
@ -60,9 +58,9 @@ return [
|
|||
|
||||
if ($this->requestMethod() === 'GET') {
|
||||
return $files->search($this->requestQuery('q'));
|
||||
} else {
|
||||
return $files->query($this->requestBody());
|
||||
}
|
||||
|
||||
return $files->query($this->requestBody());
|
||||
}
|
||||
],
|
||||
[
|
||||
|
@ -86,16 +84,20 @@ return [
|
|||
'pattern' => $pattern . '/files/(:any)',
|
||||
'method' => 'PATCH',
|
||||
'action' => function (string $path, string $filename) {
|
||||
return $this->file($path, $filename)->update($this->requestBody(), $this->language(), true);
|
||||
return $this->file($path, $filename)->update(
|
||||
$this->requestBody(),
|
||||
$this->language(),
|
||||
true
|
||||
);
|
||||
}
|
||||
],
|
||||
[
|
||||
'pattern' => $pattern . '/files/(:any)',
|
||||
'method' => 'POST',
|
||||
'action' => function (string $path, string $filename) {
|
||||
return $this->upload(function ($source) use ($path, $filename) {
|
||||
return $this->file($path, $filename)->replace($source);
|
||||
});
|
||||
return $this->upload(
|
||||
fn ($source) => $this->file($path, $filename)->replace($source)
|
||||
);
|
||||
}
|
||||
],
|
||||
[
|
||||
|
@ -124,9 +126,9 @@ return [
|
|||
|
||||
if ($this->requestMethod() === 'GET') {
|
||||
return $files->search($this->requestQuery('q'));
|
||||
} else {
|
||||
return $files->query($this->requestBody());
|
||||
}
|
||||
|
||||
return $files->query($this->requestBody());
|
||||
}
|
||||
],
|
||||
];
|
||||
|
|
|
@ -29,18 +29,14 @@ return [
|
|||
'pattern' => 'languages/(:any)',
|
||||
'method' => 'PATCH',
|
||||
'action' => function (string $code) {
|
||||
if ($language = $this->kirby()->languages()->find($code)) {
|
||||
return $language->update($this->requestBody());
|
||||
}
|
||||
return $this->kirby()->languages()->find($code)?->update($this->requestBody());
|
||||
}
|
||||
],
|
||||
[
|
||||
'pattern' => 'languages/(:any)',
|
||||
'method' => 'DELETE',
|
||||
'action' => function (string $code) {
|
||||
if ($language = $this->kirby()->languages()->find($code)) {
|
||||
return $language->delete();
|
||||
}
|
||||
return $this->kirby()->languages()->find($code)?->delete();
|
||||
}
|
||||
]
|
||||
];
|
||||
|
|
|
@ -5,40 +5,41 @@
|
|||
* Content Lock Routes
|
||||
*/
|
||||
return [
|
||||
[
|
||||
'pattern' => '(:all)/lock',
|
||||
'method' => 'GET',
|
||||
'action' => function (string $path) {
|
||||
return [
|
||||
'lock' => $this->parent($path)->lock()?->toArray() ?? false
|
||||
];
|
||||
}
|
||||
],
|
||||
[
|
||||
'pattern' => '(:all)/lock',
|
||||
'method' => 'PATCH',
|
||||
'action' => function (string $path) {
|
||||
if ($lock = $this->parent($path)->lock()) {
|
||||
return $lock->create();
|
||||
}
|
||||
return $this->parent($path)->lock()?->create();
|
||||
}
|
||||
],
|
||||
[
|
||||
'pattern' => '(:all)/lock',
|
||||
'method' => 'DELETE',
|
||||
'action' => function (string $path) {
|
||||
if ($lock = $this->parent($path)->lock()) {
|
||||
return $lock->remove();
|
||||
}
|
||||
return $this->parent($path)->lock()?->remove();
|
||||
}
|
||||
],
|
||||
[
|
||||
'pattern' => '(:all)/unlock',
|
||||
'method' => 'PATCH',
|
||||
'action' => function (string $path) {
|
||||
if ($lock = $this->parent($path)->lock()) {
|
||||
return $lock->unlock();
|
||||
}
|
||||
return $this->parent($path)->lock()?->unlock();
|
||||
}
|
||||
],
|
||||
[
|
||||
'pattern' => '(:all)/unlock',
|
||||
'method' => 'DELETE',
|
||||
'action' => function (string $path) {
|
||||
if ($lock = $this->parent($path)->lock()) {
|
||||
return $lock->resolve();
|
||||
}
|
||||
return $this->parent($path)->lock()?->resolve();
|
||||
}
|
||||
],
|
||||
];
|
||||
|
|
|
@ -104,9 +104,7 @@ return [
|
|||
'pattern' => 'pages/(:any)/sections/(:any)',
|
||||
'method' => 'GET',
|
||||
'action' => function (string $id, string $sectionName) {
|
||||
if ($section = $this->page($id)->blueprint()->section($sectionName)) {
|
||||
return $section->toResponse();
|
||||
}
|
||||
return $this->page($id)->blueprint()->section($sectionName)?->toResponse();
|
||||
}
|
||||
],
|
||||
[
|
||||
|
|
|
@ -10,14 +10,11 @@ return [
|
|||
'action' => function () {
|
||||
$kirby = $this->kirby();
|
||||
|
||||
switch ($kirby->request()->get('canBe')) {
|
||||
case 'changed':
|
||||
return $kirby->roles()->canBeChanged();
|
||||
case 'created':
|
||||
return $kirby->roles()->canBeCreated();
|
||||
default:
|
||||
return $kirby->roles();
|
||||
}
|
||||
return match ($kirby->request()->get('canBe')) {
|
||||
'changed' => $kirby->roles()->canBeChanged(),
|
||||
'created' => $kirby->roles()->canBeCreated(),
|
||||
default => $kirby->roles()
|
||||
};
|
||||
}
|
||||
],
|
||||
[
|
||||
|
|
|
@ -79,18 +79,16 @@ return [
|
|||
|
||||
if ($this->requestMethod() === 'GET') {
|
||||
return $pages->search($this->requestQuery('q'));
|
||||
} else {
|
||||
return $pages->query($this->requestBody());
|
||||
}
|
||||
|
||||
return $pages->query($this->requestBody());
|
||||
}
|
||||
],
|
||||
[
|
||||
'pattern' => 'site/sections/(:any)',
|
||||
'method' => 'GET',
|
||||
'action' => function (string $sectionName) {
|
||||
if ($section = $this->site()->blueprint()->section($sectionName)) {
|
||||
return $section->toResponse();
|
||||
}
|
||||
return $this->site()->blueprint()->section($sectionName)?->toResponse();
|
||||
}
|
||||
],
|
||||
[
|
||||
|
|
|
@ -17,19 +17,18 @@ return [
|
|||
|
||||
if ($this->kirby()->user()) {
|
||||
return $system;
|
||||
} else {
|
||||
if ($system->isOk() === true) {
|
||||
$info = $this->resolve($system)->view('login')->toArray();
|
||||
} else {
|
||||
$info = $this->resolve($system)->view('troubleshooting')->toArray();
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'ok',
|
||||
'data' => $info,
|
||||
'type' => 'model'
|
||||
];
|
||||
}
|
||||
|
||||
$info = match ($system->isOk()) {
|
||||
true => $this->resolve($system)->view('login')->toArray(),
|
||||
false => $this->resolve($system)->view('troubleshooting')->toArray()
|
||||
};
|
||||
|
||||
return [
|
||||
'status' => 'ok',
|
||||
'data' => $info,
|
||||
'type' => 'model'
|
||||
];
|
||||
}
|
||||
],
|
||||
[
|
||||
|
|
|
@ -26,9 +26,9 @@ return [
|
|||
'action' => function () {
|
||||
if ($this->requestMethod() === 'GET') {
|
||||
return $this->users()->search($this->requestQuery('q'));
|
||||
} else {
|
||||
return $this->users()->query($this->requestBody());
|
||||
}
|
||||
|
||||
return $this->users()->query($this->requestBody());
|
||||
}
|
||||
],
|
||||
[
|
||||
|
@ -79,17 +79,16 @@ return [
|
|||
],
|
||||
'method' => 'POST',
|
||||
'action' => function (string $id) {
|
||||
if ($avatar = $this->user($id)->avatar()) {
|
||||
$avatar->delete();
|
||||
}
|
||||
$this->user($id)->avatar()?->delete();
|
||||
|
||||
return $this->upload(function ($source, $filename) use ($id) {
|
||||
return $this->user($id)->createFile([
|
||||
return $this->upload(
|
||||
fn ($source, $filename) => $this->user($id)->createFile([
|
||||
'filename' => 'profile.' . F::extension($filename),
|
||||
'template' => 'avatar',
|
||||
'source' => $source
|
||||
]);
|
||||
}, $single = true);
|
||||
]),
|
||||
single: true
|
||||
);
|
||||
}
|
||||
],
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue