vaultfs 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -137,7 +137,7 @@ if (!fs.existsSync(path.join(outDir, "Main.class"))) {
137
137
  process.exit(1);
138
138
  }
139
139
 
140
- const child = spawn("java", ["-cp", outDir, "Main", ...args], {
140
+ const child = spawn("java", [`-Dvaultfs.home=${installDir}`, "-cp", outDir, "Main", ...args], {
141
141
  stdio: "inherit",
142
142
  cwd: installDir
143
143
  });
package/install.bat CHANGED
@@ -1,261 +1,522 @@
1
1
  @echo off
2
+
2
3
  setlocal enabledelayedexpansion
3
4
 
5
+
6
+
4
7
  :: ──────────────────────────────────────────────────────────────
8
+
5
9
  :: VaultFS Installer for Windows
10
+
6
11
  :: Usage: curl -fsSL https://raw.githubusercontent.com/ThreatGuardian/vaultfs-core/main/install.bat -o install.bat && install.bat
12
+
7
13
  :: ──────────────────────────────────────────────────────────────
8
14
 
15
+
16
+
9
17
  :: ─── Banner ──────────────────────────────────────────────────
18
+
10
19
  echo.
20
+
11
21
  echo ======================================
22
+
12
23
  echo = =
24
+
13
25
  echo = VaultFS Installer (Windows) =
26
+
14
27
  echo = =
28
+
15
29
  echo ======================================
30
+
16
31
  echo Secure file system simulator for your terminal.
32
+
17
33
  echo.
18
34
 
35
+
36
+
19
37
  :: ─── Check Java ──────────────────────────────────────────────
38
+
20
39
  echo [*] Checking prerequisites...
40
+
21
41
  echo.
22
42
 
43
+
44
+
23
45
  java -version >nul 2>&1
46
+
24
47
  if %errorlevel% neq 0 (
48
+
25
49
  echo [X] Java is not installed.
50
+
26
51
  echo.
52
+
27
53
  echo Download and install Java from:
54
+
28
55
  echo https://adoptium.net
56
+
29
57
  echo.
58
+
30
59
  exit /b 1
60
+
31
61
  )
32
62
 
63
+
64
+
33
65
  :: Parse Java version
66
+
34
67
  for /f "tokens=3" %%g in ('java -version 2^>^&1 ^| findstr /i "version"') do (
68
+
35
69
  set JAVA_VER_RAW=%%~g
70
+
36
71
  )
72
+
37
73
  for /f "delims=." %%a in ("!JAVA_VER_RAW!") do set JAVA_MAJOR=%%a
74
+
38
75
  echo [OK] Java !JAVA_MAJOR! found
39
76
 
77
+
78
+
40
79
  :: ─── Check Node.js ───────────────────────────────────────────
80
+
41
81
  node --version >nul 2>&1
82
+
42
83
  if %errorlevel% neq 0 (
84
+
43
85
  echo [X] Node.js is not installed.
86
+
44
87
  echo.
88
+
45
89
  echo Download and install Node.js from:
90
+
46
91
  echo https://nodejs.org
92
+
47
93
  echo.
94
+
48
95
  exit /b 1
96
+
49
97
  )
50
98
 
99
+
100
+
51
101
  for /f "tokens=1 delims=v." %%a in ('node --version') do set NODE_MAJOR=%%a
102
+
52
103
  echo [OK] Node.js found
53
104
 
105
+
106
+
54
107
  :: ─── Check npm ───────────────────────────────────────────────
108
+
55
109
  npm --version >nul 2>&1
110
+
56
111
  if %errorlevel% neq 0 (
112
+
57
113
  echo [X] npm is not installed. It usually comes with Node.js.
114
+
58
115
  exit /b 1
116
+
59
117
  )
118
+
60
119
  echo [OK] npm found
61
120
 
121
+
122
+
62
123
  :: ─── Check git ───────────────────────────────────────────────
124
+
63
125
  git --version >nul 2>&1
126
+
64
127
  if %errorlevel% neq 0 (
128
+
65
129
  echo [X] git is not installed.
130
+
66
131
  echo.
132
+
67
133
  echo Download from: https://git-scm.com/download/win
134
+
68
135
  echo.
136
+
69
137
  exit /b 1
138
+
70
139
  )
140
+
71
141
  echo [OK] git found
142
+
72
143
  echo.
73
144
 
145
+
146
+
74
147
  :: ─── Install directory ──────────────────────────────────────
148
+
75
149
  set "INSTALL_DIR=%USERPROFILE%\.vaultfs"
150
+
76
151
  set "REPO_URL=https://github.com/ThreatGuardian/vaultfs-core.git"
77
152
 
153
+
154
+
78
155
  if exist "%INSTALL_DIR%" (
156
+
79
157
  echo VaultFS is already installed at %INSTALL_DIR%
158
+
80
159
  set /p "CHOICE= Reinstall? (y/n) "
160
+
81
161
  if /i "!CHOICE!" neq "y" (
162
+
82
163
  set /p "UPGRADE= Would you like to upgrade instead? (y/n) "
164
+
83
165
  if /i "!UPGRADE!" equ "y" (
166
+
84
167
  goto :upgrade
168
+
85
169
  )
170
+
86
171
  echo.
172
+
87
173
  echo Installation cancelled.
174
+
88
175
  exit /b 0
176
+
89
177
  )
178
+
90
179
  echo Removing existing installation...
180
+
91
181
  rmdir /s /q "%INSTALL_DIR%"
182
+
92
183
  )
93
184
 
185
+
186
+
94
187
  :: ─── Clone repo ─────────────────────────────────────────────
188
+
95
189
  echo.
190
+
96
191
  echo [*] Cloning repository...
192
+
97
193
  git clone --depth 1 "%REPO_URL%" "%INSTALL_DIR%"
194
+
98
195
  if %errorlevel% neq 0 (
196
+
99
197
  echo [X] Failed to clone repository.
198
+
100
199
  exit /b 1
200
+
101
201
  )
202
+
102
203
  echo [OK] Repository cloned
204
+
103
205
  goto :build
104
206
 
207
+
208
+
105
209
  :upgrade
210
+
106
211
  echo.
212
+
107
213
  echo [*] Upgrading VaultFS...
214
+
108
215
  cd /d "%INSTALL_DIR%"
216
+
109
217
  git pull
218
+
110
219
  if %errorlevel% neq 0 (
220
+
111
221
  echo [X] git pull failed.
222
+
112
223
  exit /b 1
224
+
113
225
  )
226
+
114
227
  echo [OK] Repository updated
115
228
 
229
+
230
+
116
231
  :build
232
+
117
233
  :: ─── Build frontend ─────────────────────────────────────────
234
+
118
235
  echo.
236
+
119
237
  echo [*] Building frontend...
238
+
120
239
  cd /d "%INSTALL_DIR%\frontend"
121
240
 
241
+
242
+
122
243
  echo Installing npm dependencies...
244
+
123
245
  call npm install --silent
246
+
124
247
  if %errorlevel% neq 0 (
248
+
125
249
  echo [X] npm install failed.
250
+
126
251
  exit /b 1
252
+
127
253
  )
254
+
128
255
  echo [OK] Dependencies installed
129
256
 
257
+
258
+
130
259
  echo Building React app...
260
+
131
261
  call npm run build --silent
262
+
132
263
  if %errorlevel% neq 0 (
264
+
133
265
  echo [X] Frontend build failed.
266
+
134
267
  exit /b 1
268
+
135
269
  )
270
+
136
271
  echo [OK] Frontend built
137
272
 
273
+
274
+
138
275
  :: ─── Compile Java ───────────────────────────────────────────
276
+
139
277
  echo.
278
+
140
279
  echo [*] Compiling Java sources...
280
+
141
281
  cd /d "%INSTALL_DIR%"
142
282
 
283
+
284
+
143
285
  javac -d out src\models\*.java src\datastructures\*.java src\utils\*.java src\auth\*.java src\sync\*.java src\filesystem\*.java src\Main.java
286
+
144
287
  if %errorlevel% neq 0 (
288
+
145
289
  echo [X] Java compilation failed.
290
+
146
291
  exit /b 1
292
+
147
293
  )
294
+
148
295
  echo [OK] All sources compiled
149
296
 
297
+
298
+
150
299
  :: ─── Read version ──────────────────────────────────────────
300
+
151
301
  set /p VAULTFS_VERSION=<"%INSTALL_DIR%\version.txt"
302
+
152
303
  echo [OK] Version: v%VAULTFS_VERSION%
153
304
 
305
+
306
+
154
307
  :: ─── Create launcher ────────────────────────────────────────
308
+
155
309
  echo.
310
+
156
311
  echo [*] Creating launcher...
157
312
 
313
+
314
+
158
315
  if not exist "%INSTALL_DIR%\bin" mkdir "%INSTALL_DIR%\bin"
159
316
 
317
+
318
+
160
319
  (
320
+
161
321
  echo @echo off
322
+
162
323
  echo setlocal enabledelayedexpansion
324
+
163
325
  echo set "INSTALL_DIR=%%USERPROFILE%%\.vaultfs"
326
+
164
327
  echo.
328
+
165
329
  echo if "%%~1"=="--version" (
330
+
166
331
  echo set /p VER=^<"%%INSTALL_DIR%%\version.txt"
332
+
167
333
  echo echo VaultFS v%%VER%%
334
+
168
335
  echo exit /b 0
336
+
169
337
  echo ^
338
+
170
339
  echo.
340
+
171
341
  echo if "%%~1"=="-v" (
342
+
172
343
  echo set /p VER=^<"%%INSTALL_DIR%%\version.txt"
344
+
173
345
  echo echo VaultFS v%%VER%%
346
+
174
347
  echo exit /b 0
348
+
175
349
  echo ^
350
+
176
351
  echo.
352
+
177
353
  echo if "%%~1"=="update" (
354
+
178
355
  echo echo Checking for updates...
356
+
179
357
  echo cd /d "%%INSTALL_DIR%%"
358
+
180
359
  echo git fetch origin main
360
+
181
361
  echo for /f "tokens=*" %%%%a in ('git rev-parse HEAD'^^^) do set LOCAL=%%%%a
362
+
182
363
  echo for /f "tokens=*" %%%%b in ('git rev-parse origin/main'^^^) do set REMOTE=%%%%b
364
+
183
365
  echo if "%%LOCAL%%"=="%%REMOTE%%" (
366
+
184
367
  echo echo Already up to date.
368
+
185
369
  echo ^^ else (
370
+
186
371
  echo echo Update available! Pulling latest...
372
+
187
373
  echo git pull origin main
374
+
188
375
  echo cd frontend ^&^& call npm install ^&^& call npm run build ^&^& cd ..
376
+
189
377
  echo javac -d out src\models\*.java src\datastructures\*.java src\utils\*.java src\auth\*.java src\sync\*.java src\filesystem\*.java src\Main.java
378
+
190
379
  echo set /p VER=^<"%%INSTALL_DIR%%\version.txt"
380
+
191
381
  echo echo VaultFS updated to v%%VER%%!
382
+
192
383
  echo ^
384
+
193
385
  echo exit /b 0
386
+
194
387
  echo ^
388
+
195
389
  echo.
390
+
196
391
  echo if "%%~1"=="doctor" (
392
+
197
393
  echo echo.
394
+
198
395
  echo echo VaultFS Doctor — Health Check
396
+
199
397
  echo echo =================================
398
+
200
399
  echo java -version ^>nul 2^>^&1 ^&^& echo [OK] Java installed ^|^| echo [X] Java: NOT FOUND
400
+
201
401
  echo node --version ^>nul 2^>^&1 ^&^& echo [OK] Node installed ^|^| echo [X] Node: NOT FOUND
402
+
202
403
  echo git --version ^>nul 2^>^&1 ^&^& echo [OK] Git installed ^|^| echo [X] Git: NOT FOUND
404
+
203
405
  echo if exist "%%INSTALL_DIR%%" ^( echo [OK] Install dir exists ^^ ^) else ^( echo [X] Install dir NOT FOUND ^^
406
+
204
407
  echo if exist "%%INSTALL_DIR%%\out\Main.class" ^( echo [OK] Java classes compiled ^^ ^) else ^( echo [X] Java classes NOT compiled ^^
408
+
205
409
  echo if exist "%%INSTALL_DIR%%\frontend\dist" ^( echo [OK] Frontend built ^^ ^) else ^( echo [X] Frontend NOT built ^^
410
+
206
411
  echo if exist "%%INSTALL_DIR%%\version.txt" ^( set /p VER=^<"%%INSTALL_DIR%%\version.txt" ^&^& echo [OK] Version: v%%VER%% ^^ ^) else ^( echo [!] Version file missing ^^
412
+
207
413
  echo echo.
414
+
208
415
  echo exit /b 0
416
+
209
417
  echo ^
418
+
210
419
  echo.
420
+
211
421
  echo java -cp "%%INSTALL_DIR%%\out" Main %%*
422
+
212
423
  echo endlocal
424
+
213
425
  ) > "%INSTALL_DIR%\bin\vaultfs.bat"
214
426
 
427
+
428
+
215
429
  echo [OK] Launcher created at %INSTALL_DIR%\bin\vaultfs.bat
216
430
 
431
+
432
+
217
433
  :: ─── Add to PATH ────────────────────────────────────────────
434
+
218
435
  echo.
436
+
219
437
  echo [*] Configuring PATH...
220
438
 
439
+
440
+
221
441
  echo %PATH% | findstr /i /c:".vaultfs\bin" >nul 2>&1
442
+
222
443
  if %errorlevel% neq 0 (
444
+
223
445
  setx PATH "%USERPROFILE%\.vaultfs\bin;%PATH%"
446
+
224
447
  echo [OK] Added to PATH
448
+
225
449
  ) else (
450
+
226
451
  echo [OK] PATH already configured
452
+
227
453
  )
228
454
 
455
+
456
+
229
457
  :: ─── Check if this was an upgrade ───────────────────────────
458
+
230
459
  if /i "!UPGRADE!" equ "y" (
460
+
231
461
  goto :upgrade_done
462
+
232
463
  )
233
464
 
465
+
466
+
234
467
  :: ─── Done ───────────────────────────────────────────────────
468
+
235
469
  echo.
470
+
236
471
  echo ======================================
472
+
237
473
  echo = =
474
+
238
475
  echo = VaultFS installed! =
476
+
239
477
  echo = =
478
+
240
479
  echo ======================================
480
+
241
481
  echo.
482
+
242
483
  echo Open a NEW terminal and type: vaultfs
484
+
243
485
  echo.
486
+
244
487
  echo Installed to: %INSTALL_DIR%
488
+
245
489
  echo Launcher: %INSTALL_DIR%\bin\vaultfs.bat
490
+
246
491
  echo.
492
+
247
493
  goto :eof
248
494
 
495
+
496
+
249
497
  :upgrade_done
498
+
250
499
  echo.
500
+
251
501
  echo ======================================
502
+
252
503
  echo = =
504
+
253
505
  echo = VaultFS upgraded! =
506
+
254
507
  echo = =
508
+
255
509
  echo ======================================
510
+
256
511
  echo.
512
+
257
513
  echo VaultFS upgraded to v%VAULTFS_VERSION%!
514
+
258
515
  echo Open a NEW terminal and type: vaultfs
516
+
259
517
  echo.
260
518
 
519
+
520
+
261
521
  endlocal
522
+
package/install.sh CHANGED
@@ -307,7 +307,7 @@ if [ "$1" = "doctor" ]; then
307
307
  fi
308
308
 
309
309
  # Default: launch the app
310
- java -cp "$INSTALL_DIR/out" Main "$@"
310
+ java -Dvaultfs.home="$INSTALL_DIR" -cp "$INSTALL_DIR/out" Main "$@"
311
311
  LAUNCHER
312
312
 
313
313
  chmod +x "$INSTALL_DIR/bin/vaultfs"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vaultfs",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "A CLI-based secure file system simulator with OAuth 2.0 authentication and advanced data structures",
5
5
  "bin": {
6
6
  "vaultfs": "bin/vaultfs-npm.js"
@@ -0,0 +1,9 @@
1
+ package auth;
2
+
3
+ /** Centralized configuration for VaultFS remote authentication. */
4
+ public class AuthConfig {
5
+ public static final String AUTH_SERVER_URL = "https://vaultfs-auth-server.onrender.com";
6
+ public static final int LOCAL_PORT = 9000;
7
+ public static final int POLL_INTERVAL_MS = 2000;
8
+ public static final int LOGIN_TIMEOUT_SECONDS = 120;
9
+ }