mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-03-14 12:23:33 +00:00
This commit is contained in:
parent
c7abc14e26
commit
5eb442d9d6
2 changed files with 22 additions and 18 deletions
|
|
@ -156,7 +156,7 @@ class CheckVersionUpdateJob
|
||||||
|
|
||||||
private function extractLatestVersion(array $response, bool $enablePrereleases): array
|
private function extractLatestVersion(array $response, bool $enablePrereleases): array
|
||||||
{
|
{
|
||||||
if (! $enablePrereleases || ! is_array($response) || ! isset($response[0])) {
|
if (! $enablePrereleases || ! isset($response[0])) {
|
||||||
return [
|
return [
|
||||||
Arr::get($response, 'tag_name'),
|
Arr::get($response, 'tag_name'),
|
||||||
$response,
|
$response,
|
||||||
|
|
|
||||||
|
|
@ -87,24 +87,28 @@ final class DeviceModel extends Model
|
||||||
*/
|
*/
|
||||||
protected function cssVariables(): Attribute
|
protected function cssVariables(): Attribute
|
||||||
{
|
{
|
||||||
return Attribute::get(function (mixed $value, array $attributes): array {
|
/** @var Attribute<array<string, string>, array<string, string>> */
|
||||||
$vars = is_array($value) ? $value : (is_string($value) ? (json_decode($value, true) ?? []) : []);
|
return Attribute::get(
|
||||||
|
/** @return array<string, string> */
|
||||||
|
function (mixed $value, array $attributes): array {
|
||||||
|
$vars = is_array($value) ? $value : (is_string($value) ? (json_decode($value, true) ?? []) : []);
|
||||||
|
|
||||||
if (config('app.puppeteer_window_size_strategy') !== 'v2') {
|
if (config('app.puppeteer_window_size_strategy') !== 'v2') {
|
||||||
|
return $vars;
|
||||||
|
}
|
||||||
|
|
||||||
|
$width = $attributes['width'] ?? null;
|
||||||
|
$height = $attributes['height'] ?? null;
|
||||||
|
|
||||||
|
if (empty($vars['--screen-w']) && $width !== null && $width !== '') {
|
||||||
|
$vars['--screen-w'] = is_numeric($width) ? (int) $width.'px' : (string) $width;
|
||||||
|
}
|
||||||
|
if (empty($vars['--screen-h']) && $height !== null && $height !== '') {
|
||||||
|
$vars['--screen-h'] = is_numeric($height) ? (int) $height.'px' : (string) $height;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var array<string, string> $vars */
|
||||||
return $vars;
|
return $vars;
|
||||||
}
|
});
|
||||||
|
|
||||||
$width = $attributes['width'] ?? null;
|
|
||||||
$height = $attributes['height'] ?? null;
|
|
||||||
|
|
||||||
if (empty($vars['--screen-w']) && $width !== null && $width !== '') {
|
|
||||||
$vars['--screen-w'] = is_numeric($width) ? (int) $width.'px' : (string) $width;
|
|
||||||
}
|
|
||||||
if (empty($vars['--screen-h']) && $height !== null && $height !== '') {
|
|
||||||
$vars['--screen-h'] = is_numeric($height) ? (int) $height.'px' : (string) $height;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $vars;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue