- 修复内置模板验证问题(builtin-video-material等) - 添加模板验证工具 lib/template-validator.ts - 创建模板系统优化需求文档(30个详细需求) - 优化上传API的模板验证逻辑 - 改进错误提示信息的清晰度 - 添加字段池和分类管理相关需求 - 完善自定义字段的创建、验证、存储逻辑 - 清理过期的 .specstory 和 .trae 文件
115 lines
4.1 KiB
PowerShell
115 lines
4.1 KiB
PowerShell
# Copy install files to S:\flnxi-install
|
||
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||
$TargetDir = "S:\flnxi-install"
|
||
|
||
if (-not (Test-Path $TargetDir)) {
|
||
New-Item -ItemType Directory -Path $TargetDir -Force | Out-Null
|
||
Write-Host "[OK] Created directory: $TargetDir" -ForegroundColor Green
|
||
} else {
|
||
Write-Host "[OK] Directory exists: $TargetDir" -ForegroundColor Green
|
||
}
|
||
|
||
Write-Host ""
|
||
Write-Host "[1/3] Copying files..." -ForegroundColor Blue
|
||
Write-Host ""
|
||
|
||
$files = @(
|
||
@{Source = "scripts\tools\install.sh"; Target = "install.sh"},
|
||
@{Source = "scripts\tools\uninstall.sh"; Target = "uninstall.sh"},
|
||
@{Source = "docker-compose.prod.yml"; Target = "docker-compose.prod.yml"},
|
||
@{Source = "fix-line-endings.sh"; Target = "fix-line-endings.sh"},
|
||
@{Source = "fix-encoding.sh"; Target = "fix-encoding.sh"}
|
||
)
|
||
|
||
$SuccessCount = 0
|
||
$FailCount = 0
|
||
|
||
foreach ($file in $files) {
|
||
$SourcePath = Join-Path $ScriptDir $file.Source
|
||
$TargetPath = Join-Path $TargetDir $file.Target
|
||
|
||
Write-Host " Copying: $($file.Target)"
|
||
Write-Host " From: $SourcePath"
|
||
Write-Host " To: $TargetPath"
|
||
|
||
if (Test-Path $SourcePath) {
|
||
try {
|
||
# 如果是 .sh 文件,需要转换为 Unix 格式(LF 行结束符)并保持 UTF-8 编码
|
||
if ($file.Source -like "*.sh") {
|
||
# 读取文件内容,保持 UTF-8 编码
|
||
$content = [System.IO.File]::ReadAllText($SourcePath, [System.Text.Encoding]::UTF8)
|
||
# 移除所有 CR(\r),只保留 LF(\n)
|
||
$content = $content -replace "`r`n", "`n" -replace "`r", "`n"
|
||
# 使用 UTF-8 无 BOM 编码保存
|
||
$utf8NoBom = New-Object System.Text.UTF8Encoding $false
|
||
[System.IO.File]::WriteAllText($TargetPath, $content, $utf8NoBom)
|
||
Write-Host " [OK] Success (converted to Unix format, UTF-8)" -ForegroundColor Green
|
||
} else {
|
||
# 其他文件直接复制
|
||
Copy-Item -Path $SourcePath -Destination $TargetPath -Force
|
||
Write-Host " [OK] Success" -ForegroundColor Green
|
||
}
|
||
$SuccessCount++
|
||
} catch {
|
||
Write-Host " [FAIL] Error: $($_.Exception.Message)" -ForegroundColor Red
|
||
$FailCount++
|
||
}
|
||
} else {
|
||
Write-Host " [FAIL] Source file not found" -ForegroundColor Red
|
||
$FailCount++
|
||
}
|
||
Write-Host ""
|
||
}
|
||
|
||
Write-Host "[2/3] Copy completed" -ForegroundColor Blue
|
||
Write-Host ""
|
||
Write-Host "========================================" -ForegroundColor Cyan
|
||
Write-Host " Results" -ForegroundColor Cyan
|
||
Write-Host "========================================" -ForegroundColor Cyan
|
||
Write-Host " Success: $SuccessCount files"
|
||
Write-Host " Failed: $FailCount files"
|
||
Write-Host " Target: $TargetDir"
|
||
Write-Host ""
|
||
|
||
if ($FailCount -eq 0) {
|
||
Write-Host "[OK] All files copied successfully" -ForegroundColor Green
|
||
Write-Host ""
|
||
Write-Host "Next steps:" -ForegroundColor Yellow
|
||
Write-Host " 1. Transfer files from $TargetDir to FeiNiu NAS"
|
||
Write-Host " 2. SSH to NAS"
|
||
Write-Host " 3. Run: bash install.sh"
|
||
Write-Host " 4. To uninstall: bash uninstall.sh"
|
||
Write-Host ""
|
||
} else {
|
||
Write-Host "[FAIL] Some files failed to copy" -ForegroundColor Red
|
||
Write-Host ""
|
||
}
|
||
|
||
Write-Host "[3/3] Verifying files..." -ForegroundColor Blue
|
||
Write-Host ""
|
||
|
||
$AllFilesExist = $true
|
||
foreach ($file in $files) {
|
||
$TargetPath = Join-Path $TargetDir $file.Target
|
||
if (Test-Path $TargetPath) {
|
||
$FileSize = (Get-Item $TargetPath).Length
|
||
$FileSizeKB = [math]::Round($FileSize / 1KB, 2)
|
||
Write-Host " [OK] $($file.Target) - $FileSizeKB KB" -ForegroundColor Green
|
||
} else {
|
||
Write-Host " [FAIL] $($file.Target) not found" -ForegroundColor Red
|
||
$AllFilesExist = $false
|
||
}
|
||
}
|
||
|
||
Write-Host ""
|
||
|
||
if ($AllFilesExist) {
|
||
Write-Host "[OK] All files verified" -ForegroundColor Green
|
||
} else {
|
||
Write-Host "[FAIL] Some files verification failed" -ForegroundColor Red
|
||
}
|
||
|
||
Write-Host ""
|
||
Write-Host "========================================" -ForegroundColor Cyan
|
||
|