-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.cmd
More file actions
79 lines (70 loc) · 2.98 KB
/
Copy pathsetup.cmd
File metadata and controls
79 lines (70 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0"
echo === FetPost setup ===
echo.
REM ---- Node check (need 20.6+ for --env-file support) ----
where node >nul 2>&1
if errorlevel 1 (
echo ERROR: Node.js not found.
echo Install Node.js 20.6 or later from https://nodejs.org/ and re-run setup.cmd.
exit /b 1
)
for /f "tokens=*" %%V in ('node --version') do set NODE_VER=%%V
echo Found Node.js !NODE_VER!
for /f "tokens=1 delims=." %%M in ('node -e "process.stdout.write(process.versions.node.split('.')[0])"') do set NODE_MAJOR=%%M
if !NODE_MAJOR! LSS 20 (
echo ERROR: Node.js 20.6 or later is required ^(found !NODE_VER!^).
echo Upgrade from https://nodejs.org/ and re-run setup.cmd.
exit /b 1
)
REM ---- Chrome check (Playwright needs an installed Chrome) ----
if not exist "C:\Program Files\Google\Chrome\Application\chrome.exe" (
if not exist "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" (
echo WARNING: Google Chrome not found at default locations.
echo FetLife automation requires Chrome — install from https://www.google.com/chrome/
echo Continuing anyway. Setup will fail later if Chrome is missing.
)
)
REM ---- npm install in each service ----
echo.
echo Installing dependencies in fetlife-poster...
cd /d "%~dp0fetlife-poster"
call npm install --silent
if errorlevel 1 ( echo npm install failed in fetlife-poster & cd /d "%~dp0" & exit /b 1 )
echo Installing dependencies in nexuspost-ui...
cd /d "%~dp0nexuspost-ui"
call npm install --silent
if errorlevel 1 ( echo npm install failed in nexuspost-ui & cd /d "%~dp0" & exit /b 1 )
REM ---- Playwright Chrome integration ----
echo.
echo Configuring Playwright to use the system Chrome browser...
cd /d "%~dp0fetlife-poster"
call npx --yes playwright install chrome
if errorlevel 1 ( echo Playwright install failed & cd /d "%~dp0" & exit /b 1 )
REM ---- Secrets ----
cd /d "%~dp0"
if exist .env (
echo.
echo .env already exists. Keeping existing secrets and password.
echo Delete .env and re-run setup.cmd to regenerate.
) else (
echo.
set /p UI_PWD=Choose a password for the FetPost UI:
if "!UI_PWD!"=="" ( echo ERROR: Password is required. & exit /b 1 )
set FETPOST_UI_PWD=!UI_PWD!
node -e "const c=require('crypto'),f=require('fs');f.writeFileSync('.env','# FetPost configuration. Generated by setup.cmd. Do not share.\nFL_SERVICE_SECRET='+c.randomBytes(32).toString('hex')+'\nFL_MACHINE_SECRET='+c.randomBytes(32).toString('hex')+'\nUI_PASSWORD='+process.env.FETPOST_UI_PWD+'\n');"
if errorlevel 1 ( echo Failed to write .env & exit /b 1 )
echo Wrote .env with auto-generated secrets and your UI password.
)
echo.
echo === Setup complete! ===
echo.
echo Next:
echo 1. Run start.cmd to launch FetPost.
echo 2. Open http://127.0.0.1:4000 and log in with the password you just set.
echo 3. Click "Accounts" in the sidebar, add a FetLife account.
echo 4. Use the "Refresh cookies" button to log into FetLife once for that account.
echo 5. You're ready to schedule and cross-post events.
echo.
endlocal