mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-01-22 10:38:14 -05:00
fix: feat: add theme public files initialization check
Some checks are pending
Docker Build and Publish / build (push) Waiting to run
Some checks are pending
Docker Build and Publish / build (push) Waiting to run
This commit is contained in:
parent
5de466fc3e
commit
635943e742
@ -271,7 +271,7 @@ class ThemeService
|
||||
/**
|
||||
* 获取主题路径
|
||||
*/
|
||||
private function getThemePath(string $theme): ?string
|
||||
public function getThemePath(string $theme): ?string
|
||||
{
|
||||
$systemPath = base_path(self::SYSTEM_THEME_DIR . $theme);
|
||||
if (File::exists($systemPath)) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
use App\Services\ThemeService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -42,6 +43,16 @@ Route::get('/', function (Request $request) {
|
||||
throw new Exception('主题视图文件不存在');
|
||||
}
|
||||
|
||||
// 检查主题是否已复制到public目录
|
||||
$publicThemePath = public_path('theme/' . $theme);
|
||||
if (!File::exists($publicThemePath)) {
|
||||
$themePath = $themeService->getThemePath($theme);
|
||||
if (!$themePath || !File::copyDirectory($themePath, $publicThemePath)) {
|
||||
throw new Exception('主题初始化失败');
|
||||
}
|
||||
Log::info('Theme initialized in public directory', ['theme' => $theme]);
|
||||
}
|
||||
|
||||
$renderParams = [
|
||||
'title' => admin_setting('app_name', 'Xboard'),
|
||||
'theme' => $theme,
|
||||
|
Loading…
Reference in New Issue
Block a user