vaultfs 1.0.8 → 1.1.0
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.
- package/README.md +24 -2
- package/package.json +1 -1
- package/src/Main.java +6 -6
- package/src/auth/AuthManager.java +9 -19
- package/src/utils/Banner.java +75 -11
- package/version.txt +1 -1
package/README.md
CHANGED
|
@@ -20,14 +20,36 @@
|
|
|
20
20
|
|
|
21
21
|
## ⚡ Install
|
|
22
22
|
|
|
23
|
+
### Option 1 — npm (recommended)
|
|
24
|
+
|
|
23
25
|
```bash
|
|
24
26
|
npm install -g vaultfs
|
|
25
27
|
```
|
|
26
|
-
|
|
28
|
+
> Requires **Java 11+** and **Node.js 18+**
|
|
29
|
+
|
|
30
|
+
### Option 2 — One-line install (no npm needed)
|
|
31
|
+
|
|
32
|
+
**Windows (PowerShell):**
|
|
33
|
+
```powershell
|
|
34
|
+
curl -o install.bat https://raw.githubusercontent.com/ThreatGuardian/vaultfs-core/main/install.bat && install.bat
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**macOS / Linux:**
|
|
38
|
+
```bash
|
|
39
|
+
curl -fsSL https://raw.githubusercontent.com/ThreatGuardian/vaultfs-core/main/install.sh | bash
|
|
40
|
+
```
|
|
41
|
+
> Requires **Java 11+** and **Git**
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 🚀 Usage
|
|
46
|
+
|
|
27
47
|
```bash
|
|
28
48
|
vaultfs
|
|
29
49
|
```
|
|
30
|
-
|
|
50
|
+
|
|
51
|
+
On first launch, a browser opens for Google/GitHub login.
|
|
52
|
+
Press **Enter** to skip and continue as Guest.
|
|
31
53
|
|
|
32
54
|
---
|
|
33
55
|
|
package/package.json
CHANGED
package/src/Main.java
CHANGED
|
@@ -164,9 +164,9 @@ public class Main {
|
|
|
164
164
|
|
|
165
165
|
/** Prints the complete command help table. */
|
|
166
166
|
private static void printHelp() {
|
|
167
|
-
System.out.println("
|
|
168
|
-
System.out.println("║
|
|
169
|
-
System.out.println("
|
|
167
|
+
System.out.println("╔════════════════════════════════════════════════════════════════╗");
|
|
168
|
+
System.out.println("║ File System Simulator — Commands ║");
|
|
169
|
+
System.out.println("╠════════════════════════════════════════════════════════════════╣");
|
|
170
170
|
printHelpRow("pwd", "Print current path");
|
|
171
171
|
printHelpRow("cd <name>", "Navigate into directory");
|
|
172
172
|
printHelpRow("cd ..", "Go one level up");
|
|
@@ -188,16 +188,16 @@ public class Main {
|
|
|
188
188
|
printHelpRow("whoami", "Show account details");
|
|
189
189
|
printHelpRow("clear", "Clear terminal");
|
|
190
190
|
printHelpRow("exit", "Logout and exit program");
|
|
191
|
-
System.out.println("
|
|
191
|
+
System.out.println("╠════════════════════════════════════════════════════════════════╣");
|
|
192
192
|
printHelpRow("vaultfs --version", "Show installed version");
|
|
193
193
|
printHelpRow("vaultfs update", "Pull latest updates and rebuild");
|
|
194
194
|
printHelpRow("vaultfs doctor", "Run health checks on install");
|
|
195
|
-
System.out.println("
|
|
195
|
+
System.out.println("╚════════════════════════════════════════════════════════════════╝");
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
private static void printHelpRow(String cmd, String desc) {
|
|
199
199
|
String paddedCmd = String.format("%-28s", cmd);
|
|
200
|
-
String paddedDesc = String.format("%-
|
|
200
|
+
String paddedDesc = String.format("%-31s", desc);
|
|
201
201
|
System.out.println("║ " + Colors.c(Colors.YELLOW, paddedCmd) + " " + Colors.c(Colors.WHITE, paddedDesc) + " ║");
|
|
202
202
|
}
|
|
203
203
|
|
|
@@ -105,8 +105,10 @@ public class AuthManager {
|
|
|
105
105
|
URL url = URI.create(AuthConfig.AUTH_SERVER_URL + "/auth/session/new").toURL();
|
|
106
106
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
|
107
107
|
conn.setRequestMethod("GET");
|
|
108
|
-
conn.setConnectTimeout(
|
|
109
|
-
conn.setReadTimeout(
|
|
108
|
+
conn.setConnectTimeout(10000);
|
|
109
|
+
conn.setReadTimeout(10000);
|
|
110
|
+
int responseCode = conn.getResponseCode();
|
|
111
|
+
if (responseCode != 200) return null;
|
|
110
112
|
String response = readStream(conn.getInputStream());
|
|
111
113
|
return extractJsonValue(response, "sessionId");
|
|
112
114
|
} catch (Exception e) {
|
|
@@ -170,29 +172,17 @@ public class AuthManager {
|
|
|
170
172
|
/** Opens a URL in the default browser using platform-specific commands. */
|
|
171
173
|
private static void openBrowser(String url) {
|
|
172
174
|
String os = System.getProperty("os.name").toLowerCase();
|
|
173
|
-
Runtime rt = Runtime.getRuntime();
|
|
174
175
|
try {
|
|
175
176
|
if (os.contains("win")) {
|
|
176
|
-
|
|
177
|
+
Runtime.getRuntime().exec(new String[]{"cmd", "/c", "start", "", url});
|
|
177
178
|
} else if (os.contains("mac")) {
|
|
178
|
-
|
|
179
|
+
Runtime.getRuntime().exec(new String[]{"open", url});
|
|
179
180
|
} else {
|
|
180
|
-
String[]
|
|
181
|
-
boolean opened = false;
|
|
182
|
-
for (String browser : browsers) {
|
|
183
|
-
try {
|
|
184
|
-
rt.exec(new String[]{browser, url});
|
|
185
|
-
opened = true;
|
|
186
|
-
break;
|
|
187
|
-
} catch (Exception ignored) {}
|
|
188
|
-
}
|
|
189
|
-
if (!opened) {
|
|
190
|
-
System.out.println("Please open this URL manually: " + url);
|
|
191
|
-
}
|
|
181
|
+
Runtime.getRuntime().exec(new String[]{"xdg-open", url});
|
|
192
182
|
}
|
|
193
183
|
} catch (Exception e) {
|
|
194
|
-
System.out.println("Could not open browser
|
|
195
|
-
System.out.println("Please
|
|
184
|
+
System.out.println(" Could not open browser: " + e.getMessage());
|
|
185
|
+
System.out.println(" Please visit manually: " + url);
|
|
196
186
|
}
|
|
197
187
|
}
|
|
198
188
|
|
package/src/utils/Banner.java
CHANGED
|
@@ -1,17 +1,81 @@
|
|
|
1
1
|
package utils;
|
|
2
2
|
|
|
3
|
-
/** Prints the
|
|
3
|
+
/** Prints the VaultFS startup banner with a smooth gradient. */
|
|
4
4
|
public class Banner {
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
private static final String[][] ROWS = buildRows();
|
|
7
|
+
|
|
8
|
+
private static String[][] buildRows() {
|
|
9
|
+
String b = "\u2588\u2588";
|
|
10
|
+
return new String[][] {
|
|
11
|
+
// V A U L T F S
|
|
12
|
+
{b+" "+b, " "+b+b+" ", b+" "+b, b+" ", b+b+b, b+b+b, " "+b+b+" "},
|
|
13
|
+
{b+" "+b, b+" "+b, b+" "+b, b+" ", " "+b+" ", b+" ", b+" "},
|
|
14
|
+
{b+" "+b, b+b+b, b+" "+b, b+" ", " "+b+" ", b+b+" ", " "+b+b+" "},
|
|
15
|
+
{" "+b+b+" ", b+" "+b, b+" "+b, b+" ", " "+b+" ", b+" ", " "+b},
|
|
16
|
+
{" "+b+" ", b+" "+b, " "+b+b+" ", b+b+b, " "+b+" ", b+" ", " "+b+b+" "},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
private static final int[][] STARTS = {
|
|
21
|
+
{66, 165, 245}, {80, 145, 248}, {100, 130, 250}, {130, 110, 245}, {160, 95, 235}
|
|
22
|
+
};
|
|
23
|
+
private static final int[][] ENDS = {
|
|
24
|
+
{190, 120, 240}, {210, 110, 225}, {225, 100, 210}, {236, 90, 195}, {240, 80, 180}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** Prints the gradient ASCII banner to the console. */
|
|
6
28
|
public static void print() {
|
|
7
|
-
|
|
8
|
-
System.out.println(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
29
|
+
String version = getVersion();
|
|
30
|
+
System.out.println();
|
|
31
|
+
for (int row = 0; row < 5; row++) {
|
|
32
|
+
StringBuilder line = new StringBuilder();
|
|
33
|
+
for (int col = 0; col < ROWS[row].length; col++) {
|
|
34
|
+
if (col == 5) line.append(" "); // extra gap before F (VAULT ___ FS)
|
|
35
|
+
else if (col > 0) line.append(" "); // normal 1-space gap
|
|
36
|
+
line.append(ROWS[row][col]);
|
|
37
|
+
}
|
|
38
|
+
System.out.println(gradientLine(line.toString(), STARTS[row], ENDS[row]));
|
|
39
|
+
}
|
|
40
|
+
System.out.println();
|
|
41
|
+
System.out.println(gradientLine(" VaultFS CLI v" + version,
|
|
42
|
+
new int[]{140, 100, 250}, new int[]{236, 90, 195}));
|
|
43
|
+
System.out.println(Colors.c(Colors.WHITE, " Secure File System Simulator"));
|
|
44
|
+
System.out.println(Colors.c(Colors.GRAY, "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Reads version from version.txt (checks vaultfs.home then user.dir). */
|
|
48
|
+
private static String getVersion() {
|
|
49
|
+
String[] bases = {
|
|
50
|
+
System.getProperty("vaultfs.home"),
|
|
51
|
+
System.getProperty("user.dir")
|
|
52
|
+
};
|
|
53
|
+
for (String base : bases) {
|
|
54
|
+
if (base == null) continue;
|
|
55
|
+
java.io.File f = new java.io.File(base, "version.txt");
|
|
56
|
+
if (f.exists()) {
|
|
57
|
+
try (java.io.BufferedReader br = new java.io.BufferedReader(new java.io.FileReader(f))) {
|
|
58
|
+
String line = br.readLine();
|
|
59
|
+
if (line != null && !line.trim().isEmpty()) return line.trim();
|
|
60
|
+
} catch (Exception ignored) {}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return "0.0.0";
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private static String gradientLine(String text, int[] s, int[] e) {
|
|
67
|
+
StringBuilder sb = new StringBuilder();
|
|
68
|
+
int len = text.length();
|
|
69
|
+
for (int i = 0; i < len; i++) {
|
|
70
|
+
char c = text.charAt(i);
|
|
71
|
+
if (c == ' ') { sb.append(' '); continue; }
|
|
72
|
+
float r = len > 1 ? (float) i / (len - 1) : 0;
|
|
73
|
+
int red = (int)(s[0] + r * (e[0] - s[0]));
|
|
74
|
+
int grn = (int)(s[1] + r * (e[1] - s[1]));
|
|
75
|
+
int blu = (int)(s[2] + r * (e[2] - s[2]));
|
|
76
|
+
sb.append(String.format("\u001B[38;2;%d;%d;%dm%c", red, grn, blu, c));
|
|
77
|
+
}
|
|
78
|
+
sb.append("\u001B[0m");
|
|
79
|
+
return sb.toString();
|
|
16
80
|
}
|
|
17
81
|
}
|
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0
|
|
1
|
+
1.1.0
|