mirror of
https://github.com/typemill/typemill.git
synced 2025-08-04 21:27:41 +02:00
Replace settings instead of merge to remove old settings and key, move image standard size to imageApi and activate individual image settings
This commit is contained in:
2
cache/timer.yaml
vendored
2
cache/timer.yaml
vendored
@@ -1,2 +1,2 @@
|
||||
licenseupdate: 1751827655
|
||||
refreshnavi: 1752319250
|
||||
refreshnavi: 1752352809
|
||||
|
@@ -340,7 +340,9 @@ class ControllerApiImage extends Controller
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
if(!$media->storeRenditionsToTmp($this->settings['images']))
|
||||
$desiredSizes = $this->getDesiredSizes();
|
||||
|
||||
if(!$media->storeRenditionsToTmp($desiredSizes))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => $media->errors[0],
|
||||
@@ -509,7 +511,7 @@ class ControllerApiImage extends Controller
|
||||
}
|
||||
|
||||
# set to youtube size
|
||||
$sizes = $this->settings['images'];
|
||||
$sizes = $this->getDesiredSizes();
|
||||
$sizes['live'] = ['width' => 560, 'height' => 315];
|
||||
|
||||
if(!$media->storeRenditionsToTmp($sizes))
|
||||
@@ -574,4 +576,29 @@ class ControllerApiImage extends Controller
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
private function getDesiredSizes()
|
||||
{
|
||||
$desiredSizes = [
|
||||
'live' => [
|
||||
'width' => 820,
|
||||
],
|
||||
'thumbs' => [
|
||||
'width' => 250,
|
||||
'height' => 150,
|
||||
],
|
||||
];
|
||||
if(isset($this->settings['liveimagewidth']) && is_int($this->settings['liveimagewidth']) && $this->settings['liveimagewidth'] > 10)
|
||||
{
|
||||
$desiredSizes['live']['width'] = $this->settings['liveimagewidth'];
|
||||
}
|
||||
if(isset($this->settings['liveimageheight']) && is_int($this->settings['liveimageheight']) && $this->settings['liveimageheight'] > 10)
|
||||
{
|
||||
$desiredSizes['live']['height'] = $this->settings['liveimageheight'];
|
||||
}
|
||||
|
||||
# we could check for theme settings here
|
||||
|
||||
return $desiredSizes;
|
||||
}
|
||||
}
|
||||
|
@@ -179,9 +179,23 @@ class Settings
|
||||
$userSettings[$key1] = $newSettings;
|
||||
$settings = $userSettings;
|
||||
}
|
||||
# only merge
|
||||
# replace system settings
|
||||
else
|
||||
{
|
||||
# keep old plugin and theme settings unless explicitly replaced
|
||||
$plugins = $newSettings['plugins'] ?? ($userSettings['plugins'] ?? []);
|
||||
$themes = $newSettings['themes'] ?? ($userSettings['themes'] ?? []);
|
||||
|
||||
# remove them from $newSettings to avoid overwriting twice
|
||||
unset($newSettings['plugins'], $newSettings['themes']);
|
||||
|
||||
# final combined settings
|
||||
$settings = array_merge($newSettings, [
|
||||
'plugins' => $plugins,
|
||||
'themes' => $themes,
|
||||
]);
|
||||
|
||||
/*
|
||||
# merge usersettings with new settings
|
||||
$settings = array_merge($userSettings, $newSettings);
|
||||
|
||||
@@ -203,6 +217,7 @@ class Settings
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if($this->storage->updateYaml('settingsFolder', '', 'settings.yaml', $settings))
|
||||
|
@@ -346,7 +346,7 @@ fieldsetai:
|
||||
description: "Select the AI model you want to use. Pricing may vary over time, so please check the latest details on [OpenAI's pricing page](https://platform.openai.com/docs/pricing)"
|
||||
options:
|
||||
gpt-4.1-nano: 'gpt-4.1-nano ($0.10 / $0.40)'
|
||||
gpt-4.1-mini: 'gpt-4.1-mini ($0.30 / $1.20)'
|
||||
gpt-4.1-mini: 'gpt-4.1-mini ($0.40 / $1.60)'
|
||||
gpt-4.1: 'gpt-4.1 ($2.00 / $8.00)'
|
||||
gpt-4o-mini: 'gpt-4o-mini ($0.15 / $0.6)'
|
||||
gpt-4o: 'gpt-4o ($2.50 / $10)'
|
||||
|
Reference in New Issue
Block a user