Files
Scoreboard/deploy/backup.bat
T
AskaEth 407abec3b0 fix: 大屏背景图被兜底渐变盖住 + 配置/规则也搬到用户数据目录
1) 大屏背景图不生效:App.vue 里 .bg 与 .bg-fallback 都是 absolute inset:0,
   而兜底渐变是不透明的且在图片之后绘制 → 配了背景图也只看得到渐变。
   改成 v-if/v-else 互斥(用无头 Chromium 真渲染对照验证:修复后取到图片像素,
   回退版本只剩渐变)。新增 background-layer.test.ts 锁住层次关系。

2) 规则/config 仍在安装目录,覆盖安装/卸载会连配置一起删:现在三样都落在
   %LOCALAPPDATA%\ScoreboardConsole\(与数据目录同一基座):
   - console\config.json(Console 读写都用这份)
   - config.yaml(Console 用绝对路径 -config 传给服务端与 passwd)
   - rules\(首次从安装目录复制过去,之后只认用户目录那份)
   首次运行复制迁移、已存在不覆盖、不可写则回落安装目录并记日志(不影响启动);
   开发态行为不变。备份脚本与文档同步。
   注意 resolveExecutable 必须显式传部署包根目录,否则会去用户目录找 scoreboard.exe。

自检:服务端 11 包全绿;console 语法 16 文件 + node:test 20/20;
前端 vue-tsc + build、node --test 69/69。
2026-09-10 10:06:21 +08:00

105 lines
4.0 KiB
Batchfile

@echo off
REM ============================================================================
REM Scoreboard one-click backup (Windows)
REM
REM Calls scoreboard.exe's backup subcommand (VACUUM INTO), so it is safe to
REM run while the service is up and does not need an external sqlite3.exe.
REM Output goes to <data dir>\backups\; the server keeps the newest 20 per DB
REM (system / each event).
REM The data dir is the one the Console uses, i.e. %LOCALAPPDATA%\ScoreboardConsole\data
REM (falling back to <root>\data when that does not exist yet). It lives outside
REM the install dir on purpose: reinstalling over an existing install wipes the
REM install dir, so data must not be kept there.
REM NOTE: only .db snapshots are taken. Background images / emblems under
REM <data dir>\event_projs\<project>\uploads\ are NOT included; copy that
REM directory separately if you need them on the archive.
REM
REM Usage: deploy\backup.bat manual backup (reason=manual)
REM deploy\backup.bat publish pre-publish backup (reason=publish)
REM
REM Keep this file ASCII-only. cmd.exe mis-parses UTF-8 non-ASCII text inside
REM batch files (especially inside if(...) blocks). See deploy\build.bat.
REM ============================================================================
setlocal enabledelayedexpansion
chcp 65001 >nul 2>&1
cd /d "%~dp0.."
set "ROOT=%CD%"
REM Same data dir the Console hands to the server via -data.
set "DATA=%ROOT%\data"
if defined LOCALAPPDATA if exist "%LOCALAPPDATA%\ScoreboardConsole\data" set "DATA=%LOCALAPPDATA%\ScoreboardConsole\data"
REM Same config.yaml the Console hands to the server via -config: it lives in the
REM per-user dir now, and the copy next to this script is only the shipped template
REM (the uninstaller deletes the install dir, so edits there are lost).
set "CONFIG=%ROOT%\config.yaml"
if defined LOCALAPPDATA if exist "%LOCALAPPDATA%\ScoreboardConsole\config.yaml" set "CONFIG=%LOCALAPPDATA%\ScoreboardConsole\config.yaml"
set "REASON=manual"
if not "%~1"=="" set "REASON=%~1"
set "REASON=%REASON: =_%"
set "REASON=%REASON:/=-%"
set "REASON=%REASON:\=-%"
set "REASON=%REASON:"=%"
if not exist "%DATA%" (
echo [ERROR] data directory not found: %DATA%
echo Start Scoreboard_Console.exe once so the service creates it,
echo or point this script at the data dir via -data manually.
exit /b 1
)
REM ---- locate scoreboard.exe -------------------------------------------------
set "EXE="
if exist "%~dp0..\dist\scoreboard.exe" set "EXE=%~dp0..\dist\scoreboard.exe"
if not defined EXE if exist "%ROOT%\scoreboard.exe" set "EXE=%ROOT%\scoreboard.exe"
if not defined EXE if exist "%~dp0scoreboard.exe" set "EXE=%~dp0scoreboard.exe"
if not defined EXE for %%I in (scoreboard.exe) do if exist "%%~$PATH:I" set "EXE=%%~$PATH:I"
if not defined EXE (
echo [ERROR] scoreboard.exe not found.
echo Run deploy\build.bat first, or put it in the project root / PATH.
exit /b 1
)
REM config.yaml is still needed for port / backup settings; -data below picks the
REM data dir explicitly, so the current directory no longer decides it.
if not exist "%CONFIG%" (
echo [ERROR] config.yaml not found: %CONFIG%
exit /b 1
)
echo === Scoreboard backup ===
echo Data dir : %DATA%
echo Config : %CONFIG%
echo Server : %EXE%
echo Reason : %REASON%
echo.
set /a OK=0
set /a FAIL=0
REM The server backs up one event DB at a time (system.db is always included),
REM so loop over the project directories. A typical deployment has one project.
set "FOUND="
for /d %%D in ("%DATA%\event_projs\*") do (
set "FOUND=1"
echo backup event %%~nxD
"%EXE%" backup -config "%CONFIG%" -project "%%~nxD" -data "%DATA%" -reason "%REASON%"
if errorlevel 1 (set /a FAIL+=1) else (set /a OK+=1)
)
if not defined FOUND (
echo backup default event
"%EXE%" backup -config "%CONFIG%" -data "%DATA%" -reason "%REASON%"
if errorlevel 1 (set /a FAIL+=1) else (set /a OK+=1)
)
echo.
echo === backup done: ok=!OK! fail=!FAIL! ===
dir /b "%DATA%\backups\*.db" 2>nul
if !FAIL! GTR 0 (
endlocal
exit /b 1
)
endlocal
exit /b 0