update: theme config

This commit is contained in:
tokumeikoi 2022-05-16 17:31:37 +08:00
parent 1ddc05652d
commit 6d6ab5543a
2 changed files with 4 additions and 2 deletions

View File

@ -78,8 +78,10 @@ class ThemeController extends Controller
{
$payload = $request->validate([
'name' => 'required|in:' . join(',', $this->themes),
'config' => 'required|array'
'config' => 'required'
]);
$payload['config'] = json_decode(base64_decode($payload['config']), true);
if (!$payload['config'] || !is_array($payload['config'])) abort(500, '参数有误');
$themeConfigFile = public_path("theme/{$payload['name']}/config.php");
if (!File::exists($themeConfigFile)) abort(500, '主题不存在');
$themeConfig = include($themeConfigFile);

File diff suppressed because one or more lines are too long