Text to vertical video in 100+ styles: AI codes each scene (HTML/SVG/WebGL), renders a 9:16 MP4 with music and English/Vietnamese voice. MCP, CLI and REST for AI agents.
# Launcher LumReels (start.cmd gọi file này, cửa sổ ẩn):
# server đã chạy ở cổng 4400 → mở trình duyệt luôn;
# chưa chạy → bật `node server/server.mjs` ẩn cửa sổ, đợi cổng 4400 (tối đa 90 giây), rồi mở trình duyệt.
# Log server: %LOCALAPPDATA%\LumReels\server.log (+ server.err.log). Lỗi → hộp thông báo kèm đường dẫn log.
# File này phải lưu UTF-8 có BOM (Windows PowerShell 5.1 mới đọc đúng chữ có dấu).
param([string]$AppDir = '', [int]$Port = 4400, [switch]$NoBrowser)
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
$BaseDir = Join-Path $env:LOCALAPPDATA 'LumReels'
New-Item -ItemType Directory -Force -Path $BaseDir | Out-Null
$Url = "http://127.0.0.1:$Port/"
function Show-Error([string]$msg) {
try { (New-Object -ComObject WScript.Shell).Popup($msg, 0, 'LumReels', 16) | Out-Null } catch { Write-Host $msg }
}
function Test-LumReels {
try {
$r = Invoke-WebRequest -Uri ($Url + 'api/version') -UseBasicParsing -TimeoutSec 2
return ($r.StatusCode -eq 200 -and $r.Content -match '"version"')
} catch { return $false }
}
function Test-PortBusy {
$c = New-Object System.Net.Sockets.TcpClient
try { $iar = $c.BeginConnect('127.0.0.1', $Port, $null, $null); $ok = $iar.AsyncWaitHandle.WaitOne(400); if ($ok) { $c.EndConnect($iar) }; return $ok -and $c.Connected }
catch { return $false } finally { $c.Close() }
}
if (-not $AppDir) {
$here = Resolve-Path (Join-Path $PSScriptRoot '..\..') -ErrorAction SilentlyContinue
if ($here -and (Test-Path -LiteralPath (Join-Path $here 'server\server.mjs'))) { $AppDir = $here.Path }
else { $AppDir = Join-Path $BaseDir 'app' }
}
if (-not (Test-Path -LiteralPath (Join-Path $AppDir 'server\server.mjs'))) {
Show-Error "Không thấy LumReels ở $AppDir.`nChạy lại bộ cài LumReels-Setup.cmd."
exit 1
}
if (-not (Test-LumReels)) {
if (Test-PortBusy) {
Show-Error "Cổng $Port đang bị chương trình khác dùng, LumReels không bật được.`nTắt chương trình đó, hoặc khởi động lại máy rồi mở lại LumReels."
exit 1
}
$machine = [Environment]::GetEnvironmentVariable('Path', 'Machine')
$user = [Environment]::GetEnvironmentVariable('Path', 'User')
$env:Path = (@($machine, $user, (Join-Path $env:LOCALAPPDATA 'Microsoft\WinGet\Links')) | Where-Object { $_ }) -join ';'
$node = Get-Command node -ErrorAction SilentlyContinue | Select-Object -First 1
if (-not $node) { Show-Error "Máy chưa có Node.js.`nChạy lại bộ cài LumReels-Setup.cmd."; exit 1 }
$env:PORT = "$Port"
$log = Join-Path $BaseDir 'server.log'
$err = Join-Path $BaseDir 'server.err.log'
$proc = Start-Process -FilePath $node.Source -ArgumentList 'server/server.mjs' -WorkingDirectory $AppDir -WindowStyle Hidden `
-RedirectStandardOutput $log -RedirectStandardError $err -PassThru
Set-Content -LiteralPath (Join-Path $BaseDir 'server.pid') -Value $proc.Id -Encoding ASCII
$deadline = (Get-Date).AddSeconds(90)
while (-not (Test-LumReels)) {
if ((Get-Date) -gt $deadline) {
try { Stop-Process -Id $proc.Id -Force } catch { }
Remove-Item -LiteralPath (Join-Path $BaseDir 'server.pid') -ErrorAction SilentlyContinue
Show-Error "LumReels chưa bật được sau 90 giây.`nXem lỗi trong:`n$err"
exit 1
}
Start-Sleep -Milliseconds 500
}
}
if (-not $NoBrowser) { Start-Process $Url }
exit 0